ansible_spec 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d122ed3ab0a82c97610d92c4003e312c9b840da8
4
- data.tar.gz: a5aa9f19132d94f6a71a29dd5757fc1656ed5132
3
+ metadata.gz: d457c5cbf7de2872b6567b14f4743c967a05f9f3
4
+ data.tar.gz: 9a4af4588ffd83f2249fbba3ee13f69f250ad012
5
5
  SHA512:
6
- metadata.gz: c2032946eab61911a11307e40295d3264a313ae3e447bb44df3a93e35064f72ff5135051192cb7d0a25ffd575c8ab6860ef42088f1a425127958f0f8abc23dda
7
- data.tar.gz: 27fcb234ef270985b4111e04c245bc890bd8a2d1b448e81085eb7cfef1e708322e68eae50cf8b759e3167eae35a846f63bdc81360040cb2ab1a47798d1ea22f3
6
+ metadata.gz: 2351376f83753be73282de06c2af2f2b7a821cc221fbc86a3b9f29fbf5b571dfe75b8f8a0e6a0d3cc8fe82439bfff0936b4ded73e3d9f95eb8450206b6267225
7
+ data.tar.gz: 5162d04115f849d6b9a04431eccfbc837ea16d5fbf3ea8b572f045105fd0bf9c90d312735f65eb50eb30085fe5d0f59389b349411767429c924dda859db29b34
@@ -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 inventry file
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
@@ -1,3 +1,3 @@
1
1
  module AnsibleSpec
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -1,4 +1,4 @@
1
- ---
2
- -
1
+ ---
2
+ -
3
3
  playbook: site.yml
4
4
  inventory: hosts
@@ -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.8
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-02 00:00:00.000000000 Z
11
+ date: 2016-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler