chef 0.10.2 → 0.10.4.rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/distro/common/html/chef-client.8.html +4 -4
- data/distro/common/html/knife-cookbook.1.html +5 -3
- data/distro/common/html/knife-node.1.html +4 -4
- data/distro/common/man/man1/knife-cookbook.1 +5 -1
- data/distro/common/man/man1/knife-node.1 +1 -1
- data/distro/common/markdown/man1/knife-cookbook-site.mkd +3 -3
- data/distro/common/markdown/man1/knife-cookbook.mkd +7 -0
- data/distro/common/markdown/man1/knife-node.mkd +4 -3
- data/distro/common/markdown/man1/knife-ssh.mkd +2 -0
- data/lib/chef/application.rb +1 -0
- data/lib/chef/cookbook_loader.rb +18 -0
- data/lib/chef/cookbook_uploader.rb +1 -1
- data/lib/chef/data_bag.rb +14 -2
- data/lib/chef/data_bag_item.rb +8 -2
- data/lib/chef/encrypted_data_bag_item.rb +19 -6
- data/lib/chef/environment.rb +12 -6
- data/lib/chef/exceptions.rb +1 -0
- data/lib/chef/knife.rb +0 -28
- data/lib/chef/knife/bootstrap.rb +7 -0
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +14 -12
- data/lib/chef/knife/bootstrap/centos5-gems.erb +8 -5
- data/lib/chef/knife/bootstrap/fedora13-gems.erb +2 -0
- data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +16 -9
- data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +6 -3
- data/lib/chef/knife/client_bulk_delete.rb +28 -6
- data/lib/chef/knife/cookbook_site_install.rb +2 -2
- data/lib/chef/knife/cookbook_upload.rb +71 -0
- data/lib/chef/knife/core/bootstrap_context.rb +13 -3
- data/lib/chef/knife/core/cookbook_scm_repo.rb +2 -3
- data/lib/chef/knife/core/node_presenter.rb +5 -2
- data/lib/chef/knife/help.rb +13 -12
- data/lib/chef/knife/help_topics.rb +4 -0
- data/lib/chef/knife/ssh.rb +25 -4
- data/lib/chef/mixin/create_path.rb +3 -2
- data/lib/chef/mixin/get_source_from_package.rb +42 -0
- data/lib/chef/mixin/language.rb +8 -11
- data/lib/chef/monkey_patches/numeric.rb +9 -1
- data/lib/chef/monkey_patches/string.rb +21 -0
- data/lib/chef/platform.rb +2 -1
- data/lib/chef/provider.rb +1 -1
- data/lib/chef/provider/git.rb +16 -3
- data/lib/chef/provider/group/suse.rb +53 -0
- data/lib/chef/provider/mount/mount.rb +28 -20
- data/lib/chef/provider/package/apt.rb +39 -24
- data/lib/chef/provider/package/dpkg.rb +5 -2
- data/lib/chef/provider/package/easy_install.rb +2 -2
- data/lib/chef/provider/package/freebsd.rb +5 -2
- data/lib/chef/provider/package/macports.rb +4 -4
- data/lib/chef/provider/package/rpm.rb +4 -1
- data/lib/chef/provider/package/rubygems.rb +3 -0
- data/lib/chef/provider/package/solaris.rb +3 -0
- data/lib/chef/provider/package/yum-dump.py +239 -81
- data/lib/chef/provider/package/yum.rb +977 -110
- data/lib/chef/provider/package/zypper.rb +20 -3
- data/lib/chef/provider/remote_directory.rb +0 -1
- data/lib/chef/provider/service/arch.rb +35 -28
- data/lib/chef/provider/service/systemd.rb +102 -0
- data/lib/chef/provider/service/upstart.rb +8 -2
- data/lib/chef/providers.rb +2 -0
- data/lib/chef/resource.rb +31 -2
- data/lib/chef/resource/git.rb +9 -0
- data/lib/chef/resource/mount.rb +1 -2
- data/lib/chef/resource/yum_package.rb +20 -0
- data/lib/chef/rest.rb +1 -1
- data/lib/chef/role.rb +1 -1
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/runner.rb +15 -2
- data/lib/chef/shell_out.rb +1 -1
- data/lib/chef/shell_out/windows.rb +2 -2
- data/lib/chef/solr_query.rb +1 -1
- data/lib/chef/tasks/chef_repo.rake +1 -1
- data/lib/chef/version.rb +1 -1
- metadata +425 -441
@@ -120,9 +120,9 @@ wiki, http://wiki.opscode.com/display/chef/Home.</p>
|
|
120
120
|
|
121
121
|
<h2 id="AUTHOR">AUTHOR</h2>
|
122
122
|
|
123
|
-
<p>Chef was written by Adam Jacob <a href="mailt&#
|
123
|
+
<p>Chef was written by Adam Jacob <a href="mailto:adam@ospcode.com" data-bare-link="true">adam@ospcode.com</a> of Opscode
|
124
124
|
(http://www.opscode.com), with contributions from the community. This
|
125
|
-
manual page was written by Joshua Timberman <a href="&#
|
125
|
+
manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a> with
|
126
126
|
help2man. Permission is granted to copy, distribute and / or modify
|
127
127
|
this document under the terms of the Apache 2.0 License.</p>
|
128
128
|
|
@@ -131,8 +131,8 @@ found in /usr/share/common-licenses/Apache-2.0.</p>
|
|
131
131
|
|
132
132
|
|
133
133
|
<ol class='man-decor man-foot man foot'>
|
134
|
-
<li class='tl'>Chef 0.10.
|
135
|
-
<li class='tc'>
|
134
|
+
<li class='tl'>Chef 0.10.0</li>
|
135
|
+
<li class='tc'>April 2011</li>
|
136
136
|
<li class='tr'>chef-client(8)</li>
|
137
137
|
</ol>
|
138
138
|
|
@@ -143,6 +143,8 @@
|
|
143
143
|
<dl>
|
144
144
|
<dt><code>-a</code>, <code>--all</code></dt><dd>upload all cookbooks, rather than just a single cookbook</dd>
|
145
145
|
<dt><code>-o</code>, <code>--cookbook-path path:path</code></dt><dd>a colon-separated path to look for cookbooks in</dd>
|
146
|
+
<dt><code>-d</code>, <code>--upload-dependencies</code></dt><dd>Uploads additional cookbooks that this cookbook lists in as
|
147
|
+
dependencies in its metadata.</dd>
|
146
148
|
<dt><code>-E</code>, <code>--environment ENVIRONMENT</code></dt><dd>An <em>ENVIRONMENT</em> to apply the uploaded cookbooks to. Specifying this
|
147
149
|
option will cause knife to edit the <em>ENVIRONMENT</em> to place a strict
|
148
150
|
version constraint on the cookbook version(s) uploaded.</dd>
|
@@ -350,11 +352,11 @@ cookbook.</p>
|
|
350
352
|
|
351
353
|
<h2 id="AUTHOR">AUTHOR</h2>
|
352
354
|
|
353
|
-
<p> Chef was written by Adam Jacob <a href="m&#
|
355
|
+
<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p>
|
354
356
|
|
355
357
|
<h2 id="DOCUMENTATION">DOCUMENTATION</h2>
|
356
358
|
|
357
|
-
<p> This manual page was written by Joshua Timberman <a href="&#
|
359
|
+
<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>.
|
358
360
|
Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p>
|
359
361
|
|
360
362
|
<h2 id="CHEF">CHEF</h2>
|
@@ -364,7 +366,7 @@ cookbook.</p>
|
|
364
366
|
|
365
367
|
<ol class='man-decor man-foot man foot'>
|
366
368
|
<li class='tl'>Chef 0.10.0</li>
|
367
|
-
<li class='tc'>
|
369
|
+
<li class='tc'>May 2011</li>
|
368
370
|
<li class='tr'>knife-cookbook(1)</li>
|
369
371
|
</ol>
|
370
372
|
|
@@ -247,11 +247,11 @@ run list, the correct syntax is "role[ROLE_NAME]"</p>
|
|
247
247
|
|
248
248
|
<h2 id="AUTHOR">AUTHOR</h2>
|
249
249
|
|
250
|
-
<p> Chef was written by Adam Jacob <a href="mail&#
|
250
|
+
<p> Chef was written by Adam Jacob <a href="mailto:adam@opscode.com" data-bare-link="true">adam@opscode.com</a> with many contributions from the community.</p>
|
251
251
|
|
252
252
|
<h2 id="DOCUMENTATION">DOCUMENTATION</h2>
|
253
253
|
|
254
|
-
<p> This manual page was written by Joshua Timberman <a href="&#
|
254
|
+
<p> This manual page was written by Joshua Timberman <a href="mailto:joshua@opscode.com" data-bare-link="true">joshua@opscode.com</a>.
|
255
255
|
Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License.</p>
|
256
256
|
|
257
257
|
<h2 id="CHEF">CHEF</h2>
|
@@ -260,8 +260,8 @@ run list, the correct syntax is "role[ROLE_NAME]"</p>
|
|
260
260
|
|
261
261
|
|
262
262
|
<ol class='man-decor man-foot man foot'>
|
263
|
-
<li class='tl'>Chef 0.10.
|
264
|
-
<li class='tc'>
|
263
|
+
<li class='tl'>Chef 0.10.0</li>
|
264
|
+
<li class='tc'>April 2011</li>
|
265
265
|
<li class='tr'>knife-node(1)</li>
|
266
266
|
</ol>
|
267
267
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "KNIFE\-COOKBOOK" "1" "
|
4
|
+
.TH "KNIFE\-COOKBOOK" "1" "May 2011" "Chef 0.10.0" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-cookbook\fR \- upload and manage chef cookbooks
|
@@ -82,6 +82,10 @@ upload all cookbooks, rather than just a single cookbook
|
|
82
82
|
a colon\-separated path to look for cookbooks in
|
83
83
|
.
|
84
84
|
.TP
|
85
|
+
\fB\-d\fR, \fB\-\-upload\-dependencies\fR
|
86
|
+
Uploads additional cookbooks that this cookbook lists in as dependencies in its metadata\.
|
87
|
+
.
|
88
|
+
.TP
|
85
89
|
\fB\-E\fR, \fB\-\-environment ENVIRONMENT\fR
|
86
90
|
An \fIENVIRONMENT\fR to apply the uploaded cookbooks to\. Specifying this option will cause knife to edit the \fIENVIRONMENT\fR to place a strict version constraint on the cookbook version(s) uploaded\.
|
87
91
|
.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "KNIFE\-NODE" "1" "
|
4
|
+
.TH "KNIFE\-NODE" "1" "April 2011" "Chef 0.10.0" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBknife\-node\fR \- Manage the hosts in your infrastructure
|
@@ -11,8 +11,8 @@ __knife__ __cookbook site__ _sub-command_ _(options)_
|
|
11
11
|
## INSTALL
|
12
12
|
__cookbook site install COOKBOOK [VERSION]__ _(options)_
|
13
13
|
|
14
|
-
* `-
|
15
|
-
|
14
|
+
* `-D`, `--no-dependencies `:
|
15
|
+
Do not install dependencies automatically
|
16
16
|
|
17
17
|
Uses git(1) version control in conjunction with the cookbook site to
|
18
18
|
install community contributed cookbooks to your local cookbook
|
@@ -31,7 +31,7 @@ changes as a separate patch. When an updated upstream version becomes
|
|
31
31
|
available, you will be able to merge the upstream changes while
|
32
32
|
maintaining your local modifications.
|
33
33
|
|
34
|
-
|
34
|
+
Unless _-D_ is specified, the process is applied recursively to all the
|
35
35
|
cookbooks _COOKBOOK_ depends on (via metadata _dependencies_).
|
36
36
|
|
37
37
|
## DOWNLOAD
|
@@ -46,6 +46,9 @@ __knife cookbook upload [cookbooks...]__ _(options)_
|
|
46
46
|
upload all cookbooks, rather than just a single cookbook
|
47
47
|
* `-o`, `--cookbook-path path:path`:
|
48
48
|
a colon-separated path to look for cookbooks in
|
49
|
+
* `-d`, `--upload-dependencies`:
|
50
|
+
Uploads additional cookbooks that this cookbook lists in as
|
51
|
+
dependencies in its metadata.
|
49
52
|
* `-E`, `--environment ENVIRONMENT`:
|
50
53
|
An _ENVIRONMENT_ to apply the uploaded cookbooks to. Specifying this
|
51
54
|
option will cause knife to edit the _ENVIRONMENT_ to place a strict
|
@@ -63,6 +66,10 @@ Uploads one or more cookbooks from your local cookbook repository(ies)
|
|
63
66
|
to the Chef Server. Only files that don't yet exist on the server will
|
64
67
|
be uploaded.
|
65
68
|
|
69
|
+
As the command parses the name args as 1..n cookbook names:
|
70
|
+
`knife cookbook upload COOKBOOK COOKBOOK ...`
|
71
|
+
works for one to many cookbooks.
|
72
|
+
|
66
73
|
## DOWNLOAD
|
67
74
|
__knife cookbook download cookbook [version]__ _(options)_
|
68
75
|
|
@@ -102,13 +102,14 @@ __knife node show__ _node name_ _(options)_
|
|
102
102
|
|
103
103
|
Displays the node identified by _node name_ on stdout. The amount of
|
104
104
|
content displayed and the output format are modified by the --format
|
105
|
-
option.
|
105
|
+
option. If no alternate format is selected, the default is summary.
|
106
|
+
Valid formats are:
|
106
107
|
|
107
108
|
* summary:
|
108
|
-
displays the node in a custom, summarized format
|
109
|
+
displays the node in a custom, summarized format (default)
|
109
110
|
* text
|
110
111
|
displays the node data in its entirety using the colorized tree
|
111
|
-
display
|
112
|
+
display
|
112
113
|
* json:
|
113
114
|
displays the node in JSON format
|
114
115
|
* yaml:
|
data/lib/chef/application.rb
CHANGED
data/lib/chef/cookbook_loader.rb
CHANGED
@@ -30,6 +30,8 @@ class Chef
|
|
30
30
|
|
31
31
|
attr_accessor :metadata
|
32
32
|
attr_reader :cookbooks_by_name
|
33
|
+
attr_reader :merged_cookbooks
|
34
|
+
attr_reader :cookbook_paths
|
33
35
|
|
34
36
|
include Enumerable
|
35
37
|
|
@@ -39,9 +41,23 @@ class Chef
|
|
39
41
|
@cookbooks_by_name = Mash.new
|
40
42
|
@loaded_cookbooks = {}
|
41
43
|
@metadata = Mash.new
|
44
|
+
@cookbooks_paths = Hash.new {|h,k| h[k] = []} # for deprecation warnings
|
45
|
+
|
46
|
+
# Used to track which cookbooks appear in multiple places in the cookbook repos
|
47
|
+
# and are merged in to a single cookbook by file shadowing. This behavior is
|
48
|
+
# deprecated, so users of this class may issue warnings to the user by checking
|
49
|
+
# this variable
|
50
|
+
@merged_cookbooks = []
|
51
|
+
|
42
52
|
load_cookbooks
|
43
53
|
end
|
44
54
|
|
55
|
+
def merged_cookbook_paths # for deprecation warnings
|
56
|
+
merged_cookbook_paths = {}
|
57
|
+
@merged_cookbooks.each {|c| merged_cookbook_paths[c] = @cookbooks_paths[c]}
|
58
|
+
merged_cookbook_paths
|
59
|
+
end
|
60
|
+
|
45
61
|
def load_cookbooks
|
46
62
|
cookbook_settings = Hash.new
|
47
63
|
@repo_paths.each do |repo_path|
|
@@ -52,7 +68,9 @@ class Chef
|
|
52
68
|
loader = Cookbook::CookbookVersionLoader.new(cookbook_path, chefignore)
|
53
69
|
loader.load_cookbooks
|
54
70
|
next if loader.empty?
|
71
|
+
@cookbooks_paths[loader.cookbook_name] << cookbook_path # for deprecation warnings
|
55
72
|
if @loaded_cookbooks.key?(loader.cookbook_name)
|
73
|
+
@merged_cookbooks << loader.cookbook_name # for deprecation warnings
|
56
74
|
@loaded_cookbooks[loader.cookbook_name].merge!(loader)
|
57
75
|
else
|
58
76
|
@loaded_cookbooks[loader.cookbook_name] = loader
|
@@ -134,7 +134,7 @@ class Chef
|
|
134
134
|
RestClient::Resource.new(url, :headers=>headers, :timeout=>1800, :open_timeout=>1800).put(file_contents)
|
135
135
|
checksums_to_upload.delete(checksum)
|
136
136
|
rescue RestClient::Exception => e
|
137
|
-
ui.error("Failed to upload #@cookbook : #{e.message}\n#{e.response.body}")
|
137
|
+
Chef::Knife.ui.error("Failed to upload #@cookbook : #{e.message}\n#{e.response.body}")
|
138
138
|
raise
|
139
139
|
end
|
140
140
|
end
|
data/lib/chef/data_bag.rb
CHANGED
@@ -152,9 +152,21 @@ class Chef
|
|
152
152
|
(couchdb || Chef::CouchDB.new).load("data_bag", name)
|
153
153
|
end
|
154
154
|
|
155
|
-
# Load a Data Bag by name via the RESTful API
|
155
|
+
# Load a Data Bag by name via either the RESTful API or local data_bag_path if run in solo mode
|
156
156
|
def self.load(name)
|
157
|
-
Chef::
|
157
|
+
if Chef::Config[:solo]
|
158
|
+
unless File.directory?(Chef::Config[:data_bag_path])
|
159
|
+
raise Chef::Exceptions::InvalidDataBagPath, "Data bag path '#{Chef::Config[:data_bag_path]}' is invalid"
|
160
|
+
end
|
161
|
+
|
162
|
+
Dir.glob(File.join(Chef::Config[:data_bag_path], name, "*.json")).inject({}) do |bag, f|
|
163
|
+
item = JSON.parse(IO.read(f))
|
164
|
+
bag[item['id']] = item
|
165
|
+
bag
|
166
|
+
end
|
167
|
+
else
|
168
|
+
Chef::REST.new(Chef::Config[:chef_server_url]).get_rest("data/#{name}")
|
169
|
+
end
|
158
170
|
end
|
159
171
|
|
160
172
|
# Remove this Data Bag from CouchDB
|
data/lib/chef/data_bag_item.rb
CHANGED
@@ -187,9 +187,15 @@ class Chef
|
|
187
187
|
(couchdb || Chef::CouchDB.new).load("data_bag_item", object_name(data_bag, name))
|
188
188
|
end
|
189
189
|
|
190
|
-
# Load a Data Bag Item by name via RESTful API
|
190
|
+
# Load a Data Bag Item by name via either the RESTful API or local data_bag_path if run in solo mode
|
191
191
|
def self.load(data_bag, name)
|
192
|
-
|
192
|
+
if Chef::Config[:solo]
|
193
|
+
bag = Chef::DataBag.load(data_bag)
|
194
|
+
item = bag[name]
|
195
|
+
else
|
196
|
+
item = Chef::REST.new(Chef::Config[:chef_server_url]).get_rest("data/#{data_bag}/#{name}")
|
197
|
+
end
|
198
|
+
|
193
199
|
if item.kind_of?(DataBagItem)
|
194
200
|
item
|
195
201
|
else
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Seth Falcon (<seth@opscode.com>)
|
3
|
-
# Copyright:: Copyright 2010 Opscode, Inc.
|
3
|
+
# Copyright:: Copyright 2010-2011 Opscode, Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -20,6 +20,7 @@ require 'base64'
|
|
20
20
|
require 'openssl'
|
21
21
|
require 'chef/data_bag_item'
|
22
22
|
require 'yaml'
|
23
|
+
require 'open-uri'
|
23
24
|
|
24
25
|
# An EncryptedDataBagItem represents a read-only data bag item where
|
25
26
|
# all values, except for the value associated with the id key, have
|
@@ -56,7 +57,7 @@ class Chef::EncryptedDataBagItem
|
|
56
57
|
|
57
58
|
def [](key)
|
58
59
|
value = @enc_hash[key]
|
59
|
-
if key == "id"
|
60
|
+
if key == "id" || value.nil?
|
60
61
|
value
|
61
62
|
else
|
62
63
|
self.class.decrypt_value(value, @secret)
|
@@ -103,10 +104,22 @@ class Chef::EncryptedDataBagItem
|
|
103
104
|
|
104
105
|
def self.load_secret(path=nil)
|
105
106
|
path = path || Chef::Config[:encrypted_data_bag_secret] || DEFAULT_SECRET_FILE
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
107
|
+
secret = case path
|
108
|
+
when /^\w+:\/\//
|
109
|
+
# We have a remote key
|
110
|
+
begin
|
111
|
+
Kernel.open(path).read.strip
|
112
|
+
rescue Errno::ECONNREFUSED
|
113
|
+
raise ArgumentError, "Remote key not available from '#{path}'"
|
114
|
+
rescue OpenURI::HTTPError
|
115
|
+
raise ArgumentError, "Remote key not found at '#{path}'"
|
116
|
+
end
|
117
|
+
else
|
118
|
+
if !File.exists?(path)
|
119
|
+
raise Errno::ENOENT, "file not found '#{path}'"
|
120
|
+
end
|
121
|
+
IO.read(path).strip
|
122
|
+
end
|
110
123
|
if secret.size < 1
|
111
124
|
raise ArgumentError, "invalid zero length secret in '#{path}'"
|
112
125
|
end
|
data/lib/chef/environment.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Stephen Delano (<stephen@opscode.com>)
|
3
3
|
# Author:: Seth Falcon (<seth@opscode.com>)
|
4
|
+
# Author:: John Keiser (<jkeiser@ospcode.com>)
|
4
5
|
# Copyright:: Copyright 2010-2011 Opscode, Inc.
|
5
6
|
# License:: Apache License, Version 2.0
|
6
7
|
#
|
@@ -398,12 +399,17 @@ class Chef
|
|
398
399
|
|
399
400
|
def self.cdb_load_filtered_recipe_list(name, couchdb=nil)
|
400
401
|
cdb_load_filtered_cookbook_versions(name, couchdb).map do |cb_name, cb|
|
401
|
-
cb.
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
402
|
+
if cb.empty? # no available versions
|
403
|
+
[] # empty list elided with flatten
|
404
|
+
else
|
405
|
+
latest_version = cb.first
|
406
|
+
latest_version.recipe_filenames_by_name.keys.map do |recipe|
|
407
|
+
case recipe
|
408
|
+
when DEFAULT
|
409
|
+
cb_name
|
410
|
+
else
|
411
|
+
"#{cb_name}::#{recipe}"
|
412
|
+
end
|
407
413
|
end
|
408
414
|
end
|
409
415
|
end.flatten
|
data/lib/chef/exceptions.rb
CHANGED
@@ -76,6 +76,7 @@ class Chef
|
|
76
76
|
class EnclosingDirectoryDoesNotExist < ArgumentError; end
|
77
77
|
|
78
78
|
class ObsoleteDependencySyntax < ArgumentError; end
|
79
|
+
class InvalidDataBagPath < ArgumentError; end
|
79
80
|
|
80
81
|
# A different version of a cookbook was added to a
|
81
82
|
# VersionedRecipeList than the one already there.
|
data/lib/chef/knife.rb
CHANGED
@@ -497,34 +497,6 @@ class Chef
|
|
497
497
|
self.msg("Deleted #{obj_name}")
|
498
498
|
end
|
499
499
|
|
500
|
-
def bulk_delete(klass, fancy_name, delete_name=nil, list=nil, regex=nil, &block)
|
501
|
-
object_list = list ? list : klass.list(true)
|
502
|
-
|
503
|
-
if regex
|
504
|
-
to_delete = Hash.new
|
505
|
-
object_list.each_key do |object|
|
506
|
-
next if regex && object !~ /#{regex}/
|
507
|
-
to_delete[object] = object_list[object]
|
508
|
-
end
|
509
|
-
else
|
510
|
-
to_delete = object_list
|
511
|
-
end
|
512
|
-
|
513
|
-
output(format_list_for_display(to_delete))
|
514
|
-
|
515
|
-
confirm("Do you really want to delete the above items")
|
516
|
-
|
517
|
-
to_delete.each do |name, object|
|
518
|
-
if Kernel.block_given?
|
519
|
-
block.call(name, object)
|
520
|
-
else
|
521
|
-
object.destroy
|
522
|
-
end
|
523
|
-
output(format_for_display(object)) if config[:print_after]
|
524
|
-
self.msg("Deleted #{fancy_name} #{name}")
|
525
|
-
end
|
526
|
-
end
|
527
|
-
|
528
500
|
def rest
|
529
501
|
@rest ||= begin
|
530
502
|
require 'chef/rest'
|
data/lib/chef/knife/bootstrap.rb
CHANGED
@@ -72,6 +72,11 @@ class Chef
|
|
72
72
|
:description => "The version of Chef to install",
|
73
73
|
:proc => lambda { |v| Chef::Config[:knife][:bootstrap_version] = v }
|
74
74
|
|
75
|
+
option :bootstrap_proxy,
|
76
|
+
:long => "--bootstrap-proxy PROXY_URL",
|
77
|
+
:description => "The proxy server for the node being bootstrapped",
|
78
|
+
:proc => Proc.new { |p| Chef::Config[:knife][:bootstrap_proxy] = p }
|
79
|
+
|
75
80
|
option :distro,
|
76
81
|
:short => "-d DISTRO",
|
77
82
|
:long => "--distro DISTRO",
|
@@ -110,6 +115,7 @@ class Chef
|
|
110
115
|
bootstrap_files << File.join(File.dirname(__FILE__), 'bootstrap', "#{config[:distro]}.erb")
|
111
116
|
bootstrap_files << File.join(Dir.pwd, ".chef", "bootstrap", "#{config[:distro]}.erb")
|
112
117
|
bootstrap_files << File.join(ENV['HOME'], '.chef', 'bootstrap', "#{config[:distro]}.erb")
|
118
|
+
bootstrap_files << Gem.find_files(File.join("chef","knife","bootstrap","#{config[:distro]}.erb"))
|
113
119
|
end
|
114
120
|
|
115
121
|
template = Array(bootstrap_files).find do |bootstrap_template|
|
@@ -166,6 +172,7 @@ class Chef
|
|
166
172
|
|
167
173
|
def knife_ssh
|
168
174
|
ssh = Chef::Knife::Ssh.new
|
175
|
+
ssh.ui = ui
|
169
176
|
ssh.name_args = [ server_name, ssh_command ]
|
170
177
|
ssh.config[:ssh_user] = config[:ssh_user]
|
171
178
|
ssh.config[:ssh_password] = config[:ssh_password]
|
@@ -1,4 +1,6 @@
|
|
1
1
|
bash -c '
|
2
|
+
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
|
3
|
+
|
2
4
|
if [ ! -f /usr/bin/chef-client ]; then
|
3
5
|
pacman -Syy
|
4
6
|
pacman -S --noconfirm ruby ntp base-devel
|
@@ -10,7 +12,7 @@ fi
|
|
10
12
|
mkdir -p /etc/chef
|
11
13
|
(
|
12
14
|
cat <<'EOP'
|
13
|
-
<%=
|
15
|
+
<%= validation_key %>
|
14
16
|
EOP
|
15
17
|
) > /tmp/validation.pem
|
16
18
|
awk NF /tmp/validation.pem > /etc/chef/validation.pem
|
@@ -20,21 +22,22 @@ rm /tmp/validation.pem
|
|
20
22
|
cat <<'EOP'
|
21
23
|
log_level :info
|
22
24
|
log_location STDOUT
|
23
|
-
chef_server_url "<%=
|
24
|
-
validation_client_name "<%=
|
25
|
-
<% if @config[:chef_node_name]
|
26
|
-
# Using default node name (fqdn)
|
27
|
-
<% else %>
|
25
|
+
chef_server_url "<%= @chef_config[:chef_server_url] %>"
|
26
|
+
validation_client_name "<%= @chef_config[:validation_client_name] %>"
|
27
|
+
<% if @config[:chef_node_name] -%>
|
28
28
|
node_name "<%= @config[:chef_node_name] %>"
|
29
|
-
<%
|
30
|
-
|
31
|
-
|
32
|
-
<% end %>
|
29
|
+
<% else -%>
|
30
|
+
# Using default node name (fqdn)
|
31
|
+
<% end -%>
|
33
32
|
# ArchLinux follows the Filesystem Hierarchy Standard
|
34
33
|
file_cache_path "/var/cache/chef"
|
35
34
|
file_backup_path "/var/lib/chef/backup"
|
36
35
|
pid_file "/var/run/chef/client.pid"
|
37
36
|
cache_options({ :path => "/var/cache/chef/checksums", :skip_expires => true})
|
37
|
+
<% if knife_config[:bootstrap_proxy] %>
|
38
|
+
http_proxy "<%= knife_config[:bootstrap_proxy] %>"
|
39
|
+
https_proxy "<%= knife_config[:bootstrap_proxy] %>"
|
40
|
+
<% end -%>
|
38
41
|
EOP
|
39
42
|
) > /etc/chef/client.rb
|
40
43
|
|
@@ -44,5 +47,4 @@ cat <<'EOP'
|
|
44
47
|
EOP
|
45
48
|
) > /etc/chef/first-boot.json
|
46
49
|
|
47
|
-
|
48
|
-
'
|
50
|
+
<%= start_chef %>'
|