ansible_spec 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -4
- data/CHANGELOG.md +11 -0
- data/lib/ansible_spec/load_ansible.rb +16 -1
- data/lib/ansible_spec/version.rb +1 -1
- data/spec/load_ansible_spec.rb +53 -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: 97d3791daa7f2224554c8c7a361d4c3a19f6e0f9
|
4
|
+
data.tar.gz: 31bfe5f3c915b3797917b67ce0d21bad52debf9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38975c66323cf9b219d7fce75ac7e40582d3573fc4fe145657db1db982727f39ae2bd93c8739fd8e5ffeb57550acd247d39c75adf136311819c15bf1658f4cbb
|
7
|
+
data.tar.gz: 1d6c2cda3f7dc488c7a6f4e0822bfd2105780b46b338a720513ea5ede2955938c49d9d0b0d47be197f8f4e13db4a30a3979f698994de32a37796f77a0bb4a6fe
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -162,7 +162,22 @@ module AnsibleSpec
|
|
162
162
|
properties.push site
|
163
163
|
end
|
164
164
|
end
|
165
|
-
|
165
|
+
if name_exist?(properties)
|
166
|
+
return properties
|
167
|
+
else
|
168
|
+
fail "Please insert name on playbook"
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Issue 27
|
173
|
+
# param: array
|
174
|
+
# return: boolean
|
175
|
+
# true: name is exist on playbook
|
176
|
+
# false: name is not exist on playbook
|
177
|
+
def self.name_exist?(array)
|
178
|
+
array.each do |site|
|
179
|
+
return site.has_key?("name") ? true : false
|
180
|
+
end
|
166
181
|
end
|
167
182
|
|
168
183
|
# return: json
|
data/lib/ansible_spec/version.rb
CHANGED
data/spec/load_ansible_spec.rb
CHANGED
@@ -527,6 +527,59 @@ EOF
|
|
527
527
|
File.delete(tmp_pb)
|
528
528
|
end
|
529
529
|
end
|
530
|
+
|
531
|
+
context '異常系(playbook内にnameがない場合)' do
|
532
|
+
require 'yaml'
|
533
|
+
tmp_pb = 'playbook'
|
534
|
+
before do
|
535
|
+
content = <<'EOF'
|
536
|
+
- hosts: server
|
537
|
+
user: root
|
538
|
+
roles:
|
539
|
+
- nginx
|
540
|
+
- mariadb
|
541
|
+
EOF
|
542
|
+
create_file(tmp_pb,content)
|
543
|
+
end
|
544
|
+
|
545
|
+
it 'exitする' do
|
546
|
+
expect{ AnsibleSpec.load_playbook(tmp_pb) }.to raise_error("Please insert name on playbook")
|
547
|
+
end
|
548
|
+
|
549
|
+
after do
|
550
|
+
File.delete(tmp_pb)
|
551
|
+
end
|
552
|
+
end
|
553
|
+
end
|
554
|
+
|
555
|
+
describe "name_exist?の実行" do
|
556
|
+
context '正常系' do
|
557
|
+
before do
|
558
|
+
h = Hash.new
|
559
|
+
h["name"] = "test"
|
560
|
+
ar = Array.new
|
561
|
+
ar << h
|
562
|
+
@res_t = AnsibleSpec.name_exist?(ar)
|
563
|
+
end
|
564
|
+
|
565
|
+
it 'res_t is true' do
|
566
|
+
expect(@res_t).to be_truthy
|
567
|
+
end
|
568
|
+
end
|
569
|
+
|
570
|
+
context '異常系' do
|
571
|
+
before do
|
572
|
+
h = Hash.new
|
573
|
+
h["var"] = "test"
|
574
|
+
ar = Array.new
|
575
|
+
ar << h
|
576
|
+
@res_f = AnsibleSpec.name_exist?(ar)
|
577
|
+
end
|
578
|
+
|
579
|
+
it 'res_f is false' do
|
580
|
+
expect(@res_f).to be_falsey
|
581
|
+
end
|
582
|
+
end
|
530
583
|
end
|
531
584
|
|
532
585
|
describe "load_ansiblespecの実行" 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:
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- volanja
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|