kitchen-ansible 0.0.28 → 0.0.29

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: 223abb6eceecdfa8a197428c4039c950c0e99ad8
4
- data.tar.gz: 987c669a9bff598a0cec647eb08d81fe99042282
3
+ metadata.gz: 16cd84940415191d57d17430e877342b974a919f
4
+ data.tar.gz: c56bd4480019bc10db011459f1229b410bce82b1
5
5
  SHA512:
6
- metadata.gz: c5ce4e7d6dbcecbe5c5e144fcf8b0b53c79aacdddc0565b3817d6c6374651240046531b207dade245debef173fc7b21ae1395672d3af54010bfe40d8c188626e
7
- data.tar.gz: 3ee1cb4eef68554143bd32d5078f613f8f87fefddf829103d595db6e2bf302b93ca1bf4c9e4b2ea67661df8902dfef62ef35ba6b01b00052d7cb60ebd8f57206
6
+ metadata.gz: 4a8cd1f6e9d872899dde75f0dcfdff9a576ff9e8e58723144438c91e7b1f8eaaf9771d598b7a7e0b2f07c23b423ceed3e34d9e52f20340bf69b411f0d5aac338
7
+ data.tar.gz: 6a0a2e618696b3bb68d27983d77d6d75536418e0d585053848b9f24c7db957c5560d2ebffb92cca4ce0e9bd27834970404455457319f6e078d0c9a66d6b22f44
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Ansible
3
- VERSION = "0.0.28"
3
+ VERSION = "0.0.29"
4
4
  end
5
5
  end
@@ -289,6 +289,10 @@ module Kitchen
289
289
  if http_proxy
290
290
  cmd = "HTTP_PROXY=#{http_proxy} #{cmd}"
291
291
  end
292
+ if ansible_roles_path
293
+ cmd = "ANSIBLE_ROLES_PATH=#{ansible_roles_path} #{cmd}"
294
+ end
295
+
292
296
  result = [
293
297
  cmd,
294
298
  ansible_inventory_flag,
@@ -666,6 +670,21 @@ module Kitchen
666
670
  cmd
667
671
  end
668
672
 
673
+ def ansible_roles_path
674
+ roles_paths = []
675
+ roles_paths << File.join(config[:root_path], 'roles') unless config[:roles_path].nil?
676
+ additional_files.each do |additional_file|
677
+ roles_paths << File.join(config[:root_path], File.basename(additional_file))
678
+ end
679
+ if roles_paths.empty?
680
+ info('No roles have been set.')
681
+ nil
682
+ else
683
+ debug("Setting roles_path inside VM to #{ roles_paths.join(':') }")
684
+ roles_paths.join(':')
685
+ end
686
+ end
687
+
669
688
  def prepare_roles
670
689
  info('Preparing roles')
671
690
  debug("Using roles from #{roles}")
@@ -683,27 +702,17 @@ module Kitchen
683
702
  FileUtils.cp_r(Dir.glob("#{roles}/*"), File.join(tmp_roles_dir, role_name))
684
703
  end
685
704
 
686
- # /etc/ansible/ansible.cfg should contain
687
- # roles_path = /tmp/kitchen/roles
705
+ # copy ansible.cfg if found in root of repo
688
706
  def prepare_ansible_cfg
689
707
  info('Preparing ansible.cfg file')
690
708
  ansible_config_file = "#{File.join(sandbox_path, 'ansible.cfg')}"
691
-
692
- roles_paths = []
693
- roles_paths << File.join(config[:root_path], 'roles') unless config[:roles_path].nil?
694
- additional_files.each do |additional_file|
695
- roles_paths << File.join(config[:root_path], File.basename(additional_file))
696
- end
697
-
698
- if roles_paths.empty?
699
- info('No roles have been set. empty ansible.cfg generated')
700
- File.open(ansible_config_file, "wb") do |file|
701
- file.write("#no roles path specified\n")
702
- end
709
+ if File.exist?('ansible.cfg')
710
+ info("Found existing ansible.cfg")
711
+ FileUtils.cp_r('ansible.cfg', ansible_config_file)
703
712
  else
704
- debug("Setting roles_path inside VM to #{ roles_paths.join(':') }")
705
- File.open( ansible_config_file, "wb") do |file|
706
- file.write("[defaults]\nroles_path = #{ roles_paths.join(':') }\n")
713
+ info('Empty ansible.cfg generated')
714
+ File.open(ansible_config_file, "wb") do |file|
715
+ file.write("#no config parameters\n")
707
716
  end
708
717
  end
709
718
  end
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.0.28
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neill Turner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-20 00:00:00.000000000 Z
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen