chef 12.18.31-universal-mingw32 → 12.19.33-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (305) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -4
  3. data/README.md +12 -13
  4. data/VERSION +1 -1
  5. data/acceptance/Gemfile +4 -4
  6. data/acceptance/Gemfile.lock +70 -69
  7. data/chef-universal-mingw32.gemspec +2 -3
  8. data/chef.gemspec +6 -6
  9. data/lib/chef/api_client.rb +8 -10
  10. data/lib/chef/api_client_v1.rb +9 -11
  11. data/lib/chef/application/apply.rb +8 -10
  12. data/lib/chef/application/client.rb +1 -1
  13. data/lib/chef/application/exit_code.rb +3 -5
  14. data/lib/chef/application/knife.rb +2 -2
  15. data/lib/chef/application/windows_service.rb +29 -30
  16. data/lib/chef/application/windows_service_manager.rb +1 -1
  17. data/lib/chef/audit/audit_event_proxy.rb +2 -2
  18. data/lib/chef/audit/control_group_data.rb +1 -1
  19. data/lib/chef/chef_class.rb +1 -0
  20. data/lib/chef/chef_fs/chef_fs_data_store.rb +5 -7
  21. data/lib/chef/chef_fs/command_line.rb +15 -16
  22. data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
  23. data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
  24. data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
  25. data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
  26. data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
  27. data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
  28. data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
  29. data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +1 -1
  30. data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
  31. data/lib/chef/chef_fs/data_handler/user_data_handler.rb +1 -1
  32. data/lib/chef/chef_fs/file_pattern.rb +2 -2
  33. data/lib/chef/chef_fs/file_system.rb +1 -1
  34. data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +5 -6
  35. data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +8 -10
  36. data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +8 -10
  37. data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +10 -12
  38. data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +28 -30
  39. data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
  40. data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +27 -29
  41. data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +18 -24
  42. data/lib/chef/chef_fs/file_system/memory/memory_file.rb +1 -1
  43. data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +10 -12
  44. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +10 -12
  45. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +9 -13
  46. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -0
  47. data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
  48. data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -0
  49. data/lib/chef/chef_fs/parallelizer.rb +9 -11
  50. data/lib/chef/cookbook/cookbook_version_loader.rb +25 -31
  51. data/lib/chef/cookbook/metadata.rb +26 -26
  52. data/lib/chef/cookbook/syntax_check.rb +1 -1
  53. data/lib/chef/cookbook_version.rb +3 -3
  54. data/lib/chef/data_bag.rb +1 -1
  55. data/lib/chef/data_bag_item.rb +3 -3
  56. data/lib/chef/data_collector.rb +3 -4
  57. data/lib/chef/decorator.rb +1 -1
  58. data/lib/chef/deprecated.rb +30 -0
  59. data/lib/chef/dsl/audit.rb +2 -2
  60. data/lib/chef/dsl/declare_resource.rb +1 -1
  61. data/lib/chef/dsl/platform_introspection.rb +29 -31
  62. data/lib/chef/dsl/reboot_pending.rb +1 -1
  63. data/lib/chef/dsl/resources.rb +6 -8
  64. data/lib/chef/encrypted_data_bag_item.rb +2 -2
  65. data/lib/chef/environment.rb +9 -11
  66. data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
  67. data/lib/chef/exceptions.rb +4 -1
  68. data/lib/chef/file_access_control/unix.rb +14 -14
  69. data/lib/chef/file_access_control/windows.rb +1 -1
  70. data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +4 -5
  71. data/lib/chef/formatters/error_mapper.rb +6 -6
  72. data/lib/chef/http/api_versions.rb +50 -0
  73. data/lib/chef/http/validate_content_length.rb +2 -2
  74. data/lib/chef/json_compat.rb +6 -10
  75. data/lib/chef/key.rb +5 -5
  76. data/lib/chef/knife.rb +4 -4
  77. data/lib/chef/knife/cookbook_site_install.rb +2 -2
  78. data/lib/chef/knife/core/cookbook_scm_repo.rb +2 -2
  79. data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
  80. data/lib/chef/knife/core/status_presenter.rb +1 -1
  81. data/lib/chef/knife/core/ui.rb +19 -25
  82. data/lib/chef/knife/data_bag_secret_options.rb +1 -1
  83. data/lib/chef/knife/deps.rb +32 -34
  84. data/lib/chef/knife/help.rb +1 -1
  85. data/lib/chef/knife/list.rb +1 -1
  86. data/lib/chef/knife/search.rb +2 -2
  87. data/lib/chef/knife/ssh.rb +37 -27
  88. data/lib/chef/knife/ssl_check.rb +1 -1
  89. data/lib/chef/knife/user_delete.rb +1 -1
  90. data/lib/chef/mash.rb +1 -1
  91. data/lib/chef/mixin/command.rb +2 -2
  92. data/lib/chef/mixin/create_path.rb +3 -5
  93. data/lib/chef/mixin/from_file.rb +2 -2
  94. data/lib/chef/mixin/get_source_from_package.rb +2 -2
  95. data/lib/chef/mixin/notifying_block.rb +7 -9
  96. data/lib/chef/mixin/params_validate.rb +3 -3
  97. data/lib/chef/mixin/securable.rb +1 -1
  98. data/lib/chef/mixin/shell_out.rb +23 -3
  99. data/lib/chef/mixin/unformatter.rb +2 -2
  100. data/lib/chef/mixin/uris.rb +4 -6
  101. data/lib/chef/mixin/versioned_api.rb +69 -0
  102. data/lib/chef/mixin/which.rb +25 -8
  103. data/lib/chef/mixin/windows_architecture_helper.rb +2 -2
  104. data/lib/chef/mixin/xml_escape.rb +3 -5
  105. data/lib/chef/monkey_patches/webrick-utils.rb +1 -1
  106. data/lib/chef/node.rb +8 -8
  107. data/lib/chef/node/attribute.rb +4 -4
  108. data/lib/chef/node/common_api.rb +5 -7
  109. data/lib/chef/org.rb +10 -12
  110. data/lib/chef/platform/provider_mapping.rb +7 -7
  111. data/lib/chef/platform/query_helpers.rb +1 -1
  112. data/lib/chef/policy_builder/policyfile.rb +1 -0
  113. data/lib/chef/property.rb +31 -0
  114. data/lib/chef/provider/batch.rb +1 -1
  115. data/lib/chef/provider/breakpoint.rb +1 -1
  116. data/lib/chef/provider/cookbook_file.rb +3 -3
  117. data/lib/chef/provider/cron.rb +38 -38
  118. data/lib/chef/provider/deploy.rb +81 -81
  119. data/lib/chef/provider/deploy/revision.rb +3 -5
  120. data/lib/chef/provider/directory.rb +32 -32
  121. data/lib/chef/provider/dsc_resource.rb +22 -6
  122. data/lib/chef/provider/env.rb +28 -28
  123. data/lib/chef/provider/env/windows.rb +1 -1
  124. data/lib/chef/provider/erl_call.rb +13 -13
  125. data/lib/chef/provider/execute.rb +5 -2
  126. data/lib/chef/provider/file.rb +49 -51
  127. data/lib/chef/provider/git.rb +55 -55
  128. data/lib/chef/provider/http_request.rb +36 -36
  129. data/lib/chef/provider/launchd.rb +2 -2
  130. data/lib/chef/provider/link.rb +50 -50
  131. data/lib/chef/provider/log.rb +2 -2
  132. data/lib/chef/provider/mdadm.rb +25 -25
  133. data/lib/chef/provider/mount/aix.rb +2 -2
  134. data/lib/chef/provider/mount/mount.rb +2 -2
  135. data/lib/chef/provider/ohai.rb +1 -1
  136. data/lib/chef/provider/osx_profile.rb +23 -23
  137. data/lib/chef/provider/package.rb +74 -56
  138. data/lib/chef/provider/package/aix.rb +55 -52
  139. data/lib/chef/provider/package/apt.rb +15 -13
  140. data/lib/chef/provider/package/cab.rb +49 -20
  141. data/lib/chef/provider/package/chocolatey.rb +9 -10
  142. data/lib/chef/provider/package/dnf.rb +20 -18
  143. data/lib/chef/provider/package/dnf/dnf_helper.py +1 -1
  144. data/lib/chef/provider/package/dnf/python_helper.rb +63 -26
  145. data/lib/chef/provider/package/dnf/version.rb +1 -1
  146. data/lib/chef/provider/package/dpkg.rb +8 -9
  147. data/lib/chef/provider/package/easy_install.rb +22 -22
  148. data/lib/chef/provider/package/freebsd/base.rb +10 -10
  149. data/lib/chef/provider/package/freebsd/pkg.rb +15 -15
  150. data/lib/chef/provider/package/freebsd/pkgng.rb +13 -15
  151. data/lib/chef/provider/package/freebsd/port.rb +7 -7
  152. data/lib/chef/provider/package/homebrew.rb +11 -10
  153. data/lib/chef/provider/package/ips.rb +18 -23
  154. data/lib/chef/provider/package/macports.rb +23 -23
  155. data/lib/chef/provider/package/msu.rb +11 -11
  156. data/lib/chef/provider/package/openbsd.rb +25 -22
  157. data/lib/chef/provider/package/pacman.rb +16 -16
  158. data/lib/chef/provider/package/paludis.rb +26 -27
  159. data/lib/chef/provider/package/portage.rb +22 -22
  160. data/lib/chef/provider/package/powershell.rb +17 -17
  161. data/lib/chef/provider/package/rpm.rb +25 -25
  162. data/lib/chef/provider/package/rubygems.rb +60 -60
  163. data/lib/chef/provider/package/smartos.rb +16 -16
  164. data/lib/chef/provider/package/solaris.rb +44 -44
  165. data/lib/chef/provider/package/windows.rb +3 -3
  166. data/lib/chef/provider/package/windows/exe.rb +6 -6
  167. data/lib/chef/provider/package/windows/msi.rb +6 -6
  168. data/lib/chef/provider/package/yum.rb +318 -268
  169. data/lib/chef/provider/package/yum/rpm_utils.rb +34 -34
  170. data/lib/chef/provider/package/yum/yum_cache.rb +12 -12
  171. data/lib/chef/provider/package/zypper.rb +11 -11
  172. data/lib/chef/provider/powershell_script.rb +15 -7
  173. data/lib/chef/provider/reboot.rb +10 -10
  174. data/lib/chef/provider/registry_key.rb +39 -39
  175. data/lib/chef/provider/remote_directory.rb +3 -3
  176. data/lib/chef/provider/remote_file.rb +3 -3
  177. data/lib/chef/provider/route.rb +1 -1
  178. data/lib/chef/provider/ruby_block.rb +3 -3
  179. data/lib/chef/provider/script.rb +42 -6
  180. data/lib/chef/provider/service.rb +49 -49
  181. data/lib/chef/provider/service/solaris.rb +1 -1
  182. data/lib/chef/provider/service/systemd.rb +1 -1
  183. data/lib/chef/provider/subversion.rb +39 -39
  184. data/lib/chef/provider/systemd_unit.rb +2 -0
  185. data/lib/chef/provider/template.rb +3 -3
  186. data/lib/chef/provider/user.rb +42 -42
  187. data/lib/chef/provider/whyrun_safe_ruby_block.rb +4 -4
  188. data/lib/chef/resource.rb +27 -16
  189. data/lib/chef/resource/apt_repository.rb +0 -1
  190. data/lib/chef/resource/chef_gem.rb +1 -1
  191. data/lib/chef/resource/dnf_package.rb +6 -3
  192. data/lib/chef/resource/dsc_resource.rb +9 -1
  193. data/lib/chef/resource/execute.rb +70 -6
  194. data/lib/chef/resource/file/verification/systemd_unit.rb +67 -0
  195. data/lib/chef/resource/freebsd_package.rb +1 -1
  196. data/lib/chef/resource/gem_package.rb +1 -1
  197. data/lib/chef/resource/launchd.rb +13 -1
  198. data/lib/chef/resource/package.rb +2 -2
  199. data/lib/chef/resource/registry_key.rb +1 -1
  200. data/lib/chef/resource/yum_package.rb +12 -3
  201. data/lib/chef/resource/yum_repository.rb +0 -1
  202. data/lib/chef/resource_collection/resource_collection_serialization.rb +3 -3
  203. data/lib/chef/resource_collection/resource_set.rb +2 -2
  204. data/lib/chef/resource_reporter.rb +1 -1
  205. data/lib/chef/run_context.rb +3 -3
  206. data/lib/chef/run_list/run_list_item.rb +1 -1
  207. data/lib/chef/run_list/versioned_recipe_list.rb +6 -6
  208. data/lib/chef/server_api.rb +2 -0
  209. data/lib/chef/server_api_versions.rb +40 -0
  210. data/lib/chef/shell.rb +1 -1
  211. data/lib/chef/shell/ext.rb +3 -3
  212. data/lib/chef/shell/shell_session.rb +1 -1
  213. data/lib/chef/user.rb +9 -11
  214. data/lib/chef/user_v1.rb +9 -11
  215. data/lib/chef/util/diff.rb +1 -1
  216. data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
  217. data/lib/chef/util/selinux.rb +1 -1
  218. data/lib/chef/util/windows/net_group.rb +18 -30
  219. data/lib/chef/util/windows/net_use.rb +7 -11
  220. data/lib/chef/util/windows/net_user.rb +11 -17
  221. data/lib/chef/util/windows/volume.rb +9 -15
  222. data/lib/chef/version.rb +1 -1
  223. data/lib/chef/version_class.rb +1 -1
  224. data/lib/chef/win32/api.rb +4 -6
  225. data/lib/chef/win32/api/file.rb +25 -31
  226. data/lib/chef/win32/api/installer.rb +2 -2
  227. data/lib/chef/win32/file.rb +4 -6
  228. data/lib/chef/win32/registry.rb +9 -9
  229. data/lib/chef/win32/security.rb +2 -2
  230. data/lib/chef/win32/security/acl.rb +2 -2
  231. data/lib/chef/win32/unicode.rb +2 -2
  232. data/lib/chef/win32/version.rb +1 -1
  233. data/spec/data/prefer_metadata_json/metadata.json +51 -0
  234. data/spec/data/prefer_metadata_json/metadata.rb +6 -0
  235. data/spec/data/prefer_metadata_json/recipes/default.rb +0 -0
  236. data/spec/functional/knife/ssh_spec.rb +5 -5
  237. data/spec/functional/resource/batch_spec.rb +5 -1
  238. data/spec/functional/resource/dsc_script_spec.rb +2 -4
  239. data/spec/functional/resource/execute_spec.rb +17 -0
  240. data/spec/functional/resource/user/dscl_spec.rb +2 -4
  241. data/spec/integration/client/client_spec.rb +33 -0
  242. data/spec/integration/recipes/recipe_dsl_spec.rb +58 -58
  243. data/spec/spec_helper.rb +4 -0
  244. data/spec/support/chef_helpers.rb +5 -7
  245. data/spec/support/platform_helpers.rb +6 -0
  246. data/spec/support/platforms/prof/gc.rb +4 -6
  247. data/spec/support/shared/context/client.rb +1 -1
  248. data/spec/support/shared/functional/execute_resource.rb +150 -0
  249. data/spec/support/shared/functional/windows_script.rb +74 -4
  250. data/spec/support/shared/unit/execute_resource.rb +37 -0
  251. data/spec/support/shared/unit/provider/file.rb +10 -0
  252. data/spec/unit/cookbook/cookbook_version_loader_spec.rb +9 -0
  253. data/spec/unit/cookbook/syntax_check_spec.rb +8 -2
  254. data/spec/unit/http/api_versions_spec.rb +69 -0
  255. data/spec/unit/knife/ssh_spec.rb +34 -36
  256. data/spec/unit/mixin/versioned_api_spec.rb +107 -0
  257. data/spec/unit/mixin/which.rb +160 -0
  258. data/spec/unit/platform_spec.rb +28 -1
  259. data/spec/unit/provider/deploy_spec.rb +1 -1
  260. data/spec/unit/provider/directory_spec.rb +10 -0
  261. data/spec/unit/provider/dsc_resource_spec.rb +175 -0
  262. data/spec/unit/provider/execute_spec.rb +0 -1
  263. data/spec/unit/provider/launchd_spec.rb +2 -2
  264. data/spec/unit/provider/package/aix_spec.rb +22 -22
  265. data/spec/unit/provider/package/apt_spec.rb +27 -27
  266. data/spec/unit/provider/package/cab_spec.rb +59 -5
  267. data/spec/unit/provider/package/dnf/python_helper_spec.rb +29 -0
  268. data/spec/unit/provider/package/dpkg_spec.rb +16 -16
  269. data/spec/unit/provider/package/easy_install_spec.rb +18 -18
  270. data/spec/unit/provider/package/freebsd/pkg_spec.rb +15 -15
  271. data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
  272. data/spec/unit/provider/package/freebsd/port_spec.rb +9 -9
  273. data/spec/unit/provider/package/homebrew_spec.rb +9 -9
  274. data/spec/unit/provider/package/ips_spec.rb +37 -31
  275. data/spec/unit/provider/package/macports_spec.rb +10 -10
  276. data/spec/unit/provider/package/openbsd_spec.rb +10 -10
  277. data/spec/unit/provider/package/pacman_spec.rb +6 -6
  278. data/spec/unit/provider/package/paludis_spec.rb +7 -7
  279. data/spec/unit/provider/package/portage_spec.rb +6 -7
  280. data/spec/unit/provider/package/rpm_spec.rb +23 -23
  281. data/spec/unit/provider/package/rubygems_spec.rb +38 -38
  282. data/spec/unit/provider/package/solaris_spec.rb +15 -15
  283. data/spec/unit/provider/package/windows_spec.rb +2 -1
  284. data/spec/unit/provider/package/yum_spec.rb +51 -43
  285. data/spec/unit/provider/package/zypper_spec.rb +34 -34
  286. data/spec/unit/provider/package_spec.rb +8 -0
  287. data/spec/unit/provider/remote_file/sftp_spec.rb +3 -3
  288. data/spec/unit/provider/route_spec.rb +7 -1
  289. data/spec/unit/provider/script_spec.rb +49 -6
  290. data/spec/unit/resource/dsc_resource_spec.rb +6 -0
  291. data/spec/unit/resource/execute_spec.rb +214 -0
  292. data/spec/unit/resource/file/verification/systemd_unit_spec.rb +103 -0
  293. data/spec/unit/resource/freebsd_package_spec.rb +2 -2
  294. data/spec/unit/resource/package_spec.rb +5 -0
  295. data/spec/unit/resource/yum_package_spec.rb +42 -1
  296. data/spec/unit/resource_reporter_spec.rb +1 -1
  297. data/spec/unit/resource_spec.rb +18 -0
  298. data/spec/unit/server_api_versions_spec.rb +44 -0
  299. data/spec/unit/util/selinux_spec.rb +3 -14
  300. data/spec/unit/win32/error_spec.rb +67 -0
  301. data/spec/unit/win32/security_spec.rb +66 -0
  302. data/tasks/changelog.rb +1 -1
  303. data/tasks/dependencies.rb +20 -4
  304. metadata +39 -18
  305. data/lib/chef/monkey_patches/net-ssh-multi.rb +0 -141
@@ -73,7 +73,7 @@ class Chef
73
73
  def restart_service
74
74
  ## svcadm restart doesn't supports sync(-s) option
75
75
  disable_service
76
- return enable_service
76
+ enable_service
77
77
  end
78
78
 
79
79
  def service_status
@@ -89,7 +89,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
89
89
  args = "--system"
90
90
  end
91
91
 
92
- return options, args
92
+ [options, args]
93
93
  end
94
94
 
95
95
  def start_service
@@ -40,11 +40,11 @@ class Chef
40
40
  end
41
41
 
42
42
  def load_current_resource
43
- @current_resource = Chef::Resource::Subversion.new(@new_resource.name)
43
+ @current_resource = Chef::Resource::Subversion.new(new_resource.name)
44
44
 
45
- unless [:export, :force_export].include?(Array(@new_resource.action).first)
45
+ unless [:export, :force_export].include?(Array(new_resource.action).first)
46
46
  if current_revision = find_current_revision
47
- @current_resource.revision current_revision
47
+ current_resource.revision current_revision
48
48
  end
49
49
  end
50
50
  end
@@ -53,21 +53,21 @@ class Chef
53
53
  requirements.assert(:all_actions) do |a|
54
54
  # Make sure the parent dir exists, or else fail.
55
55
  # for why run, print a message explaining the potential error.
56
- parent_directory = ::File.dirname(@new_resource.destination)
56
+ parent_directory = ::File.dirname(new_resource.destination)
57
57
  a.assertion { ::File.directory?(parent_directory) }
58
58
  a.failure_message(Chef::Exceptions::MissingParentDirectory,
59
- "Cannot clone #{@new_resource} to #{@new_resource.destination}, the enclosing directory #{parent_directory} does not exist")
59
+ "Cannot clone #{new_resource} to #{new_resource.destination}, the enclosing directory #{parent_directory} does not exist")
60
60
  a.whyrun("Directory #{parent_directory} does not exist, assuming it would have been created")
61
61
  end
62
62
  end
63
63
 
64
64
  def action_checkout
65
65
  if target_dir_non_existent_or_empty?
66
- converge_by("perform checkout of #{@new_resource.repository} into #{@new_resource.destination}") do
66
+ converge_by("perform checkout of #{new_resource.repository} into #{new_resource.destination}") do
67
67
  shell_out!(checkout_command, run_options)
68
68
  end
69
69
  else
70
- Chef::Log.debug "#{@new_resource} checkout destination #{@new_resource.destination} already exists or is a non-empty directory - nothing to do"
70
+ Chef::Log.debug "#{new_resource} checkout destination #{new_resource.destination} already exists or is a non-empty directory - nothing to do"
71
71
  end
72
72
  end
73
73
 
@@ -75,25 +75,25 @@ class Chef
75
75
  if target_dir_non_existent_or_empty?
76
76
  action_force_export
77
77
  else
78
- Chef::Log.debug "#{@new_resource} export destination #{@new_resource.destination} already exists or is a non-empty directory - nothing to do"
78
+ Chef::Log.debug "#{new_resource} export destination #{new_resource.destination} already exists or is a non-empty directory - nothing to do"
79
79
  end
80
80
  end
81
81
 
82
82
  def action_force_export
83
- converge_by("export #{@new_resource.repository} into #{@new_resource.destination}") do
83
+ converge_by("export #{new_resource.repository} into #{new_resource.destination}") do
84
84
  shell_out!(export_command, run_options)
85
85
  end
86
86
  end
87
87
 
88
88
  def action_sync
89
89
  assert_target_directory_valid!
90
- if ::File.exist?(::File.join(@new_resource.destination, ".svn"))
90
+ if ::File.exist?(::File.join(new_resource.destination, ".svn"))
91
91
  current_rev = find_current_revision
92
- Chef::Log.debug "#{@new_resource} current revision: #{current_rev} target revision: #{revision_int}"
92
+ Chef::Log.debug "#{new_resource} current revision: #{current_rev} target revision: #{revision_int}"
93
93
  unless current_revision_matches_target_revision?
94
- converge_by("sync #{@new_resource.destination} from #{@new_resource.repository}") do
94
+ converge_by("sync #{new_resource.destination} from #{new_resource.repository}") do
95
95
  shell_out!(sync_command, run_options)
96
- Chef::Log.info "#{@new_resource} updated to revision: #{revision_int}"
96
+ Chef::Log.info "#{new_resource} updated to revision: #{revision_int}"
97
97
  end
98
98
  end
99
99
  else
@@ -102,24 +102,24 @@ class Chef
102
102
  end
103
103
 
104
104
  def sync_command
105
- c = scm :update, @new_resource.svn_arguments, verbose, authentication, proxy, "-r#{revision_int}", @new_resource.destination
106
- Chef::Log.debug "#{@new_resource} updated working copy #{@new_resource.destination} to revision #{@new_resource.revision}"
105
+ c = scm :update, new_resource.svn_arguments, verbose, authentication, proxy, "-r#{revision_int}", new_resource.destination
106
+ Chef::Log.debug "#{new_resource} updated working copy #{new_resource.destination} to revision #{new_resource.revision}"
107
107
  c
108
108
  end
109
109
 
110
110
  def checkout_command
111
- c = scm :checkout, @new_resource.svn_arguments, verbose, authentication, proxy,
112
- "-r#{revision_int}", @new_resource.repository, @new_resource.destination
113
- Chef::Log.info "#{@new_resource} checked out #{@new_resource.repository} at revision #{@new_resource.revision} to #{@new_resource.destination}"
111
+ c = scm :checkout, new_resource.svn_arguments, verbose, authentication, proxy,
112
+ "-r#{revision_int}", new_resource.repository, new_resource.destination
113
+ Chef::Log.info "#{new_resource} checked out #{new_resource.repository} at revision #{new_resource.revision} to #{new_resource.destination}"
114
114
  c
115
115
  end
116
116
 
117
117
  def export_command
118
118
  args = ["--force"]
119
- args << @new_resource.svn_arguments << verbose << authentication << proxy <<
120
- "-r#{revision_int}" << @new_resource.repository << @new_resource.destination
119
+ args << new_resource.svn_arguments << verbose << authentication << proxy <<
120
+ "-r#{revision_int}" << new_resource.repository << new_resource.destination
121
121
  c = scm :export, *args
122
- Chef::Log.info "#{@new_resource} exported #{@new_resource.repository} at revision #{@new_resource.revision} to #{@new_resource.destination}"
122
+ Chef::Log.info "#{new_resource} exported #{new_resource.repository} at revision #{new_resource.revision} to #{new_resource.destination}"
123
123
  c
124
124
  end
125
125
 
@@ -128,10 +128,10 @@ class Chef
128
128
  # If the specified revision is an integer, trust it.
129
129
  def revision_int
130
130
  @revision_int ||= begin
131
- if @new_resource.revision =~ /^\d+$/
132
- @new_resource.revision
131
+ if new_resource.revision =~ /^\d+$/
132
+ new_resource.revision
133
133
  else
134
- command = scm(:info, @new_resource.repository, @new_resource.svn_info_args, authentication, "-r#{@new_resource.revision}")
134
+ command = scm(:info, new_resource.repository, new_resource.svn_info_args, authentication, "-r#{new_resource.revision}")
135
135
  svn_info = shell_out!(command, run_options(:cwd => cwd, :returns => [0, 1])).stdout
136
136
 
137
137
  extract_revision_info(svn_info)
@@ -142,7 +142,7 @@ class Chef
142
142
  alias :revision_slug :revision_int
143
143
 
144
144
  def find_current_revision
145
- return nil unless ::File.exist?(::File.join(@new_resource.destination, ".svn"))
145
+ return nil unless ::File.exist?(::File.join(new_resource.destination, ".svn"))
146
146
  command = scm(:info)
147
147
  svn_info = shell_out!(command, run_options(:cwd => cwd, :returns => [0, 1])).stdout
148
148
 
@@ -150,20 +150,20 @@ class Chef
150
150
  end
151
151
 
152
152
  def current_revision_matches_target_revision?
153
- (!@current_resource.revision.nil?) && (revision_int.strip.to_i == @current_resource.revision.strip.to_i)
153
+ (!current_resource.revision.nil?) && (revision_int.strip.to_i == current_resource.revision.strip.to_i)
154
154
  end
155
155
 
156
156
  def run_options(run_opts = {})
157
- run_opts[:user] = @new_resource.user if @new_resource.user
158
- run_opts[:group] = @new_resource.group if @new_resource.group
159
- run_opts[:timeout] = @new_resource.timeout if @new_resource.timeout
157
+ run_opts[:user] = new_resource.user if new_resource.user
158
+ run_opts[:group] = new_resource.group if new_resource.group
159
+ run_opts[:timeout] = new_resource.timeout if new_resource.timeout
160
160
  run_opts
161
161
  end
162
162
 
163
163
  private
164
164
 
165
165
  def cwd
166
- @new_resource.destination
166
+ new_resource.destination
167
167
  end
168
168
 
169
169
  def verbose
@@ -181,7 +181,7 @@ class Chef
181
181
  rev = (repo_attrs["Last Changed Rev"] || repo_attrs["Revision"])
182
182
  rev.strip! if rev
183
183
  raise "Could not parse `svn info` data: #{svn_info}" if repo_attrs.empty?
184
- Chef::Log.debug "#{@new_resource} resolved revision #{@new_resource.revision} to #{rev}"
184
+ Chef::Log.debug "#{new_resource} resolved revision #{new_resource.revision} to #{rev}"
185
185
  rev
186
186
  end
187
187
 
@@ -190,14 +190,14 @@ class Chef
190
190
  # switch, since Capistrano will check for that prompt in the output
191
191
  # and will respond appropriately.
192
192
  def authentication
193
- return "" unless @new_resource.svn_username
194
- result = "--username #{@new_resource.svn_username} "
195
- result << "--password #{@new_resource.svn_password} "
193
+ return "" unless new_resource.svn_username
194
+ result = "--username #{new_resource.svn_username} "
195
+ result << "--password #{new_resource.svn_password} "
196
196
  result
197
197
  end
198
198
 
199
199
  def proxy
200
- repo_uri = URI.parse(@new_resource.repository)
200
+ repo_uri = URI.parse(new_resource.repository)
201
201
  proxy_uri = Chef::Config.proxy_uri(repo_uri.scheme, repo_uri.host, repo_uri.port)
202
202
  return "" if proxy_uri.nil?
203
203
 
@@ -213,18 +213,18 @@ class Chef
213
213
  end
214
214
 
215
215
  def target_dir_non_existent_or_empty?
216
- !::File.exist?(@new_resource.destination) || Dir.entries(@new_resource.destination).sort == [".", ".."]
216
+ !::File.exist?(new_resource.destination) || Dir.entries(new_resource.destination).sort == [".", ".."]
217
217
  end
218
218
 
219
219
  def svn_binary
220
- @new_resource.svn_binary ||
220
+ new_resource.svn_binary ||
221
221
  (Chef::Platform.windows? ? "svn.exe" : "svn")
222
222
  end
223
223
 
224
224
  def assert_target_directory_valid!
225
- target_parent_directory = ::File.dirname(@new_resource.destination)
225
+ target_parent_directory = ::File.dirname(new_resource.destination)
226
226
  unless ::File.directory?(target_parent_directory)
227
- msg = "Cannot clone #{@new_resource} to #{@new_resource.destination}, the enclosing directory #{target_parent_directory} does not exist"
227
+ msg = "Cannot clone #{new_resource} to #{new_resource.destination}, the enclosing directory #{target_parent_directory} does not exist"
228
228
  raise Chef::Exceptions::MissingParentDirectory, msg
229
229
  end
230
230
  end
@@ -20,6 +20,7 @@ require "chef/provider"
20
20
  require "chef/mixin/which"
21
21
  require "chef/mixin/shell_out"
22
22
  require "chef/resource/file"
23
+ require "chef/resource/file/verification/systemd_unit"
23
24
  require "iniparse"
24
25
 
25
26
  class Chef
@@ -193,6 +194,7 @@ class Chef
193
194
  f.group "root"
194
195
  f.mode "0644"
195
196
  f.content new_resource.to_ini
197
+ f.verify :systemd_unit
196
198
  end.run_action(action)
197
199
  end
198
200
 
@@ -37,7 +37,7 @@ class Chef
37
37
  end
38
38
 
39
39
  def load_current_resource
40
- @current_resource = Chef::Resource::Template.new(@new_resource.name)
40
+ @current_resource = Chef::Resource::Template.new(new_resource.name)
41
41
  super
42
42
  end
43
43
 
@@ -55,8 +55,8 @@ class Chef
55
55
  private
56
56
 
57
57
  def managing_content?
58
- return true if @new_resource.checksum
59
- return true if !@new_resource.source.nil? && @action != :create_if_missing
58
+ return true if new_resource.checksum
59
+ return true if !new_resource.source.nil? && @action != :create_if_missing
60
60
  false
61
61
  end
62
62
 
@@ -36,8 +36,8 @@ class Chef
36
36
  end
37
37
 
38
38
  def convert_group_name
39
- if @new_resource.gid.is_a? String
40
- @new_resource.gid(Etc.getgrnam(@new_resource.gid).gid)
39
+ if new_resource.gid.is_a? String
40
+ new_resource.gid(Etc.getgrnam(new_resource.gid).gid)
41
41
  end
42
42
  rescue ArgumentError
43
43
  @group_name_resolved = false
@@ -48,51 +48,51 @@ class Chef
48
48
  end
49
49
 
50
50
  def load_current_resource
51
- @current_resource = Chef::Resource::User.new(@new_resource.name)
52
- @current_resource.username(@new_resource.username)
51
+ @current_resource = Chef::Resource::User.new(new_resource.name)
52
+ current_resource.username(new_resource.username)
53
53
 
54
54
  begin
55
- user_info = Etc.getpwnam(@new_resource.username)
55
+ user_info = Etc.getpwnam(new_resource.username)
56
56
  rescue ArgumentError
57
57
  @user_exists = false
58
- Chef::Log.debug("#{@new_resource} user does not exist")
58
+ Chef::Log.debug("#{new_resource} user does not exist")
59
59
  user_info = nil
60
60
  end
61
61
 
62
62
  if user_info
63
- @current_resource.uid(user_info.uid)
64
- @current_resource.gid(user_info.gid)
65
- @current_resource.home(user_info.dir)
66
- @current_resource.shell(user_info.shell)
67
- @current_resource.password(user_info.passwd)
68
-
69
- if @new_resource.comment
70
- user_info.gecos.force_encoding(@new_resource.comment.encoding)
63
+ current_resource.uid(user_info.uid)
64
+ current_resource.gid(user_info.gid)
65
+ current_resource.home(user_info.dir)
66
+ current_resource.shell(user_info.shell)
67
+ current_resource.password(user_info.passwd)
68
+
69
+ if new_resource.comment
70
+ user_info.gecos.force_encoding(new_resource.comment.encoding)
71
71
  end
72
- @current_resource.comment(user_info.gecos)
72
+ current_resource.comment(user_info.gecos)
73
73
 
74
- if @new_resource.password && @current_resource.password == "x"
74
+ if new_resource.password && current_resource.password == "x"
75
75
  begin
76
76
  require "shadow"
77
77
  rescue LoadError
78
78
  @shadow_lib_ok = false
79
79
  else
80
- shadow_info = Shadow::Passwd.getspnam(@new_resource.username)
81
- @current_resource.password(shadow_info.sp_pwdp)
80
+ shadow_info = Shadow::Passwd.getspnam(new_resource.username)
81
+ current_resource.password(shadow_info.sp_pwdp)
82
82
  end
83
83
  end
84
84
 
85
- convert_group_name if @new_resource.gid
85
+ convert_group_name if new_resource.gid
86
86
  end
87
87
 
88
- @current_resource
88
+ current_resource
89
89
  end
90
90
 
91
91
  def define_resource_requirements
92
92
  requirements.assert(:create, :modify, :manage, :lock, :unlock) do |a|
93
93
  a.assertion { @group_name_resolved }
94
- a.failure_message Chef::Exceptions::User, "Couldn't lookup integer GID for group name #{@new_resource.gid}"
95
- a.whyrun "group name #{@new_resource.gid} does not exist. This will cause group assignment to fail. Assuming this group will have been created previously."
94
+ a.failure_message Chef::Exceptions::User, "Couldn't lookup integer GID for group name #{new_resource.gid}"
95
+ a.whyrun "group name #{new_resource.gid} does not exist. This will cause group assignment to fail. Assuming this group will have been created previously."
96
96
  end
97
97
  requirements.assert(:all_actions) do |a|
98
98
  a.assertion { @shadow_lib_ok }
@@ -102,8 +102,8 @@ class Chef
102
102
  end
103
103
  requirements.assert(:modify, :lock, :unlock) do |a|
104
104
  a.assertion { @user_exists }
105
- a.failure_message(Chef::Exceptions::User, "Cannot modify user #{@new_resource.username} - does not exist!")
106
- a.whyrun("Assuming user #{@new_resource.username} would have been created")
105
+ a.failure_message(Chef::Exceptions::User, "Cannot modify user #{new_resource.username} - does not exist!")
106
+ a.whyrun("Assuming user #{new_resource.username} would have been created")
107
107
  end
108
108
  end
109
109
 
@@ -113,10 +113,10 @@ class Chef
113
113
  # <true>:: If a change is required
114
114
  # <false>:: If the users are identical
115
115
  def compare_user
116
- return true if !@new_resource.home.nil? && Pathname.new(@new_resource.home).cleanpath != Pathname.new(@current_resource.home).cleanpath
116
+ return true if !new_resource.home.nil? && Pathname.new(new_resource.home).cleanpath != Pathname.new(current_resource.home).cleanpath
117
117
 
118
118
  [ :comment, :shell, :password, :uid, :gid ].each do |user_attrib|
119
- return true if !@new_resource.send(user_attrib).nil? && @new_resource.send(user_attrib).to_s != @current_resource.send(user_attrib).to_s
119
+ return true if !new_resource.send(user_attrib).nil? && new_resource.send(user_attrib).to_s != current_resource.send(user_attrib).to_s
120
120
  end
121
121
 
122
122
  false
@@ -124,61 +124,61 @@ class Chef
124
124
 
125
125
  def action_create
126
126
  if !@user_exists
127
- converge_by("create user #{@new_resource.username}") do
127
+ converge_by("create user #{new_resource.username}") do
128
128
  create_user
129
- Chef::Log.info("#{@new_resource} created")
129
+ Chef::Log.info("#{new_resource} created")
130
130
  end
131
131
  elsif compare_user
132
- converge_by("alter user #{@new_resource.username}") do
132
+ converge_by("alter user #{new_resource.username}") do
133
133
  manage_user
134
- Chef::Log.info("#{@new_resource} altered")
134
+ Chef::Log.info("#{new_resource} altered")
135
135
  end
136
136
  end
137
137
  end
138
138
 
139
139
  def action_remove
140
140
  return unless @user_exists
141
- converge_by("remove user #{@new_resource.username}") do
141
+ converge_by("remove user #{new_resource.username}") do
142
142
  remove_user
143
- Chef::Log.info("#{@new_resource} removed")
143
+ Chef::Log.info("#{new_resource} removed")
144
144
  end
145
145
  end
146
146
 
147
147
  def action_manage
148
148
  return unless @user_exists && compare_user
149
- converge_by("manage user #{@new_resource.username}") do
149
+ converge_by("manage user #{new_resource.username}") do
150
150
  manage_user
151
- Chef::Log.info("#{@new_resource} managed")
151
+ Chef::Log.info("#{new_resource} managed")
152
152
  end
153
153
  end
154
154
 
155
155
  def action_modify
156
156
  return unless compare_user
157
- converge_by("modify user #{@new_resource.username}") do
157
+ converge_by("modify user #{new_resource.username}") do
158
158
  manage_user
159
- Chef::Log.info("#{@new_resource} modified")
159
+ Chef::Log.info("#{new_resource} modified")
160
160
  end
161
161
  end
162
162
 
163
163
  def action_lock
164
164
  if check_lock == false
165
- converge_by("lock the user #{@new_resource.username}") do
165
+ converge_by("lock the user #{new_resource.username}") do
166
166
  lock_user
167
- Chef::Log.info("#{@new_resource} locked")
167
+ Chef::Log.info("#{new_resource} locked")
168
168
  end
169
169
  else
170
- Chef::Log.debug("#{@new_resource} already locked - nothing to do")
170
+ Chef::Log.debug("#{new_resource} already locked - nothing to do")
171
171
  end
172
172
  end
173
173
 
174
174
  def action_unlock
175
175
  if check_lock == true
176
- converge_by("unlock user #{@new_resource.username}") do
176
+ converge_by("unlock user #{new_resource.username}") do
177
177
  unlock_user
178
- Chef::Log.info("#{@new_resource} unlocked")
178
+ Chef::Log.info("#{new_resource} unlocked")
179
179
  end
180
180
  else
181
- Chef::Log.debug("#{@new_resource} already unlocked - nothing to do")
181
+ Chef::Log.debug("#{new_resource} already unlocked - nothing to do")
182
182
  end
183
183
  end
184
184
 
@@ -22,10 +22,10 @@ class Chef
22
22
  provides :whyrun_safe_ruby_block
23
23
 
24
24
  def action_run
25
- @new_resource.block.call
26
- @new_resource.updated_by_last_action(true)
27
- @run_context.events.resource_update_applied(@new_resource, :create, "execute the whyrun_safe_ruby_block #{@new_resource.name}")
28
- Chef::Log.info("#{@new_resource} called")
25
+ new_resource.block.call
26
+ new_resource.updated_by_last_action(true)
27
+ @run_context.events.resource_update_applied(new_resource, :create, "execute the whyrun_safe_ruby_block #{new_resource.name}")
28
+ Chef::Log.info("#{new_resource} called")
29
29
  end
30
30
  end
31
31
  end