ansible_spec 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/ansible_spec/load_ansible.rb +1 -1
- data/lib/ansible_spec/version.rb +1 -1
- data/spec/case/get_variable/empty_group/group_vars/group_a.yml +2 -0
- data/spec/case/get_variable/empty_group/group_vars/group_b.yml +2 -0
- data/spec/case/get_variable/empty_group/hosts +3 -0
- data/spec/case/get_variable/empty_group/site.yml +9 -0
- data/spec/get_variable_spec.rb +39 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d77ce9fa38453ab6f652cc6c20a79509c722d615790cb49b59ec8e37154aad7b
|
4
|
+
data.tar.gz: 27384622e2d91ad928ee5b37fa061efa3b80af5baad5b887823ec3df7e83dded
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2591637e35a8fa5fe8f2add17e24d5f32844030d9fd1f268ec4a0e607bb4f2500ef8a75c166c337d20c8e97c8db979dc1bdf317f64f5f93095493699bef37665
|
7
|
+
data.tar.gz: e1124d4328dc3430545f94a87306fc9148f3b91bc5074d84180edac293966115b15794e5ecd142335a2c972415143f7893bf6516d951bfb4b4ffd1f2855d561d
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# v0.3.2
|
2
|
+
- Merge [#135 Fix wrong index by empty group](https://github.com/volanja/ansible_spec/pull/135) by [mamiya312](https://github.com/mamiya312)
|
3
|
+
|
1
4
|
# v0.3.1
|
2
5
|
- Fix [#126 no implicit conversion of nil into Array Error when process get_parent](https://github.com/volanja/ansible_spec/issues/126) by [shogos3](https://github.com/shogos3)
|
3
6
|
|
@@ -516,7 +516,7 @@ module AnsibleSpec
|
|
516
516
|
|
517
517
|
def self.get_variables(host, group_idx, hosts=nil)
|
518
518
|
vars = {}
|
519
|
-
p = self.get_properties
|
519
|
+
p = self.get_properties.compact.reject{|e| e["hosts"].length == 0}
|
520
520
|
|
521
521
|
# roles default
|
522
522
|
p[group_idx]['roles'].each do |role|
|
data/lib/ansible_spec/version.rb
CHANGED
data/spec/get_variable_spec.rb
CHANGED
@@ -362,6 +362,45 @@ describe "get_variablesの実行" do
|
|
362
362
|
end
|
363
363
|
end
|
364
364
|
|
365
|
+
# Fixed a problem that there is a gap between Index passed from Rakefile when empty group exists. by #135
|
366
|
+
# cat hosts
|
367
|
+
# [group_a] #no host
|
368
|
+
# [group_b]
|
369
|
+
# localhost.localdomain ansible_ssh_private_key_file=~/.ssh/id_rsa
|
370
|
+
|
371
|
+
context 'Correct operation : empty group PR #135 ' do
|
372
|
+
before do
|
373
|
+
@current_dir = Dir.pwd()
|
374
|
+
Dir.chdir('spec/case/get_variable/empty_group')
|
375
|
+
ENV["PLAYBOOK"] = 'site.yml'
|
376
|
+
ENV["INVENTORY"] = 'hosts'
|
377
|
+
ENV["VARS_DIRS_PATH"] = ''
|
378
|
+
@res = AnsibleSpec.get_variables("localhost.localdomain", 0)
|
379
|
+
end
|
380
|
+
|
381
|
+
it 'res is hash' do
|
382
|
+
expect(@res.instance_of?(Hash)).to be_truthy
|
383
|
+
end
|
384
|
+
|
385
|
+
it 'exist 1 pair in Hash' do
|
386
|
+
expect(@res.length).to eq 1
|
387
|
+
end
|
388
|
+
|
389
|
+
it 'get correct variable' do
|
390
|
+
expect(@res).to eq("group_b_var" => "fuga")
|
391
|
+
end
|
392
|
+
|
393
|
+
it 'not get incorrect variables' do
|
394
|
+
expect(@res).not_to eq("group_a_var" => "hoge")
|
395
|
+
end
|
396
|
+
|
397
|
+
after do
|
398
|
+
ENV.delete('PLAYBOOK')
|
399
|
+
ENV.delete('INVENTORY')
|
400
|
+
ENV.delete('VARS_DIRS_PATH')
|
401
|
+
Dir.chdir(@current_dir)
|
402
|
+
end
|
403
|
+
end
|
365
404
|
end
|
366
405
|
|
367
406
|
describe "get_hash_behaviourの実行" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ansible_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- volanja
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -190,6 +190,10 @@ files:
|
|
190
190
|
- spec/case/get_variable/deep_merge/hosts
|
191
191
|
- spec/case/get_variable/deep_merge/roles/test/defaults/main.yml
|
192
192
|
- spec/case/get_variable/deep_merge/site.yml
|
193
|
+
- spec/case/get_variable/empty_group/group_vars/group_a.yml
|
194
|
+
- spec/case/get_variable/empty_group/group_vars/group_b.yml
|
195
|
+
- spec/case/get_variable/empty_group/hosts
|
196
|
+
- spec/case/get_variable/empty_group/site.yml
|
193
197
|
- spec/case/get_variable/group_all/group_vars/all.yml
|
194
198
|
- spec/case/get_variable/group_all/hosts
|
195
199
|
- spec/case/get_variable/group_all/roles/test/defaults/main.yml
|
@@ -379,6 +383,10 @@ test_files:
|
|
379
383
|
- spec/case/get_variable/deep_merge/hosts
|
380
384
|
- spec/case/get_variable/deep_merge/roles/test/defaults/main.yml
|
381
385
|
- spec/case/get_variable/deep_merge/site.yml
|
386
|
+
- spec/case/get_variable/empty_group/group_vars/group_a.yml
|
387
|
+
- spec/case/get_variable/empty_group/group_vars/group_b.yml
|
388
|
+
- spec/case/get_variable/empty_group/hosts
|
389
|
+
- spec/case/get_variable/empty_group/site.yml
|
382
390
|
- spec/case/get_variable/group_all/group_vars/all.yml
|
383
391
|
- spec/case/get_variable/group_all/hosts
|
384
392
|
- spec/case/get_variable/group_all/roles/test/defaults/main.yml
|