chef 0.9.14.beta.1 → 0.9.14.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/solo.rb +1 -1
- data/lib/chef/checksum_cache.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +2 -2
- data/lib/chef/couchdb.rb +1 -1
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +1 -1
- data/lib/chef/exceptions.rb +1 -0
- data/lib/chef/file_cache.rb +1 -1
- data/lib/chef/handler/json_file.rb +1 -1
- data/lib/chef/index_queue/amqp_client.rb +1 -1
- data/lib/chef/index_queue/consumer.rb +1 -1
- data/lib/chef/index_queue/indexable.rb +0 -1
- data/lib/chef/{json.rb → json_compat.rb} +1 -1
- data/lib/chef/knife.rb +6 -6
- data/lib/chef/knife/bluebox_images_list.rb +1 -1
- data/lib/chef/knife/bluebox_server_create.rb +1 -1
- data/lib/chef/knife/bluebox_server_delete.rb +1 -1
- data/lib/chef/knife/bluebox_server_list.rb +1 -1
- data/lib/chef/knife/bootstrap.rb +1 -1
- data/lib/chef/knife/client_bulk_delete.rb +1 -1
- data/lib/chef/knife/client_create.rb +1 -1
- data/lib/chef/knife/client_delete.rb +1 -1
- data/lib/chef/knife/client_edit.rb +1 -1
- data/lib/chef/knife/client_list.rb +1 -1
- data/lib/chef/knife/client_reregister.rb +1 -1
- data/lib/chef/knife/client_show.rb +1 -1
- data/lib/chef/knife/cookbook_create.rb +1 -1
- data/lib/chef/knife/cookbook_list.rb +1 -1
- data/lib/chef/knife/cookbook_metadata.rb +1 -1
- data/lib/chef/knife/cookbook_show.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +1 -1
- data/lib/chef/knife/cookbook_site_unshare.rb +1 -0
- data/lib/chef/knife/data_bag_delete.rb +1 -0
- data/lib/chef/knife/data_bag_from_file.rb +1 -0
- data/lib/chef/knife/ec2_instance_data.rb +1 -1
- data/lib/chef/knife/ec2_server_create.rb +2 -2
- data/lib/chef/knife/ec2_server_delete.rb +1 -1
- data/lib/chef/knife/ec2_server_list.rb +1 -1
- data/lib/chef/knife/node_bulk_delete.rb +1 -1
- data/lib/chef/knife/node_create.rb +1 -1
- data/lib/chef/knife/node_delete.rb +1 -1
- data/lib/chef/knife/node_edit.rb +1 -1
- data/lib/chef/knife/node_from_file.rb +1 -1
- data/lib/chef/knife/node_list.rb +1 -1
- data/lib/chef/knife/node_run_list_add.rb +1 -1
- data/lib/chef/knife/node_run_list_remove.rb +1 -1
- data/lib/chef/knife/node_show.rb +1 -1
- data/lib/chef/knife/rackspace_server_create.rb +1 -1
- data/lib/chef/knife/rackspace_server_delete.rb +1 -1
- data/lib/chef/knife/rackspace_server_list.rb +1 -1
- data/lib/chef/knife/role_bulk_delete.rb +1 -1
- data/lib/chef/knife/role_create.rb +1 -1
- data/lib/chef/knife/role_delete.rb +1 -1
- data/lib/chef/knife/role_edit.rb +1 -1
- data/lib/chef/knife/role_from_file.rb +1 -1
- data/lib/chef/knife/role_list.rb +1 -1
- data/lib/chef/knife/role_show.rb +1 -1
- data/lib/chef/knife/slicehost_images_list.rb +1 -1
- data/lib/chef/knife/slicehost_server_create.rb +1 -1
- data/lib/chef/knife/slicehost_server_delete.rb +1 -1
- data/lib/chef/knife/slicehost_server_list.rb +1 -1
- data/lib/chef/knife/terremark_server_create.rb +1 -1
- data/lib/chef/knife/terremark_server_delete.rb +1 -1
- data/lib/chef/knife/terremark_server_list.rb +1 -1
- data/lib/chef/log.rb +10 -5
- data/lib/chef/monkey_patches/regexp.rb +34 -0
- data/lib/chef/node.rb +1 -1
- data/lib/chef/openid_registration.rb +1 -1
- data/lib/chef/provider/deploy/revision.rb +5 -1
- data/lib/chef/provider/erl_call.rb +19 -3
- data/lib/chef/provider/package/apt.rb +1 -1
- data/lib/chef/provider/package/yum.rb +29 -3
- data/lib/chef/provider/service/simple.rb +1 -1
- data/lib/chef/resource/solaris_package.rb +1 -0
- data/lib/chef/resource/yum_package.rb +1 -0
- data/lib/chef/rest.rb +12 -11
- data/lib/chef/role.rb +2 -2
- data/lib/chef/shef.rb +4 -3
- data/lib/chef/shef/ext.rb +3 -2
- data/lib/chef/shell_out.rb +5 -0
- data/lib/chef/tasks/chef_repo.rake +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/webui_user.rb +1 -1
- metadata +6 -5
data/lib/chef/knife/node_edit.rb
CHANGED
data/lib/chef/knife/node_list.rb
CHANGED
data/lib/chef/knife/node_show.rb
CHANGED
data/lib/chef/knife/role_edit.rb
CHANGED
data/lib/chef/knife/role_list.rb
CHANGED
data/lib/chef/knife/role_show.rb
CHANGED
data/lib/chef/log.rb
CHANGED
@@ -25,21 +25,25 @@ class Chef
|
|
25
25
|
extend Mixlib::Log
|
26
26
|
|
27
27
|
class << self
|
28
|
-
attr_accessor :verbose
|
29
28
|
attr_reader :verbose_logger
|
30
|
-
|
29
|
+
|
30
|
+
@verbose_logger = nil
|
31
|
+
@verbose = false
|
31
32
|
|
32
|
-
def verbose
|
33
|
-
|
33
|
+
def verbose?
|
34
|
+
@verbose
|
34
35
|
end
|
35
36
|
|
37
|
+
alias :verbose :verbose?
|
38
|
+
|
36
39
|
def verbose=(value)
|
37
40
|
if value
|
41
|
+
@verbose = true
|
38
42
|
@verbose_logger ||= Logger.new(STDOUT)
|
39
43
|
@verbose_logger.level = self.logger.level
|
40
44
|
@verbose_logger.formatter = self.logger.formatter
|
41
45
|
else
|
42
|
-
@verbose_logger = nil
|
46
|
+
@verbose, @verbose_logger = false, nil
|
43
47
|
end
|
44
48
|
self.verbose
|
45
49
|
end
|
@@ -48,6 +52,7 @@ class Chef
|
|
48
52
|
class_eval(<<-METHOD_DEFN, __FILE__, __LINE__)
|
49
53
|
def #{method_name}(msg=nil, &block)
|
50
54
|
@logger.#{method_name}(msg, &block)
|
55
|
+
@verbose_logger.#{method_name}(msg, &block) if verbose?
|
51
56
|
end
|
52
57
|
METHOD_DEFN
|
53
58
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Copyright (c) 2009 Marc-Andre Lafortune
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
class Regexp
|
23
|
+
# Standard in Ruby 1.8.7+. See official documentation[http://www.ruby-doc.org/core-1.8.7/classes/Regexp.html]
|
24
|
+
class << self
|
25
|
+
unless (union(%w(a b)) rescue false)
|
26
|
+
alias :union_without_array_argument :union
|
27
|
+
|
28
|
+
def union(*arg)
|
29
|
+
return union_without_array_argument(*arg) unless arg.size == 1
|
30
|
+
union_without_array_argument(*arg.first)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/chef/node.rb
CHANGED
@@ -16,6 +16,10 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
+
require 'chef/provider'
|
20
|
+
require 'chef/provider/deploy'
|
21
|
+
require 'chef/json_compat'
|
22
|
+
|
19
23
|
class Chef
|
20
24
|
class Provider
|
21
25
|
class Deploy
|
@@ -56,7 +60,7 @@ class Chef
|
|
56
60
|
|
57
61
|
def load_cache
|
58
62
|
begin
|
59
|
-
Chef::
|
63
|
+
Chef::JSONCompat.from_json(Chef::FileCache.load("revision-deploys/#{new_resource.name}"))
|
60
64
|
rescue Chef::Exceptions::FileNotFound
|
61
65
|
sorted_releases_from_filesystem
|
62
66
|
end
|
@@ -66,13 +66,29 @@ class Chef
|
|
66
66
|
|
67
67
|
stdin.close
|
68
68
|
|
69
|
-
Chef::Log.info("Ran erl_call[#{@new_resource.name}] successfully")
|
70
69
|
Chef::Log.debug("erl_call[#{@new_resource.name}] output: ")
|
71
70
|
|
72
|
-
|
73
|
-
|
71
|
+
stdout_output = ""
|
72
|
+
stdout.each_line { |line| stdout_output << line }
|
74
73
|
stdout.close
|
74
|
+
|
75
|
+
stderr_output = ""
|
76
|
+
stderr.each_line { |line| stderr_output << line }
|
75
77
|
stderr.close
|
78
|
+
|
79
|
+
# fail if stderr contains anything
|
80
|
+
if stderr_output.length > 0
|
81
|
+
raise Chef::Exceptions::ErlCall, stderr_output
|
82
|
+
end
|
83
|
+
|
84
|
+
# fail if the first 4 characters aren't "{ok,"
|
85
|
+
unless stdout_output[0..3].include?('{ok,')
|
86
|
+
raise Chef::Exceptions::ErlCall, stdout_output
|
87
|
+
end
|
88
|
+
|
89
|
+
Chef::Log.debug("#{stdout_output}")
|
90
|
+
Chef::Log.info("Ran erl_call[#{@new_resource.name}] successfully")
|
91
|
+
|
76
92
|
ensure
|
77
93
|
Process.wait(pid) if pid
|
78
94
|
end
|
@@ -104,6 +104,26 @@ class Chef
|
|
104
104
|
nil
|
105
105
|
end
|
106
106
|
|
107
|
+
def version_available?(package_name, desired_version, arch)
|
108
|
+
if (package_data = @data[package_name])
|
109
|
+
if (available_versions = package_data[:available])
|
110
|
+
if arch
|
111
|
+
matching_versions = available_versions[arch]
|
112
|
+
else
|
113
|
+
matching_versions = available_versions.values
|
114
|
+
end
|
115
|
+
|
116
|
+
matching_versions.each do |ver|
|
117
|
+
if (desired_version == "#{ver[:version]}-#{ver[:release]}")
|
118
|
+
return true
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
nil
|
125
|
+
end
|
126
|
+
|
107
127
|
def installed_version(package_name, arch)
|
108
128
|
version(package_name, :installed, arch)
|
109
129
|
end
|
@@ -168,6 +188,7 @@ class Chef
|
|
168
188
|
else
|
169
189
|
@candidate_version = installed_version
|
170
190
|
end
|
191
|
+
Chef::Log.debug("#{@current_resource.name}: Installed version: #{installed_version} Candidate version: #{candidate_version}")
|
171
192
|
|
172
193
|
@current_resource
|
173
194
|
end
|
@@ -178,9 +199,14 @@ class Chef
|
|
178
199
|
:command => "yum -d0 -e0 -y #{@new_resource.options} localinstall #{@new_resource.source}"
|
179
200
|
)
|
180
201
|
else
|
181
|
-
|
182
|
-
|
183
|
-
|
202
|
+
# Work around yum not exiting with an error if a package doesn't exist for CHEF-2062
|
203
|
+
if @yum.version_available?(name, version, yum_arch)
|
204
|
+
run_command_with_systems_locale(
|
205
|
+
:command => "yum -d0 -e0 -y #{@new_resource.options} install #{name}-#{version}#{yum_arch}"
|
206
|
+
)
|
207
|
+
else
|
208
|
+
raise ArgumentError, "#{new_resource.name}: Version #{version} of #{name} not found. Did you specify both version and release? (version-release, e.g. 1.84-10.fc6)"
|
209
|
+
end
|
184
210
|
end
|
185
211
|
@yum.flush
|
186
212
|
end
|