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
@@ -32,55 +32,61 @@ fi
32
32
 
33
33
  DAEMON_OPTS="-d -P $PIDFILE -L $LOGFILE -c $CONFIG -i $INTERVAL -s $SPLAY"
34
34
 
35
- running_pid() {
35
+ running_pid() {
36
36
  pid=$1
37
- name=$2
38
- [ -z "$pid" ] && return 1
39
- [ ! -d /proc/$pid ] && return 1
37
+ name=$2
38
+ [ -z "$pid" ] && return 1
39
+ [ ! -d /proc/$pid ] && return 1
40
40
  cmd=`awk '/Name:/ {print $2}' /proc/$pid/status`
41
- [ "$cmd" != "$name" ] && return 1
42
- return 0
43
- }
41
+ [ "$cmd" != "$name" ] && return 1
42
+ return 0
43
+ }
44
44
 
45
- running() {
45
+ running() {
46
46
  [ ! -f "$PIDFILE" ] && return 1
47
47
  pid=`cat $PIDFILE`
48
- running_pid $pid $NAME || return 1
48
+ running_pid $pid $NAME || return 1
49
49
  return 0
50
- }
50
+ }
51
51
 
52
- start_server() {
53
- if [ -z "$DAEMONUSER" ] ; then
54
- start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
52
+ start_server() {
53
+ if [ -z "$DAEMONUSER" ] ; then
54
+ start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
55
55
  errcode=$?
56
56
  else
57
- start-stop-daemon --start --quiet --pidfile $PIDFILE \
58
- --chuid $DAEMONUSER \
59
- --exec $DAEMON -- $DAEMON_OPTS
60
- errcode=$?
61
- fi
62
- return $errcode
63
- }
57
+ start-stop-daemon --start --quiet --pidfile $PIDFILE \
58
+ --chuid $DAEMONUSER \
59
+ --exec $DAEMON -- $DAEMON_OPTS
60
+ errcode=$?
61
+ fi
62
+ return $errcode
63
+ }
64
64
 
65
- stop_server() {
66
- if [ -z "$DAEMONUSER" ] ; then
67
- killproc -p $PIDFILE $DAEMON
65
+ stop_server() {
66
+ if [ -z "$DAEMONUSER" ] ; then
67
+ killproc -p $PIDFILE $DAEMON
68
68
  errcode=$?
69
69
  else
70
- start-stop-daemon --stop --quiet --pidfile $PIDFILE \
71
- --user $DAEMONUSER \
70
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
71
+ --user $DAEMONUSER \
72
72
  --exec $DAEMON
73
- errcode=$?
74
- fi
75
- return $errcode
76
- }
73
+ errcode=$?
74
+ fi
75
+ return $errcode
76
+ }
77
77
 
78
- reload_server() {
79
- [ ! -f "$PIDFILE" ] && return 1
80
- pid=pidofproc $PIDFILE # This is the daemon's pid
81
- /bin/kill -1 $pid
82
- return $?
83
- }
78
+ reload_server() {
79
+ if [ -z "$DAEMONUSER" ] ; then
80
+ killproc -p $PIDFILE $DAEMON -HUP
81
+ errcode=$?
82
+ else
83
+ start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE \
84
+ --user $DAEMONUSER \
85
+ --exec $DAEMON
86
+ errcode=$?
87
+ fi
88
+ return $errcode
89
+ }
84
90
 
85
91
  force_stop() {
86
92
  [ ! -e "$PIDFILE" ] && return
@@ -108,7 +114,7 @@ case "$1" in
108
114
  exit 0
109
115
  fi
110
116
  if start_server ; then
111
- [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
117
+ [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
112
118
  if running ; then
113
119
  log_end_msg 0
114
120
  else
@@ -161,8 +167,12 @@ case "$1" in
161
167
  fi
162
168
  ;;
163
169
  reload)
164
- log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
165
- log_warning_msg "cannot re-read the config file (use restart)."
170
+ if running; then
171
+ log_daemon_msg "Reloading $DESC" "$NAME"
172
+ errcode=0
173
+ reload_server || errcode=$?
174
+ log_end_msg $errcode
175
+ fi
166
176
  ;;
167
177
  *)
168
178
  N=/etc/init.d/$NAME
@@ -1,5 +1,5 @@
1
1
  #!/bin/bash
2
- #
2
+ #
3
3
  # chef-client Startup script for the Chef client
4
4
  #
5
5
  # chkconfig: - 98 02
@@ -57,7 +57,11 @@ restart () {
57
57
  }
58
58
 
59
59
  reload() {
60
- restart
60
+ echo -n $"Reloading $prog: "
61
+ killproc -p $pidfile chef-client -HUP
62
+ retval=$?
63
+ echo
64
+ return $retval
61
65
  }
62
66
 
63
67
  force_reload() {
@@ -16,6 +16,7 @@
16
16
  # limitations under the License.
17
17
 
18
18
  require 'chef/log'
19
+ require 'chef/checksum/storage'
19
20
  require 'uuidtools'
20
21
 
21
22
  class Chef
@@ -26,6 +27,8 @@ class Chef
26
27
  attr_accessor :checksum, :create_time
27
28
  attr_accessor :couchdb_id, :couchdb_rev
28
29
 
30
+ attr_reader :storage
31
+
29
32
  # When a Checksum commits a sandboxed file to its final home in the checksum
30
33
  # repo, this attribute will have the original on-disk path where the file
31
34
  # was stored; it will be used if the commit is reverted to restore the sandbox
@@ -59,6 +62,7 @@ class Chef
59
62
  @create_time = Time.now.iso8601
60
63
  @checksum = checksum
61
64
  @original_committed_file_location = nil
65
+ @storage = Storage::Filesystem.new(Chef::Config.checksum_path, checksum)
62
66
  end
63
67
 
64
68
  def to_json(*a)
@@ -89,26 +93,12 @@ class Chef
89
93
  checksum
90
94
  end
91
95
 
92
-
93
- ##
94
- # On-Disk Checksum File Repo (Chef Server API)
95
- ##
96
-
97
- def file_location
98
- File.join(checksum_repo_directory, checksum)
99
- end
100
-
101
- def checksum_repo_directory
102
- File.join(Chef::Config.checksum_path, checksum[0..1])
103
- end
104
-
105
96
  # Moves the given +sandbox_file+ into the checksum repo using the path
106
97
  # given by +file_location+ and saves the Checksum to the database
107
98
  def commit_sandbox_file(sandbox_file)
108
99
  @original_committed_file_location = sandbox_file
109
- Chef::Log.info("Commiting sandbox file: move #{sandbox_file} to #{file_location}")
110
- FileUtils.mkdir_p(checksum_repo_directory)
111
- File.rename(sandbox_file, file_location)
100
+ Chef::Log.info("Commiting sandbox file: move #{sandbox_file} to #{@storage}")
101
+ @storage.commit(sandbox_file)
112
102
  cdb_save
113
103
  end
114
104
 
@@ -122,8 +112,8 @@ class Chef
122
112
  raise Chef::Exceptions::IllegalChecksumRevert, "Checksum #{self.inspect} cannot be reverted because the original sandbox file location is not known"
123
113
  end
124
114
 
125
- Chef::Log.warn("Reverting sandbox file commit: moving #{file_location} back to #{original_committed_file_location}")
126
- File.rename(file_location, original_committed_file_location)
115
+ Chef::Log.warn("Reverting sandbox file commit: moving #{@storage} back to #{original_committed_file_location}")
116
+ @storage.revert(original_committed_file_location)
127
117
  cdb_destroy
128
118
  end
129
119
 
@@ -169,13 +159,8 @@ class Chef
169
159
 
170
160
  private
171
161
 
172
- # Deletes the file backing this checksum from the on-disk repo.
173
- # Purging the checksums is how users can get back to a valid state if
174
- # they've deleted files, so we silently swallow Errno::ENOENT here.
175
162
  def purge_file
176
- FileUtils.rm(file_location)
177
- rescue Errno::ENOENT
178
- true
163
+ @storage.purge
179
164
  end
180
165
 
181
166
  end
@@ -0,0 +1,18 @@
1
+ #
2
+ # Author:: Andrea Campi (<andrea.campi@zephirworks.com>)
3
+ # Copyright:: Copyright (c) 2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ require 'chef/checksum/storage/filesystem'
@@ -0,0 +1,56 @@
1
+ #
2
+ # Author:: Tim Hinderliter (<tim@opscode.com>)
3
+ # Copyright:: Copyright (c) 2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ class Chef
19
+ class Checksum
20
+ class Storage
21
+ class Filesystem
22
+ def initialize(base_dir, checksum)
23
+ @base_dir = base_dir
24
+ @checksum = checksum
25
+ end
26
+
27
+ def file_location
28
+ File.join(checksum_repo_directory, @checksum)
29
+ end
30
+ alias :to_s :file_location
31
+
32
+ def checksum_repo_directory
33
+ File.join(Chef::Config.checksum_path, @checksum[0..1])
34
+ end
35
+
36
+ def commit(sandbox_file)
37
+ FileUtils.mkdir_p(checksum_repo_directory)
38
+ File.rename(sandbox_file, file_location)
39
+ end
40
+
41
+ def revert(original_committed_file_location)
42
+ File.rename(file_location, original_committed_file_location)
43
+ end
44
+
45
+ # Deletes the file backing this checksum from the on-disk repo.
46
+ # Purging the checksums is how users can get back to a valid state if
47
+ # they've deleted files, so we silently swallow Errno::ENOENT here.
48
+ def purge
49
+ FileUtils.rm(file_location)
50
+ rescue Errno::ENOENT
51
+ true
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -147,7 +147,8 @@ class Chef
147
147
  json_attribs nil
148
148
  log_level :info
149
149
  log_location STDOUT
150
- verbose_logging nil
150
+ # toggle info level log items that can create a lot of output
151
+ verbose_logging true
151
152
  node_name nil
152
153
  node_path "/var/chef/node"
153
154
 
@@ -183,7 +184,7 @@ class Chef
183
184
  # Where should chef-solo download recipes from?
184
185
  recipe_url nil
185
186
 
186
- solr_url "http://localhost:8983"
187
+ solr_url "http://localhost:8983/solr"
187
188
  solr_jetty_path "/var/chef/solr-jetty"
188
189
  solr_data_path "/var/chef/solr/data"
189
190
  solr_home_path "/var/chef/solr"
@@ -228,6 +229,9 @@ class Chef
228
229
  # Exception Handlers
229
230
  exception_handlers []
230
231
 
232
+ # Start handlers
233
+ start_handlers []
234
+
231
235
  # Checksum Cache
232
236
  # Uses Moneta on the back-end
233
237
  cache_type "BasicFile"
@@ -109,7 +109,7 @@ class Chef
109
109
 
110
110
  def validate_template(erb_file)
111
111
  Chef::Log.debug("Testing template #{erb_file} for syntax errors...")
112
- result = shell_out("sh -c 'erubis -x #{erb_file} | ruby -c'")
112
+ result = shell_out("erubis -x #{erb_file} | ruby -c")
113
113
  result.error!
114
114
  true
115
115
  rescue Chef::Exceptions::ShellCommandFailed
@@ -630,7 +630,24 @@ class Chef
630
630
  if found_pref
631
631
  @manifest_records_by_path[found_pref]
632
632
  else
633
- raise Chef::Exceptions::FileNotFound, "cookbook #{name} does not contain file #{segment}/#{filename}"
633
+ if segment == :files || segment == :templates
634
+ error_message = "Cookbook '#{name}' (#{version}) does not contain a file at any of these locations:\n"
635
+ error_locations = [
636
+ " #{segment}/#{node[:platform]}-#{node[:platform_version]}/#{filename}",
637
+ " #{segment}/#{node[:platform]}/#{filename}",
638
+ " #{segment}/default/#{filename}",
639
+ ]
640
+ error_message << error_locations.join("\n")
641
+ existing_files = segment_filenames(segment)
642
+ # Show the files that the cookbook does have. If the user made a typo,
643
+ # hopefully they'll see it here.
644
+ unless existing_files.empty?
645
+ error_message << "\n\nThis cookbook _does_ contain: ['#{existing_files.join("','")}']"
646
+ end
647
+ raise Chef::Exceptions::FileNotFound, error_message
648
+ else
649
+ raise Chef::Exceptions::FileNotFound, "cookbook #{name} does not contain file #{segment}/#{filename}"
650
+ end
634
651
  end
635
652
  end
636
653
 
@@ -675,7 +692,7 @@ class Chef
675
692
 
676
693
  best_pref = preferences.find { |pref| !filenames_by_pref[pref].empty? }
677
694
 
678
- raise Chef::Exceptions::FileNotFound, "cookbook #{name} has no directory #{segment}/#{dirname}" unless best_pref
695
+ raise Chef::Exceptions::FileNotFound, "cookbook #{name} has no directory #{segment}/default/#{dirname}" unless best_pref
679
696
 
680
697
  filenames_by_pref[best_pref]
681
698
 
@@ -710,7 +727,7 @@ class Chef
710
727
 
711
728
  best_pref = preferences.find { |pref| !records_by_pref[pref].empty? }
712
729
 
713
- raise Chef::Exceptions::FileNotFound, "cookbook #{name} has no directory #{segment}/#{dirname}" unless best_pref
730
+ raise Chef::Exceptions::FileNotFound, "cookbook #{name} (#{version}) has no directory #{segment}/default/#{dirname}" unless best_pref
714
731
 
715
732
  records_by_pref[best_pref]
716
733
  end
@@ -736,13 +753,24 @@ class Chef
736
753
 
737
754
  fqdn = node[:fqdn]
738
755
 
756
+ # Break version into components, eg: "5.7.1" => [ "5.7.1", "5.7", "5" ]
757
+ search_versions = []
758
+ parts = version.to_s.split('.')
759
+
760
+ parts.size.times do
761
+ search_versions << parts.join('.')
762
+ parts.pop
763
+ end
764
+
739
765
  # Most specific to least specific places to find the path
740
- [
741
- File.join(segment.to_s, "host-#{fqdn}", path),
742
- File.join(segment.to_s, "#{platform}-#{version}", path),
743
- File.join(segment.to_s, platform.to_s, path),
744
- File.join(segment.to_s, "default", path)
745
- ]
766
+ search_path = [ File.join(segment.to_s, "host-#{fqdn}", path) ]
767
+ search_versions.each do |v|
768
+ search_path << File.join(segment.to_s, "#{platform}-#{v}", path)
769
+ end
770
+ search_path << File.join(segment.to_s, platform.to_s, path)
771
+ search_path << File.join(segment.to_s, "default", path)
772
+
773
+ search_path
746
774
  else
747
775
  [File.join(segment, path)]
748
776
  end
@@ -107,7 +107,7 @@ class Chef
107
107
  def set_group
108
108
  if (gid = target_gid) && (gid != stat.gid)
109
109
  File.chown(nil, gid, file)
110
- Chef::Log.info("#{log_string} owner changed to #{gid}")
110
+ Chef::Log.info("#{log_string} group changed to #{gid}")
111
111
  modified
112
112
  end
113
113
  end
@@ -57,6 +57,27 @@ class Chef
57
57
  #
58
58
  class Handler
59
59
 
60
+ # The list of currently configured start handlers
61
+ def self.start_handlers
62
+ Array(Chef::Config[:start_handlers])
63
+ end
64
+
65
+ # Run the start handlers. This will usually be called by a notification
66
+ # from Chef::Client
67
+ def self.run_start_handlers(run_status)
68
+ Chef::Log.info("Running start handlers")
69
+ start_handlers.each do |handler|
70
+ handler.run_report_safely(run_status)
71
+ end
72
+ Chef::Log.info("Start handlers complete.")
73
+ end
74
+
75
+ # Wire up a notification to run the start handlers when the chef run
76
+ # starts.
77
+ Chef::Client.when_run_starts do |run_status|
78
+ run_start_handlers(run_status)
79
+ end
80
+
60
81
  # The list of currently configured report handlers
61
82
  def self.report_handlers
62
83
  Array(Chef::Config[:report_handlers])
@@ -113,9 +113,10 @@ class Chef
113
113
  else
114
114
  bootstrap_files = []
115
115
  bootstrap_files << File.join(File.dirname(__FILE__), 'bootstrap', "#{config[:distro]}.erb")
116
- bootstrap_files << File.join(Dir.pwd, ".chef", "bootstrap", "#{config[:distro]}.erb")
116
+ bootstrap_files << File.join(@@chef_config_dir, "bootstrap", "#{config[:distro]}.erb")
117
117
  bootstrap_files << File.join(ENV['HOME'], '.chef', 'bootstrap', "#{config[:distro]}.erb")
118
118
  bootstrap_files << Gem.find_files(File.join("chef","knife","bootstrap","#{config[:distro]}.erb"))
119
+ bootstrap_files.flatten!
119
120
  end
120
121
 
121
122
  template = Array(bootstrap_files).find do |bootstrap_template|
@@ -180,6 +181,7 @@ class Chef
180
181
  ssh.config[:identity_file] = config[:identity_file]
181
182
  ssh.config[:manual] = true
182
183
  ssh.config[:no_host_key_verify] = config[:no_host_key_verify]
184
+ ssh.config[:on_error] = :raise
183
185
  ssh
184
186
  end
185
187