chef 15.4.45-universal-mingw32 → 15.5.9-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (246) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -3
  3. data/Rakefile +5 -3
  4. data/chef.gemspec +2 -1
  5. data/ext/win32-eventlog/Rakefile +9 -1
  6. data/ext/win32-eventlog/{chef-log.man → chef-log.man.erb} +4 -4
  7. data/lib/chef/application.rb +2 -2
  8. data/lib/chef/application/client.rb +1 -1
  9. data/lib/chef/application/knife.rb +1 -0
  10. data/lib/chef/application/solo.rb +1 -1
  11. data/lib/chef/chef_class.rb +1 -6
  12. data/lib/chef/chef_fs.rb +1 -1
  13. data/lib/chef/chef_fs/file_pattern.rb +1 -1
  14. data/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb +2 -2
  15. data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb +2 -2
  16. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb +1 -1
  17. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +7 -1
  18. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +4 -3
  19. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +3 -3
  20. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb +1 -1
  21. data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -3
  22. data/lib/chef/chef_fs/knife.rb +1 -1
  23. data/lib/chef/chef_fs/path_utils.rb +2 -2
  24. data/lib/chef/client.rb +4 -5
  25. data/lib/chef/config.rb +3 -2
  26. data/lib/chef/cookbook/chefignore.rb +16 -11
  27. data/lib/chef/cookbook/cookbook_version_loader.rb +1 -1
  28. data/lib/chef/cookbook/syntax_check.rb +5 -3
  29. data/lib/chef/cookbook_loader.rb +3 -3
  30. data/lib/chef/cookbook_uploader.rb +1 -1
  31. data/lib/chef/data_collector.rb +2 -2
  32. data/lib/chef/data_collector/run_end_message.rb +1 -0
  33. data/lib/chef/deprecated.rb +4 -0
  34. data/lib/chef/dsl/core.rb +1 -1
  35. data/lib/chef/dsl/platform_introspection.rb +9 -18
  36. data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
  37. data/lib/chef/file_content_management/deploy.rb +3 -3
  38. data/lib/chef/file_content_management/deploy/mv_windows.rb +2 -2
  39. data/lib/chef/file_content_management/tempfile.rb +1 -1
  40. data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +2 -2
  41. data/lib/chef/http.rb +1 -1
  42. data/lib/chef/http/socketless_chef_zero_client.rb +1 -1
  43. data/lib/chef/knife.rb +4 -3
  44. data/lib/chef/knife/config_get.rb +2 -1
  45. data/lib/chef/knife/configure.rb +1 -1
  46. data/lib/chef/knife/cookbook_metadata_from_file.rb +6 -0
  47. data/lib/chef/knife/core/generic_presenter.rb +1 -1
  48. data/lib/chef/knife/core/status_presenter.rb +1 -1
  49. data/lib/chef/knife/ssh.rb +6 -0
  50. data/lib/chef/local_mode.rb +1 -1
  51. data/lib/chef/mash.rb +21 -232
  52. data/lib/chef/mixin/file_class.rb +2 -2
  53. data/lib/chef/mixin/lazy_module_include.rb +1 -1
  54. data/lib/chef/mixin/path_sanity.rb +3 -39
  55. data/lib/chef/mixin/securable.rb +1 -1
  56. data/lib/chef/mixin/shell_out.rb +4 -5
  57. data/lib/chef/mixin/template.rb +1 -1
  58. data/lib/chef/mixin/user_context.rb +3 -3
  59. data/lib/chef/mixin/which.rb +10 -38
  60. data/lib/chef/mixin/windows_architecture_helper.rb +6 -6
  61. data/lib/chef/mixin/windows_env_helper.rb +5 -5
  62. data/lib/chef/node/attribute.rb +2 -2
  63. data/lib/chef/node_map.rb +17 -4
  64. data/lib/chef/platform/query_helpers.rb +4 -2
  65. data/lib/chef/platform/rebooter.rb +1 -1
  66. data/lib/chef/platform/service_helpers.rb +14 -85
  67. data/lib/chef/provider.rb +2 -0
  68. data/lib/chef/provider/file.rb +2 -2
  69. data/lib/chef/provider/ifconfig/redhat.rb +1 -1
  70. data/lib/chef/provider/link.rb +3 -3
  71. data/lib/chef/provider/mount/solaris.rb +1 -1
  72. data/lib/chef/provider/package/yum.rb +1 -1
  73. data/lib/chef/provider/registry_key.rb +1 -1
  74. data/lib/chef/provider/remote_directory.rb +3 -3
  75. data/lib/chef/provider/remote_file/fetcher.rb +2 -2
  76. data/lib/chef/provider/remote_file/local_file.rb +1 -1
  77. data/lib/chef/provider/script.rb +3 -3
  78. data/lib/chef/provider/service.rb +5 -2
  79. data/lib/chef/provider/service/arch.rb +1 -1
  80. data/lib/chef/provider/service/debian.rb +4 -4
  81. data/lib/chef/provider/service/init.rb +1 -1
  82. data/lib/chef/provider/service/insserv.rb +4 -4
  83. data/lib/chef/provider/service/invokercd.rb +4 -4
  84. data/lib/chef/provider/service/redhat.rb +4 -4
  85. data/lib/chef/provider/service/systemd.rb +19 -3
  86. data/lib/chef/provider/service/upstart.rb +3 -3
  87. data/lib/chef/provider/subversion.rb +1 -1
  88. data/lib/chef/provider/systemd_unit.rb +26 -2
  89. data/lib/chef/provider/windows_path.rb +3 -3
  90. data/lib/chef/provider/windows_task.rb +4 -4
  91. data/lib/chef/resource.rb +1 -0
  92. data/lib/chef/resource/bash.rb +2 -0
  93. data/lib/chef/resource/batch.rb +2 -0
  94. data/lib/chef/resource/breakpoint.rb +3 -1
  95. data/lib/chef/resource/build_essential.rb +3 -3
  96. data/lib/chef/resource/chef_sleep.rb +70 -0
  97. data/lib/chef/resource/cookbook_file.rb +2 -1
  98. data/lib/chef/resource/csh.rb +2 -0
  99. data/lib/chef/resource/directory.rb +2 -0
  100. data/lib/chef/resource/dmg_package.rb +1 -1
  101. data/lib/chef/resource/dnf_package.rb +1 -1
  102. data/lib/chef/resource/execute.rb +2 -0
  103. data/lib/chef/resource/file.rb +2 -1
  104. data/lib/chef/resource/git.rb +2 -0
  105. data/lib/chef/resource/group.rb +1 -1
  106. data/lib/chef/resource/homebrew_package.rb +1 -1
  107. data/lib/chef/resource/http_request.rb +2 -0
  108. data/lib/chef/resource/ifconfig.rb +3 -1
  109. data/lib/chef/resource/ksh.rb +2 -0
  110. data/lib/chef/resource/link.rb +4 -2
  111. data/lib/chef/resource/locale.rb +1 -1
  112. data/lib/chef/resource/log.rb +2 -0
  113. data/lib/chef/resource/ohai.rb +2 -0
  114. data/lib/chef/resource/perl.rb +2 -0
  115. data/lib/chef/resource/python.rb +2 -0
  116. data/lib/chef/resource/reboot.rb +2 -0
  117. data/lib/chef/resource/registry_key.rb +2 -0
  118. data/lib/chef/resource/remote_directory.rb +3 -2
  119. data/lib/chef/resource/remote_file.rb +1 -0
  120. data/lib/chef/resource/ruby.rb +2 -0
  121. data/lib/chef/resource/ruby_block.rb +2 -0
  122. data/lib/chef/resource/scm.rb +2 -0
  123. data/lib/chef/resource/script.rb +2 -0
  124. data/lib/chef/resource/service.rb +9 -1
  125. data/lib/chef/resource/solaris_package.rb +1 -1
  126. data/lib/chef/resource/subversion.rb +2 -0
  127. data/lib/chef/resource/sudo.rb +1 -1
  128. data/lib/chef/resource/systemd_unit.rb +1 -0
  129. data/lib/chef/resource/template.rb +2 -0
  130. data/lib/chef/resource/user.rb +2 -0
  131. data/lib/chef/resource/user/aix_user.rb +2 -0
  132. data/lib/chef/resource/user/linux_user.rb +2 -0
  133. data/lib/chef/resource/user/pw_user.rb +2 -0
  134. data/lib/chef/resource/user/solaris_user.rb +2 -0
  135. data/lib/chef/resource/user/windows_user.rb +2 -0
  136. data/lib/chef/resource/whyrun_safe_ruby_block.rb +1 -0
  137. data/lib/chef/resource/windows_ad_join.rb +1 -1
  138. data/lib/chef/resource/windows_env.rb +1 -1
  139. data/lib/chef/resource/windows_feature.rb +2 -2
  140. data/lib/chef/resource/windows_feature_powershell.rb +1 -1
  141. data/lib/chef/resource/windows_firewall_rule.rb +11 -6
  142. data/lib/chef/resource/windows_script.rb +3 -1
  143. data/lib/chef/resource/yum_package.rb +1 -1
  144. data/lib/chef/resource_reporter.rb +1 -1
  145. data/lib/chef/resources.rb +1 -0
  146. data/lib/chef/run_context.rb +1 -1
  147. data/lib/chef/run_lock.rb +5 -5
  148. data/lib/chef/search/query.rb +0 -3
  149. data/lib/chef/train_transport.rb +3 -1
  150. data/lib/chef/util/powershell/ps_credential.rb +2 -2
  151. data/lib/chef/util/selinux.rb +1 -1
  152. data/lib/chef/util/windows/logon_session.rb +2 -2
  153. data/lib/chef/version.rb +1 -1
  154. data/lib/chef/win32/eventlog.rb +2 -2
  155. data/spec/data/cookbooks/starter/chefignore +8 -0
  156. data/spec/data/cookbooks/starter/files/sample.txt +1 -0
  157. data/spec/data/cookbooks/starter/metadata.rb +2 -0
  158. data/spec/data/cookbooks/starter/recipes/default.rb +4 -0
  159. data/spec/functional/event_loggers/windows_eventlog_spec.rb +1 -1
  160. data/spec/functional/mixin/user_context_spec.rb +2 -2
  161. data/spec/functional/rebooter_spec.rb +1 -1
  162. data/spec/functional/resource/cookbook_file_spec.rb +2 -2
  163. data/spec/functional/resource/template_spec.rb +1 -1
  164. data/spec/functional/version_spec.rb +1 -1
  165. data/spec/functional/win32/crypto_spec.rb +1 -1
  166. data/spec/functional/win32/security_spec.rb +1 -1
  167. data/spec/functional/win32/service_manager_spec.rb +1 -1
  168. data/spec/functional/win32/sid_spec.rb +2 -2
  169. data/spec/functional/win32/version_info_spec.rb +1 -1
  170. data/spec/functional/win32/versions_spec.rb +1 -1
  171. data/spec/integration/knife/config_get_profile_spec.rb +2 -2
  172. data/spec/integration/knife/config_get_spec.rb +9 -2
  173. data/spec/integration/knife/config_list_profiles_spec.rb +2 -2
  174. data/spec/integration/knife/config_use_profile_spec.rb +2 -2
  175. data/spec/integration/knife/list_spec.rb +2 -2
  176. data/spec/integration/solo/solo_spec.rb +1 -1
  177. data/spec/support/matchers/leak.rb +1 -1
  178. data/spec/support/mock/platform.rb +1 -1
  179. data/spec/support/platform_helpers.rb +2 -0
  180. data/spec/support/shared/integration/integration_helper.rb +1 -1
  181. data/spec/support/shared/integration/knife_support.rb +1 -1
  182. data/spec/support/shared/unit/provider/file.rb +4 -4
  183. data/spec/unit/application/client_spec.rb +2 -2
  184. data/spec/unit/application/knife_spec.rb +17 -0
  185. data/spec/unit/application_spec.rb +1 -1
  186. data/spec/unit/chef_fs/file_pattern_spec.rb +2 -2
  187. data/spec/unit/chef_fs/path_util_spec.rb +3 -3
  188. data/spec/unit/client_spec.rb +2 -2
  189. data/spec/unit/cookbook/chefignore_spec.rb +31 -11
  190. data/spec/unit/cookbook/cookbook_version_loader_spec.rb +1 -1
  191. data/spec/unit/cookbook/syntax_check_spec.rb +2 -2
  192. data/spec/unit/cookbook_loader_spec.rb +2 -2
  193. data/spec/unit/cookbook_uploader_spec.rb +6 -1
  194. data/spec/unit/data_bag_spec.rb +2 -2
  195. data/spec/unit/data_collector_spec.rb +7 -0
  196. data/spec/unit/dsl/platform_introspection_spec.rb +31 -1
  197. data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +1 -1
  198. data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +1 -1
  199. data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +7 -0
  200. data/spec/unit/knife/cookbook_show_spec.rb +1 -1
  201. data/spec/unit/knife/core/gem_glob_loader_spec.rb +1 -1
  202. data/spec/unit/knife/core/hashed_command_loader_spec.rb +1 -1
  203. data/spec/unit/knife/core/subcommand_loader_spec.rb +1 -1
  204. data/spec/unit/knife/core/ui_spec.rb +2 -2
  205. data/spec/unit/knife/data_bag_from_file_spec.rb +2 -2
  206. data/spec/unit/knife/environment_from_file_spec.rb +2 -2
  207. data/spec/unit/knife/ssh_spec.rb +27 -17
  208. data/spec/unit/knife/status_spec.rb +1 -1
  209. data/spec/unit/knife/supermarket_install_spec.rb +1 -1
  210. data/spec/unit/mixin/path_sanity_spec.rb +3 -3
  211. data/spec/unit/mixin/shell_out_spec.rb +2 -3
  212. data/spec/unit/mixin/template_spec.rb +4 -4
  213. data/spec/unit/mixin/user_context_spec.rb +3 -3
  214. data/spec/unit/node_map_spec.rb +12 -12
  215. data/spec/unit/platform/query_helpers_spec.rb +9 -9
  216. data/spec/unit/provider/execute_spec.rb +1 -1
  217. data/spec/unit/provider/link_spec.rb +5 -5
  218. data/spec/unit/provider/package/openbsd_spec.rb +1 -1
  219. data/spec/unit/provider/package/smartos_spec.rb +1 -1
  220. data/spec/unit/provider/package/windows/exe_spec.rb +1 -1
  221. data/spec/unit/provider/package/windows_spec.rb +2 -2
  222. data/spec/unit/provider/remote_file/fetcher_spec.rb +2 -2
  223. data/spec/unit/provider/remote_file/local_file_spec.rb +1 -1
  224. data/spec/unit/provider/remote_file/network_file_spec.rb +1 -1
  225. data/spec/unit/provider/script_spec.rb +2 -2
  226. data/spec/unit/provider/service/systemd_service_spec.rb +26 -2
  227. data/spec/unit/provider/subversion_spec.rb +3 -3
  228. data/spec/unit/provider/systemd_unit_spec.rb +53 -4
  229. data/spec/unit/provider/user/dscl_spec.rb +1 -1
  230. data/spec/unit/provider_resolver_spec.rb +41 -61
  231. data/spec/unit/resource/chef_sleep_spec.rb +30 -0
  232. data/spec/unit/resource/cookbook_file_spec.rb +3 -3
  233. data/spec/unit/resource/remote_file_spec.rb +3 -3
  234. data/spec/unit/resource/windows_firewall_rule_spec.rb +69 -12
  235. data/spec/unit/role_spec.rb +2 -2
  236. data/spec/unit/shell_spec.rb +1 -1
  237. data/spec/unit/util/selinux_spec.rb +2 -2
  238. data/spec/unit/win32/error_spec.rb +1 -1
  239. data/spec/unit/win32/link_spec.rb +1 -1
  240. data/spec/unit/win32/security_spec.rb +1 -1
  241. data/spec/unit/windows_service_spec.rb +1 -1
  242. data/tasks/docs.rb +10 -2
  243. data/tasks/rspec.rb +8 -6
  244. metadata +33 -9
  245. data/lib/chef/mixin/train_helpers.rb +0 -60
  246. data/spec/unit/mash_spec.rb +0 -51
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21b19428acc0503074938fb4e5dc93cb5cd70542f35625634b205d74b662bf48
4
- data.tar.gz: 9e75d184a6494c67c334198d6cc55c60a9441d9bf18bece3598d8476d95adc8f
3
+ metadata.gz: 1afaba89cda06122cc51c81b3420614fdeea3f02e7d0e6c6445c95ea7542a915
4
+ data.tar.gz: 5efb653a06b24fd9bb5074c418d48b0520b695b6ca4a51a5abc8392ae5ec396c
5
5
  SHA512:
6
- metadata.gz: 6877efd745673cb51b0879c8e78abb0ea88049e320e07d69052bc3616f4c53077f039f47310b90fb469e13f90f9f5df3b8935aee3ea45ba5aa26984829d6a849
7
- data.tar.gz: ffe577ee8b5b6f36e0a75930a9878bb659c60488c4ea9471e2596294a9590c6db0887f5be1d8266d26052b55702b89cf5ee15d432cee54aee63d9b3da65aab8d
6
+ metadata.gz: c0836a85ec320556e812ddca44716bcca33e69253031817dafa3c80159e226d869ed25860e5a3b1e0bd61b0789ccc1d308d83f8d56343fc7e7f38a7f36e488b5
7
+ data.tar.gz: c04bcfa673429f5a6f4cf867c7be4ab40413c7614bf5844b1ae43f1808376913087998f576c26d9c2a6245a508db3bc1120752af4da1659bc7082ee590e543f0
data/Gemfile CHANGED
@@ -10,6 +10,7 @@ gem "chef", path: "."
10
10
  # necessary until we release ohai 15
11
11
  gem "ohai", git: "https://github.com/chef/ohai.git", branch: "master"
12
12
 
13
+ gem "chef-utils", path: File.expand_path("../chef-utils", __FILE__) if File.exist?(File.expand_path("../chef-utils", __FILE__))
13
14
  gem "chef-config", path: File.expand_path("../chef-config", __FILE__) if File.exist?(File.expand_path("../chef-config", __FILE__))
14
15
 
15
16
  if File.exist?(File.expand_path("../chef-bin", __FILE__))
@@ -25,8 +26,8 @@ gem "cheffish", "~> 14"
25
26
  group(:omnibus_package) do
26
27
  gem "appbundler"
27
28
  gem "rb-readline"
28
- gem "inspec-core", "~> 4.3"
29
- gem "inspec-core-bin", "~> 4.3" # need to provide the binaries for inspec
29
+ gem "inspec-core", "~> 4.18"
30
+ gem "inspec-core-bin", "~> 4.18" # need to provide the binaries for inspec
30
31
  gem "chef-vault"
31
32
  gem "ed25519" # ed25519 ssh key support done here as it's a native gem we can't put in train
32
33
  gem "bcrypt_pbkdf" # ed25519 ssh key support done here as it's a native gem we can't put in train
@@ -65,6 +66,7 @@ group(:development, :test) do
65
66
  gem "rspec_junit_formatter", "~> 0.2.0"
66
67
  gem "simplecov"
67
68
  gem "webmock"
69
+ gem "fauxhai-ng" # for chef-utils gem
68
70
  end
69
71
 
70
72
  group(:chefstyle) do
@@ -76,7 +78,7 @@ instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
76
78
 
77
79
  # If you want to load debugging tools into the bundle exec sandbox,
78
80
  # add these additional dependencies into Gemfile.local
79
- eval_gemfile(__FILE__ + ".local") if File.exist?(__FILE__ + ".local")
81
+ eval_gemfile("./Gemfile.local") if File.exist?("./Gemfile.local")
80
82
 
81
83
  # These lines added for Windows development only.
82
84
  # For FFI to call into PowerShell we need the binaries and assemblies located
data/Rakefile CHANGED
@@ -26,9 +26,11 @@ ENV["CHEF_LICENSE"] = "accept-no-persist"
26
26
 
27
27
  # hack the chef-config install to run before the traditional install task
28
28
  task :super_install do
29
- chef_config_path = ::File.join(::File.dirname(__FILE__), "chef-config")
30
- Dir.chdir(chef_config_path)
31
- sh("rake install")
29
+ %w{chef-utils chef-config}.each do |gem|
30
+ path = ::File.join(::File.dirname(__FILE__), gem)
31
+ Dir.chdir(path)
32
+ sh("rake install")
33
+ end
32
34
  end
33
35
 
34
36
  task install: :super_install
@@ -16,13 +16,14 @@ Gem::Specification.new do |s|
16
16
  s.required_ruby_version = ">= 2.5.0"
17
17
 
18
18
  s.add_dependency "chef-config", "= #{Chef::VERSION}"
19
+ s.add_dependency "chef-utils", "= #{Chef::VERSION}"
19
20
  s.add_dependency "train-core", "~> 3.1"
20
21
  s.add_dependency "train-winrm", ">= 0.2.5"
21
22
 
22
23
  s.add_dependency "license-acceptance", "~> 1.0", ">= 1.0.5"
23
24
  s.add_dependency "mixlib-cli", ">= 2.1.1", "< 3.0"
24
25
  s.add_dependency "mixlib-log", ">= 2.0.3", "< 4.0"
25
- s.add_dependency "mixlib-authentication", "~> 2.1"
26
+ s.add_dependency "mixlib-authentication", ">= 2.1", "< 4"
26
27
  s.add_dependency "mixlib-shellout", ">= 3.0.3", "< 4.0"
27
28
  s.add_dependency "mixlib-archive", ">= 0.4", "< 2.0"
28
29
  s.add_dependency "ohai", "~> 15.0"
@@ -1,6 +1,8 @@
1
1
  require "rubygems"
2
2
  require "rake"
3
3
  require "mkmf"
4
+ require "erb"
5
+ require "chef/dist"
4
6
 
5
7
  desc "Building event log dll"
6
8
 
@@ -12,6 +14,12 @@ def ensure_present(commands)
12
14
  end
13
15
  end
14
16
 
17
+ # Templating the windows event log messages
18
+ # So we can inject distro constants in there
19
+ template = ERB.new(IO.read("chef-log.man.erb"))
20
+ chef_log_man = template.result
21
+ File.open("chef-log.man", "w") { |f| f.write(chef_log_man) }
22
+
15
23
  EVT_MC_FILE = "chef-log.man".freeze
16
24
  EVT_RC_FILE = "chef-log.rc".freeze
17
25
  EVT_RESOURCE_OBJECT = "resource.o".freeze
@@ -43,7 +51,7 @@ task register: EVT_SHARED_OBJECT do
43
51
  begin
44
52
  Win32::EventLog.add_event_source(
45
53
  source: "Application",
46
- key_name: "Chef",
54
+ key_name: Chef::Dist::PRODUCT,
47
55
  event_message_file: dll_file,
48
56
  category_message_file: dll_file
49
57
  )
@@ -1,25 +1,25 @@
1
1
  MessageId=10000
2
2
  SymbolicName=RUN_START
3
3
  Language=English
4
- Starting Chef Infra Client run v%1
4
+ Starting <%= Chef::Dist::PRODUCT %> run v%1
5
5
  .
6
6
 
7
7
  MessageId=10001
8
8
  SymbolicName=RUN_STARTED
9
9
  Language=English
10
- Started Chef Infra Client run %1
10
+ Started <%= Chef::Dist::PRODUCT %> run %1
11
11
  .
12
12
 
13
13
  MessageId=10002
14
14
  SymbolicName=RUN_COMPLETED
15
15
  Language=English
16
- Completed Chef Infra Client run %1 in %2 seconds
16
+ Completed <%= Chef::Dist::PRODUCT %> run %1 in %2 seconds
17
17
  .
18
18
 
19
19
  MessageId=10003
20
20
  SymbolicName=RUN_FAILED
21
21
  Language=English
22
- Failed Chef Infra Client run %1 in %2 seconds.%n
22
+ Failed <%= Chef::Dist::PRODUCT %> run %1 in %2 seconds.%n
23
23
  Exception type: %3%n
24
24
  Exception message: %4%n
25
25
  Exception backtrace: %5%n
@@ -78,7 +78,7 @@ class Chef
78
78
  Chef::Application.fatal!("SIGTERM received, stopping", Chef::Exceptions::SigTerm.new)
79
79
  end
80
80
 
81
- unless Chef::Platform.windows?
81
+ unless ChefUtils.windows?
82
82
  trap("QUIT") do
83
83
  logger.info("SIGQUIT received, call stack:\n " + caller.join("\n "))
84
84
  end
@@ -305,7 +305,7 @@ class Chef
305
305
  # win32-process gem exposes some form of :fork for Process
306
306
  # class. So we are separately ensuring that the platform we're
307
307
  # running on is not windows before forking.
308
- chef_config[:client_fork] && Process.respond_to?(:fork) && !Chef::Platform.windows?
308
+ chef_config[:client_fork] && Process.respond_to?(:fork) && !ChefUtils.windows?
309
309
  end
310
310
 
311
311
  # Run chef-client once and then exit. If TERM signal is received, ignores the
@@ -33,7 +33,7 @@ class Chef::Application::Client < Chef::Application::Base
33
33
  long: "--config CONFIG",
34
34
  description: "The configuration file to use."
35
35
 
36
- unless Chef::Platform.windows?
36
+ unless ChefUtils.windows?
37
37
  option :daemonize,
38
38
  short: "-d [WAIT]",
39
39
  long: "--daemonize [WAIT]",
@@ -114,6 +114,7 @@ class Chef::Application::Knife < Chef::Application
114
114
  short: "-F FORMAT",
115
115
  long: "--format FORMAT",
116
116
  description: "Which format to use for output.",
117
+ in: %w{summary text json yaml pp},
117
118
  default: "summary"
118
119
 
119
120
  option :local_mode,
@@ -36,7 +36,7 @@ class Chef::Application::Solo < Chef::Application::Base
36
36
  default: Chef::Config.platform_specific_path("#{Chef::Dist::CONF_DIR}/solo.rb"),
37
37
  description: "The configuration file to use."
38
38
 
39
- unless Chef::Platform.windows?
39
+ unless ChefUtils.windows?
40
40
  option :daemonize,
41
41
  short: "-d",
42
42
  long: "--daemonize",
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Lamont Granquist (<lamont@chef.io>)
3
- # Copyright:: Copyright 2015-2016, Chef Software, Inc.
3
+ # Copyright:: Copyright 2015-2018, 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");
@@ -239,10 +239,5 @@ class Chef
239
239
  end
240
240
  end
241
241
 
242
- # @api private Only for test dependency injection; not evenly implemented as yet.
243
- def self.path_to(path)
244
- path
245
- end
246
-
247
242
  reset!
248
243
  end
@@ -53,7 +53,7 @@ require_relative "platform"
53
53
  class Chef
54
54
  module ChefFS
55
55
  def self.windows?
56
- Chef::Platform.windows?
56
+ ChefUtils.windows?
57
57
  end
58
58
  end
59
59
  end
@@ -245,7 +245,7 @@ class Chef
245
245
  end
246
246
 
247
247
  def self.pattern_special_characters
248
- if Chef::ChefFS.windows?
248
+ if ChefUtils.windows?
249
249
  @pattern_special_characters ||= /(\*\*|\*|\?|[\*\?\.\|\(\)\[\]\{\}\+\\\\\^\$])/
250
250
  else
251
251
  # Unix also supports character regexes and backslashes
@@ -65,7 +65,7 @@ class Chef
65
65
  file_class.symlink other.file_path, proxy_cookbook_path
66
66
 
67
67
  # Instantiate a proxy loader using the temporary symlink
68
- proxy_loader = Chef::Cookbook::CookbookVersionLoader.new(proxy_cookbook_path, other.parent.chefignore)
68
+ proxy_loader = Chef::Cookbook::CookbookVersionLoader.new(proxy_cookbook_path, other.chefignore)
69
69
  proxy_loader.load_cookbooks
70
70
 
71
71
  cookbook_to_upload = proxy_loader.cookbook_version
@@ -86,7 +86,7 @@ class Chef
86
86
  # the symlink without removing the original contents if we
87
87
  # are running on windows
88
88
  #
89
- if Chef::Platform.windows?
89
+ if ChefUtils.windows?
90
90
  Dir.rmdir proxy_cookbook_path
91
91
  end
92
92
  end
@@ -71,7 +71,7 @@ class Chef
71
71
  file_class.symlink other.file_path, proxy_cookbook_path
72
72
 
73
73
  # Instantiate a proxy loader using the temporary symlink
74
- proxy_loader = Chef::Cookbook::CookbookVersionLoader.new(proxy_cookbook_path, other.parent.chefignore)
74
+ proxy_loader = Chef::Cookbook::CookbookVersionLoader.new(proxy_cookbook_path, other.chefignore)
75
75
  proxy_loader.load_cookbooks
76
76
 
77
77
  cookbook_to_upload = proxy_loader.cookbook_version
@@ -91,7 +91,7 @@ class Chef
91
91
  # the symlink without removing the original contents if we
92
92
  # are running on windows
93
93
  #
94
- if Chef::Platform.windows?
94
+ if ChefUtils.windows?
95
95
  Dir.rmdir proxy_cookbook_path
96
96
  end
97
97
  end
@@ -25,7 +25,7 @@ class Chef
25
25
  class ChefRepositoryFileSystemCookbookArtifactDir < ChefRepositoryFileSystemCookbookDir
26
26
  # Override from parent
27
27
  def cookbook_version
28
- loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, parent.chefignore)
28
+ loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, chefignore)
29
29
  cookbook_name, _dash, identifier = name.rpartition("-")
30
30
  # KLUDGE: We shouldn't have to use instance_variable_set
31
31
  loader.instance_variable_set(:@cookbook_name, cookbook_name)
@@ -21,6 +21,7 @@ require_relative "../chef_server/cookbook_dir"
21
21
  require_relative "../chef_server/versioned_cookbook_dir"
22
22
  require_relative "../exceptions"
23
23
  require_relative "../../../cookbook/cookbook_version_loader"
24
+ require_relative "../../../cookbook/chefignore"
24
25
 
25
26
  class Chef
26
27
  module ChefFS
@@ -31,6 +32,11 @@ class Chef
31
32
  class ChefRepositoryFileSystemCookbookDir < ChefRepositoryFileSystemCookbookEntry
32
33
 
33
34
  # API Required by Respository::Directory
35
+ def chefignore
36
+ @chefignore ||= Chef::Cookbook::Chefignore.new(file_path)
37
+ rescue Errno::EISDIR, Errno::EACCES
38
+ # Work around a bug in Chefignore when chefignore is a directory
39
+ end
34
40
 
35
41
  def fs_entry_valid?
36
42
  return false unless File.directory?(file_path) && name_valid?
@@ -136,7 +142,7 @@ class Chef
136
142
  end
137
143
 
138
144
  def cookbook_version
139
- loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, parent.chefignore)
145
+ loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, chefignore)
140
146
  loader.load_cookbooks
141
147
  loader.cookbook_version
142
148
  end
@@ -68,13 +68,14 @@ class Chef
68
68
  end
69
69
 
70
70
  # Check chefignore
71
- ignorer = parent
71
+ ignorer = self
72
+
72
73
  loop do
73
- if ignorer.is_a?(CookbooksDir)
74
+ if ignorer.is_a?(ChefRepositoryFileSystemCookbookDir)
74
75
  # Grab the path from entry to child
75
76
  path_to_child = name
76
77
  child = self
77
- while child.parent != ignorer
78
+ while child != ignorer
78
79
  path_to_child = PathUtils.join(child.name, path_to_child)
79
80
  child = child.parent
80
81
  end
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: John Keiser (<jkeiser@chef.io>)
3
- # Copyright:: Copyright 2012-2016, Chef Software, Inc.
3
+ # Copyright:: Copyright 2012-2019, 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");
@@ -44,7 +44,7 @@ require_relative "../../data_handler/role_data_handler"
44
44
  require_relative "../../data_handler/user_data_handler"
45
45
  require_relative "../../data_handler/group_data_handler"
46
46
  require_relative "../../data_handler/container_data_handler"
47
- require_relative "../../../win32/security" if Chef::Platform.windows?
47
+ require_relative "../../../win32/security" if ChefUtils.windows?
48
48
 
49
49
  class Chef
50
50
  module ChefFS
@@ -112,7 +112,7 @@ class Chef
112
112
  begin
113
113
  ::FileUtils.mkdir_p(path)
114
114
  ::FileUtils.chmod(0700, path)
115
- if Chef::Platform.windows?
115
+ if ChefUtils.windows?
116
116
  all_mask = Chef::ReservedNames::Win32::API::Security::GENERIC_ALL
117
117
  administrators = Chef::ReservedNames::Win32::Security::SID.Administrators
118
118
  owner = Chef::ReservedNames::Win32::Security::SID.default_security_object_owner
@@ -25,7 +25,7 @@ class Chef
25
25
  class ChefRepositoryFileSystemVersionedCookbookDir < ChefRepositoryFileSystemCookbookDir
26
26
  # Override from parent
27
27
  def cookbook_version
28
- loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, parent.chefignore)
28
+ loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, chefignore)
29
29
  # We need the canonical cookbook name if we are using versioned cookbooks, but we don't
30
30
  # want to spend a lot of time adding code to the main Chef libraries
31
31
  canonical_name = canonical_cookbook_name(File.basename(file_path))
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: John Keiser (<jkeiser@chef.io>)
3
3
  # Author:: Ho-Sheng Hsiao (<hosh@chef.io>)
4
- # Copyright:: Copyright 2012-2016, Chef Software Inc.
4
+ # Copyright:: Copyright 2012-2019, 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");
@@ -20,7 +20,7 @@
20
20
  require_relative "node"
21
21
  require_relative "directory"
22
22
  require_relative "../exceptions"
23
- require_relative "../../../win32/security" if Chef::Platform.windows?
23
+ require_relative "../../../win32/security" if ChefUtils.windows?
24
24
 
25
25
  class Chef
26
26
  module ChefFS
@@ -35,7 +35,7 @@ class Chef
35
35
  def create_child(child_name, file_contents = nil)
36
36
  child = super
37
37
  File.chmod(0600, child.file_path)
38
- if Chef::Platform.windows?
38
+ if ChefUtils.windows?
39
39
  read_mask = Chef::ReservedNames::Win32::API::Security::GENERIC_READ
40
40
  write_mask = Chef::ReservedNames::Win32::API::Security::GENERIC_WRITE
41
41
  administrators = Chef::ReservedNames::Win32::Security::SID.Administrators
@@ -18,7 +18,7 @@
18
18
 
19
19
  require_relative "../knife"
20
20
  require "pathname" unless defined?(Pathname)
21
- require "chef/dist"
21
+ require_relative "../dist"
22
22
 
23
23
  class Chef
24
24
  module ChefFS
@@ -58,7 +58,7 @@ class Chef
58
58
  end
59
59
 
60
60
  def self.regexp_path_separator
61
- Chef::ChefFS.windows? ? '[\/\\\\]' : "/"
61
+ ChefUtils.windows? ? '[\/\\\\]' : "/"
62
62
  end
63
63
 
64
64
  # Given a server path, determines if it is absolute.
@@ -103,7 +103,7 @@ class Chef
103
103
 
104
104
  # Compares two path fragments according to the case-sentitivity of the host platform.
105
105
  def self.os_path_eq?(left, right)
106
- Chef::ChefFS.windows? ? left.casecmp(right) == 0 : left == right
106
+ ChefUtils.windows? ? left.casecmp(right) == 0 : left == right
107
107
  end
108
108
 
109
109
  # Given two general OS-dependent file paths, determines the relative path of the
@@ -20,7 +20,7 @@
20
20
 
21
21
  require_relative "config"
22
22
  require_relative "mixin/params_validate"
23
- require_relative "mixin/path_sanity"
23
+ require "chef-utils/dsl/path_sanity" unless defined?(ChefUtils::DSL::PathSanity)
24
24
  require_relative "log"
25
25
  require_relative "deprecated"
26
26
  require_relative "server_api"
@@ -52,6 +52,7 @@ require_relative "policy_builder"
52
52
  require_relative "request_id"
53
53
  require_relative "platform/rebooter"
54
54
  require_relative "mixin/deprecation"
55
+ require "chef-utils" unless defined?(ChefUtils::CANARY)
55
56
  require "ohai" unless defined?(Ohai::System)
56
57
  require "rbconfig"
57
58
  require_relative "dist"
@@ -62,8 +63,6 @@ class Chef
62
63
  # The main object in a Chef run. Preps a Chef::Node and Chef::RunContext,
63
64
  # syncs cookbooks if necessary, and triggers convergence.
64
65
  class Client
65
- include Chef::Mixin::PathSanity
66
-
67
66
  extend Chef::Mixin::Deprecation
68
67
 
69
68
  extend Forwardable
@@ -251,7 +250,7 @@ class Chef
251
250
  logger.info "#{Chef::Dist::CLIENT.capitalize} pid: #{Process.pid}"
252
251
  logger.info "Targeting node: #{Chef::Config.target_mode.host}" if Chef::Config.target_mode?
253
252
  logger.debug("#{Chef::Dist::CLIENT.capitalize} request_id: #{request_id}")
254
- enforce_path_sanity
253
+ ENV["PATH"] = ChefUtils::PathSanity.sanitized_path if Chef::Config[:enforce_path_sanity]
255
254
 
256
255
  if Chef::Config.target_mode?
257
256
  get_ohai_data_remotely
@@ -749,7 +748,7 @@ class Chef
749
748
  # @api private
750
749
  #
751
750
  def do_windows_admin_check
752
- if Chef::Platform.windows?
751
+ if ChefUtils.windows?
753
752
  logger.trace("Checking for administrator privileges....")
754
753
 
755
754
  if !has_admin_privileges?