chef 0.10.0.beta.6 → 0.10.0.beta.7

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.
Files changed (90) hide show
  1. data/lib/chef/application.rb +3 -0
  2. data/lib/chef/application/client.rb +34 -2
  3. data/lib/chef/checksum.rb +2 -2
  4. data/lib/chef/checksum_cache.rb +2 -2
  5. data/lib/chef/client.rb +7 -5
  6. data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
  7. data/lib/chef/cookbook/syntax_check.rb +2 -2
  8. data/lib/chef/cookbook_version.rb +5 -0
  9. data/lib/chef/data_bag_item.rb +1 -1
  10. data/lib/chef/environment.rb +31 -9
  11. data/lib/chef/file_access_control.rb +7 -3
  12. data/lib/chef/index_queue/indexable.rb +2 -2
  13. data/lib/chef/knife.rb +1 -1
  14. data/lib/chef/knife/bootstrap.rb +1 -1
  15. data/lib/chef/knife/cookbook_site_install.rb +1 -1
  16. data/lib/chef/knife/cookbook_site_share.rb +2 -2
  17. data/lib/chef/knife/cookbook_upload.rb +32 -11
  18. data/lib/chef/knife/core/subcommand_loader.rb +24 -13
  19. data/lib/chef/knife/core/text_formatter.rb +2 -2
  20. data/lib/chef/knife/core/ui.rb +1 -1
  21. data/lib/chef/knife/search.rb +1 -1
  22. data/lib/chef/knife/ssh.rb +1 -0
  23. data/lib/chef/mixin/shell_out.rb +2 -2
  24. data/lib/chef/node.rb +7 -4
  25. data/lib/chef/provider/cookbook_file.rb +4 -5
  26. data/lib/chef/provider/cron.rb +3 -3
  27. data/lib/chef/provider/cron/solaris.rb +7 -7
  28. data/lib/chef/provider/deploy.rb +52 -29
  29. data/lib/chef/provider/directory.rb +8 -8
  30. data/lib/chef/provider/env.rb +8 -8
  31. data/lib/chef/provider/erl_call.rb +7 -6
  32. data/lib/chef/provider/execute.rb +7 -2
  33. data/lib/chef/provider/file.rb +9 -9
  34. data/lib/chef/provider/git.rb +17 -8
  35. data/lib/chef/provider/group.rb +6 -6
  36. data/lib/chef/provider/group/aix.rb +1 -1
  37. data/lib/chef/provider/group/dscl.rb +2 -2
  38. data/lib/chef/provider/group/gpasswd.rb +3 -3
  39. data/lib/chef/provider/group/groupadd.rb +1 -1
  40. data/lib/chef/provider/group/pw.rb +3 -3
  41. data/lib/chef/provider/group/usermod.rb +2 -2
  42. data/lib/chef/provider/group/windows.rb +1 -1
  43. data/lib/chef/provider/ifconfig.rb +9 -7
  44. data/lib/chef/provider/link.rb +27 -24
  45. data/lib/chef/provider/mdadm.rb +10 -10
  46. data/lib/chef/provider/mount.rb +10 -13
  47. data/lib/chef/provider/mount/mount.rb +10 -10
  48. data/lib/chef/provider/mount/windows.rb +4 -3
  49. data/lib/chef/provider/ohai.rb +2 -1
  50. data/lib/chef/provider/package.rb +10 -6
  51. data/lib/chef/provider/package/apt.rb +18 -18
  52. data/lib/chef/provider/package/dpkg.rb +3 -3
  53. data/lib/chef/provider/package/easy_install.rb +2 -2
  54. data/lib/chef/provider/package/freebsd.rb +4 -5
  55. data/lib/chef/provider/package/macports.rb +2 -2
  56. data/lib/chef/provider/package/pacman.rb +2 -2
  57. data/lib/chef/provider/package/portage.rb +1 -1
  58. data/lib/chef/provider/package/rpm.rb +3 -3
  59. data/lib/chef/provider/package/rubygems.rb +7 -7
  60. data/lib/chef/provider/package/solaris.rb +9 -9
  61. data/lib/chef/provider/package/yum.rb +4 -4
  62. data/lib/chef/provider/package/zypper.rb +5 -11
  63. data/lib/chef/provider/remote_directory.rb +15 -14
  64. data/lib/chef/provider/remote_file.rb +11 -12
  65. data/lib/chef/provider/route.rb +8 -10
  66. data/lib/chef/provider/ruby_block.rb +1 -0
  67. data/lib/chef/provider/service.rb +10 -16
  68. data/lib/chef/provider/service/debian.rb +1 -1
  69. data/lib/chef/provider/service/freebsd.rb +16 -18
  70. data/lib/chef/provider/service/gentoo.rb +2 -3
  71. data/lib/chef/provider/service/simple.rb +7 -5
  72. data/lib/chef/provider/service/upstart.rb +8 -8
  73. data/lib/chef/provider/service/windows.rb +3 -3
  74. data/lib/chef/provider/subversion.rb +12 -9
  75. data/lib/chef/provider/template.rb +2 -3
  76. data/lib/chef/provider/user.rb +13 -14
  77. data/lib/chef/provider/user/dscl.rb +2 -2
  78. data/lib/chef/provider/user/pw.rb +4 -4
  79. data/lib/chef/provider/user/useradd.rb +3 -3
  80. data/lib/chef/provider/user/windows.rb +3 -3
  81. data/lib/chef/resource.rb +4 -3
  82. data/lib/chef/resource/deploy.rb +1 -1
  83. data/lib/chef/rest/rest_request.rb +2 -2
  84. data/lib/chef/run_context.rb +1 -1
  85. data/lib/chef/shell_out.rb +13 -1
  86. data/lib/chef/solr_query.rb +1 -1
  87. data/lib/chef/solr_query/solr_http_request.rb +1 -1
  88. data/lib/chef/tasks/chef_repo.rake +74 -0
  89. data/lib/chef/version.rb +1 -1
  90. metadata +2 -2
@@ -274,7 +274,7 @@ class Chef
274
274
 
275
275
  def environment(arg=nil)
276
276
  if arg.is_a?(String)
277
- Chef::Log.info "Setting RAILS_ENV, RACK_ENV, and MERB_ENV to `#{arg}'"
277
+ Chef::Log.debug "Setting RAILS_ENV, RACK_ENV, and MERB_ENV to `#{arg}'"
278
278
  Chef::Log.warn "[DEPRECATED] please modify your deploy recipe or attributes to set the environment using a hash"
279
279
  arg = {"RAILS_ENV"=>arg,"MERB_ENV"=>arg,"RACK_ENV"=>arg}
280
280
  end
@@ -101,7 +101,7 @@ class Chef
101
101
  # http://redmine.ruby-lang.org/issues/show/2708
102
102
  # http://redmine.ruby-lang.org/issues/show/2758
103
103
  if e.to_s =~ /#{Regexp.escape(%q|undefined method `closed?' for nil:NilClass|)}/
104
- Chef::Log.debug("rescued error in http connect, re-raising as Errno::ECONNREFUSED to hide bug in net/http")
104
+ Chef::Log.debug("Rescued error in http connect, re-raising as Errno::ECONNREFUSED to hide bug in net/http")
105
105
  Chef::Log.debug("#{e.class.name}: #{e.to_s}")
106
106
  Chef::Log.debug(e.backtrace.join("\n"))
107
107
  raise Errno::ECONNREFUSED, "Connection refused attempting to contact #{url.scheme}://#{host}:#{port}"
@@ -141,7 +141,7 @@ class Chef
141
141
  if http_proxy.nil?
142
142
  @http_client = Net::HTTP.new(host, port)
143
143
  else
144
- Chef::Log.debug("using #{http_proxy.host}:#{http_proxy.port} for proxy")
144
+ Chef::Log.debug("Using #{http_proxy.host}:#{http_proxy.port} for proxy")
145
145
  user = Chef::Config["#{url.scheme}_proxy_user"]
146
146
  pass = Chef::Config["#{url.scheme}_proxy_pass"]
147
147
  @http_client = Net::HTTP.Proxy(http_proxy.host, http_proxy.port, user, pass).new(host, port)
@@ -107,7 +107,7 @@ class Chef
107
107
  resourcelist = Chef::ResourceDefinitionList.new
108
108
  resourcelist.from_file(filename)
109
109
  definitions.merge!(resourcelist.defines) do |key, oldval, newval|
110
- Chef::Log.info("Overriding duplicate definition #{key}, new found in #{filename}")
110
+ Chef::Log.info("Overriding duplicate definition #{key}, new definition found in #{filename}")
111
111
  newval
112
112
  end
113
113
  end
@@ -56,6 +56,8 @@ class Chef
56
56
  attr_accessor :cwd
57
57
  attr_accessor :valid_exit_codes
58
58
  attr_accessor :live_stream
59
+ attr_accessor :command_log_level
60
+ attr_accessor :command_log_prepend
59
61
 
60
62
  attr_reader :command, :umask, :environment
61
63
  attr_writer :timeout
@@ -111,6 +113,8 @@ class Chef
111
113
  def initialize(*command_args)
112
114
  @stdout, @stderr = '', ''
113
115
  @live_stream = nil
116
+ @command_log_level = :debug
117
+ @command_log_prepend = nil
114
118
  @environment = DEFAULT_ENVIRONMENT
115
119
  @cwd = nil
116
120
  @valid_exit_codes = [0]
@@ -169,7 +173,11 @@ class Chef
169
173
  # * Chef::Exceptions::CommandTimeout when the command does not complete
170
174
  # within +timeout+ seconds (default: 60s)
171
175
  def run_command
172
- Chef::Log.info("sh(#{@command})")
176
+ if command_log_prepend
177
+ Chef::Log.send(command_log_level, "#{command_log_prepend} sh(#{@command})")
178
+ else
179
+ Chef::Log.send(command_log_level, "sh(#{@command})")
180
+ end
173
181
  super
174
182
  end
175
183
 
@@ -224,6 +232,10 @@ class Chef
224
232
  self.valid_exit_codes = Array(setting)
225
233
  when 'live_stream'
226
234
  self.live_stream = setting
235
+ when 'command_log_level'
236
+ self.command_log_level = setting
237
+ when 'command_log_prepend'
238
+ self.command_log_prepend = setting
227
239
  when 'environment', 'env'
228
240
  # passing :environment => nil means don't set any new ENV vars
229
241
  @environment = setting.nil? ? {} : @environment.dup.merge!(setting)
@@ -104,7 +104,7 @@ class Chef
104
104
  def objects
105
105
  if !object_ids.empty?
106
106
  @bulk_objects ||= @couchdb.bulk_get(object_ids)
107
- Chef::Log.debug { "bulk get of objects: #{@bulk_objects.inspect}" }
107
+ Chef::Log.debug { "Bulk get of objects: #{@bulk_objects.inspect}" }
108
108
  @bulk_objects
109
109
  else
110
110
  []
@@ -97,7 +97,7 @@ class Chef
97
97
  # http://redmine.ruby-lang.org/issues/show/2758
98
98
  if e.to_s =~ /#{Regexp.escape(%q|undefined method 'closed?' for nil:NilClass|)}/
99
99
  Chef::Log.fatal("#{description} failed. Chef::Exceptions::SolrConnectionError exception: Errno::ECONNREFUSED (net/http undefined method closed?) attempting to contact #{solr_url}")
100
- Chef::Log.debug("rescued error in http connect, treating it as Errno::ECONNREFUSED to hide bug in net/http")
100
+ Chef::Log.debug("Rescued error in http connect, treating it as Errno::ECONNREFUSED to hide bug in net/http")
101
101
  Chef::Log.debug(e.backtrace.join("\n"))
102
102
  raise Chef::Exceptions::SolrConnectionError, "Errno::ECONNREFUSED: Connection refused attempting to contact #{solr_url}"
103
103
  else
@@ -254,3 +254,77 @@ task :test_cookbook, :cookbook do |t, args|
254
254
  system("knife cookbook test #{args.cookbook}")
255
255
  end
256
256
 
257
+ namespace :databag do
258
+ path = "data_bags"
259
+
260
+ desc "Upload a single databag"
261
+ task :upload, :databag do |t, args|
262
+ input_databag = args[:databag] || 'none_specified'
263
+ databag = File.join(path, input_databag)
264
+
265
+ if File.exists?(databag) && File.directory?(databag)
266
+ system "knife data bag create #{input_databag}"
267
+ Dir.foreach(databag) do |item|
268
+ name, type = item.split('.')
269
+ if type == 'json' && name.length > 0
270
+ system "knife data bag from file #{input_databag} " + File.join(databag, item)
271
+ end
272
+ end
273
+ else
274
+ puts "ERROR: Could not find the databag in your databag path (" + File.join(path, input_databag) + "), skipping it"
275
+ end
276
+ end
277
+
278
+ desc "Upload all databags"
279
+ task :upload_all do
280
+ if File.exists?(path) && File.directory?(path)
281
+ Dir.foreach(path) do |databag|
282
+ if databag == databag[/^[\-[:alnum:]_]+$/]
283
+ Rake::Task['databag:upload'].execute( { :databag => databag } )
284
+ end
285
+ end
286
+ else
287
+ puts "ERROR: Could not find any databags, skipping it"
288
+ end
289
+ end
290
+
291
+ desc "Create a databag"
292
+ task :create, :databag do |t, args|
293
+ input_databag = args[:databag] || 'none_specified'
294
+
295
+ FileUtils.mkdir(path) unless File.exists?(path)
296
+ databag = File.join(path, input_databag)
297
+ FileUtils.mkdir(databag) unless File.exists?(databag)
298
+ end
299
+
300
+ desc "Create a databag item stub"
301
+ task :create_item, :databag, :item do |t, args|
302
+ input_databag = args[:databag] || 'none_specified'
303
+ input_item = args[:item] || false
304
+
305
+ databag = File.join(path, input_databag)
306
+ if File.exists?(databag) && File.directory?(databag)
307
+ if input_item
308
+ json_filename = File.join(databag, "#{input_item}.json")
309
+ if !File.exists?(json_filename)
310
+ stub = <<EOH
311
+ {
312
+ "id" : "#{input_item}"
313
+ }
314
+ EOH
315
+ json_file = File.new(json_filename, "w")
316
+ json_file.write(stub)
317
+ json_file.close
318
+ else
319
+ puts "ERROR: databag item already exists (#{json_filename}), skipping it"
320
+ end
321
+ else
322
+ puts "ERROR: No item id specified, skipping it"
323
+ end
324
+ else
325
+ puts "ERROR: Could not find your databag (#{databag}), skipping it"
326
+ end
327
+ end
328
+
329
+ end
330
+
@@ -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.0.beta.6'
20
+ VERSION = '0.10.0.beta.7'
21
21
  end
22
22
 
23
23
  # NOTE: the Chef::Version class is defined in version_class.rb
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 7
5
- version: 0.10.0.beta.6
5
+ version: 0.10.0.beta.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Adam Jacob
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-04 00:00:00 -07:00
13
+ date: 2011-04-06 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency