kitchen-nodes 0.3.4 → 0.4.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51197eb79b46b634f7d0a853e68c62e7e693d32a
|
4
|
+
data.tar.gz: 8f44cd17903d6d0e33ca289db6a4813b948d8434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec69542ce6d53c98d59876f5602e1c60d941f821316fb4080511ca80f6994815da4226e5c06a2724bd7d09da996049c9fe9f0fae35d5d703ee369e18aed1c639
|
7
|
+
data.tar.gz: ccfdb1f276c2ed48b840ffb1d0a6e05ec4700fcd7c0ce8ecf9962a61671adb0e31f3f3a14a1178eb857203fff12a476a70b547d19c52fa1e2f59e7eeb8962cbf
|
data/kitchen-nodes.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = []
|
18
|
-
spec.test_files = spec.files.grep(
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_dependency 'net-ping'
|
@@ -17,7 +17,7 @@ module Kitchen
|
|
17
17
|
raise SshFailed, "SSH command failed (#{ex.message})"
|
18
18
|
end
|
19
19
|
|
20
|
-
# rubocop:disable Metrics/
|
20
|
+
# rubocop:disable Metrics/AbcSize
|
21
21
|
def node_execute_with_exit_code(command)
|
22
22
|
exit_code = nil
|
23
23
|
out = []
|
@@ -42,7 +42,7 @@ module Kitchen
|
|
42
42
|
session.loop
|
43
43
|
[out.join("\n"), exit_code]
|
44
44
|
end
|
45
|
-
# rubocop:enable
|
45
|
+
# rubocop:enable Metrics/AbcSize
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
@@ -52,9 +52,18 @@ module Kitchen
|
|
52
52
|
state[:hostname]
|
53
53
|
end
|
54
54
|
|
55
|
+
def chef_environment
|
56
|
+
env = '_default'
|
57
|
+
if config[:client_rb] && config[:client_rb][:environment]
|
58
|
+
env = config[:client_rb][:environment]
|
59
|
+
end
|
60
|
+
env
|
61
|
+
end
|
62
|
+
|
55
63
|
def node_template
|
56
64
|
{
|
57
65
|
id: instance.name,
|
66
|
+
chef_environment: chef_environment,
|
58
67
|
automatic: {
|
59
68
|
ipaddress: ipaddress,
|
60
69
|
platform: instance.platform.name.split('-')[0].downcase
|
data/spec/unit/nodes_spec.rb
CHANGED
@@ -13,7 +13,8 @@ describe Kitchen::Provisioner::Nodes do
|
|
13
13
|
test_base_path: '/b',
|
14
14
|
kitchen_root: '/r',
|
15
15
|
run_list: 'cookbook:recipe',
|
16
|
-
attributes: { att_key: 'att_val' }
|
16
|
+
attributes: { att_key: 'att_val' },
|
17
|
+
client_rb: { environment: 'my_env' }
|
17
18
|
}
|
18
19
|
end
|
19
20
|
let(:instance) do
|
@@ -57,6 +58,12 @@ describe Kitchen::Provisioner::Nodes do
|
|
57
58
|
expect(node[:id]).to eq instance.name
|
58
59
|
end
|
59
60
|
|
61
|
+
it 'sets the environment' do
|
62
|
+
subject.create_node
|
63
|
+
|
64
|
+
expect(node[:chef_environment]).to eq config[:client_rb][:environment]
|
65
|
+
end
|
66
|
+
|
60
67
|
it 'sets the runlist' do
|
61
68
|
subject.create_node
|
62
69
|
|
@@ -75,6 +82,16 @@ describe Kitchen::Provisioner::Nodes do
|
|
75
82
|
expect(node[:automatic][:ipaddress]).to eq state[:hostname]
|
76
83
|
end
|
77
84
|
|
85
|
+
context 'no environment explicitly set' do
|
86
|
+
before { config.delete(:client_rb) }
|
87
|
+
|
88
|
+
it 'sets the environment' do
|
89
|
+
subject.create_node
|
90
|
+
|
91
|
+
expect(node[:chef_environment]).to eq '_default'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
78
95
|
context 'instance is localhost' do
|
79
96
|
let(:state) { { hostname: '127.0.0.1' } }
|
80
97
|
let(:machine_ips) { ['192.168.1.1', '192.168.1.2', '192.168.1.3'] }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-nodes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wrock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ping
|