kondate 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/kondate/cli.rb +40 -12
- data/lib/kondate/property_builder.rb +2 -2
- data/lib/kondate/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84fbadf47b428eeb9842d1676c064afc8f747d0c
|
4
|
+
data.tar.gz: deffef184f5a2739801fd486722a9d103a4999c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c03b7ca0525454cdb06a014cc66a315beba424eb40b9dacd97d021bdae42406ab1206418f61414d566c23116c60588d7fddef6f4cc44c2192cb579fa27bbb01
|
7
|
+
data.tar.gz: 0543bde5cf1b8a5d08906c701017655a58665e0c2a4a98fbb4aea843d3f9a6fc7f037c8180dd9351e54c50346362416db8fbfe0b3f973f65e2518256755eeada
|
data/CHANGELOG.md
CHANGED
data/lib/kondate/cli.rb
CHANGED
@@ -57,8 +57,12 @@ module Kondate
|
|
57
57
|
option :recipe_graph, :type => :string, :default => nil, :desc => "[EXPERIMENTAL] Write recipe dependency graph in DOT", :banner => "PATH"
|
58
58
|
def itamae(host)
|
59
59
|
property_files = build_property_files(host)
|
60
|
-
|
61
|
-
|
60
|
+
begin
|
61
|
+
if proceed?(property_files)
|
62
|
+
exit(-1) unless do_itamae(host, property_files)
|
63
|
+
end
|
64
|
+
ensure
|
65
|
+
clean_property_files(property_files)
|
62
66
|
end
|
63
67
|
end
|
64
68
|
|
@@ -81,11 +85,15 @@ module Kondate
|
|
81
85
|
$stdout.puts "Target hosts are [#{hosts.join(", ")}]"
|
82
86
|
|
83
87
|
property_files_of_hosts, summarized_property_files, hosts_of_roles = build_property_files_of_hosts(hosts)
|
84
|
-
|
85
|
-
|
86
|
-
|
88
|
+
begin
|
89
|
+
if proceed?(summarized_property_files, hosts_of_roles)
|
90
|
+
successes = Parallel.map(hosts, in_processes: @options[:parallel]) do |host|
|
91
|
+
do_itamae(host, property_files_of_hosts[host])
|
92
|
+
end
|
93
|
+
exit(-1) unless successes.all?
|
87
94
|
end
|
88
|
-
|
95
|
+
ensure
|
96
|
+
clean_property_files_of_hosts(property_files_of_hosts)
|
89
97
|
end
|
90
98
|
end
|
91
99
|
|
@@ -97,8 +105,12 @@ module Kondate
|
|
97
105
|
option :vagrant, :type => :boolean, :default => false
|
98
106
|
def serverspec(host)
|
99
107
|
property_files = build_property_files(host)
|
100
|
-
|
101
|
-
|
108
|
+
begin
|
109
|
+
if proceed?(property_files)
|
110
|
+
exit(-1) unless do_serverspec(host, property_files)
|
111
|
+
end
|
112
|
+
ensure
|
113
|
+
clean_property_files(property_files)
|
102
114
|
end
|
103
115
|
end
|
104
116
|
|
@@ -119,11 +131,15 @@ module Kondate
|
|
119
131
|
$stdout.puts "Target hosts are [#{hosts.join(", ")}]"
|
120
132
|
|
121
133
|
property_files_of_hosts, summarized_property_files, hosts_of_roles = build_property_files_of_hosts(hosts)
|
122
|
-
|
123
|
-
|
124
|
-
|
134
|
+
begin
|
135
|
+
if proceed?(summarized_property_files, hosts_of_roles)
|
136
|
+
successes = Parallel.map(hosts, in_processes: @options[:parallel]) do |host|
|
137
|
+
do_serverspec(host, property_files_of_hosts[host])
|
138
|
+
end
|
139
|
+
exit(-1) unless successes.all?
|
125
140
|
end
|
126
|
-
|
141
|
+
ensure
|
142
|
+
clean_property_files_of_hosts(property_files_of_hosts)
|
127
143
|
end
|
128
144
|
end
|
129
145
|
|
@@ -217,6 +233,18 @@ module Kondate
|
|
217
233
|
end
|
218
234
|
end
|
219
235
|
|
236
|
+
def clean_property_files(property_files)
|
237
|
+
property_files.values.each do |file|
|
238
|
+
File.unlink(file) rescue nil
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
def clean_property_files_of_hosts(property_files_of_hosts)
|
243
|
+
property_files_of_hosts.values.each do |property_files|
|
244
|
+
clean_property_files(property_files)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
220
248
|
# @return [Hash] key value pairs whoses keys are roles and values are path (or nil)
|
221
249
|
def build_property_files(host)
|
222
250
|
builder = PropertyBuilder.new(host)
|
@@ -136,10 +136,10 @@ module Kondate
|
|
136
136
|
if property['attributes'].empty?
|
137
137
|
nil
|
138
138
|
else
|
139
|
-
fp = Tempfile.
|
139
|
+
fp = Tempfile.create("kondate_")
|
140
140
|
YAML.dump(property, fp)
|
141
141
|
fp.close
|
142
|
-
fp.path
|
142
|
+
fp.path
|
143
143
|
end
|
144
144
|
end
|
145
145
|
end
|
data/lib/kondate/version.rb
CHANGED