chef 0.10.0.beta.9 → 0.10.0.beta.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/README.rdoc +2 -0
  2. data/distro/common/html/chef-client.8.html +141 -0
  3. data/distro/common/html/chef-expander-cluster.8.html +164 -0
  4. data/distro/common/html/chef-expanderctl.8.html +146 -0
  5. data/distro/common/html/chef-server-webui.8.html +185 -0
  6. data/distro/common/html/chef-server.8.html +182 -0
  7. data/distro/common/html/chef-solo.8.html +191 -0
  8. data/distro/common/html/chef-solr.8.html +163 -0
  9. data/distro/common/html/knife-bootstrap.1.html +3 -3
  10. data/distro/common/html/knife-client.1.html +3 -3
  11. data/distro/common/html/knife-configure.1.html +1 -1
  12. data/distro/common/html/knife-cookbook-site.1.html +3 -3
  13. data/distro/common/html/knife-cookbook.1.html +3 -3
  14. data/distro/common/html/knife-data-bag.1.html +1 -1
  15. data/distro/common/html/knife-environment.1.html +3 -3
  16. data/distro/common/html/knife-exec.1.html +3 -3
  17. data/distro/common/html/knife-index.1.html +1 -1
  18. data/distro/common/html/knife-node.1.html +3 -3
  19. data/distro/common/html/knife-recipe.1.html +1 -1
  20. data/distro/common/html/knife-role.1.html +3 -3
  21. data/distro/common/html/knife-search.1.html +3 -3
  22. data/distro/common/html/knife-ssh.1.html +3 -3
  23. data/distro/common/html/knife-status.1.html +3 -3
  24. data/distro/common/html/knife-tag.1.html +3 -3
  25. data/distro/common/html/knife.1.html +3 -3
  26. data/distro/common/html/shef.1.html +3 -3
  27. data/distro/common/man/man1/knife-bootstrap.1 +1 -1
  28. data/distro/common/man/man1/knife-client.1 +1 -1
  29. data/distro/common/man/man1/knife-configure.1 +1 -1
  30. data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
  31. data/distro/common/man/man1/knife-cookbook.1 +1 -1
  32. data/distro/common/man/man1/knife-data-bag.1 +1 -1
  33. data/distro/common/man/man1/knife-environment.1 +1 -1
  34. data/distro/common/man/man1/knife-exec.1 +1 -1
  35. data/distro/common/man/man1/knife-index.1 +1 -1
  36. data/distro/common/man/man1/knife-node.1 +1 -1
  37. data/distro/common/man/man1/knife-role.1 +1 -1
  38. data/distro/common/man/man1/knife-search.1 +1 -1
  39. data/distro/common/man/man1/knife-ssh.1 +1 -1
  40. data/distro/common/man/man1/knife-status.1 +1 -1
  41. data/distro/common/man/man1/knife-tag.1 +1 -1
  42. data/distro/common/man/man1/knife.1 +1 -1
  43. data/distro/common/man/man1/shef.1 +1 -1
  44. data/distro/common/man/man8/chef-client.8 +53 -32
  45. data/distro/common/man/man8/chef-expander-cluster.8 +97 -0
  46. data/distro/common/man/man8/chef-expanderctl.8 +62 -0
  47. data/distro/common/man/man8/chef-server-webui.8 +121 -72
  48. data/distro/common/man/man8/chef-server.8 +113 -73
  49. data/distro/common/man/man8/chef-solo.8 +131 -30
  50. data/distro/common/man/man8/chef-solr.8 +85 -26
  51. data/distro/common/markdown/man8/chef-client.mkd +65 -0
  52. data/distro/common/markdown/man8/chef-expander-cluster.mkd +82 -0
  53. data/distro/common/markdown/man8/chef-expanderctl.mkd +58 -0
  54. data/distro/common/markdown/man8/chef-server-webui.mkd +121 -0
  55. data/distro/common/markdown/man8/chef-server.mkd +121 -0
  56. data/distro/common/markdown/man8/chef-solo.mkd +107 -0
  57. data/distro/common/markdown/man8/chef-solr.mkd +85 -0
  58. data/lib/chef/config.rb +1 -1
  59. data/lib/chef/cookbook/metadata.rb +1 -0
  60. data/lib/chef/cookbook_uploader.rb +12 -5
  61. data/lib/chef/couchdb.rb +21 -21
  62. data/lib/chef/file_access_control.rb +4 -4
  63. data/lib/chef/knife.rb +11 -3
  64. data/lib/chef/knife/bootstrap/centos5-gems.erb +13 -7
  65. data/lib/chef/knife/bootstrap/fedora13-gems.erb +1 -1
  66. data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +2 -2
  67. data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +1 -1
  68. data/lib/chef/knife/client_create.rb +1 -1
  69. data/lib/chef/knife/configure.rb +10 -1
  70. data/lib/chef/knife/cookbook_bulk_delete.rb +13 -3
  71. data/lib/chef/knife/cookbook_site_download.rb +5 -5
  72. data/lib/chef/knife/cookbook_site_install.rb +5 -5
  73. data/lib/chef/knife/cookbook_site_list.rb +6 -2
  74. data/lib/chef/knife/cookbook_site_search.rb +1 -1
  75. data/lib/chef/knife/cookbook_site_show.rb +3 -3
  76. data/lib/chef/knife/cookbook_upload.rb +7 -8
  77. data/lib/chef/knife/core/ui.rb +1 -1
  78. data/lib/chef/knife/node_bulk_delete.rb +37 -3
  79. data/lib/chef/knife/recipe_list.rb +0 -1
  80. data/lib/chef/knife/role_bulk_delete.rb +27 -4
  81. data/lib/chef/mixin/language.rb +2 -2
  82. data/lib/chef/resource/deploy_revision.rb +5 -0
  83. data/lib/chef/rest.rb +5 -8
  84. data/lib/chef/version.rb +1 -1
  85. data/lib/chef/version_class.rb +4 -4
  86. metadata +20 -4
@@ -32,9 +32,9 @@ class Chef
32
32
  banner "knife cookbook site install COOKBOOK [VERSION] (options)"
33
33
  category "cookbook site"
34
34
 
35
- option :deps,
36
- :short => "-d",
37
- :long => "--dependencies",
35
+ option :no_deps,
36
+ :short => "-D",
37
+ :long => "--no-dependencies",
38
38
  :boolean => true,
39
39
  :description => "Grab dependencies automatically"
40
40
 
@@ -93,12 +93,12 @@ class Chef
93
93
  end
94
94
 
95
95
 
96
- if config[:deps]
96
+ unless config[:no_deps]
97
97
  md = Chef::Cookbook::Metadata.new
98
98
  md.from_file(File.join(@install_path, @cookbook_name, "metadata.rb"))
99
99
  md.dependencies.each do |cookbook, version_list|
100
100
  # Doesn't do versions.. yet
101
- nv = Chef::Knife::CookbookSiteVendor.new
101
+ nv = self.class.new
102
102
  nv.config = config
103
103
  nv.name_args = [ cookbook ]
104
104
  nv.run
@@ -31,12 +31,16 @@ class Chef
31
31
  :description => "Show corresponding URIs"
32
32
 
33
33
  def run
34
- output(format_list_for_display(get_cookbook_list))
34
+ if config[:with_uri]
35
+ ui.msg(format_list_for_display(get_cookbook_list))
36
+ else
37
+ ui.msg(ui.list(get_cookbook_list.keys.sort, :columns_down))
38
+ end
35
39
  end
36
40
 
37
41
  def get_cookbook_list(items=10, start=0, cookbook_collection={})
38
42
  cookbooks_url = "http://cookbooks.opscode.com/api/v1/cookbooks?items=#{items}&start=#{start}"
39
- cr = rest.get_rest(cookbooks_url)
43
+ cr = noauth_rest.get_rest(cookbooks_url)
40
44
  cr["items"].each do |cookbook|
41
45
  cookbook_collection[cookbook["cookbook_name"]] = cookbook
42
46
  end
@@ -30,7 +30,7 @@ class Chef
30
30
 
31
31
  def search_cookbook(query, items=10, start=0, cookbook_collection={})
32
32
  cookbooks_url = "http://cookbooks.opscode.com/api/v1/search?q=#{query}&items=#{items}&start=#{start}"
33
- cr = rest.get_rest(cookbooks_url)
33
+ cr = noauth_rest.get_rest(cookbooks_url)
34
34
  cr["items"].each do |cookbook|
35
35
  cookbook_collection[cookbook["cookbook_name"]] = cookbook
36
36
  end
@@ -27,16 +27,16 @@ class Chef
27
27
  def run
28
28
  case @name_args.length
29
29
  when 1
30
- cookbook_data = rest.get_rest("http://cookbooks.opscode.com/api/v1/cookbooks/#{@name_args[0]}")
30
+ cookbook_data = noauth_rest.get_rest("http://cookbooks.opscode.com/api/v1/cookbooks/#{@name_args[0]}")
31
31
  when 2
32
- cookbook_data = rest.get_rest("http://cookbooks.opscode.com/api/v1/cookbooks/#{@name_args[0]}/versions/#{name_args[1].gsub('.', '_')}")
32
+ cookbook_data = noauth_rest.get_rest("http://cookbooks.opscode.com/api/v1/cookbooks/#{@name_args[0]}/versions/#{name_args[1].gsub('.', '_')}")
33
33
  end
34
34
  output(format_for_display(cookbook_data))
35
35
  end
36
36
 
37
37
  def get_cookbook_list(items=10, start=0, cookbook_collection={})
38
38
  cookbooks_url = "http://cookbooks.opscode.com/api/v1/cookbooks?items=#{items}&start=#{start}"
39
- cr = rest.get_rest(cookbooks_url)
39
+ cr = noauth_rest.get_rest(cookbooks_url)
40
40
  cr["items"].each do |cookbook|
41
41
  cookbook_collection[cookbook["cookbook_name"]] = cookbook
42
42
  end
@@ -68,9 +68,10 @@ class Chef
68
68
  version_constraints_to_update = {}
69
69
 
70
70
  if config[:all]
71
+ justify_width = cookbook_repo.cookbook_names.map {|name| name.size}.max.to_i + 2
71
72
  cookbook_repo.each do |cookbook_name, cookbook|
72
73
  cookbook.freeze_version if config[:freeze]
73
- upload(cookbook)
74
+ upload(cookbook, justify_width)
74
75
  version_constraints_to_update[cookbook_name] = cookbook.version
75
76
  end
76
77
  else
@@ -79,11 +80,12 @@ class Chef
79
80
  ui.error("You must specify the --all flag or at least one cookbook name")
80
81
  exit 1
81
82
  end
83
+ justify_width = @name_args.map {|name| name.size }.max.to_i + 2
82
84
  @name_args.each do |cookbook_name|
83
85
  begin
84
86
  cookbook = cookbook_repo[cookbook_name]
85
87
  cookbook.freeze_version if config[:freeze]
86
- upload(cookbook)
88
+ upload(cookbook, justify_width)
87
89
  version_constraints_to_update[cookbook_name] = cookbook.version
88
90
  rescue Exceptions::CookbookNotFoundInRepo => e
89
91
  ui.error("Could not find cookbook #{cookbook_name} in your cookbook path, skipping it")
@@ -129,12 +131,9 @@ class Chef
129
131
  end
130
132
  end
131
133
 
132
- def upload(cookbook)
133
- if config[:all]
134
- ui.info("** #{cookbook.name} **")
135
- else
136
- ui.info "Uploading #{cookbook.name}..."
137
- end
134
+ def upload(cookbook, justify_width)
135
+ ui.info("Uploading #{cookbook.name.to_s.ljust(justify_width + 10)} [#{cookbook.version}]")
136
+
138
137
  check_for_broken_links(cookbook)
139
138
  Chef::CookbookUploader.new(cookbook, config[:cookbook_path], :force => config[:force]).upload_cookbook
140
139
  rescue Net::HTTPServerException => e
@@ -93,7 +93,7 @@ class Chef
93
93
  # determined by the value of `config[:color]`. When output is not to a
94
94
  # terminal, colored output is never used
95
95
  def color?
96
- Chef::Config[:color] && stdout.tty?
96
+ Chef::Config[:color] && stdout.tty? && (RUBY_PLATFORM !~ /mswin|mingw32|windows/)
97
97
  end
98
98
 
99
99
  def ask(*args, &block)
@@ -30,13 +30,47 @@ class Chef
30
30
  banner "knife node bulk delete REGEX (options)"
31
31
 
32
32
  def run
33
- if @name_args.length < 1
33
+ if name_args.length < 1
34
34
  ui.fatal("You must supply a regular expression to match the results against")
35
35
  exit 42
36
- else
37
- bulk_delete(Chef::Node, "node", nil, nil, @name_args[0])
36
+ end
37
+
38
+
39
+ nodes_to_delete = {}
40
+ matcher = /#{name_args[0]}/
41
+
42
+ all_nodes.each do |name, node|
43
+ next unless name =~ matcher
44
+ nodes_to_delete[name] = node
45
+ end
46
+
47
+ if nodes_to_delete.empty?
48
+ ui.msg "No nodes match the expression /#{name_args[0]}/"
49
+ exit 0
50
+ end
51
+
52
+ ui.msg("The following nodes will be deleted:")
53
+ ui.msg("")
54
+ ui.msg(ui.list(nodes_to_delete.keys.sort, :columns_down))
55
+ ui.msg("")
56
+ ui.confirm("Are you sure you want to delete these nodes")
57
+
58
+
59
+ nodes_to_delete.sort.each do |name, node|
60
+ node.destroy
61
+ ui.msg("Deleted node #{name}")
38
62
  end
39
63
  end
64
+
65
+ def all_nodes
66
+ node_uris_by_name = Chef::Node.list
67
+
68
+ node_uris_by_name.keys.inject({}) do |nodes_by_name, name|
69
+ nodes_by_name[name] = Chef::Node.new.tap {|n| n.name(name)}
70
+ nodes_by_name
71
+ end
72
+ end
73
+
40
74
  end
41
75
  end
42
76
  end
@@ -23,7 +23,6 @@ class Chef::Knife::RecipeList < Chef::Knife
23
23
 
24
24
  def run
25
25
  recipes = rest.get_rest('cookbooks/_recipes')
26
- recipes = recipes.keys.map { |cb| recipes[cb].map {|ver, rec| rec.map{ |rn| "#{cb}::#{rn} (#{ver})" }}}.flatten.uniq
27
26
  if pattern = @name_args.first
28
27
  recipes = recipes.grep(Regexp.new(pattern))
29
28
  end
@@ -31,10 +31,33 @@ class Chef
31
31
 
32
32
  def run
33
33
  if @name_args.length < 1
34
- ui.fatal("You must supply a regular expression to match the results against")
35
- exit 42
36
- else
37
- bulk_delete(Chef::Role, "role", nil, nil, @name_args[0])
34
+ ui.error("You must supply a regular expression to match the results against")
35
+ exit 1
36
+ end
37
+
38
+ all_roles = Chef::Role.list(true)
39
+
40
+ matcher = /#{@name_args[0]}/
41
+ roles_to_delete = {}
42
+ all_roles.each do |name, role|
43
+ next unless name =~ matcher
44
+ roles_to_delete[role.name] = role
45
+ end
46
+
47
+ if roles_to_delete.empty?
48
+ ui.info "No roles match the expression /#{@name_args[0]}/"
49
+ exit 0
50
+ end
51
+
52
+ ui.msg("The following roles will be deleted:")
53
+ ui.msg("")
54
+ ui.msg(ui.list(roles_to_delete.keys.sort, :columns_down))
55
+ ui.msg("")
56
+ ui.confirm("Are you sure you want to delete these roles")
57
+
58
+ roles_to_delete.sort.each do |name, role|
59
+ role.destroy
60
+ ui.msg("Deleted role #{name}")
38
61
  end
39
62
  end
40
63
  end
@@ -143,7 +143,7 @@ class Chef
143
143
  end
144
144
 
145
145
  def data_bag(bag)
146
- DataBag.validate_name!(bag)
146
+ DataBag.validate_name!(bag.to_s)
147
147
  rbag = DataBag.load(bag)
148
148
  rbag.keys
149
149
  rescue Exception
@@ -152,7 +152,7 @@ class Chef
152
152
  end
153
153
 
154
154
  def data_bag_item(bag, item)
155
- DataBag.validate_name!(bag)
155
+ DataBag.validate_name!(bag.to_s)
156
156
  DataBagItem.validate_id!(item)
157
157
  DataBagItem.load(bag, item)
158
158
  rescue Exception
@@ -24,11 +24,16 @@ class Chef
24
24
  class DeployRevision < Chef::Resource::Deploy
25
25
  def initialize(*args, &block)
26
26
  super
27
+ @resource_name = :deploy_revision
27
28
  @provider = Chef::Provider::Deploy::Revision
28
29
  end
29
30
  end
30
31
 
31
32
  class DeployBranch < Chef::Resource::DeployRevision
33
+ def initialize(*args, &block)
34
+ super
35
+ @resource_name = :deploy_branch
36
+ end
32
37
  end
33
38
 
34
39
  end
@@ -305,14 +305,11 @@ class Chef
305
305
  end
306
306
  raise Timeout::Error, "Timeout connecting to #{url.host}:#{url.port} for #{rest_request.path}, giving up"
307
307
  rescue Net::HTTPFatalError => e
308
- case e.response
309
- when Net::HTTPServiceUnavailable
310
- if http_retry_count - http_attempts + 1 > 0
311
- sleep_time = 1 + (2 ** http_attempts) + rand(2 ** http_attempts)
312
- Chef::Log.error("Service Unavailable for #{url}, retrying #{http_attempts}/#{http_retry_count} in #{sleep_time}s")
313
- sleep(sleep_time)
314
- retry
315
- end
308
+ if http_retry_count - http_attempts + 1 > 0
309
+ sleep_time = 1 + (2 ** http_attempts) + rand(2 ** http_attempts)
310
+ Chef::Log.error("Server returned error for #{url}, retrying #{http_attempts}/#{http_retry_count} in #{sleep_time}s")
311
+ sleep(sleep_time)
312
+ retry
316
313
  end
317
314
  raise
318
315
  end
@@ -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.9'
20
+ VERSION = '0.10.0.beta.10'
21
21
  end
22
22
 
23
23
  # NOTE: the Chef::Version class is defined in version_class.rb
@@ -6,9 +6,9 @@
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
8
8
  # You may obtain a copy of the License at
9
- #
9
+ #
10
10
  # http://www.apache.org/licenses/LICENSE-2.0
11
- #
11
+ #
12
12
  # Unless required by applicable law or agreed to in writing, software
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
14
14
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,7 +50,7 @@ class Chef
50
50
  def eql?(other)
51
51
  other.is_a?(Version) && self == other
52
52
  end
53
-
53
+
54
54
  private
55
55
 
56
56
  def parse(str="")
@@ -62,7 +62,7 @@ class Chef
62
62
  [ $1.to_i, $2.to_i, 0 ]
63
63
  else
64
64
  msg = "'#{str.to_s}' does not match 'x.y.z' or 'x.y'"
65
- raise Chef::Exceptions::InvalidCookbookVersion.new msg
65
+ raise Chef::Exceptions::InvalidCookbookVersion.new( msg )
66
66
  end
67
67
  end
68
68
 
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.9
5
+ version: 0.10.0.beta.10
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-10 00:00:00 -07:00
13
+ date: 2011-04-13 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -65,7 +65,7 @@ dependencies:
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 0.5.7
68
+ version: 0.6.0
69
69
  type: :runtime
70
70
  version_requirements: *id005
71
71
  - !ruby/object:Gem::Dependency
@@ -104,7 +104,7 @@ dependencies:
104
104
  version: 1.4.4
105
105
  - - <=
106
106
  - !ruby/object:Gem::Version
107
- version: 1.4.6
107
+ version: 1.5.2
108
108
  type: :runtime
109
109
  version_requirements: *id008
110
110
  - !ruby/object:Gem::Dependency
@@ -209,6 +209,13 @@ files:
209
209
  - distro/arch/etc/rc.d/chef-server-webui
210
210
  - distro/arch/etc/rc.d/chef-solr
211
211
  - distro/arch/etc/rc.d/chef-solr-indexer
212
+ - distro/common/html/chef-client.8.html
213
+ - distro/common/html/chef-expander-cluster.8.html
214
+ - distro/common/html/chef-expanderctl.8.html
215
+ - distro/common/html/chef-server-webui.8.html
216
+ - distro/common/html/chef-server.8.html
217
+ - distro/common/html/chef-solo.8.html
218
+ - distro/common/html/chef-solr.8.html
212
219
  - distro/common/html/knife-bootstrap.1.html
213
220
  - distro/common/html/knife-client.1.html
214
221
  - distro/common/html/knife-configure.1.html
@@ -245,6 +252,8 @@ files:
245
252
  - distro/common/man/man1/knife.1
246
253
  - distro/common/man/man1/shef.1
247
254
  - distro/common/man/man8/chef-client.8
255
+ - distro/common/man/man8/chef-expander-cluster.8
256
+ - distro/common/man/man8/chef-expanderctl.8
248
257
  - distro/common/man/man8/chef-server-webui.8
249
258
  - distro/common/man/man8/chef-server.8
250
259
  - distro/common/man/man8/chef-solo.8
@@ -266,6 +275,13 @@ files:
266
275
  - distro/common/markdown/man1/knife-tag.mkd
267
276
  - distro/common/markdown/man1/knife.mkd
268
277
  - distro/common/markdown/man1/shef.mkd
278
+ - distro/common/markdown/man8/chef-client.mkd
279
+ - distro/common/markdown/man8/chef-expander-cluster.mkd
280
+ - distro/common/markdown/man8/chef-expanderctl.mkd
281
+ - distro/common/markdown/man8/chef-server-webui.mkd
282
+ - distro/common/markdown/man8/chef-server.mkd
283
+ - distro/common/markdown/man8/chef-solo.mkd
284
+ - distro/common/markdown/man8/chef-solr.mkd
269
285
  - distro/common/markdown/README
270
286
  - distro/debian/etc/default/chef-client
271
287
  - distro/debian/etc/default/chef-server