chef 0.8.4 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of chef might be problematic. Click here for more details.

@@ -27,7 +27,7 @@ require 'chef/config'
27
27
  Dir[File.join(File.dirname(__FILE__), 'chef/mixin/**/*.rb')].sort.each { |lib| require lib }
28
28
 
29
29
  class Chef
30
- VERSION = '0.8.4'
30
+ VERSION = '0.8.6'
31
31
  end
32
32
 
33
33
  # Adds a Dir.glob to Ruby 1.8.5, for compat
@@ -35,5 +35,6 @@ class Chef
35
35
  class CouchDBNotFound < RuntimeError; end
36
36
  class PrivateKeyMissing < RuntimeError; end
37
37
  class CannotWritePrivateKey < RuntimeError; end
38
+ class RoleNotFound < RuntimeError; end
38
39
  end
39
40
  end
@@ -27,8 +27,8 @@ class Chef
27
27
  banner "Sub-Command: client show CLIENT (options)"
28
28
 
29
29
  option :attribute,
30
- :short => "-a [ATTR]",
31
- :long => "--attribute [ATTR]",
30
+ :short => "-a ATTR",
31
+ :long => "--attribute ATTR",
32
32
  :description => "Show only one attribute"
33
33
 
34
34
  def run
@@ -25,7 +25,7 @@ class Chef
25
25
  class Knife
26
26
  class CookbookUpload < Knife
27
27
 
28
- banner "Sub-Command: cookbook upload COOKBOOK (options)"
28
+ banner "Sub-Command: cookbook upload [COOKBOOKS...] (options)"
29
29
 
30
30
  option :cookbook_path,
31
31
  :short => "-o PATH:PATH",
@@ -52,17 +52,20 @@ class Chef
52
52
  upload_cookbook(cookbook.name.to_s)
53
53
  end
54
54
  else
55
- upload_cookbook(@name_args[0])
55
+ @name_args.each do |cb|
56
+ Chef::Log.info("** #{cb} **")
57
+ upload_cookbook(cb)
58
+ end
56
59
  end
57
60
  end
58
-
61
+
59
62
  def test_ruby(cookbook_dir)
60
63
  Dir[File.join(cookbook_dir, '**', '*.rb')].each do |ruby_file|
61
64
  Chef::Log.info("Testing #{ruby_file} for syntax errors...")
62
65
  Chef::Mixin::Command.run_command(:command => "ruby -c #{ruby_file}")
63
66
  end
64
67
  end
65
-
68
+
66
69
  def test_templates(cookbook_dir)
67
70
  Dir[File.join(cookbook_dir, '**', '*.erb')].each do |erb_file|
68
71
  Chef::Log.info("Testing template #{erb_file} for syntax errors...")
@@ -166,7 +169,7 @@ class Chef
166
169
  Chef::Log.debug("Removing local staging directory at #{tmp_cookbook_dir}")
167
170
  FileUtils.rm_rf tmp_cookbook_dir
168
171
  end
169
-
172
+
170
173
  end
171
174
  end
172
175
  end
@@ -27,8 +27,8 @@ class Chef
27
27
  banner "Sub-Command: node run_list add [NODE] [ENTRY] (options)"
28
28
 
29
29
  option :after,
30
- :short => "-a [ITEM]",
31
- :long => "--after [ITEM]",
30
+ :short => "-a ITEM",
31
+ :long => "--after ITEM",
32
32
  :description => "Place the ENTRY in the run list after ITEM"
33
33
 
34
34
  def run
@@ -27,8 +27,8 @@ class Chef
27
27
  banner "Sub-Command: role show ROLE (options)"
28
28
 
29
29
  option :attribute,
30
- :short => "-a [ATTR]",
31
- :long => "--attribute [ATTR]",
30
+ :short => "-a ATTR",
31
+ :long => "--attribute ATTR",
32
32
  :description => "Show only one attribute"
33
33
 
34
34
  def run
@@ -46,8 +46,8 @@ class Chef
46
46
  :proc => lambda { |i| i.to_i }
47
47
 
48
48
  option :attribute,
49
- :short => "-a [ATTR]",
50
- :long => "--attribute [ATTR]",
49
+ :short => "-a ATTR",
50
+ :long => "--attribute ATTR",
51
51
  :description => "Show only one attribute"
52
52
 
53
53
  option :run_list,
@@ -171,7 +171,7 @@ class Chef
171
171
  if status.exitstatus != args[:returns]
172
172
  # if the log level is not debug, through output of command when we fail
173
173
  output = ""
174
- if Chef::Log.logger.level > 0
174
+ if Chef::Log.level == :debug
175
175
  output << "\n---- Begin output of #{args[:command]} ----\n"
176
176
  output << "#{command_output}"
177
177
  output << "---- End output of #{args[:command]} ----\n"
@@ -67,7 +67,15 @@ class Chef
67
67
  :mdadm => Chef::Provider::Mdadm
68
68
  }
69
69
  },
70
- :suse => {
70
+ :fedora => {
71
+ :default => {
72
+ :service => Chef::Provider::Service::Redhat,
73
+ :cron => Chef::Provider::Cron,
74
+ :package => Chef::Provider::Package::Yum,
75
+ :mdadm => Chef::Provider::Mdadm
76
+ }
77
+ },
78
+ :suse => {
71
79
  :default => {
72
80
  :service => Chef::Provider::Service::Redhat,
73
81
  :cron => Chef::Provider::Cron,
@@ -28,7 +28,7 @@ class Chef
28
28
  protected
29
29
 
30
30
  def release_created(release)
31
- sorted_releases { |r| r << release }
31
+ sorted_releases {|r| r.delete(release); r << release }
32
32
  end
33
33
 
34
34
  def release_deleted(release)
@@ -72,6 +72,8 @@ class Chef
72
72
  )
73
73
  end
74
74
 
75
+ alias_method :group, :gid
76
+
75
77
  def home(arg=nil)
76
78
  set_or_return(
77
79
  :home,
@@ -40,10 +40,11 @@ class Chef
40
40
 
41
41
  attr_accessor :url, :cookies, :client_name, :signing_key, :signing_key_filename, :sign_on_redirect, :sign_request
42
42
 
43
- def initialize(url, client_name=Chef::Config[:node_name], signing_key_filename=Chef::Config[:client_key])
43
+ def initialize(url, client_name=Chef::Config[:node_name], signing_key_filename=Chef::Config[:client_key], options={})
44
44
  @url = url
45
45
  @cookies = CookieJar.instance
46
46
  @client_name = client_name
47
+ @default_headers = options[:headers] || {}
47
48
  if signing_key_filename
48
49
  @signing_key_filename = signing_key_filename
49
50
  @signing_key = load_signing_key(signing_key_filename)
@@ -177,7 +178,9 @@ class Chef
177
178
  end
178
179
 
179
180
  http.read_timeout = Chef::Config[:rest_timeout]
180
-
181
+
182
+ headers = @default_headers.merge(headers)
183
+
181
184
  unless raw
182
185
  headers = headers.merge({
183
186
  'Accept' => "application/json",
@@ -116,7 +116,7 @@ class Chef
116
116
  self
117
117
  end
118
118
 
119
- def expand(from='server', couchdb=nil)
119
+ def expand(from='server', couchdb=nil, rest=nil)
120
120
  couchdb = couchdb ? couchdb : Chef::CouchDB.new
121
121
  recipes = Array.new
122
122
  default_attrs = Mash.new
@@ -128,21 +128,29 @@ class Chef
128
128
  when 'recipe'
129
129
  recipes << name unless recipes.include?(name)
130
130
  when 'role'
131
- role = nil
132
- next if @seen_roles.include?(name)
133
- if from == 'disk' || Chef::Config[:solo]
134
- # Load the role from disk
135
- role = Chef::Role.from_disk("#{name}")
136
- elsif from == 'server'
137
- # Load the role from the server
138
- r = Chef::REST.new(Chef::Config[:role_url])
139
- role = r.get_rest("roles/#{name}")
140
- elsif from == 'couchdb'
141
- # Load the role from couchdb
142
- role = Chef::Role.cdb_load(name, couchdb)
143
- end
144
- @seen_roles << name
145
- rec, d, o = role.run_list.expand(from)
131
+ role = begin
132
+ next if @seen_roles.include?(name)
133
+ @seen_roles << name
134
+ if from == 'disk' || Chef::Config[:solo]
135
+ # Load the role from disk
136
+ Chef::Role.from_disk("#{name}") || Chef::Exceptions::RoleNotFound
137
+ elsif from == 'server'
138
+ # Load the role from the server
139
+ begin
140
+ (rest || Chef::REST.new(Chef::Config[:role_url])).get_rest("roles/#{name}")
141
+ rescue Net::HTTPServerException
142
+ raise Chef::Exceptions::RoleNotFound if $!.message == '404 "Not Found"'
143
+ raise
144
+ end
145
+ elsif from == 'couchdb'
146
+ # Load the role from couchdb
147
+ Chef::Role.cdb_load(name, couchdb) rescue Chef::Exceptions::CouchDBNotFound raise(Chef::Exceptions::RoleNotFound)
148
+ end
149
+ rescue Chef::Exceptions::RoleNotFound
150
+ Chef::Log.error("Role #{name} is in the runlist but does not exist. Skipping expand.")
151
+ next
152
+ end
153
+ rec, d, o = role.run_list.expand(from, couchdb, rest)
146
154
  rec.each { |r| recipes << r unless recipes.include?(r) }
147
155
  default_attrs = Chef::Mixin::DeepMerge.merge(default_attrs, Chef::Mixin::DeepMerge.merge(role.default_attributes,d))
148
156
  override_attrs = Chef::Mixin::DeepMerge.merge(override_attrs, Chef::Mixin::DeepMerge.merge(role.override_attributes, o))
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 8
8
- - 4
9
- version: 0.8.4
8
+ - 6
9
+ version: 0.8.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Adam Jacob
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-02 00:00:00 -08:00
17
+ date: 2010-03-04 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -82,9 +82,9 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  segments:
84
84
  - 0
85
- - 4
85
+ - 5
86
86
  - 0
87
- version: 0.4.0
87
+ version: 0.5.0
88
88
  type: :runtime
89
89
  version_requirements: *id005
90
90
  - !ruby/object:Gem::Dependency
@@ -150,7 +150,7 @@ dependencies:
150
150
  type: :runtime
151
151
  version_requirements: *id010
152
152
  - !ruby/object:Gem::Dependency
153
- name: ruby-hmac
153
+ name: moneta
154
154
  prerelease: false
155
155
  requirement: &id011 !ruby/object:Gem::Requirement
156
156
  requirements:
@@ -161,18 +161,6 @@ dependencies:
161
161
  version: "0"
162
162
  type: :runtime
163
163
  version_requirements: *id011
164
- - !ruby/object:Gem::Dependency
165
- name: moneta
166
- prerelease: false
167
- requirement: &id012 !ruby/object:Gem::Requirement
168
- requirements:
169
- - - ">="
170
- - !ruby/object:Gem::Version
171
- segments:
172
- - 0
173
- version: "0"
174
- type: :runtime
175
- version_requirements: *id012
176
164
  description: A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure.
177
165
  email: adam@opscode.com
178
166
  executables: