qb 0.1.22 → 0.1.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/qb +17 -1
- data/lib/qb/options.rb +12 -6
- data/lib/qb/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: 30b0e75719390dfd0ee97d04dee5d35f94ba7c2b
|
4
|
+
data.tar.gz: 4fe81370e5657c73552b159c025ca61aca44adc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b6633ad2e732a83ca29707080ce328af5fa617b00bd1261a5bb0fdaf689e0442a5305b1ba0bf9a4a3acfcf929910af8d087611f9c03863e5c7c5865f01a9a40
|
7
|
+
data.tar.gz: 70985650858f352883521cee66af25b194ec9d48b264b34ca04e9e3015dad60f62ab1b4db8ff9062814467a031850a6f9b9376590aa6a9ed747dbe3f36c09a04
|
data/exe/qb
CHANGED
@@ -177,6 +177,16 @@ def main args
|
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
180
|
+
# check that required options are present
|
181
|
+
missing = options.values.select {|option|
|
182
|
+
option.required? && option.value.nil?
|
183
|
+
}
|
184
|
+
|
185
|
+
unless missing.empty?
|
186
|
+
puts "ERROR: options #{ missing.map {|o| o.cli_name } } are required."
|
187
|
+
exit 1
|
188
|
+
end
|
189
|
+
|
180
190
|
set_options = options.select {|k, o| !o.value.nil?}
|
181
191
|
|
182
192
|
debug "set options", set_options
|
@@ -282,10 +292,16 @@ def main args
|
|
282
292
|
end
|
283
293
|
template << "<%= playbook_path %>"
|
284
294
|
|
285
|
-
Cmds.stream
|
295
|
+
status = Cmds.stream template.join(" "),
|
286
296
|
roles_path: ansible_roles_path,
|
287
297
|
playbook_path: playbook_path.to_s,
|
288
298
|
hosts: "#{ play['hosts'].join(',') },"
|
299
|
+
|
300
|
+
if status != 0
|
301
|
+
puts "ERROR ansible-playbook failed."
|
302
|
+
end
|
303
|
+
|
304
|
+
exit status
|
289
305
|
end
|
290
306
|
end
|
291
307
|
end
|
data/lib/qb/options.rb
CHANGED
@@ -175,10 +175,12 @@ module QB
|
|
175
175
|
when nil
|
176
176
|
raise MetadataError,
|
177
177
|
"must provide type in qb metadata for option #{ option.meta_name }"
|
178
|
-
when 'string'
|
178
|
+
when 'string', 'str'
|
179
179
|
String
|
180
|
-
when 'array'
|
180
|
+
when 'array', 'list'
|
181
181
|
Array
|
182
|
+
when 'integer', 'int'
|
183
|
+
Integer
|
182
184
|
when Hash
|
183
185
|
if option.meta['type'].key? 'one_of'
|
184
186
|
klass = Class.new
|
@@ -217,15 +219,19 @@ module QB
|
|
217
219
|
|
218
220
|
on_args << option.description
|
219
221
|
|
222
|
+
if option.required?
|
223
|
+
on_args << "REQUIRED."
|
224
|
+
end
|
225
|
+
|
220
226
|
if role.defaults.key? option.var_name
|
221
227
|
on_args << if option.meta['type'] == 'boolean'
|
222
228
|
if role.defaults[option.var_name]
|
223
|
-
"
|
229
|
+
"DEFAULT: --#{ option.cli_name }"
|
224
230
|
else
|
225
|
-
"
|
231
|
+
"DEFAULT: --no-#{ option.cli_name }"
|
226
232
|
end
|
227
233
|
else
|
228
|
-
"
|
234
|
+
"DEFAULT: #{ role.defaults[option.var_name] }"
|
229
235
|
end
|
230
236
|
end
|
231
237
|
|
@@ -263,7 +269,7 @@ module QB
|
|
263
269
|
'---hosts=HOSTS',
|
264
270
|
Array,
|
265
271
|
"set playbook host",
|
266
|
-
"
|
272
|
+
"DEFAULT: localhost"
|
267
273
|
) do |value|
|
268
274
|
qb_options['hosts'] = value
|
269
275
|
end
|
data/lib/qb/version.rb
CHANGED