chef 10.26.0 → 10.28.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- data/distro/common/html/chef-client.8.html +4 -4
- data/distro/common/html/chef-expander.8.html +4 -4
- data/distro/common/html/chef-expanderctl.8.html +4 -4
- data/distro/common/html/chef-server-webui.8.html +4 -4
- data/distro/common/html/chef-server.8.html +4 -4
- data/distro/common/html/chef-solo.8.html +12 -18
- data/distro/common/html/chef-solr.8.html +4 -4
- data/distro/common/html/knife-bootstrap.1.html +4 -4
- data/distro/common/html/knife-client.1.html +4 -4
- data/distro/common/html/knife-configure.1.html +4 -4
- data/distro/common/html/knife-cookbook-site.1.html +4 -4
- data/distro/common/html/knife-cookbook.1.html +7 -10
- data/distro/common/html/knife-data-bag.1.html +7 -10
- data/distro/common/html/knife-environment.1.html +6 -8
- data/distro/common/html/knife-exec.1.html +4 -4
- data/distro/common/html/knife-index.1.html +4 -4
- data/distro/common/html/knife-node.1.html +4 -4
- data/distro/common/html/knife-role.1.html +4 -4
- data/distro/common/html/knife-search.1.html +4 -4
- data/distro/common/html/knife-ssh.1.html +4 -4
- data/distro/common/html/knife-status.1.html +4 -4
- data/distro/common/html/knife-tag.1.html +4 -4
- data/distro/common/html/knife.1.html +4 -4
- data/distro/common/html/shef.1.html +4 -4
- data/distro/common/man/man1/knife-bootstrap.1 +1 -1
- data/distro/common/man/man1/knife-client.1 +1 -1
- data/distro/common/man/man1/knife-configure.1 +1 -1
- data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
- data/distro/common/man/man1/knife-cookbook.1 +2 -15
- data/distro/common/man/man1/knife-data-bag.1 +2 -15
- data/distro/common/man/man1/knife-environment.1 +2 -12
- data/distro/common/man/man1/knife-exec.1 +1 -1
- data/distro/common/man/man1/knife-index.1 +1 -1
- data/distro/common/man/man1/knife-node.1 +1 -1
- data/distro/common/man/man1/knife-role.1 +1 -1
- data/distro/common/man/man1/knife-search.1 +1 -1
- data/distro/common/man/man1/knife-ssh.1 +1 -1
- data/distro/common/man/man1/knife-status.1 +1 -1
- data/distro/common/man/man1/knife-tag.1 +1 -1
- data/distro/common/man/man1/knife.1 +1 -1
- data/distro/common/man/man1/shef.1 +1 -1
- data/distro/common/man/man8/chef-client.8 +1 -1
- data/distro/common/man/man8/chef-expander.8 +1 -1
- data/distro/common/man/man8/chef-expanderctl.8 +1 -1
- data/distro/common/man/man8/chef-server-webui.8 +1 -1
- data/distro/common/man/man8/chef-server.8 +1 -1
- data/distro/common/man/man8/chef-solo.8 +4 -36
- data/distro/common/man/man8/chef-solr.8 +1 -1
- data/lib/chef/application/windows_service.rb +1 -1
- data/lib/chef/config.rb +1 -0
- data/lib/chef/cookbook/synchronizer.rb +8 -6
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/centos5-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/chef-full.erb +3 -3
- data/lib/chef/knife/bootstrap/fedora13-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu12.10-gems.erb +2 -2
- data/lib/chef/knife/core/node_presenter.rb +1 -1
- data/lib/chef/mixin/params_validate.rb +19 -6
- data/lib/chef/provider/package/portage.rb +9 -4
- data/lib/chef/provider/package/rubygems.rb +41 -9
- data/lib/chef/provider/package/yum.rb +18 -12
- data/lib/chef/resource.rb +9 -7
- data/lib/chef/version.rb +1 -1
- data/spec/data/cookbooks/openldap/files/default/.dotfile +1 -0
- data/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa +1 -0
- data/spec/data/cookbooks/openldap/files/default/remotedir/.a_dotdir/.a_dotfile_in_a_dotdir +1 -0
- data/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/.a_dotfile +1 -0
- data/spec/data/knife-home/.chef/plugins/knife/example_home_subcommand.rb +0 -0
- data/spec/functional/knife/cookbook_delete_spec.rb +1 -1
- data/spec/unit/checksum/storage/filesystem_spec.rb +1 -1
- data/spec/unit/cookbook/synchronizer_spec.rb +49 -1
- data/spec/unit/mixin/params_validate_spec.rb +35 -0
- data/spec/unit/provider/env_spec.rb +2 -2
- data/spec/unit/provider/group_spec.rb +2 -2
- data/spec/unit/provider/package/portage_spec.rb +44 -0
- data/spec/unit/provider/package/rubygems_spec.rb +44 -1
- data/spec/unit/provider/package/yum_spec.rb +36 -39
- data/spec/unit/provider/service/arch_service_spec.rb +1 -1
- data/spec/unit/provider/service/freebsd_service_spec.rb +1 -1
- data/spec/unit/provider/service/init_service_spec.rb +1 -1
- data/spec/unit/provider/service/invokercd_service_spec.rb +1 -1
- data/spec/unit/provider/service/upstart_service_spec.rb +2 -2
- data/spec/unit/provider/user_spec.rb +1 -1
- metadata +1183 -1181
@@ -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 "CHEF\-CLIENT" "8" "
|
4
|
+
.TH "CHEF\-CLIENT" "8" "August 2013" "Chef 10.28.0.rc.0" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBchef\-client\fR \- Runs a client node connecting to a chef\-server\.
|
@@ -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 "CHEF\-EXPANDER" "8" "
|
4
|
+
.TH "CHEF\-EXPANDER" "8" "August 2013" "Chef 10.28.0.rc.0" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBchef\-expander\fR \- fetches messages from RabbitMQ, processes, and loads into chef\-solr
|
@@ -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 "CHEF\-EXPANDERCTL" "8" "
|
4
|
+
.TH "CHEF\-EXPANDERCTL" "8" "August 2013" "Chef 10.28.0.rc.0" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBchef\-expanderctl\fR \- management program for chef\-expander
|
@@ -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 "CHEF\-SERVER\-WEBUI" "8" "
|
4
|
+
.TH "CHEF\-SERVER\-WEBUI" "8" "August 2013" "Chef 10.28.0.rc.0" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBchef\-server\-webui\fR \- Start the Chef Server merb application slice providing Web User Interface (Management Console)\.
|
@@ -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 "CHEF\-SERVER" "8" "
|
4
|
+
.TH "CHEF\-SERVER" "8" "August 2013" "Chef 10.28.0.rc.0" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBchef\-server\fR \- Start the Chef Server merb application slice\.
|
@@ -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 "CHEF\-SOLO" "8" "
|
4
|
+
.TH "CHEF\-SOLO" "8" "August 2013" "Chef 10.28.0.rc.0" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBchef\-solo\fR \- Runs chef in solo mode against a specified cookbook location\.
|
@@ -68,18 +68,7 @@ Chef Solo allows you to run Chef Cookbooks in the absence of a Chef Server\. To
|
|
68
68
|
By default Chef Solo will look in /etc/chef/solo\.rb for its configuration\. This configuration file has two required variables: file_cache_path and cookbook_path\.
|
69
69
|
.
|
70
70
|
.P
|
71
|
-
For example:
|
72
|
-
.
|
73
|
-
.IP "" 4
|
74
|
-
.
|
75
|
-
.nf
|
76
|
-
|
77
|
-
file_cache_path "/var/chef\-solo"
|
78
|
-
cookbook_path "/var/chef\-solo/cookbooks"
|
79
|
-
.
|
80
|
-
.fi
|
81
|
-
.
|
82
|
-
.IP "" 0
|
71
|
+
For example: file_cache_path "/var/chef\-solo" cookbook_path "/var/chef\-solo/cookbooks"
|
83
72
|
.
|
84
73
|
.P
|
85
74
|
For your own systems, you can change this to reflect any directory you like, but you\'ll need to specify absolute paths and the cookbook_path directory should be a subdirectory of the file_cache_path\.
|
@@ -88,18 +77,7 @@ For your own systems, you can change this to reflect any directory you like, but
|
|
88
77
|
You can also specify cookbook_path as an array, passing multiple locations to search for cookbooks\.
|
89
78
|
.
|
90
79
|
.P
|
91
|
-
For example:
|
92
|
-
.
|
93
|
-
.IP "" 4
|
94
|
-
.
|
95
|
-
.nf
|
96
|
-
|
97
|
-
file_cache_path "/var/chef\-solo"
|
98
|
-
cookbook_path ["/var/chef\-solo/cookbooks", "/var/chef\-solo/site\-cookbooks"]
|
99
|
-
.
|
100
|
-
.fi
|
101
|
-
.
|
102
|
-
.IP "" 0
|
80
|
+
For example: file_cache_path "/var/chef\-solo" cookbook_path ["/var/chef\-solo/cookbooks", "/var/chef\-solo/site\-cookbooks"]
|
103
81
|
.
|
104
82
|
.P
|
105
83
|
Note that earlier entries are now overridden by later ones\.
|
@@ -133,17 +111,7 @@ Then you can run chef\-solo with \-j to specify the JSON file\. It will look for
|
|
133
111
|
You can use \-c to specify the path to the configuration file (if you don\'t want chef\-solo to use the default)\. You can also specify \-r for a cookbook tarball\.
|
134
112
|
.
|
135
113
|
.P
|
136
|
-
For example:
|
137
|
-
.
|
138
|
-
.IP "" 4
|
139
|
-
.
|
140
|
-
.nf
|
141
|
-
|
142
|
-
chef\-solo \-c ~/solo\.rb \-j ~/node\.json \-r http://www\.example\.com/chef\-solo\.tar\.gz
|
143
|
-
.
|
144
|
-
.fi
|
145
|
-
.
|
146
|
-
.IP "" 0
|
114
|
+
For example: chef\-solo \-c ~/solo\.rb \-j ~/node\.json \-r http://www\.example\.com/chef\-solo\.tar\.gz
|
147
115
|
.
|
148
116
|
.P
|
149
117
|
In the above case, chef\-solo would extract the tarball to your specified cookbook_path, use ~/solo\.rb as the configuration file, and apply attributes and use the run_list from ~/node\.json\.
|
@@ -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 "CHEF\-SOLR" "8" "
|
4
|
+
.TH "CHEF\-SOLR" "8" "August 2013" "Chef 10.28.0.rc.0" "Chef Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBchef\-solr\fR \- Runs as Chef\'s search server
|
@@ -167,7 +167,7 @@ class Chef
|
|
167
167
|
def configure_chef(startup_parameters)
|
168
168
|
# Bit of a hack ahead:
|
169
169
|
# It is possible to specify a service's binary_path_name with arguments, like "foo.exe -x argX".
|
170
|
-
# It is also possible to specify startup parameters separately, either via the
|
170
|
+
# It is also possible to specify startup parameters separately, either via the Services manager
|
171
171
|
# or by using the registry (I think).
|
172
172
|
|
173
173
|
# In order to accommodate all possible sources of parameterization, we first parse any command line
|
data/lib/chef/config.rb
CHANGED
@@ -56,12 +56,14 @@ class Chef
|
|
56
56
|
# Synchronizes the locally cached copies of cookbooks with the files on the
|
57
57
|
# server.
|
58
58
|
class CookbookSynchronizer
|
59
|
-
EAGER_SEGMENTS = Chef::CookbookVersion::COOKBOOK_SEGMENTS.dup
|
60
|
-
EAGER_SEGMENTS.delete(:files)
|
61
|
-
EAGER_SEGMENTS.delete(:templates)
|
62
|
-
EAGER_SEGMENTS.freeze
|
63
|
-
|
64
59
|
def initialize(cookbooks_by_name, events)
|
60
|
+
@eager_segments = Chef::CookbookVersion::COOKBOOK_SEGMENTS.dup
|
61
|
+
unless Chef::Config[:no_lazy_load]
|
62
|
+
@eager_segments.delete(:files)
|
63
|
+
@eager_segments.delete(:templates)
|
64
|
+
end
|
65
|
+
@eager_segments.freeze
|
66
|
+
|
65
67
|
@cookbooks_by_name, @events = cookbooks_by_name, events
|
66
68
|
end
|
67
69
|
|
@@ -138,7 +140,7 @@ class Chef
|
|
138
140
|
|
139
141
|
# files and templates are lazily loaded, and will be done later.
|
140
142
|
|
141
|
-
|
143
|
+
@eager_segments.each do |segment|
|
142
144
|
segment_filenames = Array.new
|
143
145
|
cookbook.manifest[segment].each do |manifest_record|
|
144
146
|
|
@@ -11,13 +11,13 @@ fi
|
|
11
11
|
|
12
12
|
mkdir -p /etc/chef
|
13
13
|
|
14
|
-
|
14
|
+
cat > /etc/chef/validation.pem <<'EOP'
|
15
15
|
<%= validation_key %>
|
16
16
|
EOP
|
17
17
|
chmod 0600 /etc/chef/validation.pem
|
18
18
|
|
19
19
|
<% if @chef_config[:encrypted_data_bag_secret] -%>
|
20
|
-
|
20
|
+
cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
|
21
21
|
<%= encrypted_data_bag_secret %>
|
22
22
|
EOP
|
23
23
|
chmod 0600 /etc/chef/encrypted_data_bag_secret
|
@@ -28,13 +28,13 @@ gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
|
|
28
28
|
|
29
29
|
mkdir -p /etc/chef
|
30
30
|
|
31
|
-
|
31
|
+
cat > /etc/chef/validation.pem <<'EOP'
|
32
32
|
<%= validation_key %>
|
33
33
|
EOP
|
34
34
|
chmod 0600 /etc/chef/validation.pem
|
35
35
|
|
36
36
|
<% if @chef_config[:encrypted_data_bag_secret] -%>
|
37
|
-
|
37
|
+
cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
|
38
38
|
<%= encrypted_data_bag_secret %>
|
39
39
|
EOP
|
40
40
|
chmod 0600 /etc/chef/encrypted_data_bag_secret
|
@@ -10,7 +10,7 @@ exists() {
|
|
10
10
|
fi
|
11
11
|
}
|
12
12
|
|
13
|
-
install_sh="
|
13
|
+
install_sh="https://www.opscode.com/chef/install.sh"
|
14
14
|
version_string="-v <%= chef_version %>"
|
15
15
|
|
16
16
|
if ! exists /usr/bin/chef-client; then
|
@@ -26,13 +26,13 @@ fi
|
|
26
26
|
|
27
27
|
mkdir -p /etc/chef
|
28
28
|
|
29
|
-
|
29
|
+
cat > /etc/chef/validation.pem <<'EOP'
|
30
30
|
<%= validation_key %>
|
31
31
|
EOP
|
32
32
|
chmod 0600 /etc/chef/validation.pem
|
33
33
|
|
34
34
|
<% if @chef_config[:encrypted_data_bag_secret] -%>
|
35
|
-
|
35
|
+
cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
|
36
36
|
<%= encrypted_data_bag_secret %>
|
37
37
|
EOP
|
38
38
|
chmod 0600 /etc/chef/encrypted_data_bag_secret
|
@@ -10,13 +10,13 @@ gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
|
|
10
10
|
|
11
11
|
mkdir -p /etc/chef
|
12
12
|
|
13
|
-
|
13
|
+
cat > /etc/chef/validation.pem <<'EOP'
|
14
14
|
<%= validation_key %>
|
15
15
|
EOP
|
16
16
|
chmod 0600 /etc/chef/validation.pem
|
17
17
|
|
18
18
|
<% if @chef_config[:encrypted_data_bag_secret] -%>
|
19
|
-
|
19
|
+
cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
|
20
20
|
<%= encrypted_data_bag_secret %>
|
21
21
|
EOP
|
22
22
|
chmod 0600 /etc/chef/encrypted_data_bag_secret
|
@@ -10,13 +10,13 @@ fi
|
|
10
10
|
apt-get update
|
11
11
|
apt-get install -y chef
|
12
12
|
|
13
|
-
|
13
|
+
cat > /etc/chef/validation.pem <<'EOP'
|
14
14
|
<%= validation_key %>
|
15
15
|
EOP
|
16
16
|
chmod 0600 /etc/chef/validation.pem
|
17
17
|
|
18
18
|
<% if @chef_config[:encrypted_data_bag_secret] -%>
|
19
|
-
|
19
|
+
cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
|
20
20
|
<%= encrypted_data_bag_secret %>
|
21
21
|
EOP
|
22
22
|
chmod 0600 /etc/chef/encrypted_data_bag_secret
|
@@ -14,13 +14,13 @@ gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
|
|
14
14
|
|
15
15
|
mkdir -p /etc/chef
|
16
16
|
|
17
|
-
|
17
|
+
cat > /etc/chef/validation.pem <<'EOP'
|
18
18
|
<%= validation_key %>
|
19
19
|
EOP
|
20
20
|
chmod 0600 /etc/chef/validation.pem
|
21
21
|
|
22
22
|
<% if @chef_config[:encrypted_data_bag_secret] -%>
|
23
|
-
|
23
|
+
cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
|
24
24
|
<%= encrypted_data_bag_secret %>
|
25
25
|
EOP
|
26
26
|
chmod 0600 /etc/chef/encrypted_data_bag_secret
|
@@ -12,13 +12,13 @@ gem install chef --no-rdoc --no-ri --verbose <%= bootstrap_version_string %>
|
|
12
12
|
|
13
13
|
mkdir -p /etc/chef
|
14
14
|
|
15
|
-
|
15
|
+
cat > /etc/chef/validation.pem <<'EOP'
|
16
16
|
<%= validation_key %>
|
17
17
|
EOP
|
18
18
|
chmod 0600 /etc/chef/validation.pem
|
19
19
|
|
20
20
|
<% if @chef_config[:encrypted_data_bag_secret] -%>
|
21
|
-
|
21
|
+
cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
|
22
22
|
<%= encrypted_data_bag_secret %>
|
23
23
|
EOP
|
24
24
|
chmod 0600 /etc/chef/encrypted_data_bag_secret
|
@@ -17,7 +17,7 @@ cat <<'EOP'
|
|
17
17
|
<%= validation_key %>
|
18
18
|
EOP
|
19
19
|
) > /tmp/validation.pem
|
20
|
-
|
20
|
+
cat /tmp/validation.pem > /etc/chef/validation.pem
|
21
21
|
rm /tmp/validation.pem
|
22
22
|
chmod 0600 /etc/chef/validation.pem
|
23
23
|
|
@@ -27,7 +27,7 @@ cat <<'EOP'
|
|
27
27
|
<%= encrypted_data_bag_secret %>
|
28
28
|
EOP
|
29
29
|
) > /tmp/encrypted_data_bag_secret
|
30
|
-
|
30
|
+
cat /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
|
31
31
|
rm /tmp/encrypted_data_bag_secret
|
32
32
|
chmod 0600 /etc/chef/encrypted_data_bag_secret
|
33
33
|
<% end -%>
|
@@ -86,7 +86,7 @@ class Chef
|
|
86
86
|
# Converts a Chef::Node object to a string suitable for output to a
|
87
87
|
# terminal. If config[:medium_output] or config[:long_output] are set
|
88
88
|
# the volume of output is adjusted accordingly. Uses colors if enabled
|
89
|
-
# in the
|
89
|
+
# in the ui object.
|
90
90
|
def summarize(data)
|
91
91
|
if data.kind_of?(Chef::Node)
|
92
92
|
node = data
|
@@ -16,7 +16,8 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
18
|
class Chef
|
19
|
-
|
19
|
+
class DelayedEvaluator < Proc
|
20
|
+
end
|
20
21
|
module Mixin
|
21
22
|
module ParamsValidate
|
22
23
|
|
@@ -75,18 +76,30 @@ class Chef
|
|
75
76
|
end
|
76
77
|
opts
|
77
78
|
end
|
78
|
-
|
79
|
+
|
80
|
+
def lazy(&block)
|
81
|
+
DelayedEvaluator.new(&block)
|
82
|
+
end
|
83
|
+
|
79
84
|
def set_or_return(symbol, arg, validation)
|
80
85
|
iv_symbol = "@#{symbol.to_s}".to_sym
|
81
86
|
map = {
|
82
87
|
symbol => validation
|
83
88
|
}
|
84
|
-
|
85
89
|
if arg == nil && self.instance_variable_defined?(iv_symbol) == true
|
86
|
-
self.instance_variable_get(iv_symbol)
|
90
|
+
ivar = self.instance_variable_get(iv_symbol)
|
91
|
+
if(ivar.is_a?(DelayedEvaluator))
|
92
|
+
validate({ symbol => ivar.call }, { symbol => validation })[symbol]
|
93
|
+
else
|
94
|
+
ivar
|
95
|
+
end
|
87
96
|
else
|
88
|
-
|
89
|
-
|
97
|
+
if(arg.is_a?(DelayedEvaluator))
|
98
|
+
val = arg
|
99
|
+
else
|
100
|
+
val = validate({ symbol => arg }, { symbol => validation })[symbol]
|
101
|
+
end
|
102
|
+
self.instance_variable_set(iv_symbol, val)
|
90
103
|
end
|
91
104
|
end
|
92
105
|
|
@@ -58,14 +58,19 @@ class Chef
|
|
58
58
|
|
59
59
|
def parse_emerge(package, txt)
|
60
60
|
availables = {}
|
61
|
-
package_without_category = package.split("/").last
|
62
61
|
found_package_name = nil
|
63
62
|
|
64
63
|
txt.each_line do |line|
|
65
64
|
if line =~ /\*\s+#{PACKAGE_NAME_PATTERN}/
|
66
|
-
found_package_name = $&.strip
|
67
|
-
if
|
68
|
-
|
65
|
+
found_package_name = $&.gsub(/\*/, '').strip
|
66
|
+
if package =~ /\// #the category is specified
|
67
|
+
if found_package_name == package
|
68
|
+
availables[found_package_name] = nil
|
69
|
+
end
|
70
|
+
else #the category is not specified
|
71
|
+
if found_package_name.split("/").last == package
|
72
|
+
availables[found_package_name] = nil
|
73
|
+
end
|
69
74
|
end
|
70
75
|
end
|
71
76
|
|
@@ -31,7 +31,14 @@ require 'rubygems/version'
|
|
31
31
|
require 'rubygems/dependency'
|
32
32
|
require 'rubygems/spec_fetcher'
|
33
33
|
require 'rubygems/platform'
|
34
|
-
|
34
|
+
|
35
|
+
# Compatibility note: Rubygems 2.0 removes rubygems/format in favor of
|
36
|
+
# rubygems/package.
|
37
|
+
begin
|
38
|
+
require 'rubygems/format'
|
39
|
+
rescue LoadError
|
40
|
+
require 'rubygems/package'
|
41
|
+
end
|
35
42
|
require 'rubygems/dependency_installer'
|
36
43
|
require 'rubygems/uninstaller'
|
37
44
|
require 'rubygems/specification'
|
@@ -105,6 +112,22 @@ class Chef
|
|
105
112
|
Gem.sources = original_sources
|
106
113
|
end
|
107
114
|
|
115
|
+
##
|
116
|
+
# Extracts the gemspec from a (on-disk) gem package.
|
117
|
+
# === Returns
|
118
|
+
# Gem::Specification
|
119
|
+
#
|
120
|
+
#--
|
121
|
+
# Compatibility note: Rubygems 1.x uses Gem::Format, 2.0 moved this
|
122
|
+
# code into Gem::Package.
|
123
|
+
def spec_from_file(file)
|
124
|
+
if defined?(Gem::Format) and Gem::Package.respond_to?(:open)
|
125
|
+
Gem::Format.from_file_by_path(file).spec
|
126
|
+
else
|
127
|
+
Gem::Package.new(file).spec
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
108
131
|
##
|
109
132
|
# Determines the candidate version for a gem from a .gem file on disk
|
110
133
|
# and checks if it matches the version contraints in +gem_dependency+
|
@@ -114,7 +137,7 @@ class Chef
|
|
114
137
|
# nil returns nil if the gem on disk doesn't match the
|
115
138
|
# version constraints for +gem_dependency+
|
116
139
|
def candidate_version_from_file(gem_dependency, source)
|
117
|
-
spec =
|
140
|
+
spec = spec_from_file(source)
|
118
141
|
if spec.satisfies_requirement?(gem_dependency)
|
119
142
|
logger.debug {"#{@new_resource} found candidate gem version #{spec.version} from local gem package #{source}"}
|
120
143
|
spec.version
|
@@ -142,17 +165,26 @@ class Chef
|
|
142
165
|
# Find the newest gem version available from Gem.sources that satisfies
|
143
166
|
# the constraints of +gem_dependency+
|
144
167
|
def find_newest_remote_version(gem_dependency, *sources)
|
145
|
-
|
146
|
-
|
147
|
-
|
168
|
+
available_gems = dependency_installer.find_gems_with_sources(gem_dependency)
|
169
|
+
spec, source = if available_gems.respond_to?(:last)
|
170
|
+
# DependencyInstaller sorts the results such that the last one is
|
171
|
+
# always the one it considers best.
|
172
|
+
spec_with_source = available_gems.last
|
173
|
+
spec_with_source && spec_with_source
|
174
|
+
else
|
175
|
+
# Rubygems 2.0 returns a Gem::Available set, which is a
|
176
|
+
# collection of AvailableSet::Tuple structs
|
177
|
+
available_gems.pick_best!
|
178
|
+
best_gem = available_gems.set.first
|
179
|
+
best_gem && [best_gem.spec, best_gem.source]
|
180
|
+
end
|
148
181
|
|
149
|
-
|
150
|
-
version = spec && spec_with_source[0].version
|
182
|
+
version = spec && spec.version
|
151
183
|
if version
|
152
|
-
logger.debug { "#{@new_resource} found gem #{spec.name} version #{version} for platform #{spec.platform} from #{
|
184
|
+
logger.debug { "#{@new_resource} found gem #{spec.name} version #{version} for platform #{spec.platform} from #{source}" }
|
153
185
|
version
|
154
186
|
else
|
155
|
-
source_list = sources.compact.empty? ? "[#{Gem.sources.join(', ')}]" : "[#{sources.join(', ')}]"
|
187
|
+
source_list = sources.compact.empty? ? "[#{Gem.sources.to_a.join(', ')}]" : "[#{sources.join(', ')}]"
|
156
188
|
logger.warn { "#{@new_resource} failed to find gem #{gem_dependency} from #{source_list}" }
|
157
189
|
nil
|
158
190
|
end
|