chef-metal 0.12.1 → 0.13

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: 73917076444ad1bda8ffa1d5b3a2d44c6f13e401
4
- data.tar.gz: 04f07c5b3d36891a3c961b1d8effd2154e34f71b
3
+ metadata.gz: 5f7a30676d9791f178e7448693969b295a85d5f4
4
+ data.tar.gz: cac264ccd9b787d7ff1a799f3b0994973eb06a1a
5
5
  SHA512:
6
- metadata.gz: 102130f0959c12ce7c6b22d3d1ef15bd30aed149301af19db398d83bc4eba212fe7aceda10d2c27232e65f4c5fe341787d49a4703fe2a3c693f91564c8245f1a
7
- data.tar.gz: 6c2a7613ddd0da1090402c152579fde5de9279204ddd06a477e6c5d0e2fcd1b1cd4d342f99a84d32a7edce9c8281733aed233c9327c20879f7673df3f97ae585
6
+ metadata.gz: 31858346827c13c25a8fb8a5a6e222a424db9c610a86e643971e5a4620fb9b863eb8418c3235830d0d519870e07a519359e548a6e94099c6cc17b50251cd2255
7
+ data.tar.gz: fec942a369b4d2e82a33090bcf47caa51cda90346c9f867ac00d5633d95f9c633e98a786ddb997d43466623ca184342845e1e1ad7756d1f3444b49ef713f6c31
@@ -1,5 +1,10 @@
1
1
  # Chef Metal Changelog
2
2
 
3
+ ## 0.13 (6/17/2014)
4
+
5
+ - make winrm work again (@mwrock)
6
+ - add bootstrap_proxy as a convergence_option for when target machines require a proxy
7
+
3
8
  ## 0.12.1 (6/18/2014)
4
9
 
5
10
  - fix machine_batch action :setup
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Stories in Ready](https://badge.waffle.io/opscode/chef-metal.png?label=ready&title=Ready)](https://waffle.io/opscode/chef-metal)
1
2
  Chef Metal
2
3
  ==========
3
4
 
@@ -12,6 +13,13 @@ Date | Blog
12
13
  3/4/2014 | [Chef Metal 0.2: Overview](http://www.getchef.com/blog/2014/03/04/chef-metal-0-2-release/) - this is a pretty good overview (though dated).
13
14
  12/20/2013 | [Chef Metal Alpha](http://www.getchef.com/blog/2013/12/20/chef-metal-alpha/)
14
15
 
16
+ Documentation
17
+ -------------
18
+ * [Configuration](https://github.com/opscode/chef-metal/blob/master/docs/configuration.md#configuring-and-using-metal-drivers)
19
+ * [Writing Drivers](https://github.com/opscode/chef-metal/blob/master/docs/building_drivers.md#writing-drivers)
20
+ * [Embedding](https://github.com/opscode/chef-metal/blob/master/docs/embedding.md)
21
+ * [Providers](https://github.com/opscode/chef-metal/blob/master/docs/providers)
22
+
15
23
  Try It Out
16
24
  ----------
17
25
 
@@ -217,17 +225,28 @@ with_chef_server "https://chef-server.example.org",
217
225
  :signing_key_filename => Chef::Config[:client_key]
218
226
  ```
219
227
 
228
+ **Note for Hosted/Enterprise Chef Servers**
229
+
230
+ Currently, you will need to add the 'clients' group to the 'admin' group in order for machine provisioning to work:
231
+
232
+ ```
233
+ knife edit /groups/admin.json -e <editor>
234
+ ```
235
+ Then add:
236
+ ```
237
+ "groups": [
238
+ "clients"
239
+ ]
240
+ ```
241
+
242
+ This can also be done through the Chef Server web UI (Administration tab > Groups > select admins Group > Add 'clients'
243
+
244
+
220
245
  Kitchen
221
246
  -------
222
247
 
223
248
  Chef Metal also works with Test Kitchen, allowing you to test entire clusters, not just machines! The repository for the kitchen-metal gem is https://github.com/doubt72/kitchen-metal.
224
249
 
225
- Documentation
226
- -------------
227
- * [Configuration](https://github.com/opscode/chef-metal/blob/master/docs/configuration.md#configuring-and-using-metal-drivers)
228
- * [Writing Drivers](https://github.com/opscode/chef-metal/blob/master/docs/building_drivers.md#writing-drivers)
229
- * [Embedding](https://github.com/opscode/chef-metal/blob/master/docs/embedding.md)
230
-
231
250
  Bugs and The Plan
232
251
  -----------------
233
252
 
@@ -20,6 +20,9 @@ class Chef::Provider::Machine < Chef::Provider::LWRPBase
20
20
  if current_driver && current_driver.driver_url != new_driver.driver_url
21
21
  raise "Cannot move '#{machine_spec.name}' from #{current_driver.driver_url} to #{new_driver.driver_url}: machine moving is not supported. Destroy and recreate."
22
22
  end
23
+ if !new_driver
24
+ raise "Driver not specified for machine #{machine_spec.name}"
25
+ end
23
26
  new_driver.allocate_machine(action_handler, machine_spec, new_machine_options)
24
27
  machine_spec.save(action_handler)
25
28
  end
@@ -120,6 +120,8 @@ class Chef::Provider::MachineBatch < Chef::Provider::LWRPBase
120
120
  end
121
121
  result[driver] ||= {}
122
122
  result[driver][m[:spec]] = m[:machine_options].call(driver)
123
+ else
124
+ raise "No driver specified for #{m[:spec].name}"
123
125
  end
124
126
  end
125
127
  result
@@ -9,7 +9,7 @@ module ChefMetal
9
9
  def initialize(convergence_options, config)
10
10
  super
11
11
  @install_msi_url = convergence_options[:install_msi_url] || 'http://www.opscode.com/chef/install.msi'
12
- @install_msi_path = convergence_options[:install_msi_path] || "%TEMP%\\#{File.basename(@install_msi_url)}"
12
+ @install_msi_path = convergence_options[:install_msi_path] || "$env:TEMP\\#{File.basename(@install_msi_url)}"
13
13
  @chef_client_timeout = convergence_options.has_key?(:chef_client_timeout) ? convergence_options[:chef_client_timeout] : 120*60 # Default: 2 hours
14
14
  end
15
15
 
@@ -14,11 +14,13 @@ module ChefMetal
14
14
  super(convergence_options, config)
15
15
  @install_sh_url = convergence_options[:install_sh_url] || 'http://www.opscode.com/chef/install.sh'
16
16
  @install_sh_path = convergence_options[:install_sh_path] || '/tmp/chef-install.sh'
17
+ @bootstrap_env = convergence_options[:bootstrap_proxy] ? "http_proxy=#{convergence_options[:bootstrap_proxy]}" : ""
17
18
  @chef_client_timeout = convergence_options.has_key?(:chef_client_timeout) ? convergence_options[:chef_client_timeout] : 120*60 # Default: 2 hours
18
19
  end
19
20
 
20
21
  attr_reader :install_sh_url
21
22
  attr_reader :install_sh_path
23
+ attr_reader :bootstrap_env
22
24
 
23
25
  def setup_convergence(action_handler, machine)
24
26
  super
@@ -28,7 +30,7 @@ module ChefMetal
28
30
  # TODO ssh verification of install.sh before running arbtrary code would be nice?
29
31
  @@install_sh_cache[install_sh_url] ||= Net::HTTP.get(URI(install_sh_url))
30
32
  machine.write_file(action_handler, install_sh_path, @@install_sh_cache[install_sh_url], :ensure_dir => true)
31
- machine.execute(action_handler, "bash #{install_sh_path}")
33
+ machine.execute(action_handler, "bash -c '#{bootstrap_env} bash #{install_sh_path}'")
32
34
  end
33
35
  end
34
36
 
@@ -39,15 +39,15 @@ class Chef
39
39
  end
40
40
  end
41
41
 
42
- @@next_machine_batch_index = 1
42
+ @@next_machine_batch_index = 0
43
43
 
44
44
  def machine_batch_default_name
45
+ @@next_machine_batch_index += 1
45
46
  if @@next_machine_batch_index > 1
46
47
  "default#{@@next_machine_batch_index}"
47
48
  else
48
49
  "default"
49
50
  end
50
- @@next_machine_batch_index += 1
51
51
  end
52
52
 
53
53
  def machine_batch(name = nil, &block)
@@ -62,7 +62,30 @@ $file.Close
62
62
  end
63
63
 
64
64
  def escape(string)
65
- "'#{string.gsub("'", "''")}'"
65
+ "\"#{string.gsub("\"", "`\"")}\""
66
+ end
67
+
68
+ def available?
69
+ # If you can't pwd within 10 seconds, you can't pwd
70
+ execute('pwd', :timeout => 10)
71
+ true
72
+ rescue Timeout::Error, Errno::EHOSTUNREACH, Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::ECONNRESET, ::WinRM::WinRMHTTPTransportError, ::WinRM::WinRMWebServiceError, ::WinRM::WinRMWSManFault
73
+ Chef::Log.debug("unavailable: network connection failed or broke: #{$!.inspect}")
74
+ disconnect
75
+ false
76
+ rescue ::WinRM::WinRMAuthorizationError
77
+ Chef::Log.debug("unavailable: winrm authentication error: #{$!.inspect} ")
78
+ disconnect
79
+ false
80
+ end
81
+
82
+ def make_url_available_to_remote(local_url)
83
+ uri = URI(local_url)
84
+ host = Socket.getaddrinfo(uri.host, uri.scheme, nil, :STREAM)[0][3]
85
+ if host == '127.0.0.1' || host == '::1'
86
+ raise 'Unable to converge locally via winrm. Local converge is currently only supported with SSH. You may only converge with winrm against a chef-server.'
87
+ end
88
+ local_url
66
89
  end
67
90
 
68
91
  protected
@@ -94,6 +117,7 @@ $file.Close
94
117
  attr_reader :exitstatus
95
118
  attr_reader :command
96
119
  attr_reader :options
120
+ attr_reader :config
97
121
 
98
122
  def error!
99
123
  if exitstatus != 0
@@ -1,3 +1,3 @@
1
1
  module ChefMetal
2
- VERSION = '0.12.1'
2
+ VERSION = '0.13'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-metal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: '0.13'
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-06-18 00:00:00.000000000 Z
11
+ date: 2014-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.5'
97
+ - !ruby/object:Gem::Dependency
98
+ name: winrm
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.1.3
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.1.3
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rspec
99
113
  requirement: !ruby/object:Gem::Requirement