kafo 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kafo might be problematic. Click here for more details.

data/README.md CHANGED
@@ -289,6 +289,22 @@ bin/foreman-installer --foreman-db-password=UNDEF
289
289
 
290
290
  It also works in interactive mode.
291
291
 
292
+ ## Order of puppet modules execution
293
+
294
+ When you have more than one module you may end up in situation where you need
295
+ specific order of execution. It seems as a puppet antipattern to me however
296
+ there may be cases where it's needed. You can set order in config/kafo.yaml
297
+ like this
298
+
299
+ ```yaml
300
+ order:
301
+ - foreman
302
+ - foreman_proxy
303
+ ```
304
+
305
+ If you have other modules in your answer file they will be executed after
306
+ those that have explicit order. Their order is not be specified.
307
+
292
308
  ## Changing of log directory and user/group
293
309
 
294
310
  By default kafo logs every run to a separate file in /var/log/kafo.
@@ -9,6 +9,7 @@
9
9
  ## Kafo tuning, customization of core functionality
10
10
  # :no_prefix: false
11
11
  # :mapping: {}
12
+ # :order:
12
13
 
13
14
  ## Advanced configuration - if not set it's ignored
14
15
  # :log_owner: root
@@ -142,10 +142,16 @@ class KafoConfigure < Clamp::Command
142
142
  begin
143
143
  stdin.each { |line| puppet_log(line) }
144
144
  rescue Errno::EIO
145
- exit_code = PTY.check(pid).exitstatus
145
+ if PTY.respond_to?(:check) # ruby >= 1.9.2
146
+ exit_code = PTY.check(pid).exitstatus
147
+ else # ruby < 1.9.2
148
+ Process.wait(pid)
149
+ exit_code = $?.exitstatus
150
+ end
146
151
  end
147
152
  end
148
- rescue PTY::ChildExited
153
+ rescue PTY::ChildExited => e
154
+ exit_code = e.status.exitstatus
149
155
  end
150
156
  logger.info "Puppet has finished, bye!"
151
157
  exit(exit_code)
data/lib/kafo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kafo
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -0,0 +1,21 @@
1
+ # Orders modules names according to kafo.yaml
2
+ #
3
+ # if order was specified we take all modules in this order, if there are
4
+ # other modules that were not ordered, we put them at the end in non-specified
5
+ # order
6
+ module Puppet::Parser::Functions
7
+ newfunction(:kafo_ordered, :type => :rvalue) do |args|
8
+ order = YAML.load_file('config/kafo.yaml')[:order]
9
+ if order.nil?
10
+ args[0]
11
+ else
12
+ result = []
13
+ base = args[0].clone
14
+ order.each do |name|
15
+ result<< base.delete(name)
16
+ end
17
+ result + base
18
+ end
19
+ end
20
+ end
21
+
@@ -12,7 +12,7 @@ class kafo_configure(
12
12
  $params = loadanyyaml($answers,
13
13
  "/etc/kafo-configure/answers.yaml",
14
14
  "config/answers.yaml")
15
- $keys = hash_keys($params)
15
+ $keys = kafo_ordered(hash_keys($params))
16
16
 
17
17
  kafo_configure::yaml_to_class { $keys: }
18
18
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kafo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-28 00:00:00.000000000 Z
12
+ date: 2013-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -162,6 +162,7 @@ files:
162
162
  - modules/kafo_configure/lib/puppet/parser/functions/dump_values.rb
163
163
  - modules/kafo_configure/lib/puppet/parser/functions/load_kafo_password.rb
164
164
  - modules/kafo_configure/lib/puppet/parser/functions/hash_keys.rb
165
+ - modules/kafo_configure/lib/puppet/parser/functions/kafo_ordered.rb
165
166
  - modules/kafo_configure/lib/puppet/parser/functions/loadanyyaml.rb
166
167
  - modules/kafo_configure/manifests/yaml_to_class.pp
167
168
  - modules/kafo_configure/manifests/init.pp