kafo 0.3.16 → 0.3.17
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 426538f59aa0198c703fa2aef6172b06e3297bf9
|
4
|
+
data.tar.gz: ca884204fb99cac059c8aaa41d6a6f4baadcfa40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d474f25575e38ceedbe7726450168bad1225737fe32d22a5c58ce15f39cef8d1bde03899e7f3a556b915defbfb5632094b800c25d27b9e06cf56a5e47ef2f55
|
7
|
+
data.tar.gz: d1e54d17cfb71fa7493ce77ea1aff6b5d544895daf8573141da6ea205ef6a5b339abc05ce1b703fcf830bc96e0cf0fcc9e785d12d522bc02c69fa13399407c98
|
data/lib/kafo/configuration.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require 'yaml'
|
3
|
+
require 'tmpdir'
|
3
4
|
require 'kafo/puppet_module'
|
4
5
|
require 'kafo/password_manager'
|
5
6
|
|
@@ -74,8 +75,11 @@ module Kafo
|
|
74
75
|
|
75
76
|
def params_default_values
|
76
77
|
@params_default_values ||= begin
|
78
|
+
@logger.debug "Creating tmp dir within #{app[:default_values_dir]}..."
|
79
|
+
temp_dir = Dir.mktmpdir(nil, app[:default_values_dir])
|
80
|
+
KafoConfigure.register_cleanup_path temp_dir
|
77
81
|
@logger.info "Parsing default values from puppet modules..."
|
78
|
-
command = PuppetCommand.new("#{includes} dump_values(#{params})").append('2>&1').command
|
82
|
+
command = PuppetCommand.new("$temp_dir=\"#{temp_dir}\" #{includes} dump_values(#{params})").append('2>&1').command
|
79
83
|
@logger.debug `#{command}`
|
80
84
|
unless $?.exitstatus == 0
|
81
85
|
log = app[:log_dir] + '/' + app[:log_name]
|
@@ -84,7 +88,7 @@ module Kafo
|
|
84
88
|
KafoConfigure.exit(:defaults_error)
|
85
89
|
end
|
86
90
|
@logger.info "... finished"
|
87
|
-
YAML.load_file(File.join(
|
91
|
+
YAML.load_file(File.join(temp_dir, 'default_values.yaml'))
|
88
92
|
end
|
89
93
|
end
|
90
94
|
|
data/lib/kafo/kafo_configure.rb
CHANGED
@@ -17,12 +17,15 @@ module Kafo
|
|
17
17
|
class KafoConfigure < Clamp::Command
|
18
18
|
include StringHelper
|
19
19
|
|
20
|
-
|
21
20
|
class << self
|
22
21
|
attr_accessor :config, :root_dir, :config_file, :gem_root, :temp_config_file,
|
23
22
|
:modules_dir, :kafo_modules_dir, :verbose, :app_options, :logger
|
24
23
|
attr_writer :hooking
|
25
24
|
|
25
|
+
def cleanup_paths
|
26
|
+
@cleanup_paths ||= []
|
27
|
+
end
|
28
|
+
|
26
29
|
def hooking
|
27
30
|
@hooking ||= Hooking.new
|
28
31
|
end
|
@@ -105,6 +108,7 @@ module Kafo
|
|
105
108
|
end
|
106
109
|
|
107
110
|
def self.exit(code)
|
111
|
+
cleanup
|
108
112
|
@exit_code = translate_exit_code(code)
|
109
113
|
throw :exit
|
110
114
|
end
|
@@ -128,6 +132,26 @@ module Kafo
|
|
128
132
|
end
|
129
133
|
end
|
130
134
|
|
135
|
+
def self.cleanup
|
136
|
+
# make sure default values are removed from /tmp
|
137
|
+
(self.cleanup_paths + ['/tmp/default_values.yaml']).each do |file|
|
138
|
+
logger.debug "Cleaning #{file}"
|
139
|
+
FileUtils.rm_rf(file)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def self.register_cleanup_path(path)
|
144
|
+
self.cleanup_paths<< path
|
145
|
+
end
|
146
|
+
|
147
|
+
def register_cleanup_path(path)
|
148
|
+
self.class.register_cleanup_path(path)
|
149
|
+
end
|
150
|
+
|
151
|
+
def cleanup_paths
|
152
|
+
self.class.cleanup_paths
|
153
|
+
end
|
154
|
+
|
131
155
|
def help
|
132
156
|
self.class.help(invocation_path, self)
|
133
157
|
end
|
data/lib/kafo/version.rb
CHANGED
@@ -9,7 +9,10 @@ module Puppet::Parser::Functions
|
|
9
9
|
[arg, found_value.nil? ? arg : found_value]
|
10
10
|
end
|
11
11
|
data = Hash[data]
|
12
|
-
|
13
|
-
|
12
|
+
|
13
|
+
dump_dir = lookupvar('temp_dir')
|
14
|
+
file_name = "#{dump_dir}/default_values.yaml"
|
15
|
+
|
16
|
+
File.open(file_name, File::WRONLY|File::CREAT|File::EXCL, 0600) { |file| file.write(YAML.dump(data)) }
|
14
17
|
end
|
15
18
|
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.3.
|
4
|
+
version: 0.3.17
|
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-
|
11
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|