chef 0.10.4 → 0.10.6.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. data/distro/common/html/chef-client.8.html +9 -4
  2. data/distro/common/html/chef-expander.8.html +4 -4
  3. data/distro/common/html/chef-expanderctl.8.html +4 -4
  4. data/distro/common/html/chef-server-webui.8.html +4 -4
  5. data/distro/common/html/chef-server.8.html +4 -4
  6. data/distro/common/html/chef-solo.8.html +4 -4
  7. data/distro/common/html/chef-solr.8.html +6 -4
  8. data/distro/common/html/knife-bootstrap.1.html +13 -11
  9. data/distro/common/html/knife-client.1.html +4 -4
  10. data/distro/common/html/knife-configure.1.html +4 -4
  11. data/distro/common/html/knife-cookbook-site.1.html +7 -5
  12. data/distro/common/html/knife-cookbook.1.html +10 -8
  13. data/distro/common/html/knife-data-bag.1.html +4 -4
  14. data/distro/common/html/knife-environment.1.html +4 -4
  15. data/distro/common/html/knife-exec.1.html +4 -4
  16. data/distro/common/html/knife-index.1.html +4 -4
  17. data/distro/common/html/knife-node.1.html +5 -26
  18. data/distro/common/html/knife-role.1.html +4 -4
  19. data/distro/common/html/knife-search.1.html +9 -8
  20. data/distro/common/html/knife-ssh.1.html +10 -10
  21. data/distro/common/html/knife-status.1.html +4 -4
  22. data/distro/common/html/knife-tag.1.html +4 -4
  23. data/distro/common/html/knife.1.html +36 -10
  24. data/distro/common/html/shef.1.html +4 -4
  25. data/distro/common/man/man1/knife-bootstrap.1 +18 -10
  26. data/distro/common/man/man1/knife-client.1 +1 -1
  27. data/distro/common/man/man1/knife-configure.1 +1 -1
  28. data/distro/common/man/man1/knife-cookbook-site.1 +10 -2
  29. data/distro/common/man/man1/knife-cookbook.1 +10 -5
  30. data/distro/common/man/man1/knife-data-bag.1 +1 -1
  31. data/distro/common/man/man1/knife-environment.1 +1 -1
  32. data/distro/common/man/man1/knife-exec.1 +1 -1
  33. data/distro/common/man/man1/knife-index.1 +1 -1
  34. data/distro/common/man/man1/knife-node.1 +2 -22
  35. data/distro/common/man/man1/knife-role.1 +1 -1
  36. data/distro/common/man/man1/knife-search.1 +8 -5
  37. data/distro/common/man/man1/knife-ssh.1 +17 -12
  38. data/distro/common/man/man1/knife-status.1 +1 -1
  39. data/distro/common/man/man1/knife-tag.1 +1 -1
  40. data/distro/common/man/man1/knife.1 +50 -9
  41. data/distro/common/man/man1/shef.1 +1 -1
  42. data/distro/common/man/man8/chef-client.8 +21 -1
  43. data/distro/common/man/man8/chef-expander.8 +1 -1
  44. data/distro/common/man/man8/chef-expanderctl.8 +1 -1
  45. data/distro/common/man/man8/chef-server-webui.8 +1 -1
  46. data/distro/common/man/man8/chef-server.8 +1 -1
  47. data/distro/common/man/man8/chef-solo.8 +1 -1
  48. data/distro/common/man/man8/chef-solr.8 +9 -1
  49. data/distro/common/markdown/man1/knife-bootstrap.mkd +9 -5
  50. data/distro/common/markdown/man1/knife-cookbook-site.mkd +5 -1
  51. data/distro/common/markdown/man1/knife-cookbook.mkd +7 -4
  52. data/distro/common/markdown/man1/knife-node.mkd +1 -19
  53. data/distro/common/markdown/man1/knife-search.mkd +5 -4
  54. data/distro/common/markdown/man1/knife-ssh.mkd +8 -0
  55. data/distro/common/markdown/man1/knife.mkd +39 -8
  56. data/distro/common/markdown/man8/chef-client.mkd +10 -0
  57. data/distro/common/markdown/man8/chef-solr.mkd +5 -1
  58. data/distro/debian/etc/init.d/chef-client +48 -38
  59. data/distro/redhat/etc/init.d/chef-client +6 -2
  60. data/lib/chef/checksum.rb +9 -24
  61. data/lib/chef/checksum/storage.rb +18 -0
  62. data/lib/chef/checksum/storage/filesystem.rb +56 -0
  63. data/lib/chef/config.rb +6 -2
  64. data/lib/chef/cookbook/syntax_check.rb +1 -1
  65. data/lib/chef/cookbook_version.rb +37 -9
  66. data/lib/chef/file_access_control.rb +1 -1
  67. data/lib/chef/handler.rb +21 -0
  68. data/lib/chef/knife/bootstrap.rb +3 -1
  69. data/lib/chef/knife/bootstrap/archlinux-gems.erb +10 -0
  70. data/lib/chef/knife/bootstrap/centos5-gems.erb +13 -2
  71. data/lib/chef/knife/bootstrap/fedora13-gems.erb +10 -0
  72. data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +10 -0
  73. data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +10 -0
  74. data/lib/chef/knife/client_create.rb +13 -7
  75. data/lib/chef/knife/client_delete.rb +0 -2
  76. data/lib/chef/knife/client_edit.rb +0 -3
  77. data/lib/chef/knife/client_list.rb +0 -1
  78. data/lib/chef/knife/client_reregister.rb +2 -3
  79. data/lib/chef/knife/client_show.rb +0 -1
  80. data/lib/chef/knife/configure.rb +1 -1
  81. data/lib/chef/knife/configure_client.rb +0 -2
  82. data/lib/chef/knife/cookbook_create.rb +12 -12
  83. data/lib/chef/knife/cookbook_delete.rb +2 -0
  84. data/lib/chef/knife/cookbook_download.rb +9 -6
  85. data/lib/chef/knife/cookbook_list.rb +1 -6
  86. data/lib/chef/knife/cookbook_metadata.rb +8 -8
  87. data/lib/chef/knife/cookbook_site_list.rb +4 -2
  88. data/lib/chef/knife/cookbook_test.rb +1 -1
  89. data/lib/chef/knife/core/bootstrap_context.rb +9 -0
  90. data/lib/chef/knife/core/generic_presenter.rb +8 -1
  91. data/lib/chef/knife/core/node_presenter.rb +30 -0
  92. data/lib/chef/knife/core/ui.rb +8 -3
  93. data/lib/chef/knife/data_bag_create.rb +2 -5
  94. data/lib/chef/knife/data_bag_from_file.rb +2 -6
  95. data/lib/chef/knife/node_show.rb +8 -3
  96. data/lib/chef/knife/role_create.rb +2 -2
  97. data/lib/chef/knife/role_from_file.rb +12 -5
  98. data/lib/chef/knife/search.rb +1 -1
  99. data/lib/chef/knife/ssh.rb +20 -3
  100. data/lib/chef/mixin/command/windows.rb +1 -1
  101. data/lib/chef/platform.rb +24 -0
  102. data/lib/chef/provider/deploy.rb +93 -17
  103. data/lib/chef/provider/file.rb +5 -1
  104. data/lib/chef/provider/group/groupadd.rb +11 -1
  105. data/lib/chef/provider/ifconfig.rb +66 -5
  106. data/lib/chef/provider/package.rb +41 -5
  107. data/lib/chef/provider/package/apt.rb +10 -0
  108. data/lib/chef/provider/package/yum.rb +59 -14
  109. data/lib/chef/provider/remote_directory.rb +0 -1
  110. data/lib/chef/provider/service/debian.rb +2 -2
  111. data/lib/chef/provider/service/invokercd.rb +35 -0
  112. data/lib/chef/provider/service/windows.rb +92 -83
  113. data/lib/chef/resource.rb +4 -1
  114. data/lib/chef/resource/deploy.rb +9 -0
  115. data/lib/chef/resource/group.rb +8 -0
  116. data/lib/chef/resource/ifconfig.rb +12 -2
  117. data/lib/chef/resource/package.rb +1 -1
  118. data/lib/chef/resource/service.rb +1 -10
  119. data/lib/chef/shef/shef_session.rb +2 -1
  120. data/lib/chef/shell_out.rb +0 -1
  121. data/lib/chef/shell_out/windows.rb +508 -52
  122. data/lib/chef/solr_query/solr_http_request.rb +19 -5
  123. data/lib/chef/tasks/chef_repo.rake +9 -5
  124. data/lib/chef/version.rb +1 -1
  125. metadata +414 -453
@@ -18,6 +18,16 @@ EOP
18
18
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
19
19
  rm /tmp/validation.pem
20
20
 
21
+ <% if @chef_config[:encrypted_data_bag_secret] -%>
22
+ (
23
+ cat <<'EOP'
24
+ <%= encrypted_data_bag_secret %>
25
+ EOP
26
+ ) > /tmp/encrypted_data_bag_secret
27
+ awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
28
+ rm /tmp/encrypted_data_bag_secret
29
+ <% end -%>
30
+
21
31
  (
22
32
  cat <<'EOP'
23
33
  log_level :info
@@ -4,9 +4,10 @@ bash -c '
4
4
  if [ ! -f /usr/bin/chef-client ]; then
5
5
  wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
6
6
  rpm -Uvh epel-release-5-4.noarch.rpm
7
- wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>-O /etc/yum.repos.d/aegis.repo http://rpm.aegisco.com/aegisco/el5/aegisco.repo
7
+ wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://rpm.aegisco.com/aegisco/rhel/aegisco-rhel.rpm
8
+ rpm -Uvh aegisco-rhel.rpm
8
9
 
9
- yum install -y ruby-1.8.7.334-2.el5 ruby-devel-1.8.7.334-2.el5 gcc gcc-c++ automake autoconf make
10
+ yum install -y ruby ruby-devel gcc gcc-c++ automake autoconf make
10
11
 
11
12
  cd /tmp
12
13
  wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz
@@ -30,6 +31,16 @@ EOP
30
31
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
31
32
  rm /tmp/validation.pem
32
33
 
34
+ <% if @chef_config[:encrypted_data_bag_secret] -%>
35
+ (
36
+ cat <<'EOP'
37
+ <%= encrypted_data_bag_secret %>
38
+ EOP
39
+ ) > /tmp/encrypted_data_bag_secret
40
+ awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
41
+ rm /tmp/encrypted_data_bag_secret
42
+ <% end -%>
43
+
33
44
  (
34
45
  cat <<'EOP'
35
46
  <%= config_content %>
@@ -18,6 +18,16 @@ EOP
18
18
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
19
19
  rm /tmp/validation.pem
20
20
 
21
+ <% if @chef_config[:encrypted_data_bag_secret] -%>
22
+ (
23
+ cat <<'EOP'
24
+ <%= encrypted_data_bag_secret %>
25
+ EOP
26
+ ) > /tmp/encrypted_data_bag_secret
27
+ awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
28
+ rm /tmp/encrypted_data_bag_secret
29
+ <% end -%>
30
+
21
31
  (
22
32
  cat <<'EOP'
23
33
  <%= config_content %>
@@ -17,6 +17,16 @@ EOP
17
17
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
18
18
  rm /tmp/validation.pem
19
19
 
20
+ <% if @chef_config[:encrypted_data_bag_secret] -%>
21
+ (
22
+ cat <<'EOP'
23
+ <%= encrypted_data_bag_secret %>
24
+ EOP
25
+ ) > /tmp/encrypted_data_bag_secret
26
+ awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
27
+ rm /tmp/encrypted_data_bag_secret
28
+ <% end -%>
29
+
20
30
  <% unless @chef_config[:validation_client_name] == "chef-validator" -%>
21
31
  [ `grep -qx "validation_client_name \"<%= @chef_config[:validation_client_name] %>\"" /etc/chef/client.rb` ] || echo "validation_client_name \"<%= @chef_config[:validation_client_name] %>\"" >> /etc/chef/client.rb
22
32
  <% end -%>
@@ -25,6 +25,16 @@ EOP
25
25
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
26
26
  rm /tmp/validation.pem
27
27
 
28
+ <% if @chef_config[:encrypted_data_bag_secret] -%>
29
+ (
30
+ cat <<'EOP'
31
+ <%= encrypted_data_bag_secret %>
32
+ EOP
33
+ ) > /tmp/encrypted_data_bag_secret
34
+ awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
35
+ rm /tmp/encrypted_data_bag_secret
36
+ <% end -%>
37
+
28
38
  (
29
39
  cat <<'EOP'
30
40
  <%= config_content %>
@@ -55,16 +55,22 @@ class Chef
55
55
 
56
56
  output = edit_data(client)
57
57
 
58
- key = output.save
58
+ # Chef::ApiClient.save will try to create a client and if it exists will update it instead silently
59
+ client = output.save
59
60
 
60
- ui.info("Created #{output}")
61
-
62
- if config[:file]
63
- File.open(config[:file], "w") do |f|
64
- f.print(key['private_key'])
61
+ # We only get a private_key on client creation, not on client update.
62
+ if client['private_key']
63
+ ui.info("Created #{output}")
64
+
65
+ if config[:file]
66
+ File.open(config[:file], "w") do |f|
67
+ f.print(client['private_key'])
68
+ end
69
+ else
70
+ puts client['private_key']
65
71
  end
66
72
  else
67
- puts key['private_key']
73
+ ui.error "Client '#{client['name']}' already exists"
68
74
  end
69
75
  end
70
76
  end
@@ -44,5 +44,3 @@ class Chef
44
44
  end
45
45
  end
46
46
  end
47
-
48
-
@@ -43,6 +43,3 @@ class Chef
43
43
  end
44
44
  end
45
45
  end
46
-
47
-
48
-
@@ -40,4 +40,3 @@ class Chef
40
40
  end
41
41
  end
42
42
  end
43
-
@@ -44,16 +44,15 @@ class Chef
44
44
  end
45
45
 
46
46
  client = Chef::ApiClient.load(@client_name)
47
- key = client.save(true)
47
+ key = client.save(new_key=true)
48
48
  if config[:file]
49
49
  File.open(config[:file], "w") do |f|
50
50
  f.print(key['private_key'])
51
51
  end
52
52
  else
53
- puts key['private_key']
53
+ ui.msg key['private_key']
54
54
  end
55
55
  end
56
56
  end
57
57
  end
58
58
  end
59
-
@@ -50,4 +50,3 @@ class Chef
50
50
  end
51
51
  end
52
52
  end
53
-
@@ -69,7 +69,7 @@ cache_type 'BasicFile'
69
69
  cache_options( :path => '#{File.join(chef_config_path, "checksums")}' )
70
70
  EOH
71
71
  unless chef_repo.empty?
72
- f.puts "cookbook_path [ '#{chef_repo}/cookbooks', '#{chef_repo}/site-cookbooks' ]"
72
+ f.puts "cookbook_path [ '#{chef_repo}/cookbooks' ]"
73
73
  end
74
74
  end
75
75
 
@@ -48,5 +48,3 @@ class Chef
48
48
  end
49
49
  end
50
50
  end
51
-
52
-
@@ -38,8 +38,7 @@ class Chef
38
38
  option :readme_format,
39
39
  :short => "-r FORMAT",
40
40
  :long => "--readme-format FORMAT",
41
- :description => "Format of the README file, supported formats are 'md' (markdown) and 'rdoc' (rdoc)",
42
- :default => "rdoc"
41
+ :description => "Format of the README file, supported formats are 'md' (markdown) and 'rdoc' (rdoc)"
43
42
 
44
43
  option :cookbook_license,
45
44
  :short => "-I LICENSE",
@@ -68,14 +67,15 @@ class Chef
68
67
  raise ArgumentError, "Default cookbook_path is not specified in the knife.rb config file, and a value to -o is not provided. Nowhere to write the new cookbook to."
69
68
  end
70
69
 
71
- cookbook_path = Array(config[:cookbook_path]).first
70
+ cookbook_path = File.expand_path(Array(config[:cookbook_path]).first)
72
71
  cookbook_name = @name_args.first
73
72
  copyright = config[:cookbook_copyright] || "YOUR_COMPANY_NAME"
74
73
  email = config[:cookbook_email] || "YOUR_EMAIL"
75
74
  license = ((config[:cookbook_license] != "false") && config[:cookbook_license]) || "none"
75
+ readme_format = ((config[:readme_format] != "false") && config[:readme_format]) || "md"
76
76
  create_cookbook(cookbook_path,cookbook_name, copyright, license)
77
- create_readme(cookbook_path,cookbook_name)
78
- create_metadata(cookbook_path,cookbook_name, copyright, email, license)
77
+ create_readme(cookbook_path,cookbook_name,readme_format)
78
+ create_metadata(cookbook_path,cookbook_name, copyright, email, license,readme_format)
79
79
  end
80
80
 
81
81
  def create_cookbook(dir, cookbook_name, copyright, license)
@@ -179,11 +179,11 @@ EOH
179
179
  end
180
180
  end
181
181
 
182
- def create_readme(dir, cookbook_name)
182
+ def create_readme(dir, cookbook_name,readme_format)
183
183
  msg("** Creating README for cookbook: #{cookbook_name}")
184
- unless File.exists?(File.join(dir, cookbook_name, "README.#{config[:readme_format]}"))
185
- open(File.join(dir, cookbook_name, "README.#{config[:readme_format]}"), "w") do |file|
186
- case config[:readme_format]
184
+ unless File.exists?(File.join(dir, cookbook_name, "README.#{readme_format}"))
185
+ open(File.join(dir, cookbook_name, "README.#{readme_format}"), "w") do |file|
186
+ case readme_format
187
187
  when "rdoc"
188
188
  file.puts <<-EOH
189
189
  = DESCRIPTION:
@@ -226,7 +226,7 @@ EOH
226
226
  end
227
227
  end
228
228
 
229
- def create_metadata(dir, cookbook_name, copyright, email, license)
229
+ def create_metadata(dir, cookbook_name, copyright, email, license,readme_format)
230
230
  msg("** Creating metadata for cookbook: #{cookbook_name}")
231
231
 
232
232
  license_name = case license
@@ -244,8 +244,8 @@ EOH
244
244
 
245
245
  unless File.exists?(File.join(dir, cookbook_name, "metadata.rb"))
246
246
  open(File.join(dir, cookbook_name, "metadata.rb"), "w") do |file|
247
- if File.exists?(File.join(dir, cookbook_name, "README.#{config[:readme_format]}"))
248
- long_description = "long_description IO.read(File.join(File.dirname(__FILE__), 'README.#{config[:readme_format]}'))"
247
+ if File.exists?(File.join(dir, cookbook_name, "README.#{readme_format}"))
248
+ long_description = "long_description IO.read(File.join(File.dirname(__FILE__), 'README.#{readme_format}'))"
249
249
  end
250
250
  file.puts <<-EOH
251
251
  maintainer "#{copyright}"
@@ -22,6 +22,8 @@ class Chef
22
22
  class Knife
23
23
  class CookbookDelete < Knife
24
24
 
25
+ attr_accessor :cookbook_name, :version
26
+
25
27
  deps do
26
28
  require 'chef/cookbook_version'
27
29
  end
@@ -23,6 +23,9 @@ class Chef
23
23
  class Knife
24
24
  class CookbookDownload < Knife
25
25
 
26
+ attr_reader :version
27
+ attr_accessor :cookbook_name
28
+
26
29
  deps do
27
30
  require 'chef/cookbook_version'
28
31
  end
@@ -40,7 +43,7 @@ class Chef
40
43
  :long => "--dir DOWNLOAD_DIRECTORY",
41
44
  :description => "The directory to download the cookbook into",
42
45
  :default => Dir.pwd
43
-
46
+
44
47
  option :force,
45
48
  :short => "-f",
46
49
  :long => "--force",
@@ -57,11 +60,11 @@ class Chef
57
60
  ui.fatal("You must specify a cookbook name")
58
61
  exit 1
59
62
  elsif @version.nil?
60
- determine_version
63
+ @version = determine_version
61
64
  end
62
-
65
+
63
66
  ui.info("Downloading #{@cookbook_name} cookbook version #{@version}")
64
-
67
+
65
68
  cookbook = rest.get_rest("cookbooks/#{@cookbook_name}/#{@version}")
66
69
  manifest = cookbook.manifest
67
70
 
@@ -75,7 +78,7 @@ class Chef
75
78
  exit
76
79
  end
77
80
  end
78
-
81
+
79
82
  Chef::CookbookVersion::COOKBOOK_SEGMENTS.each do |segment|
80
83
  next unless manifest.has_key?(segment)
81
84
  ui.info("Downloading #{segment}")
@@ -109,7 +112,6 @@ class Chef
109
112
  versions.sort!
110
113
  versions
111
114
  end
112
- #pp :available_versions => @available_versions
113
115
  @available_versions
114
116
  end
115
117
 
@@ -127,6 +129,7 @@ class Chef
127
129
  ui.error("'#{response}' is not a valid value.")
128
130
  exit(1)
129
131
  end
132
+ @version
130
133
  end
131
134
 
132
135
  end
@@ -40,13 +40,8 @@ class Chef
40
40
  num_versions = config[:all_versions] ? "num_versions=all" : "num_versions=1"
41
41
  api_endpoint = env ? "/environments/#{env}/cookbooks?#{num_versions}" : "/cookbooks?#{num_versions}"
42
42
  cookbook_versions = rest.get_rest(api_endpoint)
43
- format_cookbook_list_for_display(cookbook_versions).each do |line|
44
- ui.msg(line)
45
- end
43
+ ui.output(format_cookbook_list_for_display(cookbook_versions))
46
44
  end
47
45
  end
48
46
  end
49
47
  end
50
-
51
-
52
-
@@ -82,10 +82,10 @@ class Chef
82
82
  generated = true
83
83
  Chef::Log.debug("Generated #{json_file}")
84
84
  rescue Exceptions::ObsoleteDependencySyntax, Exceptions::InvalidVersionConstraint => e
85
- STDERR.puts "ERROR: The cookbook '#{cookbook}' contains invalid or obsolete metadata syntax."
86
- STDERR.puts "in #{file}:"
87
- STDERR.puts
88
- STDERR.puts e.message
85
+ ui.stderr.puts "ERROR: The cookbook '#{cookbook}' contains invalid or obsolete metadata syntax."
86
+ ui.stderr.puts "in #{file}:"
87
+ ui.stderr.puts
88
+ ui.stderr.puts e.message
89
89
  exit 1
90
90
  end
91
91
 
@@ -95,10 +95,10 @@ class Chef
95
95
  Chef::Cookbook::Metadata.validate_json(IO.read(json_file))
96
96
  end
97
97
  rescue Exceptions::ObsoleteDependencySyntax, Exceptions::InvalidVersionConstraint => e
98
- STDERR.puts "ERROR: The cookbook '#{cookbook}' contains invalid or obsolete metadata syntax."
99
- STDERR.puts "in #{json_file}:"
100
- STDERR.puts
101
- STDERR.puts e.message
98
+ ui.stderr.puts "ERROR: The cookbook '#{cookbook}' contains invalid or obsolete metadata syntax."
99
+ ui.stderr.puts "in #{json_file}:"
100
+ ui.stderr.puts
101
+ ui.stderr.puts e.message
102
102
  exit 1
103
103
  end
104
104
 
@@ -32,7 +32,9 @@ class Chef
32
32
 
33
33
  def run
34
34
  if config[:with_uri]
35
- ui.msg(format_list_for_display(get_cookbook_list))
35
+ cookbooks = Hash.new
36
+ get_cookbook_list.each{ |k,v| cookbooks[k] = v['cookbook'] }
37
+ ui.output(format_for_display(cookbooks))
36
38
  else
37
39
  ui.msg(ui.list(get_cookbook_list.keys.sort, :columns_down))
38
40
  end
@@ -46,7 +48,7 @@ class Chef
46
48
  end
47
49
  new_start = start + cr["items"].length
48
50
  if new_start < cr["total"]
49
- get_cookbook_list(items, new_start, cookbook_collection)
51
+ get_cookbook_list(items, new_start, cookbook_collection)
50
52
  else
51
53
  cookbook_collection
52
54
  end
@@ -53,7 +53,7 @@ class Chef
53
53
  end
54
54
  else
55
55
  @name_args.each do |cb|
56
- puts "checking #{cb}"
56
+ ui.info "checking #{cb}"
57
57
  next unless cookbook_loader.cookbook_exists?(cb)
58
58
  checked_a_cookbook = true
59
59
  test_cookbook(cb)
@@ -50,6 +50,10 @@ class Chef
50
50
  IO.read(@chef_config[:validation_key])
51
51
  end
52
52
 
53
+ def encrypted_data_bag_secret
54
+ IO.read(@chef_config[:encrypted_data_bag_secret])
55
+ end
56
+
53
57
  def config_content
54
58
  client_rb = <<-CONFIG
55
59
  log_level :info
@@ -67,6 +71,11 @@ CONFIG
67
71
  client_rb << %Q{http_proxy "#{knife_config[:bootstrap_proxy]}"\n}
68
72
  client_rb << %Q{https_proxy "#{knife_config[:bootstrap_proxy]}"\n}
69
73
  end
74
+
75
+ if @chef_config[:encrypted_data_bag_secret]
76
+ client_rb << %Q{encrypted_data_bag_secret "/etc/chef/encrypted_data_bag_secret"\n}
77
+ end
78
+
70
79
  client_rb
71
80
  end
72
81
 
@@ -67,6 +67,7 @@ class Chef
67
67
  require 'yaml'
68
68
  YAML::dump(data)
69
69
  when :pp
70
+ require 'stringio'
70
71
  # If you were looking for some attribute and there is only one match
71
72
  # just dump the attribute value
72
73
  if data.length == 1 and config[:attribute]
@@ -165,7 +166,13 @@ class Chef
165
166
 
166
167
  def format_cookbook_list_for_display(item)
167
168
  if config[:with_uri]
168
- item
169
+ item.inject({}) do |collected, (cookbook, versions)|
170
+ collected[cookbook] = Hash.new
171
+ versions['versions'].each do |ver|
172
+ collected[cookbook][ver['version']] = ver['url']
173
+ end
174
+ collected
175
+ end
169
176
  else
170
177
  versions_by_cookbook = item.inject({}) do |collected, ( cookbook, versions )|
171
178
  collected[cookbook] = versions["versions"].map {|v| v['version']}