ansible_spec 0.2.8 → 0.2.9
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/ansible_spec/load_ansible.rb +2 -2
- data/lib/ansible_spec/version.rb +1 -1
- data/lib/src/.ansiblespec +2 -2
- data/spec/load_ansible_spec.rb +50 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d457c5cbf7de2872b6567b14f4743c967a05f9f3
|
4
|
+
data.tar.gz: 9a4af4588ffd83f2249fbba3ee13f69f250ad012
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2351376f83753be73282de06c2af2f2b7a821cc221fbc86a3b9f29fbf5b571dfe75b8f8a0e6a0d3cc8fe82439bfff0936b4ded73e3d9f95eb8450206b6267225
|
7
|
+
data.tar.gz: 5162d04115f849d6b9a04431eccfbc837ea16d5fbf3ea8b572f045105fd0bf9c90d312735f65eb50eb30085fe5d0f59389b349411767429c924dda859db29b34
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# v0.2.9
|
2
|
+
- Merge [#65 return an empty array when the group has no hosts in it](https://github.com/volanja/ansible_spec/pull/65) by [franmrl](https://github.com/franmrl)
|
3
|
+
|
1
4
|
# v0.2.8
|
2
5
|
- Merge [#60 Support ansible variable in playbook partially](https://github.com/volanja/ansible_spec/pull/60) by [okamototk](https://github.com/okamototk)
|
3
6
|
|
@@ -273,8 +273,7 @@ module AnsibleSpec
|
|
273
273
|
def self.get_properties()
|
274
274
|
playbook, inventoryfile = load_ansiblespec
|
275
275
|
|
276
|
-
#load
|
277
|
-
# inventory fileとplaybookのhostsをマッピングする。
|
276
|
+
# load inventory file and playbook hosts mapping
|
278
277
|
hosts = load_targets(inventoryfile)
|
279
278
|
properties = load_playbook(playbook)
|
280
279
|
properties.each do |var|
|
@@ -285,6 +284,7 @@ module AnsibleSpec
|
|
285
284
|
var["hosts"] = hosts["#{var["hosts"]}"]
|
286
285
|
else
|
287
286
|
puts "no hosts matched for #{var["hosts"]}"
|
287
|
+
var["hosts"] = []
|
288
288
|
end
|
289
289
|
end
|
290
290
|
return properties
|
data/lib/ansible_spec/version.rb
CHANGED
data/lib/src/.ansiblespec
CHANGED
data/spec/load_ansible_spec.rb
CHANGED
@@ -1320,4 +1320,54 @@ EOF
|
|
1320
1320
|
end
|
1321
1321
|
end
|
1322
1322
|
|
1323
|
+
context 'Incorrect Case: Select invalid hostname' do
|
1324
|
+
require 'yaml'
|
1325
|
+
tmp_ansiblespec = '.ansiblespec'
|
1326
|
+
tmp_playbook = 'site.yml'
|
1327
|
+
tmp_hosts = 'hosts'
|
1328
|
+
|
1329
|
+
before do
|
1330
|
+
|
1331
|
+
content = <<'EOF'
|
1332
|
+
---
|
1333
|
+
-
|
1334
|
+
playbook: site.yml
|
1335
|
+
inventory: hosts
|
1336
|
+
EOF
|
1337
|
+
|
1338
|
+
content_p = <<'EOF'
|
1339
|
+
- name: Ansible-Sample-TDD
|
1340
|
+
hosts: server
|
1341
|
+
user: root
|
1342
|
+
roles:
|
1343
|
+
- nginx
|
1344
|
+
- mariadb
|
1345
|
+
EOF
|
1346
|
+
|
1347
|
+
content_h = <<'EOF'
|
1348
|
+
# miss name of group
|
1349
|
+
[servers]
|
1350
|
+
192.168.0.103
|
1351
|
+
192.168.0.104
|
1352
|
+
EOF
|
1353
|
+
|
1354
|
+
create_file(tmp_ansiblespec,content)
|
1355
|
+
create_file(tmp_playbook,content_p)
|
1356
|
+
create_file(tmp_hosts,content_h)
|
1357
|
+
end
|
1358
|
+
|
1359
|
+
it 'not exist hosts.' do
|
1360
|
+
# output error messages
|
1361
|
+
expect {AnsibleSpec.get_properties}.to output("no hosts matched for server\n").to_stdout
|
1362
|
+
@res = AnsibleSpec.get_properties
|
1363
|
+
expect(@res[0]['hosts'].instance_of?(Array)).to be_truthy
|
1364
|
+
expect(@res[0]['hosts'].length).to eq 0
|
1365
|
+
end
|
1366
|
+
|
1367
|
+
after do
|
1368
|
+
File.delete(tmp_ansiblespec)
|
1369
|
+
File.delete(tmp_playbook)
|
1370
|
+
File.delete(tmp_hosts)
|
1371
|
+
end
|
1372
|
+
end
|
1323
1373
|
end
|
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.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- volanja
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|