qb 0.1.22 → 0.1.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/exe/qb +17 -1
  3. data/lib/qb/options.rb +12 -6
  4. data/lib/qb/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: edfdd80c095e4ab8bb69552dc2657d0f684dcda5
4
- data.tar.gz: 12bcfa8f876ffdc439a652ebde87f0a8ed817df6
3
+ metadata.gz: 30b0e75719390dfd0ee97d04dee5d35f94ba7c2b
4
+ data.tar.gz: 4fe81370e5657c73552b159c025ca61aca44adc5
5
5
  SHA512:
6
- metadata.gz: f1f671dfa6971a2a13dcf51772b0dd426babe6948dcd84d7b6920e6a581dc70058ee3cf1984e4c4f65029afbabc599515893325b0bc9ccc8cf23125615bc695f
7
- data.tar.gz: 50c90d54f4f5433d91edbd762d0bb9b835e67d4f599cba565b17ce4e1c6bbd30eaec85215d614069f4c63b879b1eada0b8c11e9ebde3b997acf792f279d32112
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! template.join(" "),
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
- "default --#{ option.cli_name }"
229
+ "DEFAULT: --#{ option.cli_name }"
224
230
  else
225
- "default --no-#{ option.cli_name }"
231
+ "DEFAULT: --no-#{ option.cli_name }"
226
232
  end
227
233
  else
228
- "default = #{ role.defaults[option.var_name] }"
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
- "default: localhost"
272
+ "DEFAULT: localhost"
267
273
  ) do |value|
268
274
  qb_options['hosts'] = value
269
275
  end
data/lib/qb/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module QB
2
2
  GEM_NAME = 'qb'
3
3
 
4
- VERSION = "0.1.22"
4
+ VERSION = "0.1.23"
5
5
 
6
6
  def self.gemspec
7
7
  Gem.loaded_specs[GEM_NAME]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.22
4
+ version: 0.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser