chef-metal 0.14.1 → 0.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +0 -2
- data/lib/chef/provider/machine.rb +1 -0
- data/lib/chef/resource/machine.rb +17 -0
- data/lib/chef_metal/chef_machine_spec.rb +3 -0
- data/lib/chef_metal/chef_run_data.rb +28 -16
- data/lib/chef_metal/recipe_dsl.rb +0 -44
- data/lib/chef_metal/transport/ssh.rb +1 -1
- data/lib/chef_metal/transport/winrm.rb +1 -0
- data/lib/chef_metal/version.rb +1 -1
- metadata +30 -32
- data/spec/integration/machine.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5749137daded5cf0892f7b9644a8ff02cc583dee
|
4
|
+
data.tar.gz: 71de4e147d8293f3ef2926782267ccd6a1b1b661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 139a845c49f82f68dbe825e3a979bc9089409dac57da88c3f882a3d29ebc502a3f01eddcd6b904a2f865cd9c1fc37051dc27dc612e80c32b1287ad9df1feac73
|
7
|
+
data.tar.gz: 16563847c88a20311a09aebc7c5aa565c49316cf5e19d95de5f8bea01f3d10f05fa5c907476ae03762d51bb1f561b01f37be9e92230be52499c3be0211161341
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Chef Metal Changelog
|
2
2
|
|
3
|
+
## 0.14.2 (9/2/2014)
|
4
|
+
|
5
|
+
- Disable auto batching
|
6
|
+
- Fix for with_machine_options context hash
|
7
|
+
- Pass timeout from execution_options to winrm set_timeout
|
8
|
+
- Add better error message when driver does not specify driver_url
|
9
|
+
- Add info that location.driver_url is required
|
10
|
+
- Remove Chef 11.14 alpha note in readme
|
11
|
+
- Gracefully handle Host Down and Network Unreachable
|
12
|
+
|
3
13
|
## 0.14.1 (8/18/2014)
|
4
14
|
|
5
15
|
- Fix "metal execute mario ls" to work again
|
data/README.md
CHANGED
@@ -25,8 +25,6 @@ Try It Out
|
|
25
25
|
|
26
26
|
You can try out Metal in many different flavors.
|
27
27
|
|
28
|
-
HINT: chef-metal looks prettiest with chef 11.14 alpha. `gem install chef --pre` to get it.
|
29
|
-
|
30
28
|
### Vagrant
|
31
29
|
|
32
30
|
To give it a spin, install Vagrant and VirtualBox and try this from the `chef-metal/docs/examples` directory:
|
@@ -133,6 +133,7 @@ class Chef::Provider::Machine < Chef::Provider::LWRPBase
|
|
133
133
|
result
|
134
134
|
end
|
135
135
|
}
|
136
|
+
|
136
137
|
configs << new_resource.machine_options if new_resource.machine_options
|
137
138
|
configs << driver.config[:machine_options] if driver.config[:machine_options]
|
138
139
|
Cheffish::MergedConfig.new(*configs)
|
@@ -92,6 +92,23 @@ class Chef::Resource::Machine < Chef::Resource::LWRPBase
|
|
92
92
|
@machine_options = Cheffish::MergedConfig.new(options, @machine_options)
|
93
93
|
end
|
94
94
|
|
95
|
+
|
96
|
+
# This is here because metal users will probably want to do things like:
|
97
|
+
# machine "foo"
|
98
|
+
# action :destroy
|
99
|
+
# end
|
100
|
+
#
|
101
|
+
# with_machine_options :bootstrap_options => {...}
|
102
|
+
# machine "foo"
|
103
|
+
# converge true
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# Without this, the first resource's machine options will obliterate the second
|
107
|
+
# resource's machine options, and then unexpected (and undesired) things happen.
|
108
|
+
def load_prior_resource
|
109
|
+
Chef::Log.debug "Overloading #{self.resource_name} load_prior_resource with NOOP"
|
110
|
+
end
|
111
|
+
|
95
112
|
# chef client version and omnibus
|
96
113
|
# chef-zero boot method?
|
97
114
|
# chef-client -z boot method?
|
@@ -54,6 +54,9 @@ module ChefMetal
|
|
54
54
|
# saved automatically for you after allocate_machine and ready_machine.
|
55
55
|
#
|
56
56
|
def save(action_handler)
|
57
|
+
if location && (!location.is_a?(Hash) || !location['driver_url'])
|
58
|
+
raise "Drivers must specify a canonical driver_url in machine_spec.location. Contact your driver's author."
|
59
|
+
end
|
57
60
|
# Save the node to the server.
|
58
61
|
_self = self
|
59
62
|
_chef_server = _self.chef_server
|
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'chef/mixin/deep_merge'
|
2
|
-
require 'cheffish/with_pattern'
|
3
2
|
require 'cheffish/merged_config'
|
4
3
|
require 'chef_metal/chef_machine_spec'
|
5
4
|
|
6
5
|
module ChefMetal
|
7
6
|
class ChefRunData
|
8
|
-
|
7
|
+
|
9
8
|
def initialize(config)
|
10
9
|
@config = config
|
11
10
|
@drivers = {}
|
@@ -14,28 +13,41 @@ module ChefMetal
|
|
14
13
|
attr_reader :config
|
15
14
|
attr_reader :drivers
|
16
15
|
attr_reader :current_driver
|
16
|
+
attr_accessor :current_machine_options
|
17
|
+
attr_accessor :current_image_options
|
17
18
|
|
18
|
-
with :machine_options
|
19
|
-
with :image_options
|
20
19
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
20
|
+
def with_machine_options(value)
|
21
|
+
old_value = self.current_machine_options
|
22
|
+
self.current_machine_options = value
|
23
|
+
if block_given?
|
24
|
+
begin
|
25
|
+
yield
|
26
|
+
ensure
|
27
|
+
self.current_machine_options = old_value
|
28
|
+
end
|
24
29
|
end
|
25
|
-
@current_driver = driver
|
26
|
-
@current_driver_options = options
|
27
30
|
end
|
28
31
|
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
def with_image_options(value)
|
33
|
+
old_value = self.current_image_options
|
34
|
+
self.current_image_options = value
|
35
|
+
if block_given?
|
36
|
+
begin
|
37
|
+
yield
|
38
|
+
ensure
|
39
|
+
self.current_image_options = old_value
|
40
|
+
end
|
34
41
|
end
|
35
42
|
end
|
36
43
|
|
37
|
-
|
38
|
-
|
44
|
+
|
45
|
+
def with_driver(driver, options = nil, &block)
|
46
|
+
if drivers[driver] && options
|
47
|
+
raise "Driver #{driver} has already been created, options #{options} would be ignored!"
|
48
|
+
end
|
49
|
+
@current_driver = driver
|
50
|
+
@current_driver_options = options
|
39
51
|
end
|
40
52
|
|
41
53
|
def current_driver
|
@@ -41,14 +41,6 @@ class Chef
|
|
41
41
|
|
42
42
|
NOT_PASSED = Object.new
|
43
43
|
|
44
|
-
def auto_batch_machines(value = NOT_PASSED)
|
45
|
-
if value == NOT_PASSED
|
46
|
-
run_context.chef_metal.auto_batch_machines
|
47
|
-
else
|
48
|
-
run_context.chef_metal.auto_batch_machines = value
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
44
|
@@next_machine_batch_index = 0
|
53
45
|
|
54
46
|
def machine_batch_default_name
|
@@ -69,47 +61,11 @@ class Chef
|
|
69
61
|
end
|
70
62
|
end
|
71
63
|
|
72
|
-
# When the machine resource is first declared, create a machine_batch (if there
|
73
|
-
# isn't one already)
|
74
|
-
def machine(name, &block)
|
75
|
-
resource = build_resource(:machine, name, caller[0], &block)
|
76
|
-
|
77
|
-
# Grab the previous resource so we can decide whether to batch this or make it its own resource.
|
78
|
-
previous_index = run_context.resource_collection.previous_index
|
79
|
-
previous = previous_index >= 0 ? run_context.resource_collection[previous_index] : nil
|
80
|
-
if run_context.chef_metal.auto_batch_machines &&
|
81
|
-
previous &&
|
82
|
-
Array(resource.action).size == 1 &&
|
83
|
-
Array(previous.action) == Array(resource.action)
|
84
|
-
|
85
|
-
# Handle batching similar machines (with similar actions)
|
86
|
-
if previous.is_a?(Chef::Resource::MachineBatch)
|
87
|
-
# If we see a machine declared after a previous machine_batch with the same action, add it to the batch.
|
88
|
-
previous.machines << resource
|
89
|
-
elsif previous.is_a?(Chef::Resource::Machine)
|
90
|
-
# If we see two machines in a row with the same action, batch them.
|
91
|
-
_self = self
|
92
|
-
batch = build_resource(:machine_batch, machine_batch_default_name) do
|
93
|
-
action resource.action
|
94
|
-
machines [ previous, resource ]
|
95
|
-
end
|
96
|
-
batch.from_recipe self
|
97
|
-
run_context.resource_collection[previous_index] = batch
|
98
|
-
else
|
99
|
-
run_context.resource_collection.insert(resource)
|
100
|
-
end
|
101
|
-
|
102
|
-
else
|
103
|
-
run_context.resource_collection.insert(resource)
|
104
|
-
end
|
105
|
-
resource
|
106
|
-
end
|
107
64
|
end
|
108
65
|
end
|
109
66
|
|
110
67
|
class Config
|
111
68
|
default(:driver) { ENV['CHEF_DRIVER'] }
|
112
|
-
default(:auto_batch_machines) { true }
|
113
69
|
# config_context :drivers do
|
114
70
|
# # each key is a driver_url, and each value can have driver, driver_options and machine_options
|
115
71
|
# config_strict_mode false
|
@@ -141,7 +141,7 @@ module ChefMetal
|
|
141
141
|
# If you can't pwd within 10 seconds, you can't pwd
|
142
142
|
execute('pwd', :timeout => 10)
|
143
143
|
true
|
144
|
-
rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::ECONNRESET, Net::SSH::Disconnect
|
144
|
+
rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ENETUNREACH, Errno::EHOSTDOWN, Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::ECONNRESET, Net::SSH::Disconnect
|
145
145
|
Chef::Log.debug("#{username}@#{host} unavailable: network connection failed or broke: #{$!.inspect}")
|
146
146
|
disconnect
|
147
147
|
false
|
@@ -19,6 +19,7 @@ module ChefMetal
|
|
19
19
|
|
20
20
|
def execute(command, execute_options = {})
|
21
21
|
output = with_execute_timeout(execute_options) do
|
22
|
+
session.set_timeout(execute_timeout(execute_options))
|
22
23
|
session.run_powershell_script(command) do |stdout, stderr|
|
23
24
|
stream_chunk(execute_options, stdout, stderr)
|
24
25
|
end
|
data/lib/chef_metal/version.rb
CHANGED
metadata
CHANGED
@@ -1,139 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-metal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Keiser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
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: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: net-ssh
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.0'
|
34
34
|
type: :runtime
|
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: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: net-scp
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.0'
|
48
48
|
type: :runtime
|
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: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: net-ssh-gateway
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.2.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: 1.2.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: inifile
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '2.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: '2.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: cheffish
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0.5'
|
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.5'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: winrm
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 1.1.3
|
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: 1.1.3
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
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: :development
|
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: rake
|
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: :development
|
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
|
description: A library for creating machines and infrastructures idempotently in Chef.
|
@@ -146,11 +146,10 @@ extra_rdoc_files:
|
|
146
146
|
- CHANGELOG.md
|
147
147
|
- LICENSE
|
148
148
|
files:
|
149
|
-
-
|
149
|
+
- Rakefile
|
150
150
|
- LICENSE
|
151
151
|
- README.md
|
152
|
-
-
|
153
|
-
- bin/metal
|
152
|
+
- CHANGELOG.md
|
154
153
|
- lib/chef/provider/machine.rb
|
155
154
|
- lib/chef/provider/machine_batch.rb
|
156
155
|
- lib/chef/provider/machine_execute.rb
|
@@ -161,32 +160,32 @@ files:
|
|
161
160
|
- lib/chef/resource/machine_execute.rb
|
162
161
|
- lib/chef/resource/machine_file.rb
|
163
162
|
- lib/chef/resource/machine_image.rb
|
164
|
-
- lib/chef_metal.rb
|
165
163
|
- lib/chef_metal/action_handler.rb
|
166
164
|
- lib/chef_metal/add_prefix_action_handler.rb
|
167
165
|
- lib/chef_metal/chef_image_spec.rb
|
168
166
|
- lib/chef_metal/chef_machine_spec.rb
|
169
167
|
- lib/chef_metal/chef_provider_action_handler.rb
|
170
168
|
- lib/chef_metal/chef_run_data.rb
|
171
|
-
- lib/chef_metal/convergence_strategy.rb
|
172
169
|
- lib/chef_metal/convergence_strategy/install_cached.rb
|
173
170
|
- lib/chef_metal/convergence_strategy/install_msi.rb
|
174
171
|
- lib/chef_metal/convergence_strategy/install_sh.rb
|
175
172
|
- lib/chef_metal/convergence_strategy/no_converge.rb
|
176
173
|
- lib/chef_metal/convergence_strategy/precreate_chef_objects.rb
|
174
|
+
- lib/chef_metal/convergence_strategy.rb
|
177
175
|
- lib/chef_metal/driver.rb
|
178
176
|
- lib/chef_metal/image_spec.rb
|
179
|
-
- lib/chef_metal/machine.rb
|
180
177
|
- lib/chef_metal/machine/basic_machine.rb
|
181
178
|
- lib/chef_metal/machine/unix_machine.rb
|
182
179
|
- lib/chef_metal/machine/windows_machine.rb
|
180
|
+
- lib/chef_metal/machine.rb
|
183
181
|
- lib/chef_metal/machine_spec.rb
|
184
182
|
- lib/chef_metal/recipe_dsl.rb
|
185
|
-
- lib/chef_metal/transport.rb
|
186
183
|
- lib/chef_metal/transport/ssh.rb
|
187
184
|
- lib/chef_metal/transport/winrm.rb
|
185
|
+
- lib/chef_metal/transport.rb
|
188
186
|
- lib/chef_metal/version.rb
|
189
|
-
-
|
187
|
+
- lib/chef_metal.rb
|
188
|
+
- bin/metal
|
190
189
|
homepage: http://wiki.opscode.com/display/chef
|
191
190
|
licenses: []
|
192
191
|
metadata: {}
|
@@ -196,19 +195,18 @@ require_paths:
|
|
196
195
|
- lib
|
197
196
|
required_ruby_version: !ruby/object:Gem::Requirement
|
198
197
|
requirements:
|
199
|
-
- -
|
198
|
+
- - '>='
|
200
199
|
- !ruby/object:Gem::Version
|
201
200
|
version: '0'
|
202
201
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
202
|
requirements:
|
204
|
-
- -
|
203
|
+
- - '>='
|
205
204
|
- !ruby/object:Gem::Version
|
206
205
|
version: '0'
|
207
206
|
requirements: []
|
208
207
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.
|
208
|
+
rubygems_version: 2.0.14
|
210
209
|
signing_key:
|
211
210
|
specification_version: 4
|
212
211
|
summary: A library for creating machines and infrastructures idempotently in Chef.
|
213
212
|
test_files: []
|
214
|
-
has_rdoc:
|
data/spec/integration/machine.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
describe Chef::Resource::Machine do
|
2
|
-
# With Properties
|
3
|
-
#
|
4
|
-
# with_driver
|
5
|
-
# machine.driver
|
6
|
-
# no driver
|
7
|
-
# with_machine_options
|
8
|
-
# machine.machine_options
|
9
|
-
# no machine_options
|
10
|
-
#
|
11
|
-
# node tests
|
12
|
-
# machine with_environment
|
13
|
-
# machine.environment
|
14
|
-
# no environment
|
15
|
-
# machine with_chef_server
|
16
|
-
# machine.chef_server
|
17
|
-
# no chef_server
|
18
|
-
# all node attributes
|
19
|
-
# attributes overwrites normal attributes, but not attributes
|
20
|
-
#
|
21
|
-
# client tests
|
22
|
-
# different private key generation options
|
23
|
-
# pass in private / public key
|
24
|
-
#
|
25
|
-
# Actions
|
26
|
-
context 'with a recipe that ' do
|
27
|
-
with_recipe do
|
28
|
-
machine 'blah'
|
29
|
-
end
|