kitchen-ansiblepush 0.5.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7b7a7c54d6db3032fafdec0df791c8c5218917b
4
- data.tar.gz: 06cd24f0c08c3960d6b718ae92e2baa52b816efe
3
+ metadata.gz: e3cbe198c6b5c78f2bc9fc8539e3e5c37ebc3c6c
4
+ data.tar.gz: 633e2fd2ff220a952d7eaae9f4861a5269e3cd21
5
5
  SHA512:
6
- metadata.gz: f27af40952e7f1a8e6a284972c92e211e3795de71167e94a6c68d0eb599cfac822b21cfb24cf2236e9ba6210516a3d8522279dd5dc08192d11bcb3ec1b446122
7
- data.tar.gz: 7d1186dcd96c12611a20f91e62c7a96454c462d37d817cd4c849ff053db4ec3ee4b9c490d763a6843d15397f4d2b317bd14d68670da65be02175e061e9b83bf3
6
+ metadata.gz: 909021bd352a2ffdc6701c2dda863a8cc73f231aaec9383c493cf5e106ea962879c1b7f803a9d3bfcf448f5aa4a58315113e09f618adf691cd92c1660e9aa519
7
+ data.tar.gz: 8185394ce8433fc72d60a4581814946e708a08e12a1e7697accd3a63a830b25a5e76abb811a4feadd00afd37ed14c3bfa0e471fd66403a2db5a54854dc1ce7e3
@@ -41,7 +41,7 @@ module Kitchen
41
41
  default_config :idempotency_test, false
42
42
  default_config :fail_non_idempotent, true
43
43
  default_config :use_instance_name, false
44
- default_config :ansible_connection, "smart"
44
+ default_config :ansible_connection, 'smart'
45
45
 
46
46
  # For tests disable if not needed
47
47
  default_config :chef_bootstrap_url, 'https://omnitruck.chef.io/install.sh'
@@ -61,8 +61,8 @@ module Kitchen
61
61
 
62
62
  # Validate that extra_vars is either a hash, or a path to an existing file
63
63
  if config[:extra_vars]
64
- extra_vars_is_valid = config[:extra_vars].kind_of?(Hash) || config[:extra_vars].kind_of?(String)
65
- if config[:extra_vars].kind_of?(String)
64
+ extra_vars_is_valid = config[:extra_vars].is_a?(Hash) || config[:extra_vars].is_a?(String)
65
+ if config[:extra_vars].is_a?(String)
66
66
  # Accept the usage of '@' (e.g. '@vars.yml' and 'vars.yml' are both supported)
67
67
  match_data = /^@?(.+)$/.match(config[:extra_vars])
68
68
  extra_vars_path = match_data[1].to_s
@@ -108,11 +108,11 @@ module Kitchen
108
108
  options << "--inventory-file=#{conf[:generate_inv_path]}" if conf[:generate_inv]
109
109
 
110
110
  # By default we limit by the current machine,
111
- if conf[:limit]
112
- options << "--limit=#{as_list_argument(conf[:limit])}"
113
- else
114
- options << "--limit=#{machine_name}"
115
- end
111
+ options << if conf[:limit]
112
+ "--limit=#{as_list_argument(conf[:limit])}"
113
+ else
114
+ "--limit=#{machine_name}"
115
+ end
116
116
 
117
117
  # Add raw argument as final thing
118
118
  options << conf[:raw_arguments] if conf[:raw_arguments]
@@ -144,14 +144,14 @@ module Kitchen
144
144
  true_command
145
145
  end
146
146
 
147
- def true_command
148
- # Place holder so a string is returned. This will execute true on remote host
149
- if conf[:ansible_connection] == "winrm"
147
+ def true_command
148
+ # Place holder so a string is returned. This will execute true on remote host
149
+ if conf[:ansible_connection] == 'winrm'
150
150
  '$TRUE'
151
- else
151
+ else
152
152
  'true'
153
- end
154
- end
153
+ end
154
+ end
155
155
 
156
156
  def install_command
157
157
  # Must install chef for busser and serverspec to work :(
@@ -169,7 +169,6 @@ module Kitchen
169
169
  end
170
170
 
171
171
  def chef_installation(chef_url, omnibus_download_dir, transport)
172
-
173
172
  if chef_url && (chef_url != 'nil') # ignore string nil
174
173
  scripts = []
175
174
  scripts << Util.shell_helpers
@@ -225,7 +224,7 @@ module Kitchen
225
224
  def exec_ansible_command(env, command, desc)
226
225
  debug('env=%s command=%s' % [env, command])
227
226
  system(env, command.to_s)
228
- exit_code = $?.exitstatus
227
+ exit_code = $CHILD_STATUS.exitstatus
229
228
  debug("ansible-playbook exit code = #{exit_code}")
230
229
  if exit_code.to_i != 0
231
230
  raise '%s returned a non zero \'%s\'. Please see the output above.' % [desc, exit_code.to_s]
@@ -241,12 +240,12 @@ module Kitchen
241
240
 
242
241
  def prepare_inventory
243
242
  if instance_connection_option.nil?
244
- hostname = machine_name
245
- elsif not instance_connection_option()[:hostname].nil?
246
- instance_connection_option()[:hostname]
247
- elsif not instance_connection_option()[:endpoint].nil?
243
+ hostname = machine_name
244
+ elsif !instance_connection_option[:hostname].nil?
245
+ hostname = instance_connection_option[:hostname]
246
+ elsif !instance_connection_option[:endpoint].nil?
248
247
  require 'uri'
249
- urlhost = URI.parse(instance_connection_option()[:endpoint])
248
+ urlhost = URI.parse(instance_connection_option[:endpoint])
250
249
  hostname = urlhost.host
251
250
  end
252
251
  debug("hostname='#{hostname}")
@@ -258,7 +257,7 @@ module Kitchen
258
257
  end
259
258
 
260
259
  def extra_vars_argument
261
- if conf[:extra_vars].kind_of?(String) && conf[:extra_vars] =~ /^@.+$/
260
+ if conf[:extra_vars].is_a?(String) && conf[:extra_vars] =~ /^@.+$/
262
261
  # A JSON or YAML file is referenced (requires Ansible 1.3+)
263
262
  conf[:extra_vars]
264
263
  else
@@ -280,7 +279,7 @@ module Kitchen
280
279
  end
281
280
 
282
281
  def as_list_argument(v)
283
- v.kind_of?(Array) ? v.join(',') : v
282
+ v.is_a?(Array) ? v.join(',') : v
284
283
  end
285
284
 
286
285
  def verbosity_argument
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module AnsiblePush
3
- VERSION = '0.5.0'.freeze
3
+ VERSION = '0.5.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-ansiblepush
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adham Helal