chef 12.5.1 → 12.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -1
  3. data/README.md +6 -4
  4. data/Rakefile +1 -4
  5. data/chef-windows.gemspec +21 -0
  6. data/chef.gemspec +58 -0
  7. data/lib/chef/api_client/registration.rb +9 -4
  8. data/lib/chef/application.rb +3 -84
  9. data/lib/chef/application/apply.rb +9 -2
  10. data/lib/chef/application/client.rb +8 -3
  11. data/lib/chef/application/solo.rb +7 -1
  12. data/lib/chef/application/windows_service.rb +21 -6
  13. data/lib/chef/application/windows_service_manager.rb +2 -3
  14. data/lib/chef/audit/runner.rb +1 -0
  15. data/lib/chef/chef_class.rb +1 -11
  16. data/lib/chef/chef_fs/chef_fs_data_store.rb +181 -2
  17. data/lib/chef/chef_fs/file_system/cookbook_subdir.rb +5 -0
  18. data/lib/chef/chef_fs/file_system/file_system_entry.rb +11 -7
  19. data/lib/chef/client.rb +28 -1
  20. data/lib/chef/cookbook/cookbook_collection.rb +14 -1
  21. data/lib/chef/cookbook/cookbook_version_loader.rb +1 -1
  22. data/lib/chef/cookbook/metadata.rb +115 -9
  23. data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
  24. data/lib/chef/cookbook_version.rb +6 -2
  25. data/lib/chef/data_bag.rb +1 -1
  26. data/lib/chef/data_bag_item.rb +1 -1
  27. data/lib/chef/digester.rb +5 -1
  28. data/lib/chef/dsl/chef_provisioning.rb +57 -0
  29. data/lib/chef/dsl/cheffish.rb +64 -0
  30. data/lib/chef/dsl/declare_resource.rb +108 -0
  31. data/lib/chef/dsl/platform_introspection.rb +3 -3
  32. data/lib/chef/dsl/recipe.rb +3 -73
  33. data/lib/chef/dsl/resources.rb +27 -1
  34. data/lib/chef/event_dispatch/base.rb +3 -0
  35. data/lib/chef/event_dispatch/dispatcher.rb +5 -0
  36. data/lib/chef/event_dispatch/events_output_stream.rb +8 -0
  37. data/lib/chef/exceptions.rb +21 -1
  38. data/lib/chef/file_access_control/unix.rb +12 -12
  39. data/lib/chef/file_content_management/deploy/cp.rb +2 -2
  40. data/lib/chef/file_content_management/deploy/mv_unix.rb +4 -4
  41. data/lib/chef/file_content_management/deploy/mv_windows.rb +1 -1
  42. data/lib/chef/formatters/base.rb +7 -0
  43. data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +2 -2
  44. data/lib/chef/formatters/indentable_output_stream.rb +5 -0
  45. data/lib/chef/http.rb +19 -3
  46. data/lib/chef/http/decompressor.rb +2 -2
  47. data/lib/chef/json_compat.rb +1 -0
  48. data/lib/chef/knife.rb +16 -2
  49. data/lib/chef/knife/bootstrap.rb +55 -10
  50. data/lib/chef/knife/cookbook_site_install.rb +5 -1
  51. data/lib/chef/knife/core/bootstrap_context.rb +2 -1
  52. data/lib/chef/knife/core/node_presenter.rb +1 -1
  53. data/lib/chef/knife/ssh.rb +30 -16
  54. data/lib/chef/knife/ssl_check.rb +4 -2
  55. data/lib/chef/knife/ssl_fetch.rb +3 -2
  56. data/lib/chef/knife/status.rb +14 -1
  57. data/lib/chef/log.rb +14 -0
  58. data/lib/chef/mixin/get_source_from_package.rb +7 -2
  59. data/lib/chef/mixin/properties.rb +302 -0
  60. data/lib/chef/mixin/proxified_socket.rb +38 -0
  61. data/lib/chef/mixin/subclass_directive.rb +37 -0
  62. data/lib/chef/node.rb +13 -5
  63. data/lib/chef/platform/query_helpers.rb +14 -3
  64. data/lib/chef/platform/service_helpers.rb +20 -38
  65. data/lib/chef/policy_builder/expand_node_object.rb +3 -0
  66. data/lib/chef/policy_builder/policyfile.rb +1 -0
  67. data/lib/chef/property.rb +51 -12
  68. data/lib/chef/provider.rb +40 -35
  69. data/lib/chef/provider/deploy.rb +1 -1
  70. data/lib/chef/provider/dsc_resource.rb +54 -20
  71. data/lib/chef/provider/execute.rb +25 -4
  72. data/lib/chef/provider/group.rb +1 -1
  73. data/lib/chef/provider/lwrp_base.rb +1 -0
  74. data/lib/chef/provider/package.rb +76 -30
  75. data/lib/chef/provider/package/dpkg.rb +152 -69
  76. data/lib/chef/provider/package/openbsd.rb +6 -8
  77. data/lib/chef/provider/package/solaris.rb +2 -0
  78. data/lib/chef/provider/package/windows.rb +95 -14
  79. data/lib/chef/provider/package/windows/exe.rb +129 -0
  80. data/lib/chef/provider/package/windows/msi.rb +37 -13
  81. data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +89 -0
  82. data/lib/chef/provider/package/yum.rb +13 -3
  83. data/lib/chef/provider/powershell_script.rb +3 -0
  84. data/lib/chef/provider/remote_file/cache_control_data.rb +37 -4
  85. data/lib/chef/provider/remote_file/http.rb +1 -1
  86. data/lib/chef/provider/script.rb +1 -0
  87. data/lib/chef/provider/service.rb +13 -10
  88. data/lib/chef/provider/service/solaris.rb +43 -17
  89. data/lib/chef/provider/service/upstart.rb +3 -3
  90. data/lib/chef/provider/user.rb +1 -1
  91. data/lib/chef/provider/user/dscl.rb +111 -100
  92. data/lib/chef/provider/user/windows.rb +5 -3
  93. data/lib/chef/recipe.rb +3 -5
  94. data/lib/chef/resource.rb +77 -320
  95. data/lib/chef/resource/action_class.rb +4 -0
  96. data/lib/chef/resource/dpkg_package.rb +4 -3
  97. data/lib/chef/resource/dsc_resource.rb +40 -2
  98. data/lib/chef/resource/execute.rb +9 -1
  99. data/lib/chef/resource/ksh.rb +32 -0
  100. data/lib/chef/resource/lwrp_base.rb +6 -10
  101. data/lib/chef/resource/package.rb +8 -9
  102. data/lib/chef/resource/registry_key.rb +1 -1
  103. data/lib/chef/resource/resource_notification.rb +14 -1
  104. data/lib/chef/resource/script.rb +1 -1
  105. data/lib/chef/resource/windows_package.rb +1 -1
  106. data/lib/chef/resource_builder.rb +14 -7
  107. data/lib/chef/resource_reporter.rb +6 -0
  108. data/lib/chef/resources.rb +1 -7
  109. data/lib/chef/rest.rb +1 -1
  110. data/lib/chef/run_context.rb +45 -2
  111. data/lib/chef/run_list/run_list_expansion.rb +47 -0
  112. data/lib/chef/runner.rb +25 -0
  113. data/lib/chef/search/query.rb +16 -2
  114. data/lib/chef/util/diff.rb +2 -2
  115. data/lib/chef/util/powershell/ps_credential.rb +2 -3
  116. data/lib/chef/version.rb +1 -1
  117. data/lib/chef/win32/api/file.rb +51 -1
  118. data/lib/chef/win32/file.rb +5 -0
  119. data/lib/chef/win32/file/version_info.rb +93 -0
  120. data/lib/chef/win32/mutex.rb +1 -1
  121. data/spec/data/apt/chef-integration-test2-1.0/debian/changelog +5 -0
  122. data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2.debhelper.log +45 -0
  123. data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2.substvars +1 -0
  124. data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/conffiles +1 -0
  125. data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/control +10 -0
  126. data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/md5sums +1 -0
  127. data/spec/data/apt/chef-integration-test2-1.0/debian/compat +1 -0
  128. data/spec/data/apt/chef-integration-test2-1.0/debian/conffiles +1 -0
  129. data/spec/data/apt/chef-integration-test2-1.0/debian/control +13 -0
  130. data/spec/data/apt/chef-integration-test2-1.0/debian/copyright +34 -0
  131. data/spec/data/apt/chef-integration-test2-1.0/debian/files +1 -0
  132. data/spec/data/apt/chef-integration-test2-1.0/debian/rules +13 -0
  133. data/spec/data/apt/chef-integration-test2-1.0/debian/source/format +1 -0
  134. data/spec/data/apt/chef-integration-test2_1.0-1.debian.tar.gz +0 -0
  135. data/spec/data/apt/chef-integration-test2_1.0-1.dsc +18 -0
  136. data/spec/data/apt/chef-integration-test2_1.0-1_amd64.build +91 -0
  137. data/spec/data/apt/chef-integration-test2_1.0-1_amd64.changes +31 -0
  138. data/spec/data/apt/chef-integration-test2_1.0-1_amd64.deb +0 -0
  139. data/spec/data/apt/chef-integration-test2_1.0.orig.tar.gz +0 -0
  140. data/spec/functional/application_spec.rb +1 -1
  141. data/spec/functional/audit/runner_spec.rb +4 -0
  142. data/spec/functional/knife/ssh_spec.rb +5 -5
  143. data/spec/functional/notifications_spec.rb +74 -4
  144. data/spec/functional/resource/aix_service_spec.rb +2 -2
  145. data/spec/functional/resource/dpkg_package_spec.rb +339 -0
  146. data/spec/functional/resource/ifconfig_spec.rb +3 -1
  147. data/spec/functional/resource/mount_spec.rb +5 -2
  148. data/spec/functional/resource/package_spec.rb +1 -1
  149. data/spec/functional/resource/user/windows_spec.rb +8 -0
  150. data/spec/functional/resource/windows_package_spec.rb +177 -0
  151. data/spec/functional/win32/version_info_spec.rb +50 -0
  152. data/spec/integration/client/client_spec.rb +80 -0
  153. data/spec/integration/knife/download_spec.rb +9 -0
  154. data/spec/integration/knife/upload_spec.rb +28 -1
  155. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +93 -23
  156. data/spec/integration/recipes/resource_action_spec.rb +211 -116
  157. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +72 -0
  158. data/spec/integration/solo/solo_spec.rb +34 -0
  159. data/spec/spec_helper.rb +11 -1
  160. data/spec/support/platform_helpers.rb +8 -0
  161. data/spec/support/shared/integration/integration_helper.rb +6 -0
  162. data/spec/support/shared/unit/execute_resource.rb +5 -0
  163. data/spec/support/shared/unit/platform_introspector.rb +7 -0
  164. data/spec/tiny_server.rb +6 -2
  165. data/spec/unit/api_client/registration_spec.rb +5 -4
  166. data/spec/unit/application_spec.rb +1 -181
  167. data/spec/unit/chef_fs/file_system/cookbook_subdir_spec.rb +34 -0
  168. data/spec/unit/cookbook/metadata_spec.rb +122 -2
  169. data/spec/unit/http_spec.rb +102 -0
  170. data/spec/unit/knife/bootstrap_spec.rb +55 -13
  171. data/spec/unit/knife/core/bootstrap_context_spec.rb +10 -3
  172. data/spec/unit/knife/ssl_check_spec.rb +7 -3
  173. data/spec/unit/knife/ssl_fetch_spec.rb +2 -2
  174. data/spec/unit/knife/status_spec.rb +13 -13
  175. data/spec/unit/knife_spec.rb +26 -2
  176. data/spec/unit/lwrp_spec.rb +1 -1
  177. data/spec/unit/mixin/properties_spec.rb +97 -0
  178. data/spec/unit/mixin/proxified_socket_spec.rb +94 -0
  179. data/spec/unit/mixin/subclass_directive_spec.rb +45 -0
  180. data/spec/unit/node_spec.rb +9 -1
  181. data/spec/unit/policy_builder/policyfile_spec.rb +2 -0
  182. data/spec/unit/property/validation_spec.rb +14 -12
  183. data/spec/unit/property_spec.rb +56 -0
  184. data/spec/unit/provider/deploy_spec.rb +1 -1
  185. data/spec/unit/provider/dsc_resource_spec.rb +63 -24
  186. data/spec/unit/provider/execute_spec.rb +95 -28
  187. data/spec/unit/provider/package/dpkg_spec.rb +185 -96
  188. data/spec/unit/provider/package/windows/exe_spec.rb +251 -0
  189. data/spec/unit/provider/package/windows/msi_spec.rb +94 -10
  190. data/spec/unit/provider/package/windows_spec.rb +227 -26
  191. data/spec/unit/provider/package/yum_spec.rb +6 -0
  192. data/spec/unit/provider/package_spec.rb +495 -366
  193. data/spec/unit/provider/remote_file/cache_control_data_spec.rb +62 -36
  194. data/spec/unit/provider/script_spec.rb +2 -2
  195. data/spec/unit/provider/service/solaris_smf_service_spec.rb +110 -39
  196. data/spec/unit/provider/service/upstart_service_spec.rb +19 -0
  197. data/spec/unit/provider/user/dscl_spec.rb +14 -0
  198. data/spec/unit/provider/user/windows_spec.rb +2 -2
  199. data/spec/unit/provider/user_spec.rb +9 -0
  200. data/spec/unit/provider_resolver_spec.rb +6 -30
  201. data/spec/unit/recipe_spec.rb +46 -20
  202. data/spec/unit/resource/chef_gem_spec.rb +1 -1
  203. data/spec/unit/resource/dsc_resource_spec.rb +14 -3
  204. data/spec/unit/resource/ksh_spec.rb +40 -0
  205. data/spec/unit/resource/registry_key_spec.rb +2 -2
  206. data/spec/unit/resource/resource_notification_spec.rb +44 -45
  207. data/spec/unit/resource_reporter_spec.rb +7 -0
  208. data/spec/unit/resource_spec.rb +268 -253
  209. data/spec/unit/rest_spec.rb +2 -2
  210. data/spec/unit/run_list/run_list_expansion_spec.rb +18 -3
  211. data/spec/unit/search/query_spec.rb +19 -1
  212. data/spec/unit/util/powershell/ps_credential_spec.rb +8 -1
  213. data/spec/unit/windows_service_spec.rb +83 -38
  214. data/tasks/external_tests.rb +19 -9
  215. data/tasks/rspec.rb +1 -1
  216. metadata +64 -15
  217. data/spec/support/pedant/Gemfile +0 -3
  218. data/spec/support/pedant/pedant_config.rb +0 -129
  219. data/spec/support/pedant/run_pedant.rb +0 -63
  220. data/spec/support/pedant/stickywicket.pem +0 -27
  221. data/spec/unit/provider/package_spec.rbe +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 557c3370ca4b630b3b0d88a0e6d1dc537fe8eecd
4
- data.tar.gz: 23e7884bba6c18220f795feeb56e0bf24529cdef
3
+ metadata.gz: df8a7b4dd38ea10e99495e4b17736c2376061c62
4
+ data.tar.gz: ca424df72ff1f6034a9911cc917c3d42e0d69d9b
5
5
  SHA512:
6
- metadata.gz: 03db54c21bf46780976bdbf85ffd99229b4de092ffbe4c4ec4ac8e4eaee8228473df21bed284f73356528043d836a4d49d20381325def7b10f2cb9db6d843251
7
- data.tar.gz: 48bdefe05abdfeb788440d6333538dbd9df996c9847a676b7360e7f42f9b238608819c2f9997d8dd8e469c635644c0ee0be1d75b878d5da7cc3796d01084c216
6
+ metadata.gz: 7b7dc5c9cb1bb123d3e1287d3ae4553989333531a08a0a686ae878ba86165316d1c1b4e49f20ba14ef9b31dd5e47b7756bd34e37955f66c289a2bca6963ce825
7
+ data.tar.gz: 8aea19d29a691a0045b32c9c6a7914b8a36ef6f731b5deb2871eb5e0328a0b1d1392035bafac1e1d15d1af502a4a498eaa1aa87f77a6b2c3a5eba65b3bf776e0
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ gemspec :name => "chef"
3
3
 
4
4
  gem "activesupport", "< 4.0.0", :group => :compat_testing, :platform => "ruby"
5
5
 
6
- gem 'chef-config', path: "chef-config"
6
+ gem 'chef-config', path: "chef-config" if File.exists?(__FILE__ + '../chef-config')
7
7
 
8
8
  group(:docgen) do
9
9
  gem "yard"
@@ -17,6 +17,11 @@ group(:maintenance) do
17
17
  gem "netrc"
18
18
  end
19
19
 
20
+ group(:ruby_prof) do
21
+ # may need to disable this in insolation on fussy builds like AIX, RHEL4, etc
22
+ gem "ruby-prof"
23
+ end
24
+
20
25
  group(:development, :test) do
21
26
 
22
27
  gem "simplecov"
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- # Chef
2
- [![Code Climate](https://codeclimate.com/github/opscode/chef.png)](https://codeclimate.com/github/opscode/chef)
1
+ # Chef
2
+ [![Code Climate](https://codeclimate.com/github/chef/chef.png)](https://codeclimate.com/github/chef/chef)
3
3
  [![Build Status Master](https://travis-ci.org/chef/chef.svg?branch=master)](https://travis-ci.org/chef/chef)
4
4
  [![Build Status Master](https://ci.appveyor.com/api/projects/status/github/chef/chef?branch=master&svg=true&passingText=master%20-%20Ok&pendingText=master%20-%20Pending&failingText=master%20-%20Failing)](https://ci.appveyor.com/project/Chef/chef/branch/master)
5
5
 
@@ -9,7 +9,9 @@ Want to try Chef? Get started with [learnchef](https://learn.chef.io)
9
9
  * Source: [http://github.com/chef/chef/tree/master](http://github.com/chef/chef/tree/master)
10
10
  * Tickets/Issues: [https://github.com/chef/chef/issues](https://github.com/chef/chef/issues)
11
11
  * IRC: `#chef` and `#chef-hacking` on Freenode
12
- * Mailing list: [http://lists.opscode.com](http://lists.opscode.com)
12
+ - Join via browser: [#chef](https://webchat.freenode.net/?channels=chef), [#chef-hacking](https://webchat.freenode.net/?channels=chef-hacking)
13
+ - View logs: [#chef](https://botbot.me/freenode/chef/), [#chef-hacking](https://botbot.me/freenode/chef-hacking/)
14
+ * Mailing list: [https://discourse.chef.io](https://discourse.chef.io)
13
15
 
14
16
  Chef is a configuration management tool designed to bring automation to your
15
17
  entire infrastructure.
@@ -46,7 +48,7 @@ Then get the source and install it:
46
48
 
47
49
  # Clone this repo
48
50
  git clone https://github.com/chef/chef.git
49
-
51
+
50
52
  # cd into the source tree
51
53
  cd chef
52
54
 
data/Rakefile CHANGED
@@ -31,9 +31,7 @@ ChefConfig::PackageTask.new(File.expand_path('..', __FILE__), 'Chef') do |packag
31
31
  package.generate_version_class = true
32
32
  end
33
33
 
34
- task :pedant do
35
- require File.expand_path('spec/support/pedant/run_pedant')
36
- end
34
+ task :pedant, :chef_zero_spec
37
35
 
38
36
  task :build_eventlog do
39
37
  Dir.chdir 'ext/win32-eventlog/' do
@@ -62,4 +60,3 @@ begin
62
60
  rescue LoadError
63
61
  puts "yard is not available. (sudo) gem install yard to generate yard documentation."
64
62
  end
65
-
@@ -0,0 +1,21 @@
1
+ gemspec = eval(IO.read(File.expand_path("../chef.gemspec", __FILE__)))
2
+
3
+ gemspec.platform = Gem::Platform.new(["universal", "mingw32"])
4
+
5
+ gemspec.add_dependency "ffi", "~> 1.9"
6
+ gemspec.add_dependency "win32-api", "~> 1.5.3"
7
+ gemspec.add_dependency "win32-dir", "~> 0.5.0"
8
+ gemspec.add_dependency "win32-event", "~> 0.6.1"
9
+ gemspec.add_dependency "win32-eventlog", "0.6.3"
10
+ gemspec.add_dependency "win32-mmap", "~> 0.4.1"
11
+ gemspec.add_dependency "win32-mutex", "~> 0.4.2"
12
+ gemspec.add_dependency "win32-process", "~> 0.8.2"
13
+ gemspec.add_dependency "win32-service", "~> 0.8.7"
14
+ gemspec.add_dependency "windows-api", "~> 0.4.4"
15
+ gemspec.add_dependency "wmi-lite", "~> 1.0"
16
+ gemspec.extensions << "ext/win32-eventlog/Rakefile"
17
+ gemspec.files += %w(ext/win32-eventlog/Rakefile ext/win32-eventlog/chef-log.man)
18
+
19
+ gemspec.executables += %w( chef-service-manager chef-windows-service )
20
+
21
+ gemspec
@@ -0,0 +1,58 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/lib')
2
+ require 'chef/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'chef'
6
+ s.version = Chef::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.extra_rdoc_files = ["README.md", "CONTRIBUTING.md", "LICENSE" ]
9
+ s.summary = "A systems integration framework, built to bring the benefits of configuration management to your entire infrastructure."
10
+ s.description = s.summary
11
+ s.license = "Apache-2.0"
12
+ s.author = "Adam Jacob"
13
+ s.email = "adam@chef.io"
14
+ s.homepage = "http://www.chef.io"
15
+
16
+ s.required_ruby_version = ">= 2.0.0"
17
+
18
+ s.add_dependency "chef-config", "= #{Chef::VERSION}"
19
+
20
+ s.add_dependency "mixlib-cli", "~> 1.4"
21
+ s.add_dependency "mixlib-log", "~> 1.3"
22
+ s.add_dependency "mixlib-authentication", "~> 1.3"
23
+ s.add_dependency "mixlib-shellout", "~> 2.0"
24
+ s.add_dependency "ohai", ">= 8.6.0.alpha.1", "< 9"
25
+
26
+ s.add_dependency "ffi-yajl", "~> 2.2"
27
+ s.add_dependency "net-ssh", "~> 2.6"
28
+ s.add_dependency "net-ssh-multi", "~> 1.1"
29
+ s.add_dependency "highline", "~> 1.6", ">= 1.6.9"
30
+ s.add_dependency "erubis", "~> 2.7"
31
+ s.add_dependency "diff-lcs", "~> 1.2", ">= 1.2.4"
32
+
33
+ s.add_dependency "chef-zero", "~> 4.2", ">= 4.2.2"
34
+ s.add_dependency "pry", "~> 0.9"
35
+
36
+ s.add_dependency 'plist', '~> 3.1.0'
37
+
38
+ # Audit mode requires these, so they are non-developmental dependencies now
39
+ %w(rspec-core rspec-expectations rspec-mocks).each { |gem| s.add_dependency gem, "~> 3.4" }
40
+ s.add_dependency "rspec_junit_formatter", "~> 0.2.0"
41
+ s.add_dependency "serverspec", "~> 2.7"
42
+ s.add_dependency "specinfra", "~> 2.10"
43
+
44
+ s.add_dependency "syslog-logger", "~> 1.6"
45
+
46
+ s.add_dependency "proxifier", "~> 1.0"
47
+
48
+ s.add_development_dependency "rack"
49
+ s.add_development_dependency "cheffish", "~> 1.1"
50
+
51
+ s.add_development_dependency "rake", "~> 10.1"
52
+
53
+ s.bindir = "bin"
54
+ s.executables = %w( chef-client chef-solo knife chef-shell chef-apply )
55
+
56
+ s.require_path = 'lib'
57
+ s.files = %w(Gemfile Rakefile LICENSE README.md CONTRIBUTING.md) + Dir.glob("{distro,lib,tasks,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) } + Dir.glob("*.gemspec")
58
+ end
@@ -68,7 +68,8 @@ class Chef
68
68
 
69
69
  def assert_destination_writable!
70
70
  if (File.exists?(destination) && !File.writable?(destination)) or !File.writable?(File.dirname(destination))
71
- raise Chef::Exceptions::CannotWritePrivateKey, "I cannot write your private key to #{destination} - check permissions?"
71
+ abs_path = File.expand_path(destination)
72
+ raise Chef::Exceptions::CannotWritePrivateKey, "I can't write your private key to #{abs_path} - check permissions?"
72
73
  end
73
74
  end
74
75
 
@@ -122,9 +123,13 @@ class Chef
122
123
  end
123
124
 
124
125
  def http_api
125
- @http_api ||= Chef::REST.new(Chef::Config[:chef_server_url],
126
- Chef::Config[:validation_client_name],
127
- Chef::Config[:validation_key])
126
+ @http_api ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url],
127
+ {
128
+ :api_version => "0",
129
+ :client_name => Chef::Config[:validation_client_name],
130
+ :signing_key_filename => Chef::Config[:validation_key]
131
+ }
132
+ )
128
133
  end
129
134
 
130
135
  # Whether or not to generate keys locally and post the public key to the
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: AJ Christensen (<aj@opscode.com>)
3
3
  # Author:: Mark Mzyk (mmzyk@opscode.com)
4
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # Copyright:: Copyright (c) 2008-2015 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,6 @@
17
17
  # limitations under the License.
18
18
 
19
19
  require 'pp'
20
- require 'uri'
21
20
  require 'socket'
22
21
  require 'chef/config'
23
22
  require 'chef/config_fetcher'
@@ -47,7 +46,6 @@ class Chef
47
46
  def reconfigure
48
47
  configure_chef
49
48
  configure_logging
50
- configure_proxy_environment_variables
51
49
  configure_encoding
52
50
  emit_warnings
53
51
  end
@@ -85,6 +83,7 @@ class Chef
85
83
  def configure_chef
86
84
  parse_options
87
85
  load_config_file
86
+ Chef::Config.export_proxies
88
87
  end
89
88
 
90
89
  # Parse the config file
@@ -180,14 +179,6 @@ class Chef
180
179
  end
181
180
  end
182
181
 
183
- # Configure and set any proxy environment variables according to the config.
184
- def configure_proxy_environment_variables
185
- configure_http_proxy
186
- configure_https_proxy
187
- configure_ftp_proxy
188
- configure_no_proxy
189
- end
190
-
191
182
  # Sets the default external encoding to UTF-8 (users can change this, but they shouldn't)
192
183
  def configure_encoding
193
184
  Encoding.default_external = Chef::Config[:ruby_encoding]
@@ -302,79 +293,6 @@ class Chef
302
293
  Chef::Application.fatal!("Aborting due to error in '#{config_file_path}'", 2)
303
294
  end
304
295
 
305
- # Set ENV['http_proxy']
306
- def configure_http_proxy
307
- if http_proxy = Chef::Config[:http_proxy]
308
- http_proxy_string = configure_proxy("http", http_proxy,
309
- Chef::Config[:http_proxy_user], Chef::Config[:http_proxy_pass])
310
- env['http_proxy'] = http_proxy_string unless env['http_proxy']
311
- env['HTTP_PROXY'] = http_proxy_string unless env['HTTP_PROXY']
312
- end
313
- end
314
-
315
- # Set ENV['https_proxy']
316
- def configure_https_proxy
317
- if https_proxy = Chef::Config[:https_proxy]
318
- https_proxy_string = configure_proxy("https", https_proxy,
319
- Chef::Config[:https_proxy_user], Chef::Config[:https_proxy_pass])
320
- env['https_proxy'] = https_proxy_string unless env['https_proxy']
321
- env['HTTPS_PROXY'] = https_proxy_string unless env['HTTPS_PROXY']
322
- end
323
- end
324
-
325
- # Set ENV['ftp_proxy']
326
- def configure_ftp_proxy
327
- if ftp_proxy = Chef::Config[:ftp_proxy]
328
- ftp_proxy_string = configure_proxy("ftp", ftp_proxy,
329
- Chef::Config[:ftp_proxy_user], Chef::Config[:ftp_proxy_pass])
330
- env['ftp_proxy'] = ftp_proxy_string unless env['ftp_proxy']
331
- env['FTP_PROXY'] = ftp_proxy_string unless env['FTP_PROXY']
332
- end
333
- end
334
-
335
- # Set ENV['no_proxy']
336
- def configure_no_proxy
337
- if Chef::Config[:no_proxy]
338
- env['no_proxy'] = Chef::Config[:no_proxy] unless env['no_proxy']
339
- env['NO_PROXY'] = Chef::Config[:no_proxy] unless env['NO_PROXY']
340
- end
341
- end
342
-
343
- # Builds a proxy uri. Examples:
344
- # http://username:password@hostname:port
345
- # https://username@hostname:port
346
- # ftp://hostname:port
347
- # when
348
- # scheme = "http", "https", or "ftp"
349
- # hostport = hostname:port
350
- # user = username
351
- # pass = password
352
- def configure_proxy(scheme, path, user, pass)
353
- begin
354
- path = "#{scheme}://#{path}" unless path.include?('://')
355
- # URI.split returns the following parts:
356
- # [scheme, userinfo, host, port, registry, path, opaque, query, fragment]
357
- parts = URI.split(URI.encode(path))
358
- # URI::Generic.build requires an integer for the port, but URI::split gives
359
- # returns a string for the port.
360
- parts[3] = parts[3].to_i if parts[3]
361
- if user
362
- userinfo = URI.encode(URI.encode(user), '@:')
363
- if pass
364
- userinfo << ":#{URI.encode(URI.encode(pass), '@:')}"
365
- end
366
- parts[1] = userinfo
367
- end
368
-
369
- return URI::Generic.build(parts).to_s
370
- rescue URI::Error => e
371
- # URI::Error messages generally include the offending string. Including a message
372
- # for which proxy config item has the issue should help deduce the issue when
373
- # the URI::Error message is vague.
374
- raise Chef::Exceptions::BadProxyURI, "Cannot configure #{scheme} proxy. Does not comply with URI scheme. #{e.message}"
375
- end
376
- end
377
-
378
296
  # This is a hook for testing
379
297
  def env
380
298
  ENV
@@ -394,6 +312,7 @@ class Chef
394
312
 
395
313
  Chef::FileCache.store("chef-stacktrace.out", chef_stacktrace_out)
396
314
  Chef::Log.fatal("Stacktrace dumped to #{Chef::FileCache.load("chef-stacktrace.out", false)}")
315
+ Chef::Log.fatal("Please provide the contents of the stacktrace.out file if you file a bug report")
397
316
  Chef::Log.debug(message)
398
317
  true
399
318
  end
@@ -29,7 +29,7 @@ require 'chef/resources'
29
29
 
30
30
  class Chef::Application::Apply < Chef::Application
31
31
 
32
- banner "Usage: chef-apply [RECIPE_FILE] [-e RECIPE_TEXT] [-s]"
32
+ banner "Usage: chef-apply [RECIPE_FILE | -e RECIPE_TEXT | -s] [OPTIONS]"
33
33
 
34
34
  option :execute,
35
35
  :short => "-e RECIPE_TEXT",
@@ -97,6 +97,12 @@ class Chef::Application::Apply < Chef::Application
97
97
  :description => 'Enable whyrun mode',
98
98
  :boolean => true
99
99
 
100
+ option :profile_ruby,
101
+ :long => "--[no-]profile-ruby",
102
+ :description => "Dump complete Ruby call graph stack of entire Chef run (expert only)",
103
+ :boolean => true,
104
+ :default => false
105
+
100
106
  option :color,
101
107
  :long => '--[no-]color',
102
108
  :boolean => true,
@@ -118,7 +124,7 @@ class Chef::Application::Apply < Chef::Application
118
124
  parse_options
119
125
  Chef::Config.merge!(config)
120
126
  configure_logging
121
- configure_proxy_environment_variables
127
+ Chef::Config.export_proxies
122
128
  parse_json
123
129
  end
124
130
 
@@ -190,6 +196,7 @@ class Chef::Application::Apply < Chef::Application
190
196
  ensure
191
197
  @recipe_fh.close
192
198
  end
199
+ Chef::Platform::Rebooter.reboot_if_needed!(runner)
193
200
  end
194
201
 
195
202
  def run_application
@@ -2,7 +2,7 @@
2
2
  # Author:: AJ Christensen (<aj@opscode.com)
3
3
  # Author:: Christopher Brown (<cb@opscode.com>)
4
4
  # Author:: Mark Mzyk (mmzyk@opscode.com)
5
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
5
+ # Copyright:: Copyright (c) 2008-2015 Chef Software, Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -55,6 +55,12 @@ class Chef::Application::Client < Chef::Application
55
55
  :boolean => true,
56
56
  :default => false
57
57
 
58
+ option :profile_ruby,
59
+ :long => "--[no-]profile-ruby",
60
+ :description => "Dump complete Ruby call graph stack of entire Chef run (expert only)",
61
+ :boolean => true,
62
+ :default => false
63
+
58
64
  option :color,
59
65
  :long => '--[no-]color',
60
66
  :boolean => true,
@@ -163,8 +169,7 @@ class Chef::Application::Client < Chef::Application
163
169
  option :named_run_list,
164
170
  :short => "-n NAMED_RUN_LIST",
165
171
  :long => "--named-run-list NAMED_RUN_LIST",
166
- :description => "Use a policyfile's named run list instead of the default run list",
167
- :default => nil
172
+ :description => "Use a policyfile's named run list instead of the default run list"
168
173
 
169
174
  option :environment,
170
175
  :short => '-E ENVIRONMENT',
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: AJ Christensen (<aj@opscode.com>)
3
3
  # Author:: Mark Mzyk (mmzyk@opscode.com)
4
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
+ # Copyright:: Copyright (c) 2008-2015 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -52,6 +52,12 @@ class Chef::Application::Solo < Chef::Application
52
52
  :boolean => true,
53
53
  :default => false
54
54
 
55
+ option :profile_ruby,
56
+ :long => "--[no-]profile-ruby",
57
+ :description => "Dump complete Ruby call graph stack of entire Chef run (expert only)",
58
+ :boolean => true,
59
+ :default => false
60
+
55
61
  option :color,
56
62
  :long => '--[no-]color',
57
63
  :boolean => true,
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Christopher Maier (<maier@lambda.local>)
3
- # Copyright:: Copyright (c) 2011 Opscode, Inc.
3
+ # Copyright:: Copyright (c) 2011-2015 Chef Software, Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -45,8 +45,7 @@ class Chef
45
45
  option :log_location,
46
46
  :short => "-L LOGLOCATION",
47
47
  :long => "--logfile LOGLOCATION",
48
- :description => "Set the log file location",
49
- :default => "#{ENV['SYSTEMDRIVE']}/chef/client.log"
48
+ :description => "Set the log file location"
50
49
 
51
50
  option :splay,
52
51
  :short => "-s SECONDS",
@@ -60,6 +59,8 @@ class Chef
60
59
  :description => "Set the number of seconds to wait between chef-client runs",
61
60
  :proc => lambda { |s| s.to_i }
62
61
 
62
+ DEFAULT_LOG_LOCATION ||= "#{ENV['SYSTEMDRIVE']}/chef/client.log"
63
+
63
64
  def service_init
64
65
  @service_action_mutex = Mutex.new
65
66
  @service_signal = ConditionVariable.new
@@ -187,9 +188,18 @@ class Chef
187
188
  # Pass config params to the new process
188
189
  config_params = " --no-fork"
189
190
  config_params += " -c #{Chef::Config[:config_file]}" unless Chef::Config[:config_file].nil?
190
- config_params += " -L #{Chef::Config[:log_location]}" unless Chef::Config[:log_location] == STDOUT
191
+ # log_location might be an event logger and if so we cannot pass as a command argument
192
+ # but shed no tears! If the logger is an event logger, it must have been configured
193
+ # as such in the config file and chef-client will use that when no arg is passed here
194
+ config_params += " -L #{resolve_log_location}" if resolve_log_location.is_a?(String)
195
+
191
196
  # Starts a new process and waits till the process exits
192
- result = shell_out("chef-client #{config_params}", :timeout => Chef::Config[:windows_service][:watchdog_timeout])
197
+
198
+ result = shell_out(
199
+ "chef-client #{config_params}",
200
+ :timeout => Chef::Config[:windows_service][:watchdog_timeout],
201
+ :logger => Chef::Log
202
+ )
193
203
  Chef::Log.debug "#{result.stdout}"
194
204
  Chef::Log.debug "#{result.stderr}"
195
205
  rescue Mixlib::ShellOut::CommandTimeout => e
@@ -231,7 +241,7 @@ class Chef
231
241
  # See application.rb for related comments.
232
242
 
233
243
  def configure_logging
234
- Chef::Log.init(MonoLogger.new(Chef::Config[:log_location]))
244
+ Chef::Log.init(MonoLogger.new(resolve_log_location))
235
245
  if want_additional_logger?
236
246
  configure_stdout_logger
237
247
  end
@@ -260,6 +270,11 @@ class Chef
260
270
  Chef::Config[:log_level] == :auto
261
271
  end
262
272
 
273
+ def resolve_log_location
274
+ # STDOUT is the default log location, but makes no sense for a windows service
275
+ Chef::Config[:log_location] == STDOUT ? DEFAULT_LOG_LOCATION : Chef::Config[:log_location]
276
+ end
277
+
263
278
  # if log_level is `:auto`, convert it to :warn (when using output formatter)
264
279
  # or :info (no output formatter). See also +using_output_formatter?+
265
280
  def resolve_log_level