kafo 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 28bffac9d7e55edd41f48c6a903957d23326eef9
4
- data.tar.gz: f5b1a55aad263beb13835a95b8da6f295af46f06
3
+ metadata.gz: e1ec7f732b4cc08131c8afb5c1a5389bef876617
4
+ data.tar.gz: afe48075667781a74ed7d65608010cf48d74ba3f
5
5
  SHA512:
6
- metadata.gz: b881d76347f6fdb20606974985eaf8d9ed8c2fb4101a2eb1941d5e5f5f3599ad8416303a41d4746ec582daf777f4cf44ceff71500debe54cf7487eb10140e109
7
- data.tar.gz: d2264a66324dabb9ca8d7eb78d20b1d8e326f431864df2ac15410be33e64dbaa3d7e225815aeb23433992020d889495ffbe29c1a72a673b65e6b44aaaec8ce9b
6
+ metadata.gz: 40af9267bb53134e7fc823326aff92c175a8d0f1c0dbc84b6d91b6df86479f2f6a16f75cc6fcf0936d6accd6ac502f523f4c8ddad116b7fac5639809162be36e
7
+ data.tar.gz: 4bf8d90f62ad04863d2a4d1f170719bd6b2692e92ae3baabeb4c20a819b20a2a9737e6cae92945339c89015b1731bc74261bb7a2aab203134ae8784d43445229
data/README.md CHANGED
@@ -9,36 +9,36 @@ echo "include some_modules" | puppet apply
9
9
  ```
10
10
  ## Why should I care?
11
11
 
12
- Suppose you work on software which you want to distribute to a machine in
12
+ Suppose you work on software which you want to distribute to a machine in an
13
13
  infrastructure managed by puppet. You write a puppet module for your app.
14
- But you also want to be able to distribute this app to a machine outside of
15
- puppet infrastructure (e.g. install it to your clients) or you want to install
14
+ But now you also want to be able to distribute your app to a machine outside of
15
+ your puppet infrastructure (e.g. install it to your clients) or you want to install
16
16
  it in order to create a puppet infrastructure itself (e.g. foreman or
17
17
  foreman-proxy).
18
18
 
19
- With kafo you can reuse your puppet modules for creating an installer. Even
20
- better after the installation you can easily modify you configuration. All
21
- using the very same puppet modules.
19
+ With kafo you can reuse your puppet modules for creating an installer.
20
+ Even better: After the installation you can easily modify your configuration.
21
+ All using the very same puppet modules.
22
22
 
23
- ## What it does, how does it work?
23
+ ## What does it do, how does it work?
24
24
 
25
- Kafo reads a config file to find out which modules should it use. Then it
26
- loads parameters from puppet manifests and gives you a way to customize them.
25
+ Kafo reads a config file to find out which modules it should use. Then it
26
+ loads parameters from puppet manifests and gives you different ways to customize them.
27
27
 
28
- There are three ways how you can set parameters. You can
29
- * predefine them in configuration file
28
+ There are three options how you can set parameters. You can
29
+ * predefine them in the configuration file
30
30
  * specify them as CLI arguments
31
- * you can use interactive mode which will ask you for all required parameters
31
+ * you can use the interactive mode which will ask you for all required parameters
32
32
 
33
- Note that your answers (gathered from any mode) are saved for the next run
34
- so you don't have to specify them again. Kafo also support default values of
35
- parameters so you can set only those you want to change. Also you can combine
36
- akk modes so you can create an answer file with default values easily
37
- and then use it for unattended installs.
33
+ Note that your answers (gathered from any mode) are automatically saved for the next run
34
+ so you don't have to specify them again. Kafo also supports default values for
35
+ parameters so you can set only those you want to change. You can also combine
36
+ all modes to create an answer file with default values easily
37
+ and then use it for unattended installations.
38
38
 
39
39
  ## How do I use it?
40
40
 
41
- First install kafo gem.
41
+ First install the kafo gem.
42
42
 
43
43
  Using bundler - add kafo gem to your Gemfile and run
44
44
  ```bash
@@ -50,7 +50,7 @@ or without bundler
50
50
  gem install kafo
51
51
  ```
52
52
 
53
- Create a directory for your installer. Let's say we want to create
53
+ Create a directory for your installer. Let's say we want to create a
54
54
  foreman-installer.
55
55
 
56
56
  ```bash
@@ -58,23 +58,23 @@ mkdir foreman-installer
58
58
  cd foreman-installer
59
59
  ```
60
60
 
61
- Now we run ```kafofy``` script which will prepare directory structure and
62
- optionally create a bin script according to first parameter.
61
+ Now we run ```kafofy``` script which will prepare the directory structure and
62
+ optionally create a bin script according to the first parameter.
63
63
 
64
64
  ```bash
65
65
  kafofy -n foreman-installer
66
66
  ```
67
67
 
68
- You can see that it created modules directory where your puppet modules
69
- should live. It also created config and bin directories. If you specify
70
- argument --name (or -n for short, foreman-installer in this case) a script in
71
- bin is created.
68
+ You can see that it created a modules directory where your puppet modules
69
+ should live. It also created config and bin directories. If you specify the
70
+ argument ```--name``` (or -n for short, foreman-installer in this case) a script in
71
+ the "bin" directory with this name will be created.
72
72
 
73
- It's the script you can use to run installer. If you did not specify any
74
- you can run your installer by `kafo-configure` which is the default.
75
- All configuration related files are to be found in config directory.
73
+ It's the script you can use to run the installer. If you did not specify any
74
+ arguments you can run your installer by `kafo-configure` which is the default.
75
+ All configuration related files are to be found in the config directory.
76
76
 
77
- You can supply custom locations for you configuration and answers files using
77
+ You can supply custom locations for you configuration- and answer- files using
78
78
  options:
79
79
  ```
80
80
  kafofy --help
@@ -84,10 +84,10 @@ Usage: kafofy [options]
84
84
  -n, --name NAME your installer name
85
85
  ```
86
86
 
87
- Configuration file will be created by default template. It's the configuration
88
- of you installer (so you can setup log level, path to puppet modules etc).
89
- On the other hand, answer file must be created manually. Answer file defines
90
- which modules should be used and hold all values for puppet class parameters.
87
+ The configuration file will be created by a default template. It's the configuration
88
+ of your installer (so you can setup the log level, path to puppet modules etc).
89
+ On the other hand, the answer file must be created manually. Answer files define
90
+ which modules should be used and hold all values for the puppet class parameters.
91
91
 
92
92
 
93
93
  So for example to install foreman you want to
@@ -96,27 +96,27 @@ cd foreman-installer/modules
96
96
  git clone https://github.com/theforeman/puppet-foreman/ foreman
97
97
  ```
98
98
  You must also download any dependant modules.
99
- Then you need to tell kafo it's going to use foreman module.
99
+ Then you need to tell kafo it's going to use the foreman module.
100
100
  ```bash
101
101
  cd ..
102
102
  echo "foreman: true" > config/answers.yaml
103
103
  ```
104
104
 
105
- Alternatively you can use librarian-puppet project to manage all deps for you.
105
+ Alternatively you can use the librarian-puppet project to manage all dependencies for you.
106
106
  You just create a Puppetfile and call librarian to install your modules. See
107
107
  https://github.com/rodjek/librarian-puppet for more details.
108
108
 
109
- When you have your modules in-place, fire the installer with -h argument
109
+ When you have your modules in-place, fire the installer with -h as argument
110
110
  ```bash
111
111
  bin/foreman-installer -h
112
112
  ```
113
113
 
114
- You will see all arguments that you can pass to kafo. Note that underscored
114
+ This will show you all the possible arguments you can pass to kafo. Note that underscored
115
115
  puppet parameters are automatically converted to dashed arguments. You can
116
- also see a documentation extracted from foreman puppet module and default
116
+ also see a documentation extracted from the foreman puppet module and a default
117
117
  value.
118
118
 
119
- Now run it without -h argument. It will print you the puppet apply command
119
+ Now run it without the -h argument. It will print you the puppet apply command
120
120
  to execute. This will be automatized later. Look at config/answers.yaml, it
121
121
  was populated with default values. To change those options you can use
122
122
  arguments like this
@@ -125,17 +125,17 @@ arguments like this
125
125
  bin/foreman-installer --foreman-enc=false --foreman-db-type=sqlite
126
126
  ```
127
127
 
128
- or you can run interactive mode
128
+ or you can run it in interactive mode
129
129
 
130
130
  ```bash
131
131
  bin/foreman-installer --interactive
132
132
  ```
133
133
 
134
- Also every change made to config/answers.yaml persists and becomes new default
135
- value for next run.
134
+ Also every change made to the config/answers.yaml persists and becomes the new default
135
+ value for the next run.
136
136
 
137
- As you noticed there are several ways how to specify arguments. Here's the list
138
- the lower the item is the higher precedence it has:
137
+ As you may have noticed there are several ways how to specify arguments. Here's the list:
138
+ (the lower the item is in this list the higher precedence it has):
139
139
  * default values from puppet modules
140
140
  * values from answers.yaml
141
141
  * values specified on CLI
@@ -144,7 +144,7 @@ the lower the item is the higher precedence it has:
144
144
  ## How do I report bugs or contribute?
145
145
 
146
146
  You can find our redmine issue tracker [here](http://projects.theforeman.org/projects/kafo),
147
- you can use your github account for logging in. When reporting new issue please
147
+ you can use your github account for logging in. When reporting new issues please
148
148
  don't forget to specify your:
149
149
  * puppet version
150
150
  * installation options (GEM/RPM/DEB)
@@ -152,8 +152,8 @@ don't forget to specify your:
152
152
  * reproducing steps
153
153
 
154
154
  Since Kafo is a side project of Foreman you can use its IRC channels to
155
- contact us on freenode. #theforeman is channel for generic discussions
156
- and #theforeman-dev is for technical topics. Likewise you can use Foreman
155
+ contact us on freenode. #theforeman is the channel for generic discussions
156
+ and #theforeman-dev is reserved only for technical topics. Likewise you can use the Foreman
157
157
  mailing lists on googlegroups. For more information see [this page](http://theforeman.org/support.html)
158
158
 
159
159
  Patches are always welcome. You can use instructions for Foreman, just
@@ -163,21 +163,21 @@ substitute Foreman with Kafo. More details are [here](http://projects.theforeman
163
163
 
164
164
  ## Testing aka noop etc
165
165
 
166
- You'll probably want to tweak your installer before so you may find
166
+ Since you'll probably want to tweak your installer before you run it, you may find the
167
167
  ```--noop``` argument handy (-n for short). This will run puppet in
168
- noop so no change will be done to your system. Default value is
168
+ noop so no change will be done to your system. The default value here is set to
169
169
  false!
170
170
 
171
- Sometimes you may want kafo not to store answers from current run. You can
172
- disable saving by passing a ```--dont-save-answers``` argument (or -d for short).
171
+ Sometimes you may want kafo not to store answers from the current run. You can
172
+ disable saving answer by passing a ```--dont-save-answers``` argument (or -d for short).
173
173
 
174
174
  Note that running ```--noop``` implies ```--dont-save-answers```.
175
175
 
176
176
  ## Parameters prefixes
177
177
 
178
- You probably noticed that every module parameter is prefixed by module name
179
- by default. If you use just one module it's probably unnecessary and you
180
- can disable this behavior in config/kafo.yaml. Just set option like this
178
+ As a default every module parameter is prefixed by the module name.
179
+ If you use just one module it's probably not necessary and you
180
+ can disable this behavior in config/kafo.yaml. Just enable the following option
181
181
  ```yaml
182
182
  :no_prefix: true
183
183
  ```
@@ -185,13 +185,12 @@ can disable this behavior in config/kafo.yaml. Just set option like this
185
185
  ## Documentation
186
186
 
187
187
  Every parameter that can be set by kafo *must* be documented. This means that
188
- you must add documentation to your puppet class in init.pp. It's basically
189
- rdoc formatted documentation that must be above class definitions. There can
190
- be no space between doc block and class definition.
188
+ you must add documentation to your puppet class in init.pp. It's basically a
189
+ rdoc formatted documentation that must be above the class definitions. There can
190
+ be no space between the doc block and the class definition.
191
191
 
192
192
  In case of emergency, it's still possible to use
193
- `--ignore-undocumented` option, but in general it's not recommended to
194
- use it long-term.
193
+ `--ignore-undocumented` option, but in general it's not recommended to override it.
195
194
 
196
195
  Example:
197
196
  ```puppet
@@ -234,26 +233,26 @@ Example - separating parameters into groups:
234
233
  # $mysql_host:: MySQL server address
235
234
  ```
236
235
 
237
- When you run the installer with ```--help``` argument it displays only
238
- parameters specified in ```=== Parameters:``` group. If you don't specify
239
- any group all parameters will be considered as Basic and will be displayed.
236
+ When you run the installer with the ```--help``` argument it displays only
237
+ parameters specified in the ```=== Parameters:``` group. If you don't specify
238
+ any group all parameters will be considered as basic and will be displayed.
240
239
 
241
- If you run installer with ```--full-help``` you'll receive help of all
240
+ If you run the installer with ```--full-help``` you'll receive help for all
242
241
  parameters divided into groups. Note that only headers that include word
243
242
  parameters are considered as parameter groups. Other headers are ignored.
244
243
  Also note that you can nest parameter groups and the child has precedence.
245
244
  Help output does not take header level into account though.
246
245
 
247
- So in previous example, each parameter would be printed in one group even
246
+ So in the previous example, each parameter would be printed in one group even
248
247
  though MySQL is a child of Advanced parameter. All groups in help would be
249
- prefixed with second level (==). The first level is always a module to which
250
- particular parameter belongs.
248
+ prefixed with a second level (==). The first level is always a module to which
249
+ the particular parameter belongs.
251
250
 
252
251
  ## Argument types
253
252
 
254
- By default all arguments that are parsed from puppet are treated as string.
253
+ By default all arguments that are parsed from puppet are treated as strings.
255
254
  If you want to indicate that a parameter has a particular type you can do it
256
- in puppet manifest documentation like this
255
+ in the puppet manifest documentation like this
257
256
 
258
257
  ```puppet
259
258
  # $param:: Some documentation for param
@@ -263,24 +262,24 @@ in puppet manifest documentation like this
263
262
  Supported types are: string, boolean, integer, array, password
264
263
 
265
264
  Note that all arguments that are nil (have no value in answers.yaml or you
266
- set them UNDEF (see below) are translated to ```undef``` in puppet.
265
+ set them UNDEF (see below)) are translated to ```undef``` in puppet.
267
266
 
268
267
  ## Password arguments
269
268
 
270
- Kafo support password arguments. It's adding some level of protection for you
269
+ Kafo supports password arguments. It's adding some level of protection for your
271
270
  passwords. Usually people generate random strings for passwords. However all
272
- values are stored in config/answers.yaml which introduce some security risk.
271
+ values are stored in config/answers.yaml which may introduce a security risk.
273
272
 
274
- If this is something to consider for you, you can use password type (see
273
+ If this is something to consider for you, you can use the password type (see
275
274
  Argument types for more info how to define parameter type). It will
276
- generate a secure (random) password of decent length (32 chars) and encrypts
275
+ generate a secure (random) password with a length of 32 chars and encrypts
277
276
  it using AES 256 in CBC mode. It uses a passphrase that is stored in
278
277
  config/kafo.yaml so if anyone gets an access to this file, he can read all
279
- other passwords from answers.yaml. A random password is generated and stored
278
+ the passwords from the answers.yaml, too. A random password is generated and stored
280
279
  if there is none in kafo.yaml yet.
281
280
 
282
281
  When Kafo runs puppet, puppet will read this password from config/kafo.yaml.
283
- It runs under the same user so it should have read access by default. Kafo
282
+ It runs under the same user so it should have read access by default. The Kafo
284
283
  puppet module also provides a function that you can use to decrypt such
285
284
  parameters. You can use it like this
286
285
 
@@ -288,13 +287,13 @@ parameters. You can use it like this
288
287
  password: <%= scope.function_decrypt([scope.lookupvar("::foreman::db_password"))]) -%>
289
288
  ```
290
289
 
291
- Also you can take advantage of already encrypted password and store as it is
290
+ Also you can take advantage of already encrypted passwords and store since it is
292
291
  (encrypted). Your application can decrypt it as long as it knows the
293
- passphrase. Passphrase can be obtained as $kafo_configure::password.
292
+ passphrase. The passphrase can be obtained from $kafo_configure::password.
294
293
 
295
294
  Note that we use a bit extraordinary form of encrypted passwords. All our
296
- encrypted passwords looks like "$1$base64encodeddata". As you can see we
297
- use $1$ prefix by which we can detect that its encrypted password by us.
295
+ encrypted passwords look like "$1$base64encodeddata". As you can see we
296
+ use the $1$ as prefix by which we can detect that it is our specially encrypted password.
298
297
  The form has nothing common with Modular Crypt Format. Also our AES output
299
298
  is base64 encoded. To get a password from this format you can do something
300
299
  like this in your application
@@ -320,14 +319,14 @@ blank line.
320
319
 
321
320
  ## Hash arguments
322
321
 
323
- You can use Hash value not unlike Arrays. It's also multivalue type but
324
- you have to specify a key:value pairs like this.
322
+ You can use a Hash value like an Array. It's also a multivalue type but
323
+ you have to specify a key:value pair like in the following example.
325
324
  ```bash
326
325
  bin/foreman-installer --puppet-server-git-branch-map=master:some --puppet-server-git-branch-map=development:another
327
326
  ```
328
327
 
329
- The same applies in interactive mode, you enter each pair on separate line
330
- just like with Array, the only difference is that the line must be formatted
328
+ The same applies to the interactive mode, you enter each pair on separate lines
329
+ just like with an Array, the only difference is that the line must be formatted
331
330
  as key:value.
332
331
 
333
332
  When parsing the value, the first colon divides key and value. All other
@@ -335,9 +334,9 @@ colons are ignored.
335
334
 
336
335
  ## Grouping in interactive mode
337
336
 
338
- If your module has too much parameters you may find useful grouping. Every
339
- block in your documentation (prefixed by header) forms a group. Unlike for
340
- help, all block are used in interactive mode. Suppose you have following
337
+ If your module has too many parameters you may find the grouping feature useful.
338
+ Every block in your documentation (prefixed by header) forms a group. Unlike for
339
+ help, all blocks are used in interactive mode. Suppose you have the following
341
340
  example:
342
341
 
343
342
  ```puppet
@@ -364,8 +363,8 @@ example:
364
363
  # $three:: number three
365
364
  ```
366
365
 
367
- When you enter Testing class module in interactive mode you see parameters
368
- from Basic group and options to configure parameters which belongs to rest
366
+ When you enter the Testing class module in interactive mode you can see parameters
367
+ from the Basic group and options to configure parameters which belong to the rest
369
368
  of groups on same level, in this case Advanced and Extra parameters.
370
369
 
371
370
  ```
@@ -377,12 +376,12 @@ Module foreman configuration
377
376
  5. Back to main menu
378
377
  ```
379
378
 
380
- When you enter Extra paramaters, you see only $three and option to get back
381
- to parent. In Advanced you see $two and two more subgroups - Advanced A and
382
- Advanced B. When you enter these subgroups, you see their parameters of
383
- course. Nesting is unlimited. Also there's no naming rule. Just notice that
379
+ When you enter Extra parameters, you see only $three and an option to get back
380
+ to the parent. In Advanced you can see $two and two more subgroups - Advanced A and
381
+ Advanced B. When you enter these subgroups, you can again see their parameters.
382
+ Nesting is unlimited. Also there's no naming rule. Just notice that
384
383
  the main group must be called `Parameters` and it's parameters are always
385
- displayed on first level of module configuration.
384
+ displayed on first level of the module configuration.
386
385
 
387
386
  ```
388
387
  Group Extra parameters (of module foreman)
@@ -391,15 +390,15 @@ Group Extra parameters (of module foreman)
391
390
  ```
392
391
 
393
392
  If there's no primary group a new one is created for you and it does not have
394
- any parameter. This mean when user enters module configuration he or she will
395
- see only subgroups in menu (no parameters until a particular subgroup is entered).
396
- If there is no group in documentation a new primary group is created and it
397
- holds all module parameters (there are no subgroups in module configuration).
393
+ any parameter. This means when a user enters the module configuration he or she will
394
+ see only subgroups in the menu (no parameters until a particular subgroup is entered).
395
+ If there is no group in the documentation a new primary group is created and it
396
+ holds all module parameters (there are no subgroups in the module configuration).
398
397
 
399
398
  ## Conditional parameters in interactive mode
400
399
 
401
- You can also define conditions to parameter and their groups. These conditions
402
- are evaluated in interactive mode and based on the result they are displayed
400
+ You can also define conditions to parameters and their groups. These conditions
401
+ are evaluated in interactive mode and are based on the results which are then displayed
403
402
  to the user. You can use this for example to hide mysql_* parameters when
404
403
  $db_type is not set 'mysql'. Let's look at following example
405
404
 
@@ -425,9 +424,9 @@ $db_type is not set 'mysql'. Let's look at following example
425
424
  # condition: !$remote
426
425
  ```
427
426
 
428
- Here you can see we defined several conditions on group and parameter level.
429
- You can write condition in ruby language. All dollar-prefixed words are be
430
- substituted by value of a particular puppet parameter.
427
+ Here you can see we defined several conditions on the group and parameter level.
428
+ You can write a condition in ruby. All dollar-prefixed words will be
429
+ substituted with the value of the particular puppet parameter.
431
430
 
432
431
  Note that conditions are combined using ```&&``` when you nest them. So these
433
432
  are facts based on example:
@@ -462,8 +461,8 @@ to you answer file, Kafo expects a ```foreman``` subdirectory in ```modules/```.
462
461
  it expects that there will be init.pp which it will instantiate. If you need
463
462
  to change this behavior you can via ```mapping``` option in ```config/kafo.yaml```.
464
463
 
465
- Suppose we have puppet module and we want to use puppet/server.pp as our init
466
- file. Also we want to name our module as puppetmaster. We add following mapping
464
+ Suppose we have a puppet module and we want to use a puppet/server.pp as our init
465
+ file. Also we want to name our module puppetmaster. To do so we add the following mapping
467
466
  to kafo.yaml
468
467
 
469
468
  ```yaml
@@ -475,33 +474,33 @@ to kafo.yaml
475
474
  :params_name: 'params' # name of manifest holding the params class without .pp extension
476
475
  ```
477
476
 
478
- Note that if you add mapping you must enter both dir_name and manifest_name even
479
- if one of them is default. Arguments params_path and params_name are optional. You can
480
- use just params_name or override not just file name but complete path using params_path.
481
- If you use params_path for this purpose, params_name is ignored.
477
+ Note that if you add a mapping you must enter both the dir_name and manifest_name even
478
+ if one of them is already the default. The arguments params_path and params_name are optional.
479
+ You can use just "params_name" or override not just the file name but also complete paths using "params_path".
480
+ If you use "params_path" for this purpose, "params_name" is ignored.
482
481
 
483
482
  ## Validations
484
483
 
485
- If you specify validations of parameters in you init.pp manifest they
486
- will be executed for your values even before puppet is run. In order to do this
487
- you must follow few rules however:
484
+ If you specify validations of parameters in your init.pp manifest they
485
+ will be replaced with your values even before puppet is run. In order to do this
486
+ you must follow a few rules however:
488
487
 
489
488
  * you must use standard validation functions (e.g. validate_array, validate_re, ...)
490
489
  * you must have stdlib in modules directory
491
490
 
492
491
  ## Enabling or disabling module
493
492
 
494
- You can enable or disable module specified in answers.yaml file. Every module
495
- automatically adds two options to foreman-installer script. For module foreman
493
+ You can enable or disable a module specified in the answers.yaml file. Every module
494
+ automatically adds two options to the foreman-installer script. For the module "foreman"
496
495
  you have two flag options ```--enable-foreman``` and ```--no-enable-foreman```.
497
496
 
498
- When you disable a module all its answers will be removed and module will be
499
- set to false. When you reenable the module you'll end up with default values.
497
+ When you disable a module all its answers will be removed and "module" will be
498
+ set to false. When you reenable the module you'll end up with the default values.
500
499
 
501
500
  ## Special values for arguments
502
501
 
503
502
  Sometimes you may want to enforce ```undef``` value for a particular parameter.
504
- You can set this value by specifying UNDEF string e.g.
503
+ You can set this value by specifying an UNDEF string e.g.
505
504
 
506
505
  ```bash
507
506
  bin/foreman-installer --foreman-db-password=UNDEF
@@ -509,25 +508,25 @@ bin/foreman-installer --foreman-db-password=UNDEF
509
508
 
510
509
  It also works in interactive mode.
511
510
 
512
- You may also need to override array parameter with empty array value. For this
511
+ You may also need to override array parameters with empty array values. For this
513
512
  purpose you can use `EMPTY_ARRAY` string as a value. Similarly you can use
514
513
  `EMPTY_HASH` for hash parameters.
515
514
 
516
515
  ## Hooks
517
516
 
518
- You may need to add new features to the installer. Kafo provides simple hook
519
- mechanism that allows you to run custom code at various time. We support
520
- several hooks.
517
+ You may need to add new features to the installer. Kafo provides a simple hook
518
+ mechanism that allows you to run custom code at 6 different occasions.
519
+ We currently support the following hooks.
521
520
 
522
- * boot - before kafo is ready to work, useful for adding new installer arguments, logger won't work yet
521
+ * boot - before kafo is ready to work, useful for adding new installer arguments, but logger won't work yet
523
522
  * init - just after hooking is initialized and kafo is configured, parameters have no values yet
524
523
  * pre_values - just before value from CLI is set to parameters (they already have default values)
525
524
  * pre_validations - just after system checks and before validations are executed (and before interactive wizard is started), at this point all parameter values are already set but not yet stored in answer file
526
525
  * pre - just before puppet is executed to converge system
527
526
  * post - just after puppet is executed to converge system
528
527
 
529
- Let's assume we want to add --reset-foreman-db option to our
530
- foreman-installer. We could either add following lines to generated
528
+ Let's assume we want to add the ```--reset-foreman-db``` option to our
529
+ foreman-installer. We could add the following lines to the generated
531
530
  installer script.
532
531
 
533
532
  ```ruby
@@ -557,21 +556,21 @@ KafoConfigure.hooking.register_pre(:reset_db) do
557
556
  end
558
557
  ```
559
558
 
560
- Note that the hook is evaluated in HookContext object which provides some DSL. We can create
559
+ Note that the hook is evaluated in HookContext object which provides some DSL. We can create a
561
560
  new installer option using ```app_option```. These option values can be accessed by using
562
561
  ```app_value(:reset_foreman_db)```. You can modify parameters (if they are already defined)
563
562
  using ```param('module name', 'parameter name')``` accessor. You can register your own module
564
- that is not specified in answer file using ```add_module```. Custom mapping is also supported.
565
- This is useful if you need to add some module to existing installer based on kafo but you don't
566
- have control over its source code. You can use custom config storage which persists among
563
+ that is not specified in the answer file using ```add_module```. Custom mapping is also supported.
564
+ This is useful if you need to add some module to the existing installer based on kafo but you don't
565
+ have control over its source code. You can use a custom config storage which persists among
567
566
  kafo runs using ```get_custom_config``` and ```store_custom_config```.
568
567
  Last but not least you have access to logger. For more details, see
569
568
  [hook_context.rb](https://github.com/theforeman/kafo/blob/master/lib/kafo/hook_context.rb).
570
569
 
571
- If you don't want to modify you installer script you can place your hooks into
572
- hooks directory. By default hooks dir is searched for ruby files in subdirectories
570
+ If you don't want to modify your installer script you can place your hooks into the
571
+ hooks directory. By default the hooks dir is searched for ruby files in subdirectories
573
572
  based on hook type. For example pre hooks are searched for in ```$installer_dir/hooks/pre/*.rb```
574
- Hooks from previous example would look like this. The only change to the code is
573
+ The hooks from the previous example would look like this. The only change to the code is
575
574
  that you don't explicitely register hooks, it's done automatically for you.
576
575
 
577
576
  ```ruby
@@ -597,8 +596,8 @@ end
597
596
  ```
598
597
 
599
598
 
600
- If you want to add more directories to be search you can use hook_dirs option
601
- in installer configuration file.
599
+ If you want to add more directories to be search you can use the "hook_dirs" option
600
+ in the installer configuration file.
602
601
 
603
602
  ```yaml
604
603
  :hook_dirs:
@@ -606,24 +605,24 @@ in installer configuration file.
606
605
  - /my/plugin/hooks
607
606
  ```
608
607
 
609
- You can register as many hooks as you need. The order of execution for particular hook type
608
+ You can register as many hooks as you need. The order of execution for a particular hook type
610
609
  is based on hook file name.
611
610
 
612
- If you want to cancel installation you can use ```exit``` method and specify an exit code.
611
+ If you want to cancel the installation you can use the ```exit``` method and specify an exit code.
613
612
 
614
613
  ## Colors
615
614
 
616
- Everybody loves colors right? In case you don't you can disable them using ```--no-colors```
617
- argument or disallow them in installer config file (search for ```colors:``` key and set
615
+ Everybody loves colors right? In case you don't you can disable them using the ```--no-colors```
616
+ argument or disallow them in the installer config file (search for ```colors:``` key and set
618
617
  it to false). If you don't touch this setting, kafo will try to detect whether colors
619
618
  are supported and will enable/disable it accordingly.
620
619
 
621
620
  Kafo supports two sets of colors, one for terminals with bright and one for dark backround.
622
621
  You can specify your installer default scheme in installer config file (```color_of_background```
623
- key). Or user can override this default setting by ```--color-of-background``` argument.
622
+ key). Alternatively the user can override this default setting with the ```--color-of-background``` argument.
624
623
  Possible values are ```dark``` and ```bright```.
625
624
 
626
- You can reuse kafo color schema in your custom hooks (so you can reuse dark/bright logic).
625
+ You can reuse the kafo color schema in your custom hooks (so you can reuse dark/bright logic).
627
626
  Look at this example in bin/foreman-installer
628
627
  ```ruby
629
628
  #!/usr/bin/env ruby
@@ -671,18 +670,18 @@ paths. In order to do that you can use following configuration options:
671
670
  * :modules_dir: /usr/share/foreman-installer/modules
672
671
  * :kafo_modules_dir: /usr/share/kafo/modules
673
672
 
674
- Answer file is obvious. Installer dir is a place where you installer is
675
- installed. E.g. system checks will be loaded from here (under checks
673
+ Answer file is obvious. The "installer_dir" is the place where your installer is
674
+ located. E.g. system checks will be loaded from here (under checks
676
675
  subdirectory). You can optionally change foreman-installer modules dir
677
676
  using modules_dir option.
678
677
 
679
678
  On debian systems you may want to specify kafo modules dir
680
- independent on your installer location. If you specify this option kafo
681
- internal installer puppet modules will be loaded from here.
679
+ independent on your installer location. If you specify this option kafo's
680
+ internal-installer puppet-modules will be loaded from here.
682
681
 
683
682
  ## Order of puppet modules execution
684
683
 
685
- When you have more than one module you may end up in situation where you need
684
+ When you have more than one module you may end up in the situation where you need a
686
685
  specific order of execution. It seems as a puppet antipattern to me however
687
686
  there may be cases where it's needed. You can set order in config/kafo.yaml
688
687
  like this
@@ -698,8 +697,9 @@ those that have explicit order. Their order is not be specified.
698
697
 
699
698
  ## Changing the order of module appearance in interactive mode
700
699
 
701
- We sort our module alphabetically. Sometimes you may want to reorder
702
- module, e.g. display plugin modules last. For this you can use ```low_priority_modules```
700
+ We sort our modules alphabetically. Sometimes you may want to reorder
701
+ modules, e.g. a display plugin modules as last module.
702
+ For this you can use the ```low_priority_modules```
703
703
  configuration option. It accepts an array of patterns considering the
704
704
  first to have the lowest priority. So in follwing example
705
705
 
@@ -720,23 +720,23 @@ were mentioned later.
720
720
  By default kafo logs every run to a separate file in /var/log/kafo.
721
721
  You probably want to put your installation logs alongside with other logs of
722
722
  your application. That's why kafo has its own configuration file in which you
723
- can tune details like this.
723
+ can tune details like these.
724
724
 
725
- In order to do that create a configuration file in config/kafo.yaml. You can
725
+ In order to do that, create a configuration file under config/kafo.yaml. You can
726
726
  use config/kafo.yaml.example as a template. If config/kafo.yaml does not exist
727
727
  default values will be used.
728
728
 
729
- As a developer you can appreciate more verbose log. You can set debug level
729
+ As a developer you can appreciate more verbose log. You can set a debug level
730
730
  in config/kafo.yml. Also you can change a user or group that will own the
731
- log file. This is usefull if your installer requires to be run under root
731
+ log file. This is usefull if your installer requires to be run as root
732
732
  but you want the logs to be readable by specific users.
733
733
 
734
734
  ## System checks
735
735
 
736
- When you want to make sure that user has some software installed or has the
737
- right version you can write a simple script and put it into checks directory.
736
+ When you want to make sure that a user has a certain software installed or has the
737
+ right version you can write a simple script and put it into the checks directory.
738
738
  All files found there will be executed and if any of these exits with an non-zero
739
- exit code, kafo won't execute puppet but print an error message
739
+ exit code, kafo won't execute puppet but only print an error message
740
740
  `Your system does not meet configuration criteria.`
741
741
 
742
742
  Everything on STDOUT and STDERR is logged in error level.
@@ -749,16 +749,16 @@ java -version 2>&1 | grep OpenJDK
749
749
  exit $?
750
750
  ```
751
751
 
752
- If you want to ignore results of check scripts, you can use the builtin
752
+ If you want to ignore results of the check scripts, you can use the builtin
753
753
  parameter `--skip-checks-i-know-better` (or `-s`). This will completely
754
754
  disable running all system check scripts. Note that this option is
755
755
  not persisted between runs.
756
756
 
757
757
  ## Exit code
758
758
 
759
- Kafo can terminate either before or after puppet is ran. Puppet is ran with
760
- --detailed-exitcodes and Kafo returns the same exit code as puppet does. If
761
- kafo terminates after puppet run exit codes are:
759
+ Kafo can terminate either before or after puppet is run. If it is run with
760
+ ```--detailed-exitcodes``` Kafo returns the same exit code as puppet does. If
761
+ kafo terminates after puppet run exit codes are like the following:
762
762
  * '1' means there were parser/validation errors
763
763
  * '2' means there were changes,
764
764
  * '4' means there were failures during the transaction,
@@ -776,7 +776,7 @@ Other exit codes that can be returned:
776
776
 
777
777
  ## Running Puppet Profiling
778
778
 
779
- As of Puppet 3.2, performance data can be gathered during a puppet run by assing the `--profile` option. See [Tune Puppet for Performance with Profiler](https://puppetlabs.com/blog/tune-puppet-performance-profiler) for more information from the Puppet team. Users who wish to perform a Kafo run and gather this type of profiling data to analyze can pass the same option to their installer. The profiling data will then be present in the normal Kafo logs.
779
+ As of Puppet 3.2, performance data can be gathered during a puppet run by adding the `--profile` option. See [Tune Puppet for Performance with Profiler](https://puppetlabs.com/blog/tune-puppet-performance-profiler) for more information from the Puppet team. Users who wish to perform a Kafo run and gather this type of profiling data to analyze can pass the same option to their installer. The profiling data will then be present in the normal Kafo logs.
780
780
 
781
781
  # License
782
782
 
@@ -44,7 +44,8 @@ module Kafo
44
44
 
45
45
  def execute(group)
46
46
  logger.info "Executing hooks in group #{group}"
47
- self.hooks[group].each_pair do |name, hook|
47
+ self.hooks[group].keys.sort.each do |name|
48
+ hook = self.hooks[group][name]
48
49
  result = HookContext.execute(self.kafo, &hook)
49
50
  logger.debug "Hook #{name} returned #{result.inspect}"
50
51
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module Kafo
3
- VERSION = "0.6.7"
3
+ VERSION = "0.6.8"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kafo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Hulan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-06 00:00:00.000000000 Z
11
+ date: 2015-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: puppet
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - <
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 4.0.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - <
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 4.0.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: logging
113
113
  requirement: !ruby/object:Gem::Requirement