chef 0.10.4.rc.3 → 0.10.4.rc.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@ class Chef
26
26
  class Apt < Chef::Provider::Package
27
27
 
28
28
  include Chef::Mixin::ShellOut
29
- attr_accessor :virtual
29
+ attr_accessor :is_virtual_package
30
30
 
31
31
  def load_current_resource
32
32
  @current_resource = Chef::Resource::Package.new(@new_resource.name)
@@ -36,14 +36,15 @@ class Chef
36
36
  end
37
37
 
38
38
  def check_package_state(package)
39
- Chef::Log.debug("Checking package status for #{package}")
39
+ Chef::Log.debug("#{@new_resource} checking package status for #{package}")
40
40
  installed = false
41
- depends = false
42
41
 
43
42
  shell_out!("aptitude show #{package}").stdout.each_line do |line|
44
43
  case line
45
44
  when /^State: installed/
46
45
  installed = true
46
+ when /^State: not a real package/
47
+ @is_virtual_package = true
47
48
  when /^Version: (.*)/
48
49
  @candidate_version = $1
49
50
  if installed
@@ -51,18 +52,16 @@ class Chef
51
52
  else
52
53
  @current_resource.version(nil)
53
54
  end
54
- # Grab the first package in the dependency list to resolve case where a virtual package is provided by more than one package
55
- when /Depends: ([\w\d\-\.]*)/
56
- depends = $1
57
- # Check to see if this is a virtual package
58
- when /Provided by: ([\w\d\-\.]*)/
59
- next if installed
55
+ # If we are a virtual package with one provider package, install it
56
+ when /^Provided by: ([\w\d\-\.]*)$/
57
+ next unless @is_virtual_package
60
58
  virtual_provider = $1
61
- virtual_provider = depends if depends
62
- Chef::Log.debug("Virtual package provided by #{virtual_provider}")
63
- @virtual = true
59
+ Chef::Log.info("#{@new_resource} is a virtual package, actually acting on package[#{virtual_provider}]")
64
60
  installed = check_package_state(virtual_provider)
65
- @candidate_version = virtual_provider
61
+ # If there is a comma, it is a list of packages. In this case fail to force the user to choose.
62
+ when /^Provided by: .*,/
63
+ next unless @is_virtual_package
64
+ raise Chef::Exceptions::Package, "#{@new_resource.package_name} is a virtual package provided by multiple packages, you must explicitly select one to install"
66
65
  end
67
66
  end
68
67
 
@@ -75,7 +74,7 @@ class Chef
75
74
 
76
75
  def install_package(name, version)
77
76
  package_name = "#{name}=#{version}"
78
- package_name = "#{name} #{@candidate_version}" if @virtual
77
+ package_name = name if @is_virtual_package
79
78
  run_command_with_systems_locale(
80
79
  :command => "apt-get -q -y#{expand_options(@new_resource.options)} install #{package_name}",
81
80
  :environment => {
@@ -90,7 +89,6 @@ class Chef
90
89
 
91
90
  def remove_package(name, version)
92
91
  package_name = "#{name}"
93
- package_name = "#{name} #{@candidate_version}" if @virtual
94
92
  run_command_with_systems_locale(
95
93
  :command => "apt-get -q -y#{expand_options(@new_resource.options)} remove #{package_name}",
96
94
  :environment => {
data/lib/chef/version.rb CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  class Chef
19
19
  CHEF_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__)))
20
- VERSION = '0.10.4.rc.3'
20
+ VERSION = '0.10.4.rc.4'
21
21
  end
22
22
 
23
23
  # NOTE: the Chef::Version class is defined in version_class.rb
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424147
4
+ hash: 15424157
5
5
  prerelease: 7
6
6
  segments:
7
7
  - 0
8
8
  - 10
9
9
  - 4
10
10
  - rc
11
- - 3
12
- version: 0.10.4.rc.3
11
+ - 4
12
+ version: 0.10.4.rc.4
13
13
  platform: ruby
14
14
  authors:
15
15
  - Adam Jacob
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-07-28 00:00:00 Z
20
+ date: 2011-08-02 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: mixlib-config
@@ -307,30 +307,6 @@ files:
307
307
  - distro/common/html/chef-expander.8.html
308
308
  - distro/common/html/knife-bootstrap.1.html
309
309
  - distro/common/html/knife-cookbook-site.1.html
310
- - distro/common/man/man1/knife-ssh.1
311
- - distro/common/man/man1/knife-environment.1
312
- - distro/common/man/man1/knife-bootstrap.1
313
- - distro/common/man/man1/knife-cookbook.1
314
- - distro/common/man/man1/knife-exec.1
315
- - distro/common/man/man1/knife-tag.1
316
- - distro/common/man/man1/knife-status.1
317
- - distro/common/man/man1/knife.1
318
- - distro/common/man/man1/knife-data-bag.1
319
- - distro/common/man/man1/knife-index.1
320
- - distro/common/man/man1/knife-configure.1
321
- - distro/common/man/man1/knife-search.1
322
- - distro/common/man/man1/knife-node.1
323
- - distro/common/man/man1/knife-client.1
324
- - distro/common/man/man1/shef.1
325
- - distro/common/man/man1/knife-role.1
326
- - distro/common/man/man1/knife-cookbook-site.1
327
- - distro/common/man/man8/chef-server.8
328
- - distro/common/man/man8/chef-client.8
329
- - distro/common/man/man8/chef-server-webui.8
330
- - distro/common/man/man8/chef-expander.8
331
- - distro/common/man/man8/chef-solo.8
332
- - distro/common/man/man8/chef-expanderctl.8
333
- - distro/common/man/man8/chef-solr.8
334
310
  - distro/common/markdown/man1/knife-ssh.mkd
335
311
  - distro/common/markdown/man1/knife-role.mkd
336
312
  - distro/common/markdown/man1/knife-cookbook.mkd
@@ -1,189 +0,0 @@
1
- .\" generated with Ronn/v0.7.3
2
- .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
- .
4
- .TH "KNIFE\-BOOTRAP" "1" "April 2011" "Chef 0.10.0" "Chef Manual"
5
- .
6
- .SH "NAME"
7
- \fBknife\-bootrap\fR \- Install Chef Client on a remote host
8
- .
9
- .SH "SYNOPSIS"
10
- \fBknife\fR \fBbootstrap\fR \fI(options)\fR
11
- .
12
- .TP
13
- \fB\-i\fR, \fB\-\-identity\-file IDENTITY_FILE\fR
14
- The SSH identity file used for authentication
15
- .
16
- .TP
17
- \fB\-N\fR, \fB\-\-node\-name NAME\fR
18
- The Chef node name for your new node
19
- .
20
- .TP
21
- \fB\-P\fR, \fB\-\-ssh\-password PASSWORD\fR
22
- The ssh password
23
- .
24
- .TP
25
- \fB\-x\fR, \fB\-\-ssh\-user USERNAME\fR
26
- The ssh username
27
- .
28
- .TP
29
- \fB\-\-prerelease\fR
30
- Install pre\-release Chef gems
31
- .
32
- .TP
33
- \fB\-r\fR, \fB\-\-run\-list RUN_LIST\fR
34
- Comma separated list of roles/recipes to apply
35
- .
36
- .TP
37
- \fB\-P\fR, \fB\-\-ssh\-password PASSWORD\fR
38
- The ssh password
39
- .
40
- .TP
41
- \fB\-x\fR, \fB\-\-ssh\-user USERNAME\fR
42
- The ssh username
43
- .
44
- .TP
45
- \fB\-\-template\-file TEMPLATE\fR
46
- Full path to location of template to use
47
- .
48
- .TP
49
- \fB\-\-sudo\fR
50
- Execute the bootstrap via sudo
51
- .
52
- .TP
53
- \fB\-d\fR, \fB\-\-distro DISTRO\fR
54
- Bootstrap a distro using a template
55
- .
56
- .SH "DESCRIPTION"
57
- Performs a Chef Bootstrap on the target node\. The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server\. The main assumption is a baseline OS installation exists\. This sub\-command is used internally by some cloud computing plugins\.
58
- .
59
- .P
60
- The bootstrap sub\-command supports supplying a template to perform the bootstrap steps\. If the distro is not specified (via \fB\-d\fR or \fB\-\-distro\fR option), an Ubuntu 10\.04 host bootstrapped with RubyGems is assumed\. The \fBDISTRO\fR value corresponds to the base filename of the template, in other words \fBDISTRO\fR\.erb\. A template file can be specified with the \fB\-\-template\-file\fR option in which case the \fBDISTRO\fR is not used\. The sub\-command looks in the following locations for the template to use:
61
- .
62
- .IP "\(bu" 4
63
- \fBbootstrap\fR directory in the installed Chef Knife library\.
64
- .
65
- .IP "\(bu" 4
66
- \fBbootstrap\fR directory in the \fB$PWD/\.chef\fR\.
67
- .
68
- .IP "\(bu" 4
69
- \fBbootstrap\fR directory in the users \fB$HOME/\.chef\fR\.
70
- .
71
- .IP "" 0
72
- .
73
- .P
74
- The default bootstrap templates are scripts that get copied to the target node (FQDN)\. The following distros are supported:
75
- .
76
- .IP "\(bu" 4
77
- centos5\-gems
78
- .
79
- .IP "\(bu" 4
80
- fedora13\-gems
81
- .
82
- .IP "\(bu" 4
83
- ubuntu10\.04\-gems
84
- .
85
- .IP "\(bu" 4
86
- ubuntu10\.04\-apt
87
- .
88
- .IP "" 0
89
- .
90
- .P
91
- The gems installations will use RubyGems 1\.3\.6 and Chef installed as a gem\. The apt installation will use the Opscode APT repository\. The RubyGems installation requires installing gems with native extensions, so development related packages (ruby\-dev, build\-essential) are installed\. These are not installed with the apt installation, as native extensions are already compiled in the required packages\.
92
- .
93
- .P
94
- In addition to handling the software installation, these bootstrap templates do the following:
95
- .
96
- .IP "\(bu" 4
97
- Write the validation\.pem per the local knife configuration\.
98
- .
99
- .IP "\(bu" 4
100
- Write a default config file for Chef (\fB/etc/chef/client\.rb\fR) using values from the \fBknife\.rb\fR\.
101
- .
102
- .IP "\(bu" 4
103
- Create a JSON attributes file containing the specified run list and run Chef\.
104
- .
105
- .IP "" 0
106
- .
107
- .P
108
- In the case of the RubyGems, the \fBclient\.rb\fR will be written from scratch with a minimal set of values; see \fBEXAMPLES\fR\. In the case of APT Package installation, \fBclient\.rb\fR will have the \fBvalidation_client_name\fR appended if it is not set to \fBchef\-validator\fR (default config value), and the \fBnode_name\fR will be added if \fBchef_node_name\fR option is specified\.
109
- .
110
- .P
111
- When this is complete, the bootstrapped node will have:
112
- .
113
- .IP "\(bu" 4
114
- Latest Chef version installed from RubyGems or APT Packages from Opscode\. This may be a later version than the local system\.
115
- .
116
- .IP "\(bu" 4
117
- Be validated with the configured Chef Server\.
118
- .
119
- .IP "\(bu" 4
120
- Have run Chef with its default run list if one is specfied\.
121
- .
122
- .IP "" 0
123
- .
124
- .P
125
- Additional custom bootstrap templates can be created and stored in \fB\.chef/bootstrap/DISTRO\.erb\fR, replacing \fBDISTRO\fR with the value passed with the \fB\-d\fR or \fB\-\-distro\fR option\. See \fBEXAMPLES\fR for more information\.
126
- .
127
- .SH "EXAMPLES"
128
- Setting up a custom bootstrap is fairly straightforward\. Create a \fB\.chef/bootstrap\fR directory in your Chef Repository or in \fB$HOME/\.chef/bootstrap\fR\. Then create the ERB template file\.
129
- .
130
- .IP "" 4
131
- .
132
- .nf
133
-
134
- mkdir ~/\.chef/bootstrap
135
- vi ~/\.chef/bootstrap/debian5\.0\-apt\.erb
136
- .
137
- .fi
138
- .
139
- .IP "" 0
140
- .
141
- .P
142
- For example, to create a new bootstrap template that should be used when setting up a new Debian node\. Edit the template to run the commands, set up the validation certificate and the client configuration file, and finally to run chef\-client on completion\. The bootstrap template can be called with:
143
- .
144
- .IP "" 4
145
- .
146
- .nf
147
-
148
- knife bootstrap mynode\.example\.com \-\-template\-file ~/\.chef/bootstrap/debian5\.0\-apt\.erb
149
- .
150
- .fi
151
- .
152
- .IP "" 0
153
- .
154
- .P
155
- Or,
156
- .
157
- .IP "" 4
158
- .
159
- .nf
160
-
161
- knife bootstrap mynode\.example\.com \-\-distro debian5\.0\-apt
162
- .
163
- .fi
164
- .
165
- .IP "" 0
166
- .
167
- .P
168
- The \fB\-\-distro\fR parameter will automatically look in the \fB~/\.chef/bootstrap\fR directory for a file named \fBdebian5\.0\-apt\.erb\fR\.
169
- .
170
- .P
171
- Templates provided by the Chef installation are located in \fBBASEDIR/lib/chef/knife/bootstrap/*\.erb\fR, where \fIBASEDIR\fR is the location where the package or Gem installed the Chef client libraries\.
172
- .
173
- .SH "BUGS"
174
- \fBknife bootstrap\fR is not capable of bootstrapping multiple hosts in parallel\.
175
- .
176
- .P
177
- The bootstrap script is passed as an argument to sh(1) on the remote system, so sensitive information contained in the script will be visible to other users via the process list using tools such as ps(1)\.
178
- .
179
- .SH "SEE ALSO"
180
- \fBknife\-ssh\fR(1)
181
- .
182
- .SH "AUTHOR"
183
- Chef was written by Adam Jacob \fIadam@opscode\.com\fR with many contributions from the community\.
184
- .
185
- .SH "DOCUMENTATION"
186
- This manual page was written by Joshua Timberman \fIjoshua@opscode\.com\fR\. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2\.0 License\.
187
- .
188
- .SH "CHEF"
189
- Knife is distributed with Chef\. \fIhttp://wiki\.opscode\.com/display/chef/Home\fR
@@ -1,99 +0,0 @@
1
- .\" generated with Ronn/v0.7.3
2
- .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
- .
4
- .TH "KNIFE\-CLIENT" "1" "April 2011" "Chef 0.10.0" "Chef Manual"
5
- .
6
- .SH "NAME"
7
- \fBknife\-client\fR \- Manage Chef API Clients
8
- .
9
- .SH "SYNOPSIS"
10
- \fBknife\fR \fBclient\fR \fIsub\-command\fR \fI(options)\fR
11
- .
12
- .SH "SUB\-COMMANDS"
13
- Client subcommands follow a basic create, read, update, delete (CRUD) pattern\. The Following subcommands are available:
14
- .
15
- .SH "BULK DELETE"
16
- \fBknife client bulk delete\fR \fIregex\fR \fI(options)\fR
17
- .
18
- .P
19
- Delete clients where the client name matches the regular expression \fIregex\fR on the Chef Server\. The regular expression should be given as a quoted string, and not surrounded by forward slashes\.
20
- .
21
- .SH "CREATE"
22
- \fBknife client create\fR \fIclient name\fR \fI(options)\fR
23
- .
24
- .TP
25
- \fB\-a\fR, \fB\-\-admin\fR
26
- Create the client as an admin
27
- .
28
- .TP
29
- \fB\-f\fR, \fB\-\-file FILE\fR
30
- Write the key to a file
31
- .
32
- .P
33
- Create a new client\. This generates an RSA keypair\. The private key will be displayed on \fISTDOUT\fR or written to the named file\. The public half will be stored on the Server\. For \fIchef\-client\fR systems, the private key should be copied to the system as \fB/etc/chef/client\.pem\fR\.
34
- .
35
- .P
36
- Admin clients should be created for users that will use \fIknife\fR to access the API as an administrator\. The private key will generally be copied to \fB~/\.chef/client\e_name\.pem\fR and referenced in the \fBknife\.rb\fR configuration file\.
37
- .
38
- .SH "DELETE"
39
- \fBknife client delete\fR \fIclient name\fR \fI(options)\fR
40
- .
41
- .P
42
- Deletes a registered client\.
43
- .
44
- .SH "EDIT"
45
- \fBclient edit\fR \fIclient name\fR \fI(options)\fR
46
- .
47
- .P
48
- Edit a registered client\.
49
- .
50
- .SH "LIST"
51
- \fBclient list\fR \fI(options)\fR
52
- .
53
- .TP
54
- \fB\-w\fR, \fB\-\-with\-uri\fR
55
- Show corresponding URIs
56
- .
57
- .P
58
- List all registered clients\.
59
- .
60
- .SH "REREGISTER"
61
- \fBclient reregister\fR \fIclient name\fR \fI(options)\fR
62
- .
63
- .TP
64
- \fB\-f\fR, \fB\-\-file FILE\fR
65
- Write the key to a file
66
- .
67
- .P
68
- Regenerate the RSA keypair for a client\. The public half will be stored on the server and the private key displayed on \fISTDOUT\fR or written to the named file\. This operation will invalidate the previous keypair used by the client, preventing it from authenticating with the Chef Server\. Use care when reregistering the validator client\.
69
- .
70
- .SH "SHOW"
71
- \fBclient show\fR \fIclient name\fR \fI(options)\fR
72
- .
73
- .TP
74
- \fB\-a\fR, \fB\-\-attribute ATTR\fR
75
- Show only one attribute
76
- .
77
- .P
78
- Show a client\. Output format is determined by the \-\-format option\.
79
- .
80
- .SH "DESCRIPTION"
81
- Clients are identities used for communication with the Chef Server API, roughly equivalent to user accounts on the Chef Server, except that clients only communicate with the Chef Server API and are authenticated via request signatures\.
82
- .
83
- .P
84
- In the typical case, there will be one client object on the server for each node, and the corresponding client and node will have identical names\.
85
- .
86
- .P
87
- In the Chef authorization model, there is one special client, the "validator", which is authorized to create new non\-administrative clients but has minimal privileges otherwise\. This identity is used as a sort of "guest account" to create a client identity when initially setting up a host for management with Chef\.
88
- .
89
- .SH "SEE ALSO"
90
- \fBknife\-node\fR(1)
91
- .
92
- .SH "AUTHOR"
93
- Chef was written by Adam Jacob \fIadam@opscode\.com\fR with many contributions from the community\.
94
- .
95
- .SH "DOCUMENTATION"
96
- This manual page was written by Joshua Timberman \fIjoshua@opscode\.com\fR\. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2\.0 License\.
97
- .
98
- .SH "CHEF"
99
- Knife is distributed with Chef\. \fIhttp://wiki\.opscode\.com/display/chef/Home\fR
@@ -1,88 +0,0 @@
1
- .\" generated with Ronn/v0.7.3
2
- .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
- .
4
- .TH "KNIFE\-CONFIGURE" "1" "April 2011" "Chef 0.10.0" "Chef Manual"
5
- .
6
- .SH "NAME"
7
- \fBknife\-configure\fR \- Generate configuration files for knife or Chef Client
8
- .
9
- .SH "SYNOPSIS"
10
- \fBknife\fR \fBconfigure\fR [client] \fI(options)\fR
11
- .
12
- .SH "DESCRIPTION"
13
- Generates a knife\.rb configuration file interactively\. When given the \-\-initial option, also creates a new administrative user\.
14
- .
15
- .SH "CONFIGURE SUBCOMMANDS"
16
- \fBknife configure\fR \fI(options)\fR
17
- .
18
- .TP
19
- \fB\-i\fR, \fB\-\-initial\fR
20
- Create an initial API Client
21
- .
22
- .TP
23
- \fB\-r\fR, \fB\-\-repository REPO\fR
24
- The path to your chef\-repo
25
- .
26
- .P
27
- Create a configuration file for knife\. This will prompt for values to enter into the file\. Default values are listed in square brackets if no other entry is typed\. See \fBknife\fR(1) for a description of configuration options\.
28
- .
29
- .P
30
- \fBknife configure client\fR \fIdirectory\fR
31
- .
32
- .P
33
- Read the \fIknife\.rb\fR config file and generate a config file suitable for use in \fI/etc/chef/client\.rb\fR and copy the validation certificate into the specified \fIdirectory\fR\.
34
- .
35
- .SH "EXAMPLES"
36
- .
37
- .IP "\(bu" 4
38
- On a freshly installed Chef Server, use \fIknife configure \-i\fR to create an administrator and knife configuration file\. Leave the field blank to accept the default value\. On most systems, the default values are acceptable\.
39
- .
40
- .IP
41
- user@host$ knife configure \-i
42
- .
43
- .br
44
- Please enter the chef server URL: [http://localhost:4000]
45
- .
46
- .br
47
- Please enter a clientname for the new client: [username]
48
- .
49
- .br
50
- Please enter the existing admin clientname: [chef\-webui]
51
- .
52
- .br
53
- Please enter the location of the existing admin client\'s private key: [/etc/chef/webui\.pem]
54
- .
55
- .br
56
- Please enter the validation clientname: [chef\-validator]
57
- .
58
- .br
59
- Please enter the location of the validation key: [/etc/chef/validation\.pem]
60
- .
61
- .br
62
- Please enter the path to a chef repository (or leave blank):
63
- .
64
- .br
65
- Creating initial API user\.\.\.
66
- .
67
- .br
68
- Created (or updated) client[username]
69
- .
70
- .br
71
- Configuration file written to /home/username/\.chef/knife\.rb
72
- .
73
- .IP
74
- This creates a new administrator client named \fIusername\fR, writes a configuration file to \fI/home/username/\.chef/knife\.rb\fR, and the private key to \fI/home/username/\.chef/username\.pem\fR\. The configuration file and private key may be copied to another system to facilitate administration of the Chef Server from a remote system\. Depending on the value given for the Chef Server URL, you may need to modify that setting after copying to a remote host\.
75
- .
76
- .IP "" 0
77
- .
78
- .SH "SEE ALSO"
79
- \fBknife\fR(1) \fBknife\-client\fR(1)
80
- .
81
- .SH "AUTHOR"
82
- Chef was written by Adam Jacob \fIadam@opscode\.com\fR with many contributions from the community\.
83
- .
84
- .SH "DOCUMENTATION"
85
- This manual page was written by Joshua Timberman \fIjoshua@opscode\.com\fR\. Permission is granted to copy, distribute and / or modify this document under the terms of the Apache 2\.0 License\.
86
- .
87
- .SH "CHEF"
88
- Knife is distributed with Chef\. \fIhttp://wiki\.opscode\.com/display/chef/Home\fR