kafo 0.3.7 → 0.3.8

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d19db45310802b9ec8accfbdf35c9744ba7d8c26
4
- data.tar.gz: dd65098dfe239223143b997c40670dc55183a049
3
+ metadata.gz: 2097c6e99602c8b478265219c447052baaece53b
4
+ data.tar.gz: 2edb25f2bbe58a5f25ba2ad3ee98b49bb1cd8532
5
5
  SHA512:
6
- metadata.gz: b0d661901003eee9440f6c1ea87732fd8ccb9b221ebc21a3df124e4b23adbbe55cb2bd02755b40a65d6082dc855c1c1c1e2cba574724cce48939e996978c157e
7
- data.tar.gz: 49d8de9235174a299f47e975066fbb7b9828dc632e04e351a992e053ce7dd6453f74ff73438c9f671b621c42b4b33124dba72e8148d156b3069b47d722ef2c85
6
+ metadata.gz: 6e889867eb668c139ccffc103824e3597ee5c2122f9f9309b6eb359a099b90d491a0ea500dba55a86fb835b34133cabf8c1bd278181f6363e9ff28fbca4a72f0
7
+ data.tar.gz: 8e72a851e7320ef021e5dc9bd3ceba54803dd4dd6cde30e9b4cf387269f100e74ec6507035bb8ba90b41858c968b5c84c640f315d9a75d6d29d5eb572c892f39
@@ -4,11 +4,16 @@ require 'ostruct'
4
4
  require 'clamp'
5
5
  require 'logging'
6
6
  require 'kafo/string_helper'
7
+ require 'kafo/exceptions'
8
+ require 'logger'
7
9
 
8
10
  $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'kafo'))
9
11
  require 'configuration'
10
12
 
11
13
  KafoConfigure = OpenStruct.new
14
+ def KafoConfigure.exit(code)
15
+ Kernel.exit(1)
16
+ end
12
17
 
13
18
  module Kafo
14
19
  class KafoExportParams < Clamp::Command
@@ -29,6 +34,7 @@ module Kafo
29
34
  KafoConfigure.config = c
30
35
  KafoConfigure.root_dir = File.expand_path(c.app[:installer_dir])
31
36
  KafoConfigure.modules_dir = File.expand_path(c.app[:modules_dir])
37
+ KafoConfigure.logger = Logger.new(STDOUT)
32
38
 
33
39
  exporter = self.class.const_get(format.capitalize).new(c)
34
40
  exporter.print_out
@@ -95,7 +95,7 @@ module Kafo
95
95
  end
96
96
 
97
97
  def module_enabled?(mod)
98
- value = @data[mod.is_a?(String) ? mod : mod.name]
98
+ value = @data[mod.is_a?(String) ? mod : mod.identifier]
99
99
  !!value || value.is_a?(Hash)
100
100
  end
101
101
 
@@ -271,7 +271,7 @@ module Kafo
271
271
  end
272
272
 
273
273
  def store_params(file = nil)
274
- data = Hash[config.modules.map { |mod| [mod.name, mod.enabled? ? mod.params_hash : false] }]
274
+ data = Hash[config.modules.map { |mod| [mod.identifier, mod.enabled? ? mod.params_hash : false] }]
275
275
  config.store(data, file)
276
276
  end
277
277
 
@@ -8,11 +8,12 @@ module Kafo
8
8
  class PuppetModule
9
9
  PRIMARY_GROUP_NAME = 'Parameters'
10
10
 
11
- attr_reader :name, :params, :dir_name, :class_name, :manifest_name, :manifest_path,
11
+ attr_reader :name, :identifier, :params, :dir_name, :class_name, :manifest_name, :manifest_path,
12
12
  :groups
13
13
 
14
- def initialize(name, parser = PuppetModuleParser)
15
- @name = name
14
+ def initialize(identifier, parser = PuppetModuleParser)
15
+ @identifier = identifier
16
+ @name = get_name
16
17
  @dir_name = get_dir_name
17
18
  @manifest_name = get_manifest_name
18
19
  @class_name = get_class_name
@@ -97,21 +98,25 @@ module Kafo
97
98
 
98
99
  # custom module directory name
99
100
  def get_dir_name
100
- mapping[name].nil? ? name : mapping[name][:dir_name]
101
+ mapping[identifier].nil? ? name : mapping[identifier][:dir_name]
101
102
  end
102
103
 
103
104
  # custom manifest filename without .pp extension
104
105
  def get_manifest_name
105
- mapping[name].nil? ? 'init' : mapping[name][:manifest_name]
106
+ mapping[identifier].nil? ? 'init' : mapping[identifier][:manifest_name]
106
107
  end
107
108
 
108
109
  def get_class_name
109
- manifest_name == 'init' ? name : "#{dir_name}::#{manifest_name}"
110
+ manifest_name == 'init' ? name : "#{dir_name}::#{manifest_name.gsub('_', '::')}"
110
111
  end
111
112
 
112
113
  def module_manifest_path
113
114
  "#{dir_name}/manifests/#{manifest_name}.pp"
114
115
  end
115
116
 
117
+ def get_name
118
+ identifier.gsub('::', '_')
119
+ end
120
+
116
121
  end
117
122
  end
@@ -3,8 +3,11 @@ module Kafo
3
3
  class Validator
4
4
 
5
5
  def initialize(params)
6
- files = KafoConfigure.modules_dir + '/*/lib/puppet/parser/functions/validate_*.rb'
7
- Dir.glob(files).each do |file|
6
+ validate_files = KafoConfigure.modules_dir + '/*/lib/puppet/parser/functions/validate_*.rb'
7
+ is_function_files = KafoConfigure.modules_dir + '/*/lib/puppet/parser/functions/is_*.rb'
8
+ definitions = Dir.glob(validate_files) + Dir.glob(is_function_files)
9
+
10
+ definitions.each do |file|
8
11
  require file
9
12
  end
10
13
 
data/lib/kafo/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module Kafo
3
- VERSION = "0.3.7"
3
+ VERSION = "0.3.8"
4
4
  end
@@ -9,7 +9,7 @@ module Puppet::Parser::Functions
9
9
  newfunction(:class_name, :type => :rvalue) do |args|
10
10
  mapping = YAML.load_file(lookupvar('kafo_config_file'))[:mapping]
11
11
  mod = args[0].to_sym
12
- mapping[mod].nil? ? mod : "#{mapping[mod][:dir_name]}::#{mapping[mod][:manifest_name]}"
12
+ mapping[mod].nil? ? mod : "#{mapping[mod][:dir_name]}::#{mapping[mod][:manifest_name].gsub('/', '::')}"
13
13
  end
14
14
  end
15
15
 
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.3.7
4
+ version: 0.3.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: 2014-01-14 00:00:00.000000000 Z
11
+ date: 2014-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler