kafo 0.5.2 → 0.5.3

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: 1e97bd2473d708bd19a6a85e1e4e861420697f58
4
- data.tar.gz: c3d5788d32f73a7801f0474338c6916f5ac1c354
3
+ metadata.gz: 04471c1066e9f6dd65d78a5367cdc0eb56321c0c
4
+ data.tar.gz: 17179ea8c8da4b0982b6a9bbedb82eade0e66cfe
5
5
  SHA512:
6
- metadata.gz: e3030707d7cec780ab60a04f7b08c50ec3ae481792ff091d96ab1f823561320ccf8100064aba7583cc561966ea91f0c62dd7c3ccc8cf484aedcfe6f21d7b5695
7
- data.tar.gz: 841dc1c57a6332259e51e9e63e5ff065f5159b77416b6264d54b36381177a96e4f76bc9e7102ce9a7f673c8db387c96e0d83b43e32a39828f0b84dd43a9bf1b1
6
+ metadata.gz: 3a55344a02495577be8d8a43227b605f39baeea111cad9555dcab69ea13a97547e6359ba3cf6c91a47d0736120ab544bb18e8dcdec45a1fa6460eb496c7273de
7
+ data.tar.gz: ab04cfc6b76c6131d23557074736fe4eb75066ac978da2646202ceed53e3e8ce7e442afd97b4b1eaa607469c51729059125b630f4daf228ecc835761dcfb44c4
data/README.md CHANGED
@@ -451,10 +451,14 @@ to kafo.yaml
451
451
  :puppetmaster: # a module name, so we'll have puppetmaster: true in answer file
452
452
  :dir_name: 'puppet' # the subdirectory in modules/
453
453
  :manifest_name: 'server' # manifest filename without .pp extension
454
+ :params_path: ... # params manifest full path, overriding params_name, must be with .pp extension
455
+ :params_name: 'params' # name of manifest holding the params class without .pp extension
454
456
  ```
455
457
 
456
458
  Note that if you add mapping you must enter both dir_name and manifest_name even
457
- if one of them is default.
459
+ if one of them is default. Arguments params_path and params_name are optional. You can
460
+ use just params_name or override not just file name but complete path using params_path.
461
+ If you use params_path for this purpose, params_name is ignored.
458
462
 
459
463
  ## Validations
460
464
 
@@ -123,10 +123,10 @@ module Kafo
123
123
 
124
124
  def includes
125
125
  modules.map do |mod|
126
- params_file = File.join(KafoConfigure.modules_dir, modules.first.dir_name, 'manifests', 'params.pp')
126
+ params_file = File.join(KafoConfigure.modules_dir, mod.params_path)
127
127
  @logger.debug "checking presence of #{params_file}"
128
- File.exist?(params_file) ? "include #{mod.dir_name}::params" : nil
129
- end.compact.join(' ')
128
+ File.exist?(params_file) ? "include #{mod.dir_name}::#{mod.params_class_name}" : nil
129
+ end.uniq.compact.join(' ')
130
130
  end
131
131
 
132
132
  def params
@@ -9,20 +9,22 @@ module Kafo
9
9
  PRIMARY_GROUP_NAME = 'Parameters'
10
10
 
11
11
  attr_reader :name, :identifier, :params, :dir_name, :class_name, :manifest_name, :manifest_path,
12
- :groups
12
+ :groups, :params_path, :params_class_name
13
13
 
14
14
  def initialize(identifier, parser = KafoParsers::PuppetModuleParser)
15
- @identifier = identifier
16
- @name = get_name
17
- @dir_name = get_dir_name
18
- @manifest_name = get_manifest_name
19
- @class_name = get_class_name
20
- @params = []
21
- @manifest_path = File.join(KafoConfigure.modules_dir, module_manifest_path)
22
- @parser = parser
23
- @validations = []
24
- @logger = KafoConfigure.logger
25
- @groups = {}
15
+ @identifier = identifier
16
+ @name = get_name
17
+ @dir_name = get_dir_name
18
+ @manifest_name = get_manifest_name
19
+ @class_name = get_class_name
20
+ @params = []
21
+ @manifest_path = File.join(KafoConfigure.modules_dir, module_manifest_path)
22
+ @parser = parser
23
+ @validations = []
24
+ @logger = KafoConfigure.logger
25
+ @groups = {}
26
+ @params_path = get_params_path
27
+ @params_class_name = get_params_class_name
26
28
  end
27
29
 
28
30
  def enabled?
@@ -107,16 +109,37 @@ module Kafo
107
109
  end
108
110
 
109
111
  def get_class_name
110
- manifest_name == 'init' ? name : "#{dir_name}::#{manifest_name.gsub('_', '::')}"
112
+ manifest_name == 'init' ? name : "#{dir_name}::#{manifest_name.gsub('/', '::')}"
113
+ end
114
+
115
+ def get_params_path
116
+ mapping[identifier].nil? ? default_params_path : (mapping[identifier][:params_path] || default_params_path)
117
+ end
118
+
119
+ def get_params_name
120
+ default = 'params'
121
+ mapping[identifier].nil? ? default : (mapping[identifier][:params_name] || default)
122
+ end
123
+
124
+ def get_params_class_name
125
+ name_to_class_name(get_params_name)
111
126
  end
112
127
 
113
128
  def module_manifest_path
114
129
  "#{dir_name}/manifests/#{manifest_name}.pp"
115
130
  end
116
131
 
132
+ def default_params_path
133
+ "#{dir_name}/manifests/#{get_params_name}.pp"
134
+ end
135
+
117
136
  def get_name
118
137
  identifier.gsub('::', '_')
119
138
  end
120
139
 
140
+ def name_to_class_name(name)
141
+ name.gsub('/', '::')
142
+ end
143
+
121
144
  end
122
145
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module Kafo
3
- VERSION = "0.5.2"
3
+ VERSION = "0.5.3"
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.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Hulan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2014-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler