You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building a catalog, the default behavior of `octocatalog-diff` is to:
4
+
5
+
1. Create a temporary directory
6
+
2. Create a symlink from `<temporary directory>/environments/production` to the checkout of your code
7
+
3. Run Puppet using `environment=production`
8
+
9
+
If you are using environment names to control the behavior of Puppet, this default behavior may not be suitable. In that case you can invoke the alternate behavior: preserving environments.
10
+
11
+
## Command line options
12
+
13
+
### Preserving the environments
14
+
15
+
When you supply the command line argument `--preserve-environments` (or set `settings[:preserve_environments] = true` in your [configuration file](/doc/configuration.md)), `octocatalog-diff` will instead do the following:
16
+
17
+
1. Create a temporary directory
18
+
2. Create the following symlinks from `<temporary directory>` to the corresponding directories in the checkout of your code:
19
+
20
+
-`environments`
21
+
-`manifests`
22
+
-`modules`
23
+
24
+
3. Run Puppet using an environment you specify via the command line
25
+
26
+
Note that you must have set `--preserve-environments` in order for the `--environment` and/or `--create-symlinks` options (described below) to have any effect.
27
+
28
+
### Changing the environment
29
+
30
+
If you wish to use an environment name other than `production` you can use the `--environment <environment_name>` command line option. This will set the environment for both the `to` and `from` compiles.
If you need to specify different environments for the `to` and `from` compiles, you can use `--to-environment <environment_name>` and `--from-environment <environment_name>`.
Within the temporary directory, the `environments` symlink will always be created.
45
+
46
+
By default, `manifests` and `modules` will also be created from the temporary directory to the corresponding directories in your Puppet code base. If you need to customize the symlinks that are created, you can use the `--create-symlinks <dir1>,<dir2>,...` to list the symlinks that you need.
47
+
48
+
For example, if you have some code stored in a directory called `modules` and more code stored in a directory called `site`, you could do the following to create the symlinks as desired:
Consider that your Puppet code base is organized as follows:
57
+
58
+
```
59
+
- /opt/puppet
60
+
- environments
61
+
- old
62
+
- environment.conf
63
+
- manifests
64
+
- site.pp
65
+
- modules
66
+
- module_zero
67
+
- new
68
+
- environment.conf
69
+
- manifests
70
+
- site.pp
71
+
- modules
72
+
- module_zero
73
+
- modules
74
+
- module_one
75
+
- module_two
76
+
- site
77
+
- module_three
78
+
- module_four
79
+
```
80
+
81
+
To calculate the difference between the "old" and "new" environment, you could use:
82
+
83
+
```
84
+
octocatalog-diff \
85
+
--bootstrapped-from-dir /opt/puppet \
86
+
--bootstrapped-to-dir /opt/puppet \
87
+
--preserve-environments \
88
+
--from-environment old \
89
+
--to-environment new \
90
+
--create-symlinks modules,site
91
+
```
92
+
93
+
(Note that `--bootstrapped-from-dir` and `--bootstrapped-to-dir` are used to specify the directory path to your code, and `-t` and `-f` are not used. That's because the difference in the catalog is derived from the environment used, and not the branch from a git repository.)
0 commit comments