chef-provisioning 1.2.1 → 1.3.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: bdf81e38047405e6ffb044e3112628cd6cce7732
4
- data.tar.gz: 18351e619438b43f8e2ef7f6622de7a416a4ba84
3
+ metadata.gz: d1d0e8bd93eb76771d1303941bb28915e896fcc0
4
+ data.tar.gz: 51efa93be19879302fb8667c019083c0e361ab6c
5
5
  SHA512:
6
- metadata.gz: 846ed8458a5d37d3befd1cc983b81ec7efd26a7d4b5ad10bd43f0485b7c78d8f499ea7f89bea6964bee7735e97b41640dcde5312834d6b59a47013efdeecf014
7
- data.tar.gz: 800540b188262a24c73cce456a5116aed4d707863025cba6dfbdc9c00af9b6c2bb33cee04f2e3a8bd3d2da5be4b3b2d36847c28a670ad45dfa30a384d0eb8653
6
+ metadata.gz: ab0789c2693c7ec113fdf2382359a802f3d47d9fc4b17b2baf366d4baffca4eada93bae2a4269b80db08e01e7c55ff2e482f61066a53e53ba16272355e5bbbd2
7
+ data.tar.gz: 36288cf508696c26b97962be8d548780ec0575705c5e0b5b9bac5e55fdb679c7fb9ca9cd81234f9c70fe4a1981b4d604db8d51647aaa4e21e3d4690b0373f9f6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Chef Provisioning Changelog
2
2
 
3
+ ## 1.3.0 (8/5/2015)
4
+
5
+ - Expose machine_spec.from_image to allocate_machine ([#366][], [@mwrock][])
6
+ - Use mixlib-install to install from omnitruck ([#389][], [@thommay][])
7
+
3
8
  ## 1.2.1 (7/17/2015)
4
9
 
5
10
  - Added support for `options[:scp_temp_dir]` to permit specifying a directory other than `/tmp` to copy files to via SCP. ([#339][])
@@ -314,7 +319,9 @@
314
319
  [#352]: https://github.com/chef/chef-provisioning/issues/352
315
320
  [#363]: https://github.com/chef/chef-provisioning/issues/363
316
321
  [#364]: https://github.com/chef/chef-provisioning/issues/364
322
+ [#366]: https://github.com/chef/chef-provisioning/issues/366
317
323
  [#369]: https://github.com/chef/chef-provisioning/issues/369
324
+ [#389]: https://github.com/chef/chef-provisioning/issues/389
318
325
  [@MrMMorris]: https://github.com/MrMMorris
319
326
  [@causton1]: https://github.com/causton1
320
327
  [@chef]: https://github.com/chef
@@ -330,6 +337,7 @@
330
337
  [@mivok]: https://github.com/mivok
331
338
  [@mwrock]: https://github.com/mwrock
332
339
  [@segv]: https://github.com/segv
340
+ [@thommay]: https://github.com/thommay
333
341
  [@tyler-ball]: https://github.com/tyler-ball
334
342
  [@xeon22]: https://github.com/xeon22
335
- [@xorl]: https://github.com/xorl
343
+ [@xorl]: https://github.com/xorl
data/README.md CHANGED
@@ -1,10 +1,31 @@
1
- [![Stories in Ready](https://badge.waffle.io/chef/chef-provisioning.png?label=ready&title=Ready)](https://waffle.io/chef/chef-provisioning)
2
1
  Chef Provisioning
3
2
  ==========
4
3
  [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/chef/chef-provisioning?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
+ [![Stories in Ready](https://badge.waffle.io/chef/chef-provisioning.png?label=ready&title=Ready)](https://waffle.io/chef/chef-provisioning)
5
+ [![Status](https://travis-ci.org/chef/chef-provisioning.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning)
6
+
7
+ Driver build status:
8
+
9
+ AWS | Azure | Docker | Fog | Hanlon | LXC | ssh | Vagrant
10
+ ---- | ---- | ---- | ---- | ---- | ---- | ---- | ----
11
+ [![Status](https://travis-ci.org/chef/chef-provisioning-aws.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-aws)| [![Status](https://travis-ci.org/chef/chef-provisioning-azure.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-azure) | [![Status](https://travis-ci.org/chef/chef-provisioning-docker.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-docker) | [![Status](https://travis-ci.org/chef/chef-provisioning-fog.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-fog) | [![Status](https://travis-ci.org/chef/chef-provisioning-hanlon.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-hanlon) | [![Status](https://travis-ci.org/chef/chef-provisioning-lxc.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-lxc) | [![Status](https://travis-ci.org/chef/chef-provisioning-ssh.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-ssh) | [![Status](https://travis-ci.org/chef/chef-provisioning-vagrant.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-vagrant)
5
12
 
6
13
  This library solves the problem of repeatably creating machines and infrastructures in Chef. It has a plugin model that lets you write bootstrappers for your favorite infrastructures, including VirtualBox, EC2, LXC, bare metal, and many more!
7
14
 
15
+ Documentation
16
+ -------------
17
+
18
+ These are the primary documents to help learn about using Provisioning and creating Provisioning drivers:
19
+
20
+ * [Chef Docs](https://docs.chef.io/provisioning.html)
21
+ * [Frequently Asked Questions](https://github.com/chef/chef-provisioning/blob/master/docs/faq.md)
22
+ * [Configuration](https://github.com/chef/chef-provisioning/blob/master/docs/configuration.md#configuring-and-using-provisioning-drivers)
23
+ * [Writing Drivers](https://github.com/chef/chef-provisioning/blob/master/docs/building_drivers.md#writing-drivers)
24
+ * [Embedding](https://github.com/chef/chef-provisioning/blob/master/docs/embedding.md)
25
+ * [Providers](https://github.com/chef/chef-provisioning/blob/master/docs/providers)
26
+
27
+ Media
28
+ -----
8
29
  [This video](https://www.youtube.com/watch?v=Yb8QdL30WgM) explains the basics of chef-provisioning (though provisioners are now called drivers). Slides (more up to date) are [here](http://slides.com/jkeiser/chef-metal).
9
30
 
10
31
  Date | Blog
@@ -17,15 +38,6 @@ Date | Blog
17
38
  2014-03-04 | [Chef Metal 0.2: Overview](http://www.chef.io/blog/2014/03/04/chef-metal-0-2-release/) - this is a pretty good overview (though dated).
18
39
  2013-12-20 | [Chef Metal Alpha](http://www.chef.io/blog/2013/12/20/chef-metal-alpha/)
19
40
 
20
- Documentation
21
- -------------
22
- * [Chef Docs](https://docs.chef.io/provisioning.html)
23
- * [Frequently Asked Questions](https://github.com/chef/chef-provisioning/blob/master/docs/faq.md)
24
- * [Configuration](https://github.com/chef/chef-provisioning/blob/master/docs/configuration.md#configuring-and-using-provisioning-drivers)
25
- * [Writing Drivers](https://github.com/chef/chef-provisioning/blob/master/docs/building_drivers.md#writing-drivers)
26
- * [Embedding](https://github.com/chef/chef-provisioning/blob/master/docs/embedding.md)
27
- * [Providers](https://github.com/chef/chef-provisioning/blob/master/docs/providers)
28
-
29
41
  Try It Out
30
42
  ----------
31
43
 
@@ -239,28 +251,14 @@ with_chef_server "https://chef-server.example.org",
239
251
  :signing_key_filename => Chef::Config[:client_key]
240
252
  ```
241
253
 
242
- **Note for Hosted/Enterprise Chef Servers**
254
+ Finally, you can specify a Chef Server for an individual machine by using the `chef_server` attribute. This attribute takes the same additional options (`:client_name`, `:signing_key_filename`) that `with_chef_server` does.
243
255
 
244
- Currently, you will need to add the 'clients' group to the 'admin' group in order for machine provisioning to work:
245
-
246
- ```
247
- knife edit /groups/admin.json -e <editor>
248
- ```
249
- Then add:
250
- ```
251
- {
252
- "users": [
253
- "pivotal" # This is an internal superuser for Hosted/Enterprise Chef
254
- ],
255
- "groups": [
256
- "clients" # This is what you need to add
257
- ]
258
- }
256
+ ```ruby
257
+ machine 'mario' do
258
+ chef_server :chef_server_url => "https://chef-server.example.org"
259
+ end
259
260
  ```
260
261
 
261
- This can also be done through the Chef Server web UI (Administration tab > Groups > select admins Group > Add 'clients'
262
-
263
-
264
262
  Kitchen
265
263
  -------
266
264
 
@@ -146,6 +146,7 @@ class Machine < Chef::Provider::LWRPBase
146
146
  end
147
147
  }
148
148
 
149
+ configs << { from_image: new_resource.from_image } if new_resource.from_image
149
150
  configs << new_resource.machine_options if new_resource.machine_options
150
151
  configs << driver.config[:machine_options] if driver.config[:machine_options]
151
152
  Cheffish::MergedConfig.new(*configs)
@@ -50,6 +50,9 @@ module Provisioning
50
50
  begin
51
51
  require "chef_metal/driver_init/#{scheme}"
52
52
  rescue LoadError
53
+ # try the doomed require again so the stack trace shows the first LoadError and not the second (which
54
+ # would throw a confusing "chef_metal" into the error output of what is now chef-provisioning). one
55
+ # could also experiment with saving the first LoadError and re-raising it.
53
56
  require "chef/provisioning/driver_init/#{scheme}"
54
57
  end
55
58
  end
@@ -1,4 +1,5 @@
1
1
  require 'chef/provisioning/convergence_strategy/precreate_chef_objects'
2
+ require 'mixlib/install'
2
3
  require 'pathname'
3
4
 
4
5
  class Chef
@@ -9,8 +10,6 @@ module Provisioning
9
10
  super
10
11
  @chef_version ||= convergence_options[:chef_version]
11
12
  @prerelease ||= convergence_options[:prerelease]
12
- @install_msi_url = convergence_options[:install_msi_url] || 'https://www.chef.io/chef/install.msi'
13
- @install_msi_path = convergence_options[:install_msi_path] || "$env:TEMP\\#{File.basename(@install_msi_url)}"
14
13
  @chef_client_timeout = convergence_options.has_key?(:chef_client_timeout) ? convergence_options[:chef_client_timeout] : 120*60 # Default: 2 hours
15
14
  end
16
15
 
@@ -28,35 +27,16 @@ module Provisioning
28
27
  })
29
28
  end
30
29
 
31
- super
32
-
33
- # Check for existing chef client.
34
- version = machine.execute_always('chef-client -v')
35
-
36
- # Don't do install/upgrade if a chef client exists and
37
- # no chef version is defined by user configs or
38
- # the chef client's version already matches user config
39
- if version.exitstatus == 0
40
- version = version.stdout.strip
41
- if !chef_version
42
- return
43
- elsif version =~ /Chef: #{chef_version}$/
44
- Chef::Log.debug "Already installed chef version #{version}"
45
- return
46
- elsif version.include?(chef_version)
47
- Chef::Log.warn "Installed chef version #{version} contains desired version #{chef_version}. " +
48
- "If you see this message on consecutive chef runs tighten your desired version constraint to prevent " +
49
- "multiple convergence."
50
- end
30
+ opts = {"prerelease" => prerelease}
31
+ if convergence_options[:bootstrap_proxy]
32
+ opts["http_proxy"] = convergence_options[:bootstrap_proxy]
33
+ opts["https_proxy"] = convergence_options[:bootstrap_proxy]
51
34
  end
35
+ opts["install_msi_url"] = convergence_options[:install_msi_url] if convergence_options[:install_msi_url]
36
+ super
52
37
 
53
- # Install chef client
54
- # TODO ssh verification of install.msi before running arbtrary code would be nice?
55
- # TODO find a way to cache this on the host like with the Unix stuff.
56
- # Limiter is we don't know how to efficiently upload large files to
57
- # the remote machine with WMI.
58
- machine.execute(action_handler, "(New-Object System.Net.WebClient).DownloadFile(#{machine.escape(install_msi_url)}, #{machine.escape(install_msi_path)})")
59
- machine.execute(action_handler, "msiexec /qn /i #{machine.escape(install_msi_path)}")
38
+ install_command = Mixlib::Install.new(chef_version, true, opts).install_command
39
+ machine.execute(action_handler, install_command)
60
40
  end
61
41
 
62
42
  def converge(action_handler, machine)
@@ -73,6 +53,7 @@ module Provisioning
73
53
  end
74
54
  end
75
55
  end
56
+
76
57
  end
77
58
  end
78
59
  end
@@ -1,5 +1,6 @@
1
1
  require 'chef/provisioning/convergence_strategy/precreate_chef_objects'
2
2
  require 'pathname'
3
+ require 'mixlib/install'
3
4
 
4
5
  class Chef
5
6
  module Provisioning
@@ -29,58 +30,19 @@ module Provisioning
29
30
  attr_reader :install_sh_arguments
30
31
  attr_reader :bootstrap_env
31
32
 
32
- def install_sh_command_line
33
- arguments = install_sh_arguments ? " #{install_sh_arguments}" : ""
34
- arguments << " -v #{chef_version}" if chef_version
35
- arguments << " -p" if prerelease
36
- "bash -c '#{bootstrap_env} bash #{install_sh_path}#{arguments}'"
37
- end
38
-
39
33
  def setup_convergence(action_handler, machine)
40
34
  super
41
35
 
42
- # Check for existing chef client.
43
- version = machine.execute_always('chef-client -v')
44
-
45
- # Don't do install/upgrade if a chef client exists and
46
- # no chef version is defined by user configs or
47
- # the chef client's version already matches user config
48
- if version.exitstatus == 0
49
- version = version.stdout.strip
50
- if !chef_version
51
- return
52
- # This logic doesn't cover the case for a client with 12.0.1.dev.0 => 12.0.1
53
- # so we decided to just use exact version for the time being (see comments in PR 303)
54
- #elsif version.stdout.strip =~ /Chef: #{chef_version}([^0-9]|$)/
55
- elsif version =~ /Chef: #{chef_version}$/
56
- Chef::Log.debug "Already installed chef version #{version}"
57
- return
58
- elsif version.include?(chef_version)
59
- Chef::Log.warn "Installed chef version #{version} contains desired version #{chef_version}. " +
60
- "If you see this message on consecutive chef runs tighten your desired version constraint to prevent " +
61
- "multiple convergence."
62
- end
36
+ opts = {"prerelease" => prerelease}
37
+ if convergence_options[:bootstrap_proxy]
38
+ opts["http_proxy"] = convergence_options[:bootstrap_proxy]
39
+ opts["https_proxy"] = convergence_options[:bootstrap_proxy]
63
40
  end
64
41
 
65
- # Install chef client
66
- # TODO ssh verification of install.sh before running arbtrary code would be nice?
67
- if !convergence_options[:bootstrap_proxy] || convergence_options[:bootstrap_proxy].empty?
68
- @@install_sh_cache[install_sh_url] ||= Net::HTTP.get(URI(install_sh_url))
69
- else
70
- @@install_sh_cache[install_sh_url] ||= begin
71
- proxy_uri = URI.parse(convergence_options[:bootstrap_proxy])
72
- chef_uri = URI.parse(@install_sh_url)
73
- proxy = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user, proxy_uri.password)
74
- req = Net::HTTP::Get.new(chef_uri.path)
75
- script = proxy.start(chef_uri.host, :use_ssl => proxy_uri.scheme == 'https') do |http|
76
- http.request(req)
77
- end
78
- script.body
79
- end
80
- end
81
- machine.write_file(action_handler, install_sh_path, @@install_sh_cache[install_sh_url], :ensure_dir => true)
82
- # TODO handle bad version case better
83
- machine.execute(action_handler, install_sh_command_line)
42
+ install_command = Mixlib::Install.new(chef_version, false, opts).install_command
43
+ machine.write_file(action_handler, install_sh_path, install_command, :ensure_dir => true)
44
+ machine.set_attributes(action_handler, install_sh_path, :mode => '0755')
45
+ machine.execute(action_handler, "sh -c #{install_sh_path}")
84
46
  end
85
47
 
86
48
  def converge(action_handler, machine)
@@ -1,5 +1,5 @@
1
1
  class Chef
2
2
  module Provisioning
3
- VERSION = '1.2.1'
3
+ VERSION = '1.3.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-17 00:00:00.000000000 Z
11
+ date: 2015-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: mixlib-install
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.4'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.4'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rspec
113
127
  requirement: !ruby/object:Gem::Requirement