barking_iguana-compound 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/CHANGELOG.md +12 -1
- data/lib/barking_iguana/compound.rb +1 -0
- data/lib/barking_iguana/compound/ansible/inventory_writer.rb +9 -3
- data/lib/barking_iguana/compound/environment.rb +53 -0
- data/lib/barking_iguana/compound/test.rb +9 -0
- data/lib/barking_iguana/compound/test_stage.rb +7 -1
- data/lib/barking_iguana/compound/test_suite.rb +8 -0
- data/lib/barking_iguana/compound/vagrant.rb +3 -2
- data/lib/barking_iguana/compound/version.rb +1 -1
- metadata +30 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 106a0aa890444d7853a237f477ca89fc8e7ee819
|
4
|
+
data.tar.gz: c1428c31024ad408401d1846f08db595e6cd6726
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01d7729b3fd5103175969d6799a4dd95993cb97da198c8f45dda8a2ef0c53b425c71383aa952f48f27c6f7d4bf1fed9b1e2f7d1daa100dd91b839411f9a3b4e1
|
7
|
+
data.tar.gz: 13ddaf33b37681936fe62fdf2f27586469e2aa61ad38d61e492a1e0f837014ea6d4264096147668ef1985dee54cc879ceb180868ba22484fc25daa05e12c2036
|
data/docs/CHANGELOG.md
CHANGED
@@ -2,10 +2,21 @@
|
|
2
2
|
|
3
3
|
Entries are in reverse chronological order.
|
4
4
|
|
5
|
-
## *0.1.
|
5
|
+
## *0.1.7* (Current Development)
|
6
6
|
|
7
7
|
Add release notes here, as things are added to the project.
|
8
8
|
|
9
|
+
## *0.1.6* (2017-01-05)
|
10
|
+
|
11
|
+
* Allow setting ENV variables for the Vagrant command by adding an `env` file
|
12
|
+
to the test suite or individual test.
|
13
|
+
|
14
|
+
* Bug fix: set correct Ansible variable for SSH key to access VMs.
|
15
|
+
|
16
|
+
* Allow setting verbosity of Ansible output using `ANSIBLE_VERBOSITY`. This
|
17
|
+
will only be seen if `LOG_LEVEL` is `debug`, but it can be handy even in
|
18
|
+
that case.
|
19
|
+
|
9
20
|
## *0.1.5* (2016-12-29)
|
10
21
|
|
11
22
|
* Bug fix: Only generate connection inventory for those hosts in the current
|
@@ -14,6 +14,7 @@ require 'barking_iguana/compound/ansible/inventory_parser'
|
|
14
14
|
require 'barking_iguana/compound/ansible/inventory_writer'
|
15
15
|
require 'barking_iguana/compound/ansible/playbook'
|
16
16
|
require 'barking_iguana/compound/command_line_client'
|
17
|
+
require 'barking_iguana/compound/environment'
|
17
18
|
require 'barking_iguana/compound/host_manager'
|
18
19
|
require 'barking_iguana/compound/host'
|
19
20
|
require 'barking_iguana/compound/server_spec'
|
@@ -2,6 +2,8 @@ module BarkingIguana
|
|
2
2
|
module Compound
|
3
3
|
module Ansible
|
4
4
|
class InventoryWriter
|
5
|
+
include BarkingIguana::Logging::Helper
|
6
|
+
|
5
7
|
attr_accessor :path
|
6
8
|
private :path=
|
7
9
|
|
@@ -29,11 +31,15 @@ module BarkingIguana
|
|
29
31
|
|
30
32
|
def write_file
|
31
33
|
File.open path, 'w' do |inventory|
|
32
|
-
|
33
|
-
inventory.puts "#{h.inventory_name} ansible_host=#{h.ip_address} ansible_user=#{h.ssh_username} ansible_ssh_private_key_path=#{h.ssh_key} ansible_ssh_extra_args=\"#{h.ssh_extra_args}\""
|
34
|
-
end
|
34
|
+
inventory.puts to_s
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
def to_s
|
39
|
+
hosts.sort_by(&:name).map do |h|
|
40
|
+
%Q(#{h.inventory_name} ansible_host=#{h.ip_address} ansible_user=#{h.ssh_username} ansible_ssh_private_key_file=#{h.ssh_key} ansible_ssh_extra_args="#{h.ssh_extra_args}")
|
41
|
+
end.join("\n")
|
42
|
+
end
|
37
43
|
end
|
38
44
|
end
|
39
45
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module BarkingIguana
|
2
|
+
module Compound
|
3
|
+
class Environment
|
4
|
+
include BarkingIguana::Logging::Helper
|
5
|
+
|
6
|
+
attr_accessor :file
|
7
|
+
private :file=, :file
|
8
|
+
|
9
|
+
attr_accessor :overrides
|
10
|
+
private :overrides=, :overrides
|
11
|
+
|
12
|
+
def initialize file
|
13
|
+
self.file = file
|
14
|
+
self.overrides = []
|
15
|
+
end
|
16
|
+
|
17
|
+
def merge override
|
18
|
+
logger.debug { "ENV registering override: #{override.inspect}" }
|
19
|
+
overrides << override
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_h
|
24
|
+
logger.debug { "ENV evaluating #{file.inspect} (present: #{present?})" }
|
25
|
+
h = my_values
|
26
|
+
logger.debug { "ENV from #{file.inspect}: #{h.inspect}" }
|
27
|
+
overrides.each do |override|
|
28
|
+
h.merge! override.to_h
|
29
|
+
logger.debug { "ENV after merging #{override.inspect}: #{h.inspect}" }
|
30
|
+
end
|
31
|
+
logger.debug { "ENV returned from #{file.inspect}: #{h.inspect}" }
|
32
|
+
h
|
33
|
+
end
|
34
|
+
|
35
|
+
def present?
|
36
|
+
File.exists? file
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def my_values
|
42
|
+
return {} unless present?
|
43
|
+
text = File.read file
|
44
|
+
logger.debug { "ENV reading from #{file.inspect}" }
|
45
|
+
text.split(/\n/).inject({}) do |env, line|
|
46
|
+
name, value = line.split '=', 2
|
47
|
+
env[name] = value
|
48
|
+
env
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -68,9 +68,18 @@ module BarkingIguana
|
|
68
68
|
logger.debug { "Does #{vagrant_file_template_path} exist? -> #{File.exists? vagrant_file_template_path}" }
|
69
69
|
options[:vagrant_file_template_path] = vagrant_file_template_path if File.exists? vagrant_file_template_path
|
70
70
|
options[:root] = directory
|
71
|
+
options[:environment] = suite.environment.merge environment
|
71
72
|
options
|
72
73
|
end
|
73
74
|
|
75
|
+
def environment_file
|
76
|
+
File.join directory, 'env'
|
77
|
+
end
|
78
|
+
|
79
|
+
def environment
|
80
|
+
@environment ||= Environment.new(environment_file)
|
81
|
+
end
|
82
|
+
|
74
83
|
def vagrant_file_template_path
|
75
84
|
File.join directory, 'Vagrantfile.erb'
|
76
85
|
end
|
@@ -77,6 +77,7 @@ module BarkingIguana
|
|
77
77
|
h = test.host_manager.find_by_name host.inventory_name
|
78
78
|
i.add_host h
|
79
79
|
end
|
80
|
+
logger.debug { "#{name}: writing connection inventory:\n#{i.to_s}" }
|
80
81
|
i.write_file
|
81
82
|
end
|
82
83
|
end
|
@@ -95,8 +96,13 @@ module BarkingIguana
|
|
95
96
|
test.suite.control_directory
|
96
97
|
end
|
97
98
|
|
99
|
+
def ansible_verbosity
|
100
|
+
return 2 unless ENV['ANSIBLE_VERBOSITY']
|
101
|
+
ENV['ANSIBLE_VERBOSITY'].to_i
|
102
|
+
end
|
103
|
+
|
98
104
|
def playbook
|
99
|
-
Ansible.playbook(playbook_path, run_from: control_directory).inventory(generated_inventory).stream_to(logger).verbosity(
|
105
|
+
Ansible.playbook(playbook_path, run_from: control_directory).inventory(generated_inventory).stream_to(logger).verbosity(ansible_verbosity).diff
|
100
106
|
end
|
101
107
|
|
102
108
|
def suite
|
@@ -33,8 +33,9 @@ class Vagrant
|
|
33
33
|
logger.debug { "MERGED ARGS: #{merged_args.inspect}" }
|
34
34
|
command_line = "/usr/local/bin/vagrant #{command} #{merged_args}".strip
|
35
35
|
logger.debug { "COMMAND LINE: #{command_line.inspect}" }
|
36
|
-
|
37
|
-
|
36
|
+
logger.debug { "COMMAND ENV: #{environment.inspect}" }
|
37
|
+
c = Mixlib::ShellOut.new command_line, cwd: root, env: environment.to_h, live_stream: logger
|
38
|
+
benchmark "running command #{command_line.inspect} in #{root.inspect} with env #{environment.to_h.inspect}" do
|
38
39
|
c.run_command
|
39
40
|
end
|
40
41
|
c.error!
|
metadata
CHANGED
@@ -1,167 +1,167 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barking_iguana-compound
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig R Webster
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.13'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.13'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: barking_iguana-logging
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: barking_iguana-benchmark
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: mixlib-shellout
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec-wait
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: ansible_spec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: colorize
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: hostlist_expression
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - '>='
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: oj
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - '>='
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
description: Compound testing of Ansible playbooks
|
@@ -172,8 +172,8 @@ executables:
|
|
172
172
|
extensions: []
|
173
173
|
extra_rdoc_files: []
|
174
174
|
files:
|
175
|
-
-
|
176
|
-
-
|
175
|
+
- .gitignore
|
176
|
+
- .rspec
|
177
177
|
- Gemfile
|
178
178
|
- README.md
|
179
179
|
- Rakefile
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/barking_iguana/compound/ansible/inventory_writer.rb
|
193
193
|
- lib/barking_iguana/compound/ansible/playbook.rb
|
194
194
|
- lib/barking_iguana/compound/command_line_client.rb
|
195
|
+
- lib/barking_iguana/compound/environment.rb
|
195
196
|
- lib/barking_iguana/compound/host.rb
|
196
197
|
- lib/barking_iguana/compound/host_manager.rb
|
197
198
|
- lib/barking_iguana/compound/server_spec.rb
|
@@ -212,17 +213,17 @@ require_paths:
|
|
212
213
|
- lib
|
213
214
|
required_ruby_version: !ruby/object:Gem::Requirement
|
214
215
|
requirements:
|
215
|
-
- -
|
216
|
+
- - '>='
|
216
217
|
- !ruby/object:Gem::Version
|
217
218
|
version: '0'
|
218
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
220
|
requirements:
|
220
|
-
- -
|
221
|
+
- - '>='
|
221
222
|
- !ruby/object:Gem::Version
|
222
223
|
version: '0'
|
223
224
|
requirements: []
|
224
225
|
rubyforge_project:
|
225
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.0.14.1
|
226
227
|
signing_key:
|
227
228
|
specification_version: 4
|
228
229
|
summary: Compound testing of Ansible playbooks
|