chef 10.14.4 → 10.16.0.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. data/distro/common/html/chef-client.8.html +4 -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 +182 -0
  6. data/distro/common/html/chef-solo.8.html +4 -4
  7. data/distro/common/html/chef-solr.8.html +4 -4
  8. data/distro/common/html/knife-bootstrap.1.html +5 -5
  9. data/distro/common/html/knife-client.1.html +4 -4
  10. data/distro/common/html/knife-configure.1.html +5 -5
  11. data/distro/common/html/knife-cookbook-site.1.html +4 -4
  12. data/distro/common/html/knife-cookbook.1.html +8 -8
  13. data/distro/common/html/knife-data-bag.1.html +4 -4
  14. data/distro/common/html/knife-environment.1.html +7 -7
  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 -5
  18. data/distro/common/html/knife-role.1.html +4 -4
  19. data/distro/common/html/knife-search.1.html +6 -6
  20. data/distro/common/html/knife-ssh.1.html +4 -4
  21. data/distro/common/html/knife-status.1.html +5 -5
  22. data/distro/common/html/knife-tag.1.html +4 -4
  23. data/distro/common/html/knife.1.html +4 -4
  24. data/distro/common/html/shef.1.html +4 -4
  25. data/distro/common/man/man1/knife-bootstrap.1 +1 -1
  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 +1 -1
  29. data/distro/common/man/man1/knife-cookbook.1 +1 -1
  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 +1 -1
  35. data/distro/common/man/man1/knife-role.1 +1 -1
  36. data/distro/common/man/man1/knife-search.1 +1 -1
  37. data/distro/common/man/man1/knife-ssh.1 +1 -1
  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 +1 -1
  41. data/distro/common/man/man1/shef.1 +1 -1
  42. data/distro/common/man/man8/chef-client.8 +1 -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 +1 -1
  49. data/distro/debian/etc/init.d/chef-client +1 -1
  50. data/distro/debian/etc/init.d/chef-expander +1 -1
  51. data/distro/debian/etc/init.d/chef-server +1 -1
  52. data/distro/debian/etc/init.d/chef-server-webui +1 -1
  53. data/distro/debian/etc/init.d/chef-solr +1 -1
  54. data/lib/chef/application/client.rb +3 -3
  55. data/lib/chef/client.rb +4 -1
  56. data/lib/chef/config.rb +2 -1
  57. data/lib/chef/knife/bootstrap/archlinux-gems.erb +2 -0
  58. data/lib/chef/knife/bootstrap/centos5-gems.erb +2 -0
  59. data/lib/chef/knife/bootstrap/chef-full.erb +2 -1
  60. data/lib/chef/knife/bootstrap/fedora13-gems.erb +2 -0
  61. data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +2 -0
  62. data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +2 -0
  63. data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +2 -0
  64. data/lib/chef/knife/configure.rb +19 -0
  65. data/lib/chef/knife/data_bag_from_file.rb +1 -1
  66. data/lib/chef/knife/environment_from_file.rb +41 -8
  67. data/lib/chef/knife/ssh.rb +5 -1
  68. data/lib/chef/provider/cookbook_file.rb +4 -4
  69. data/lib/chef/provider/directory.rb +3 -0
  70. data/lib/chef/provider/file.rb +49 -3
  71. data/lib/chef/provider/ifconfig.rb +1 -1
  72. data/lib/chef/provider/package.rb +2 -0
  73. data/lib/chef/provider/package/pacman.rb +10 -1
  74. data/lib/chef/provider/remote_file.rb +1 -1
  75. data/lib/chef/provider/service.rb +22 -0
  76. data/lib/chef/provider/template.rb +9 -1
  77. data/lib/chef/resource.rb +1 -1
  78. data/lib/chef/resource/cookbook_file.rb +1 -0
  79. data/lib/chef/resource/cron.rb +5 -0
  80. data/lib/chef/resource/deploy.rb +6 -1
  81. data/lib/chef/resource/directory.rb +6 -0
  82. data/lib/chef/resource/env.rb +5 -0
  83. data/lib/chef/resource/erl_call.rb +3 -0
  84. data/lib/chef/resource/execute.rb +3 -0
  85. data/lib/chef/resource/file.rb +5 -5
  86. data/lib/chef/resource/group.rb +5 -0
  87. data/lib/chef/resource/http_request.rb +3 -0
  88. data/lib/chef/resource/ifconfig.rb +5 -0
  89. data/lib/chef/resource/link.rb +6 -1
  90. data/lib/chef/resource/log.rb +19 -16
  91. data/lib/chef/resource/mdadm.rb +5 -0
  92. data/lib/chef/resource/mount.rb +5 -0
  93. data/lib/chef/resource/ohai.rb +14 -0
  94. data/lib/chef/resource/package.rb +2 -1
  95. data/lib/chef/resource/remote_directory.rb +5 -0
  96. data/lib/chef/resource/route.rb +6 -1
  97. data/lib/chef/resource/ruby_block.rb +11 -0
  98. data/lib/chef/resource/scm.rb +4 -0
  99. data/lib/chef/resource/script.rb +3 -0
  100. data/lib/chef/resource/service.rb +5 -0
  101. data/lib/chef/resource/subversion.rb +2 -1
  102. data/lib/chef/resource/template.rb +1 -0
  103. data/lib/chef/resource/user.rb +4 -0
  104. data/lib/chef/resource_reporter.rb +71 -27
  105. data/lib/chef/rest.rb +8 -4
  106. data/lib/chef/run_list.rb +2 -2
  107. data/lib/chef/scan_access_control.rb +1 -1
  108. data/lib/chef/version.rb +1 -1
  109. data/spec/unit/client_spec.rb +6 -2
  110. data/spec/unit/knife/configure_spec.rb +121 -25
  111. data/spec/unit/knife/data_bag_from_file_spec.rb +5 -3
  112. data/spec/unit/knife/environment_from_file_spec.rb +23 -0
  113. data/spec/unit/provider/cookbook_file_spec.rb +3 -0
  114. data/spec/unit/provider/directory_spec.rb +16 -17
  115. data/spec/unit/provider/file_spec.rb +75 -0
  116. data/spec/unit/provider/ifconfig_spec.rb +2 -2
  117. data/spec/unit/provider/package/pacman_spec.rb +29 -0
  118. data/spec/unit/provider/package_spec.rb +4 -0
  119. data/spec/unit/provider/remote_directory_spec.rb +6 -1
  120. data/spec/unit/provider/remote_file_spec.rb +7 -0
  121. data/spec/unit/resource/cookbook_file_spec.rb +42 -1
  122. data/spec/unit/resource/cron_spec.rb +27 -0
  123. data/spec/unit/resource/deploy_spec.rb +27 -0
  124. data/spec/unit/resource/directory_spec.rb +20 -0
  125. data/spec/unit/resource/env_spec.rb +19 -0
  126. data/spec/unit/resource/erl_call_spec.rb +12 -0
  127. data/spec/unit/resource/execute_spec.rb +16 -0
  128. data/spec/unit/resource/group_spec.rb +17 -1
  129. data/spec/unit/resource/http_request_spec.rb +13 -0
  130. data/spec/unit/resource/ifconfig_spec.rb +46 -0
  131. data/spec/unit/resource/link_spec.rb +21 -0
  132. data/spec/unit/resource/log_spec.rb +10 -0
  133. data/spec/unit/resource/mdadm_spec.rb +22 -0
  134. data/spec/unit/resource/mount_spec.rb +20 -0
  135. data/spec/unit/resource/ohai_spec.rb +18 -0
  136. data/spec/unit/resource/package_spec.rb +3 -0
  137. data/spec/unit/resource/remote_directory_spec.rb +22 -0
  138. data/spec/unit/resource/remote_file_spec.rb +40 -0
  139. data/spec/unit/resource/route_spec.rb +19 -0
  140. data/spec/unit/resource/ruby_block_spec.rb +11 -0
  141. data/spec/unit/resource/scm_spec.rb +20 -0
  142. data/spec/unit/resource/script_spec.rb +14 -0
  143. data/spec/unit/resource/service_spec.rb +21 -0
  144. data/spec/unit/resource/user_spec.rb +21 -0
  145. data/spec/unit/resource_reporter_spec.rb +260 -134
  146. data/spec/unit/run_list_spec.rb +14 -0
  147. metadata +15 -10
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "KNIFE\-STATUS" "1" "September 2012" "Chef 10.14.4" "Chef Manual"
4
+ .TH "KNIFE\-STATUS" "1" "October 2012" "Chef 10.16.0.rc.0" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBknife\-status\fR \- Display status information for the nodes in your infrastructure
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "KNIFE\-TAG" "1" "September 2012" "Chef 10.14.4" "Chef Manual"
4
+ .TH "KNIFE\-TAG" "1" "October 2012" "Chef 10.16.0.rc.0" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBknife\-tag\fR \- Apply tags to nodes on a Chef Server
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "KNIFE" "1" "September 2012" "Chef 10.14.4" "Chef Manual"
4
+ .TH "KNIFE" "1" "October 2012" "Chef 10.16.0.rc.0" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBknife\fR \- Chef Server API client utility
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "SHEF" "1" "September 2012" "Chef 10.14.4" "Chef Manual"
4
+ .TH "SHEF" "1" "October 2012" "Chef 10.16.0.rc.0" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBshef\fR \- Interactive Chef Console
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "CHEF\-CLIENT" "8" "September 2012" "Chef 10.14.4" "Chef Manual"
4
+ .TH "CHEF\-CLIENT" "8" "October 2012" "Chef 10.16.0.rc.0" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-client\fR \- Runs a client node connecting to a chef\-server\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "CHEF\-EXPANDER" "8" "September 2012" "Chef 10.14.4" "Chef Manual"
4
+ .TH "CHEF\-EXPANDER" "8" "October 2012" "Chef 10.16.0.rc.0" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-expander\fR \- fetches messages from RabbitMQ, processes, and loads into chef\-solr
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "CHEF\-EXPANDERCTL" "8" "September 2012" "Chef 10.14.4" "Chef Manual"
4
+ .TH "CHEF\-EXPANDERCTL" "8" "October 2012" "Chef 10.16.0.rc.0" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-expanderctl\fR \- management program for chef\-expander
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "CHEF\-SERVER\-WEBUI" "8" "September 2012" "Chef 10.14.4" "Chef Manual"
4
+ .TH "CHEF\-SERVER\-WEBUI" "8" "October 2012" "Chef 10.16.0.rc.0" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-server\-webui\fR \- Start the Chef Server merb application slice providing Web User Interface (Management Console)\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "CHEF\-SERVER" "8" "September 2012" "Chef 10.14.4" "Chef Manual"
4
+ .TH "CHEF\-SERVER" "8" "October 2012" "Chef 10.16.0.rc.0" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-server\fR \- Start the Chef Server merb application slice\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "CHEF\-SOLO" "8" "September 2012" "Chef 10.14.4" "Chef Manual"
4
+ .TH "CHEF\-SOLO" "8" "October 2012" "Chef 10.16.0.rc.0" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-solo\fR \- Runs chef in solo mode against a specified cookbook location\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "CHEF\-SOLR" "8" "September 2012" "Chef 10.14.4" "Chef Manual"
4
+ .TH "CHEF\-SOLR" "8" "October 2012" "Chef 10.16.0.rc.0" "Chef Manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBchef\-solr\fR \- Runs as Chef\'s search server
@@ -15,7 +15,7 @@
15
15
  # description: starts up chef-client in daemon mode.
16
16
 
17
17
  PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
- DAEMON=/usr/bin/chef-client
18
+ DAEMON=$(which chef-client)
19
19
  NAME=chef-client
20
20
  DESC=chef-client
21
21
  PIDFILE=/var/run/chef/client.pid
@@ -15,7 +15,7 @@
15
15
  # description: starts up chef-expander in daemon mode.
16
16
 
17
17
  PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
- DAEMON=/usr/bin/chef-expander
18
+ DAEMON=$(which chef-expander)
19
19
  NAME=chef-expander
20
20
  DESC=chef-expander
21
21
  PIDFILE=/var/run/chef/expander.pid
@@ -15,7 +15,7 @@
15
15
  # description: starts up chef-server webui.
16
16
 
17
17
  PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
- DAEMON=/usr/bin/chef-server
18
+ DAEMON=$(which chef-server)
19
19
  PIDFILE=/var/run/chef/server.%s.pid
20
20
  MAINPID=/var/run/chef/server.main.pid
21
21
  NAME=chef-server
@@ -15,7 +15,7 @@
15
15
  # description: starts up chef-server webui.
16
16
 
17
17
  PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
- DAEMON=/usr/bin/chef-server-webui
18
+ DAEMON=$(which chef-server-webui)
19
19
  PIDFILE=/var/run/chef/server-webui.%s.pid
20
20
  MAINPID=/var/run/chef/server-webui.main.pid
21
21
  NAME=chef-server-webui
@@ -15,7 +15,7 @@
15
15
  # description: starts up chef-solr in daemon mode.
16
16
 
17
17
  PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
- DAEMON=/usr/bin/chef-solr
18
+ DAEMON=$(which chef-solr)
19
19
  DAEMON_NAME=java
20
20
  NAME=chef-solr
21
21
  DESC=chef-solr
@@ -176,10 +176,10 @@ class Chef::Application::Client < Chef::Application
176
176
  :description => "Fork client",
177
177
  :boolean => true
178
178
 
179
- option :disable_reporting,
179
+ option :enable_reporting,
180
180
  :short => "-R",
181
- :long => "--disable-reporting",
182
- :description => "Disable reporting data collection for chef runs",
181
+ :long => "--enable-reporting",
182
+ :description => "Enable reporting data collection for chef runs",
183
183
  :boolean => true
184
184
 
185
185
  attr_reader :chef_client_json
@@ -447,7 +447,10 @@ class Chef
447
447
 
448
448
  # Ensures runlist override contains RunListItem instances
449
449
  def runlist_override_sanity_check!
450
- @override_runlist = @override_runlist.split(',') if @override_runlist.is_a?(String)
450
+ # Convert to array and remove whitespace
451
+ if @override_runlist.is_a?(String)
452
+ @override_runlist = @override_runlist.split(',').map { |e| e.strip }
453
+ end
451
454
  @override_runlist = [@override_runlist].flatten.compact
452
455
  @override_runlist.map! do |item|
453
456
  if(item.is_a?(Chef::RunList::RunListItem))
@@ -201,7 +201,8 @@ class Chef
201
201
  why_run false
202
202
  color false
203
203
  client_fork false
204
- disable_reporting true
204
+ enable_reporting true
205
+ enable_reporting_url_fatals false
205
206
 
206
207
  # Set these to enable SSL authentication / mutual-authentication
207
208
  # with the server
@@ -17,6 +17,7 @@ EOP
17
17
  ) > /tmp/validation.pem
18
18
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
19
19
  rm /tmp/validation.pem
20
+ chmod 0600 /etc/chef/validation.pem
20
21
 
21
22
  <% if @chef_config[:encrypted_data_bag_secret] -%>
22
23
  (
@@ -26,6 +27,7 @@ EOP
26
27
  ) > /tmp/encrypted_data_bag_secret
27
28
  awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
28
29
  rm /tmp/encrypted_data_bag_secret
30
+ chmod 0600 /etc/chef/encrypted_data_bag_secret
29
31
  <% end -%>
30
32
 
31
33
  <%# Generate Ohai Hints -%>
@@ -30,6 +30,7 @@ EOP
30
30
  ) > /tmp/validation.pem
31
31
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
32
32
  rm /tmp/validation.pem
33
+ chmod 0600 /etc/chef/validation.pem
33
34
 
34
35
  <% if @chef_config[:encrypted_data_bag_secret] -%>
35
36
  (
@@ -39,6 +40,7 @@ EOP
39
40
  ) > /tmp/encrypted_data_bag_secret
40
41
  awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
41
42
  rm /tmp/encrypted_data_bag_secret
43
+ chmod 0600 /etc/chef/encrypted_data_bag_secret
42
44
  <% end -%>
43
45
 
44
46
  <%# Generate Ohai Hints -%>
@@ -32,7 +32,7 @@ EOP
32
32
  ) > /tmp/validation.pem
33
33
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
34
34
  rm /tmp/validation.pem
35
-
35
+ chmod 0600 /etc/chef/validation.pem
36
36
 
37
37
  <% if @chef_config[:encrypted_data_bag_secret] -%>
38
38
  (
@@ -42,6 +42,7 @@ EOP
42
42
  ) > /tmp/encrypted_data_bag_secret
43
43
  awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
44
44
  rm /tmp/encrypted_data_bag_secret
45
+ chmod 0600 /etc/chef/encrypted_data_bag_secret
45
46
  <% end -%>
46
47
 
47
48
  <%# Generate Ohai Hints -%>
@@ -17,6 +17,7 @@ EOP
17
17
  ) > /tmp/validation.pem
18
18
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
19
19
  rm /tmp/validation.pem
20
+ chmod 0600 /etc/chef/validation.pem
20
21
 
21
22
  <% if @chef_config[:encrypted_data_bag_secret] -%>
22
23
  (
@@ -26,6 +27,7 @@ EOP
26
27
  ) > /tmp/encrypted_data_bag_secret
27
28
  awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
28
29
  rm /tmp/encrypted_data_bag_secret
30
+ chmod 0600 /etc/chef/encrypted_data_bag_secret
29
31
  <% end -%>
30
32
 
31
33
  <%# Generate Ohai Hints -%>
@@ -17,6 +17,7 @@ EOP
17
17
  ) > /tmp/validation.pem
18
18
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
19
19
  rm /tmp/validation.pem
20
+ chmod 0600 /etc/chef/validation.pem
20
21
 
21
22
  <% if @chef_config[:encrypted_data_bag_secret] -%>
22
23
  (
@@ -26,6 +27,7 @@ EOP
26
27
  ) > /tmp/encrypted_data_bag_secret
27
28
  awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
28
29
  rm /tmp/encrypted_data_bag_secret
30
+ chmod 0600 /etc/chef/encrypted_data_bag_secret
29
31
  <% end -%>
30
32
 
31
33
  <%# Generate Ohai Hints -%>
@@ -24,6 +24,7 @@ EOP
24
24
  ) > /tmp/validation.pem
25
25
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
26
26
  rm /tmp/validation.pem
27
+ chmod 0600 /etc/chef/validation.pem
27
28
 
28
29
  <% if @chef_config[:encrypted_data_bag_secret] -%>
29
30
  (
@@ -33,6 +34,7 @@ EOP
33
34
  ) > /tmp/encrypted_data_bag_secret
34
35
  awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
35
36
  rm /tmp/encrypted_data_bag_secret
37
+ chmod 0600 /etc/chef/encrypted_data_bag_secret
36
38
  <% end -%>
37
39
 
38
40
  <%# Generate Ohai Hints -%>
@@ -19,6 +19,7 @@ EOP
19
19
  ) > /tmp/validation.pem
20
20
  awk NF /tmp/validation.pem > /etc/chef/validation.pem
21
21
  rm /tmp/validation.pem
22
+ chmod 0600 /etc/chef/validation.pem
22
23
 
23
24
  <% if @chef_config[:encrypted_data_bag_secret] -%>
24
25
  (
@@ -28,6 +29,7 @@ EOP
28
29
  ) > /tmp/encrypted_data_bag_secret
29
30
  awk NF /tmp/encrypted_data_bag_secret > /etc/chef/encrypted_data_bag_secret
30
31
  rm /tmp/encrypted_data_bag_secret
32
+ chmod 0600 /etc/chef/encrypted_data_bag_secret
31
33
  <% end -%>
32
34
 
33
35
  <%# Generate Ohai Hints -%>
@@ -42,6 +42,22 @@ class Chef
42
42
  :boolean => true,
43
43
  :description => "Create an initial API Client"
44
44
 
45
+ option :admin_client_name,
46
+ :long => "--admin-client-name NAME",
47
+ :description => "The existing admin clientname (usually chef-webui)"
48
+
49
+ option :admin_client_key,
50
+ :long => "--admin-client-key PATH",
51
+ :description => "The path to the admin client's private key (usually a file named webui.pem)"
52
+
53
+ option :validation_client_name,
54
+ :long => "--validation-client-name NAME",
55
+ :description => "The validation clientname (usually chef-validator)"
56
+
57
+ option :validation_key,
58
+ :long => "--validation-key PATH",
59
+ :description => "The location of the location of the validation key (usually a file named validation.pem)"
60
+
45
61
  def configure_chef
46
62
  # We are just faking out the system so that you can do this without a key specified
47
63
  Chef::Config[:node_name] = 'woot'
@@ -120,14 +136,17 @@ EOH
120
136
  @new_client_name = config[:node_name] || ask_question("Please enter a clientname for the new client: ", :default => Etc.getlogin)
121
137
  @admin_client_name = config[:admin_client_name] || ask_question("Please enter the existing admin clientname: ", :default => 'chef-webui')
122
138
  @admin_client_key = config[:admin_client_key] || ask_question("Please enter the location of the existing admin client's private key: ", :default => '/etc/chef/webui.pem')
139
+ @admin_client_key = File.expand_path(@admin_client_key)
123
140
  else
124
141
  @new_client_name = config[:node_name] || ask_question("Please enter an existing username or clientname for the API: ", :default => Etc.getlogin)
125
142
  end
126
143
  @validation_client_name = config[:validation_client_name] || ask_question("Please enter the validation clientname: ", :default => 'chef-validator')
127
144
  @validation_key = config[:validation_key] || ask_question("Please enter the location of the validation key: ", :default => '/etc/chef/validation.pem')
145
+ @validation_key = File.expand_path(@validation_key)
128
146
  @chef_repo = config[:repository] || ask_question("Please enter the path to a chef repository (or leave blank): ")
129
147
 
130
148
  @new_client_key = config[:client_key] || File.join(chef_config_path, "#{@new_client_name}.pem")
149
+ @new_client_key = File.expand_path(@new_client_key)
131
150
  end
132
151
 
133
152
  def guess_servername
@@ -46,7 +46,7 @@ class Chef
46
46
  option :all,
47
47
  :short => "-a",
48
48
  :long => "--all",
49
- :description => "Upload all data bags"
49
+ :description => "Upload all data bags or all items for specified data bags"
50
50
 
51
51
  def read_secret
52
52
  if config[:secret]
@@ -25,26 +25,59 @@ class Chef
25
25
  require 'chef/knife/core/object_loader'
26
26
  end
27
27
 
28
- banner "knife environment from file FILE (options)"
28
+ banner "knife environment from file FILE [FILE..] (options)"
29
+
30
+ option :all,
31
+ :short => "-a",
32
+ :long => "--all",
33
+ :description => "Upload all environments"
29
34
 
30
35
  def loader
31
36
  @loader ||= Knife::Core::ObjectLoader.new(Chef::Environment, ui)
32
37
  end
33
38
 
39
+ def environments_path
40
+ @environments_path ||= "environments"
41
+ end
34
42
 
35
- def run
36
- if @name_args[0].nil?
37
- show_usage
38
- ui.fatal("You must specify a file to load")
39
- exit 1
40
- end
43
+ def find_all_environments
44
+ loader.find_all_objects("./#{environments_path}/")
45
+ end
41
46
 
47
+ def load_all_environments
48
+ environments = find_all_environments
49
+ if environments.empty?
50
+ ui.fatal("Unable to find any environment files in '#{environments_path}'")
51
+ exit(1)
52
+ end
53
+ environments.each do |env|
54
+ load_environment(env)
55
+ end
56
+ end
42
57
 
43
- updated = loader.load_from("environments", @name_args[0])
58
+ def load_environment(env)
59
+ updated = loader.load_from("environments", env)
44
60
  updated.save
45
61
  output(format_for_display(updated)) if config[:print_after]
46
62
  ui.info("Updated Environment #{updated.name}")
47
63
  end
64
+
65
+
66
+ def run
67
+ if config[:all] == true
68
+ load_all_environments
69
+ else
70
+ if @name_args[0].nil?
71
+ show_usage
72
+ ui.fatal("You must specify a file to load")
73
+ exit 1
74
+ end
75
+
76
+ @name_args.each do |arg|
77
+ load_environment(arg)
78
+ end
79
+ end
80
+ end
48
81
  end
49
82
  end
50
83
  end
@@ -124,6 +124,8 @@ class Chef
124
124
  q = Chef::Search::Query.new
125
125
  @action_nodes = q.search(:node, @name_args[0])[0]
126
126
  @action_nodes.each do |item|
127
+ # we should skip the loop to next iteration if the item returned by the search is nil
128
+ next if item.nil?
127
129
  # if a command line attribute was not passed, and we have a cloud public_hostname, use that.
128
130
  # see #configure_attribute for the source of config[:attribute] and config[:override_attribute]
129
131
  if !config[:override_attribute] && item[:cloud] and item[:cloud][:public_hostname]
@@ -133,7 +135,9 @@ class Chef
133
135
  else
134
136
  i = format_for_display(item)[config[:attribute]]
135
137
  end
136
- r.push(i) unless i.nil?
138
+ # next if we couldn't find the specified attribute in the returned node object
139
+ next if i.nil?
140
+ r.push(i)
137
141
  end
138
142
  r
139
143
  end