kitchen-ansible 0.48.5 → 0.48.6

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: 8ae64a9bf60c79cd925b28a1feeaab6b9e157aaa
4
- data.tar.gz: 519f333100157d297faea9d93cb755dfd941ff7a
3
+ metadata.gz: 2aacf7ab5b66aab2f5605e8dd601fed542f3331c
4
+ data.tar.gz: 0c65375cbe9d589d27be5aa0e62bb9bfd0b3dab1
5
5
  SHA512:
6
- metadata.gz: b26ed031d8e00da5ce1bf347987e638a15bab942e848b350be59478c6d3d838147424187315331bca4415a3713845c11ab0a32c2ae221126eb3c7b85e89b1415
7
- data.tar.gz: 7de899411d95bb8aec8cac0025a02a0c2ba0bdd3ba04278d98eaca21b9b4370c9d7948bfdf0dc8dce3f120ede9d82cf5af6e5aaffb72441e481fdf80cf4e9ceb
6
+ metadata.gz: ea700d4d1670ef5f7f1ce80712ea99e3951eade045a393aa8966efc68cab5bda0ad1d384606d2b5ea188cfa5fcb5cc8ef92820e62e539ec78f08c3322c533f94
7
+ data.tar.gz: ab1ca6713358784aed798462f2c6acf6937c587a465d97ba4e549d2d01bd5b9b468219b8fa80c70eca2d62a4760f10725fc889d19d085e6f5456152caa3fd9e3
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module Kitchen
3
3
  module Ansible
4
- VERSION = '0.48.5'.freeze
4
+ VERSION = '0.48.6'.freeze
5
5
  end
6
6
  end
@@ -73,6 +73,8 @@ module Kitchen
73
73
  default_config :ansible_playbook_command, nil
74
74
  default_config :ansible_host_key_checking, true
75
75
  default_config :idempotency_test, nil
76
+ default_config :idempotency_tags, []
77
+ default_config :idempotency_skip_tags, []
76
78
  default_config :ansible_inventory, nil
77
79
  default_config :ansible_inventory_file, nil
78
80
  default_config :ansible_limit, nil
@@ -401,25 +401,29 @@ module Kitchen
401
401
  cmd = "#{cd_ansible} #{cmd}" if !config[:ansible_sudo].nil? && !config[:ansible_sudo]
402
402
  cmd = "#{copy_private_key_cmd} #{cmd}" if config[:private_key]
403
403
 
404
- result = [
405
- cmd,
406
- ansible_inventory_flag,
407
- ansible_limit_flag,
408
- ansible_connection_flag,
409
- "-M #{File.join(config[:root_path], 'modules')}",
410
- ansible_verbose_flag,
411
- ansible_check_flag,
412
- ansible_diff_flag,
413
- ansible_vault_flag,
414
- private_key,
415
- extra_vars,
416
- extra_vars_file,
417
- tags,
418
- ansible_extra_flags,
419
- "#{File.join(config[:root_path], File.basename(config[:playbook]))}"
420
- ].join(' ')
404
+ def _run(cmd, idempotence = false)
405
+ [
406
+ cmd,
407
+ ansible_inventory_flag,
408
+ ansible_limit_flag,
409
+ ansible_connection_flag,
410
+ "-M #{File.join(config[:root_path], 'modules')}",
411
+ ansible_verbose_flag,
412
+ ansible_check_flag,
413
+ ansible_diff_flag,
414
+ ansible_vault_flag,
415
+ private_key,
416
+ extra_vars,
417
+ extra_vars_file,
418
+ tags(idempotence),
419
+ ansible_extra_flags,
420
+ "#{File.join(config[:root_path], File.basename(config[:playbook]))}"
421
+ ].join(' ')
422
+ end
423
+ result = _run(cmd)
421
424
  if config[:idempotency_test]
422
- result = "#{result} && (echo 'Going to invoke ansible-playbook second time:'; #{result} | tee /tmp/idempotency_test.txt; if grep -qE 'changed=[1-9].*failed=|changed=.*failed=[1-9]' /tmp/idempotency_test.txt; then echo 'Idempotence test: FAIL' && exit 1; else echo 'Idempotence test: PASS' && exit 0; fi)"
425
+ idempotency_result = _run(cmd, true)
426
+ result = "#{result} && (echo 'Going to invoke ansible-playbook second time:'; #{idempotency_result} | tee /tmp/idempotency_test.txt; if grep -qE 'changed=[1-9].*failed=|changed=.*failed=[1-9]' /tmp/idempotency_test.txt; then echo 'Idempotence test: FAIL' && exit 1; else echo 'Idempotence test: PASS' && exit 0; fi)"
423
427
  end
424
428
  if config[:custom_post_play_command]
425
429
  custom_post_play_trap = <<-TRAP
@@ -824,14 +828,24 @@ module Kitchen
824
828
  bash_extra_vars
825
829
  end
826
830
 
827
- def tags
831
+ def tags(idempotence = false)
828
832
  bash_tags = config.key?(:attributes) && config[:attributes].key?(:tags) && config[:attributes][:tags].is_a?(Array) ? config[:attributes][:tags] : config[:tags]
829
- return nil if bash_tags.empty?
833
+ bash_skip_tags = []
834
+ if idempotence and config[:idempotency_test]
835
+ bash_tags += config[:idempotency_tags]
836
+ bash_skip_tags += config[:idempotency_skip_tags]
837
+ end
838
+ return nil if (bash_tags.empty? and bash_skip_tags.empty?)
830
839
 
831
- bash_tags = bash_tags.join(',')
832
- bash_tags = "-t '#{bash_tags}'"
833
- debug(bash_tags)
834
- bash_tags
840
+ result = ''
841
+ if not bash_tags.empty?
842
+ result += " --tags=#{bash_tags.join(',')}"
843
+ end
844
+ if not bash_skip_tags.empty?
845
+ result += " --skip-tags=#{bash_skip_tags.join(',')}"
846
+ end
847
+ debug(result)
848
+ result
835
849
  end
836
850
 
837
851
  def chef_url
@@ -73,6 +73,8 @@ hosts | | Create Ansible hosts file for localhost with this server group or lis
73
73
  http_proxy | nil | Use HTTP proxy when installing Ansible, packages and running Ansible
74
74
  https_proxy | nil | Use HTTPS proxy when installing Ansible, packages and running Ansible
75
75
  idempotency_test | false | Enable to test Ansible playbook idempotency
76
+ idempotency_tags | [] | Adds a `--tags` parameter with the specified tags to the second invocation of `ansible-playbook` when `idempotency_test` is set to `true`
77
+ idempotency_skip_tags | [] | Adds a `--skip-tags` parameter with the specified tags to the second invocation of `ansible-playbook` when `idempotency_test` is set to `true`
76
78
  ignore_extensions_from_root | ['.pyc'] | allow extensions to be ignored when copying from roles using additional_copy_role_path or doing recursive_additional_copy_path
77
79
  ignore_paths_from_root | [] | allow extra paths to be ignored when copying from roles using additional_copy_role_path or using recursive_additional_copy_path
78
80
  kerberos_conf_file | | Path of krb5.conf file using in Windows support
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.48.5
4
+ version: 0.48.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neill Turner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-31 00:00:00.000000000 Z
11
+ date: 2018-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec