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.
- checksums.yaml +4 -4
- data/Gemfile +5 -4
- data/README.md +12 -13
- data/VERSION +1 -1
- data/acceptance/Gemfile +4 -4
- data/acceptance/Gemfile.lock +70 -69
- data/chef-universal-mingw32.gemspec +2 -3
- data/chef.gemspec +6 -6
- data/lib/chef/api_client.rb +8 -10
- data/lib/chef/api_client_v1.rb +9 -11
- data/lib/chef/application/apply.rb +8 -10
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/exit_code.rb +3 -5
- data/lib/chef/application/knife.rb +2 -2
- data/lib/chef/application/windows_service.rb +29 -30
- data/lib/chef/application/windows_service_manager.rb +1 -1
- data/lib/chef/audit/audit_event_proxy.rb +2 -2
- data/lib/chef/audit/control_group_data.rb +1 -1
- data/lib/chef/chef_class.rb +1 -0
- data/lib/chef/chef_fs/chef_fs_data_store.rb +5 -7
- data/lib/chef/chef_fs/command_line.rb +15 -16
- data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/user_data_handler.rb +1 -1
- data/lib/chef/chef_fs/file_pattern.rb +2 -2
- data/lib/chef/chef_fs/file_system.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +5 -6
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +28 -30
- data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +27 -29
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +18 -24
- data/lib/chef/chef_fs/file_system/memory/memory_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +9 -13
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -0
- data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -0
- data/lib/chef/chef_fs/parallelizer.rb +9 -11
- data/lib/chef/cookbook/cookbook_version_loader.rb +25 -31
- data/lib/chef/cookbook/metadata.rb +26 -26
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_version.rb +3 -3
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +3 -3
- data/lib/chef/data_collector.rb +3 -4
- data/lib/chef/decorator.rb +1 -1
- data/lib/chef/deprecated.rb +30 -0
- data/lib/chef/dsl/audit.rb +2 -2
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +29 -31
- data/lib/chef/dsl/reboot_pending.rb +1 -1
- data/lib/chef/dsl/resources.rb +6 -8
- data/lib/chef/encrypted_data_bag_item.rb +2 -2
- data/lib/chef/environment.rb +9 -11
- data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
- data/lib/chef/exceptions.rb +4 -1
- data/lib/chef/file_access_control/unix.rb +14 -14
- data/lib/chef/file_access_control/windows.rb +1 -1
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +4 -5
- data/lib/chef/formatters/error_mapper.rb +6 -6
- data/lib/chef/http/api_versions.rb +50 -0
- data/lib/chef/http/validate_content_length.rb +2 -2
- data/lib/chef/json_compat.rb +6 -10
- data/lib/chef/key.rb +5 -5
- data/lib/chef/knife.rb +4 -4
- data/lib/chef/knife/cookbook_site_install.rb +2 -2
- data/lib/chef/knife/core/cookbook_scm_repo.rb +2 -2
- data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +1 -1
- data/lib/chef/knife/core/ui.rb +19 -25
- data/lib/chef/knife/data_bag_secret_options.rb +1 -1
- data/lib/chef/knife/deps.rb +32 -34
- data/lib/chef/knife/help.rb +1 -1
- data/lib/chef/knife/list.rb +1 -1
- data/lib/chef/knife/search.rb +2 -2
- data/lib/chef/knife/ssh.rb +37 -27
- data/lib/chef/knife/ssl_check.rb +1 -1
- data/lib/chef/knife/user_delete.rb +1 -1
- data/lib/chef/mash.rb +1 -1
- data/lib/chef/mixin/command.rb +2 -2
- data/lib/chef/mixin/create_path.rb +3 -5
- data/lib/chef/mixin/from_file.rb +2 -2
- data/lib/chef/mixin/get_source_from_package.rb +2 -2
- data/lib/chef/mixin/notifying_block.rb +7 -9
- data/lib/chef/mixin/params_validate.rb +3 -3
- data/lib/chef/mixin/securable.rb +1 -1
- data/lib/chef/mixin/shell_out.rb +23 -3
- data/lib/chef/mixin/unformatter.rb +2 -2
- data/lib/chef/mixin/uris.rb +4 -6
- data/lib/chef/mixin/versioned_api.rb +69 -0
- data/lib/chef/mixin/which.rb +25 -8
- data/lib/chef/mixin/windows_architecture_helper.rb +2 -2
- data/lib/chef/mixin/xml_escape.rb +3 -5
- data/lib/chef/monkey_patches/webrick-utils.rb +1 -1
- data/lib/chef/node.rb +8 -8
- data/lib/chef/node/attribute.rb +4 -4
- data/lib/chef/node/common_api.rb +5 -7
- data/lib/chef/org.rb +10 -12
- data/lib/chef/platform/provider_mapping.rb +7 -7
- data/lib/chef/platform/query_helpers.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +1 -0
- data/lib/chef/property.rb +31 -0
- data/lib/chef/provider/batch.rb +1 -1
- data/lib/chef/provider/breakpoint.rb +1 -1
- data/lib/chef/provider/cookbook_file.rb +3 -3
- data/lib/chef/provider/cron.rb +38 -38
- data/lib/chef/provider/deploy.rb +81 -81
- data/lib/chef/provider/deploy/revision.rb +3 -5
- data/lib/chef/provider/directory.rb +32 -32
- data/lib/chef/provider/dsc_resource.rb +22 -6
- data/lib/chef/provider/env.rb +28 -28
- data/lib/chef/provider/env/windows.rb +1 -1
- data/lib/chef/provider/erl_call.rb +13 -13
- data/lib/chef/provider/execute.rb +5 -2
- data/lib/chef/provider/file.rb +49 -51
- data/lib/chef/provider/git.rb +55 -55
- data/lib/chef/provider/http_request.rb +36 -36
- data/lib/chef/provider/launchd.rb +2 -2
- data/lib/chef/provider/link.rb +50 -50
- data/lib/chef/provider/log.rb +2 -2
- data/lib/chef/provider/mdadm.rb +25 -25
- data/lib/chef/provider/mount/aix.rb +2 -2
- data/lib/chef/provider/mount/mount.rb +2 -2
- data/lib/chef/provider/ohai.rb +1 -1
- data/lib/chef/provider/osx_profile.rb +23 -23
- data/lib/chef/provider/package.rb +74 -56
- data/lib/chef/provider/package/aix.rb +55 -52
- data/lib/chef/provider/package/apt.rb +15 -13
- data/lib/chef/provider/package/cab.rb +49 -20
- data/lib/chef/provider/package/chocolatey.rb +9 -10
- data/lib/chef/provider/package/dnf.rb +20 -18
- data/lib/chef/provider/package/dnf/dnf_helper.py +1 -1
- data/lib/chef/provider/package/dnf/python_helper.rb +63 -26
- data/lib/chef/provider/package/dnf/version.rb +1 -1
- data/lib/chef/provider/package/dpkg.rb +8 -9
- data/lib/chef/provider/package/easy_install.rb +22 -22
- data/lib/chef/provider/package/freebsd/base.rb +10 -10
- data/lib/chef/provider/package/freebsd/pkg.rb +15 -15
- data/lib/chef/provider/package/freebsd/pkgng.rb +13 -15
- data/lib/chef/provider/package/freebsd/port.rb +7 -7
- data/lib/chef/provider/package/homebrew.rb +11 -10
- data/lib/chef/provider/package/ips.rb +18 -23
- data/lib/chef/provider/package/macports.rb +23 -23
- data/lib/chef/provider/package/msu.rb +11 -11
- data/lib/chef/provider/package/openbsd.rb +25 -22
- data/lib/chef/provider/package/pacman.rb +16 -16
- data/lib/chef/provider/package/paludis.rb +26 -27
- data/lib/chef/provider/package/portage.rb +22 -22
- data/lib/chef/provider/package/powershell.rb +17 -17
- data/lib/chef/provider/package/rpm.rb +25 -25
- data/lib/chef/provider/package/rubygems.rb +60 -60
- data/lib/chef/provider/package/smartos.rb +16 -16
- data/lib/chef/provider/package/solaris.rb +44 -44
- data/lib/chef/provider/package/windows.rb +3 -3
- data/lib/chef/provider/package/windows/exe.rb +6 -6
- data/lib/chef/provider/package/windows/msi.rb +6 -6
- data/lib/chef/provider/package/yum.rb +318 -268
- data/lib/chef/provider/package/yum/rpm_utils.rb +34 -34
- data/lib/chef/provider/package/yum/yum_cache.rb +12 -12
- data/lib/chef/provider/package/zypper.rb +11 -11
- data/lib/chef/provider/powershell_script.rb +15 -7
- data/lib/chef/provider/reboot.rb +10 -10
- data/lib/chef/provider/registry_key.rb +39 -39
- data/lib/chef/provider/remote_directory.rb +3 -3
- data/lib/chef/provider/remote_file.rb +3 -3
- data/lib/chef/provider/route.rb +1 -1
- data/lib/chef/provider/ruby_block.rb +3 -3
- data/lib/chef/provider/script.rb +42 -6
- data/lib/chef/provider/service.rb +49 -49
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +1 -1
- data/lib/chef/provider/subversion.rb +39 -39
- data/lib/chef/provider/systemd_unit.rb +2 -0
- data/lib/chef/provider/template.rb +3 -3
- data/lib/chef/provider/user.rb +42 -42
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +4 -4
- data/lib/chef/resource.rb +27 -16
- data/lib/chef/resource/apt_repository.rb +0 -1
- data/lib/chef/resource/chef_gem.rb +1 -1
- data/lib/chef/resource/dnf_package.rb +6 -3
- data/lib/chef/resource/dsc_resource.rb +9 -1
- data/lib/chef/resource/execute.rb +70 -6
- data/lib/chef/resource/file/verification/systemd_unit.rb +67 -0
- data/lib/chef/resource/freebsd_package.rb +1 -1
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/launchd.rb +13 -1
- data/lib/chef/resource/package.rb +2 -2
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/yum_package.rb +12 -3
- data/lib/chef/resource/yum_repository.rb +0 -1
- data/lib/chef/resource_collection/resource_collection_serialization.rb +3 -3
- data/lib/chef/resource_collection/resource_set.rb +2 -2
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/run_list/run_list_item.rb +1 -1
- data/lib/chef/run_list/versioned_recipe_list.rb +6 -6
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/server_api_versions.rb +40 -0
- data/lib/chef/shell.rb +1 -1
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/user.rb +9 -11
- data/lib/chef/user_v1.rb +9 -11
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/util/windows/net_group.rb +18 -30
- data/lib/chef/util/windows/net_use.rb +7 -11
- data/lib/chef/util/windows/net_user.rb +11 -17
- data/lib/chef/util/windows/volume.rb +9 -15
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +1 -1
- data/lib/chef/win32/api.rb +4 -6
- data/lib/chef/win32/api/file.rb +25 -31
- data/lib/chef/win32/api/installer.rb +2 -2
- data/lib/chef/win32/file.rb +4 -6
- data/lib/chef/win32/registry.rb +9 -9
- data/lib/chef/win32/security.rb +2 -2
- data/lib/chef/win32/security/acl.rb +2 -2
- data/lib/chef/win32/unicode.rb +2 -2
- data/lib/chef/win32/version.rb +1 -1
- data/spec/data/prefer_metadata_json/metadata.json +51 -0
- data/spec/data/prefer_metadata_json/metadata.rb +6 -0
- data/spec/data/prefer_metadata_json/recipes/default.rb +0 -0
- data/spec/functional/knife/ssh_spec.rb +5 -5
- data/spec/functional/resource/batch_spec.rb +5 -1
- data/spec/functional/resource/dsc_script_spec.rb +2 -4
- data/spec/functional/resource/execute_spec.rb +17 -0
- data/spec/functional/resource/user/dscl_spec.rb +2 -4
- data/spec/integration/client/client_spec.rb +33 -0
- data/spec/integration/recipes/recipe_dsl_spec.rb +58 -58
- data/spec/spec_helper.rb +4 -0
- data/spec/support/chef_helpers.rb +5 -7
- data/spec/support/platform_helpers.rb +6 -0
- data/spec/support/platforms/prof/gc.rb +4 -6
- data/spec/support/shared/context/client.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +150 -0
- data/spec/support/shared/functional/windows_script.rb +74 -4
- data/spec/support/shared/unit/execute_resource.rb +37 -0
- data/spec/support/shared/unit/provider/file.rb +10 -0
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +9 -0
- data/spec/unit/cookbook/syntax_check_spec.rb +8 -2
- data/spec/unit/http/api_versions_spec.rb +69 -0
- data/spec/unit/knife/ssh_spec.rb +34 -36
- data/spec/unit/mixin/versioned_api_spec.rb +107 -0
- data/spec/unit/mixin/which.rb +160 -0
- data/spec/unit/platform_spec.rb +28 -1
- data/spec/unit/provider/deploy_spec.rb +1 -1
- data/spec/unit/provider/directory_spec.rb +10 -0
- data/spec/unit/provider/dsc_resource_spec.rb +175 -0
- data/spec/unit/provider/execute_spec.rb +0 -1
- data/spec/unit/provider/launchd_spec.rb +2 -2
- data/spec/unit/provider/package/aix_spec.rb +22 -22
- data/spec/unit/provider/package/apt_spec.rb +27 -27
- data/spec/unit/provider/package/cab_spec.rb +59 -5
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +29 -0
- data/spec/unit/provider/package/dpkg_spec.rb +16 -16
- data/spec/unit/provider/package/easy_install_spec.rb +18 -18
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +15 -15
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
- data/spec/unit/provider/package/freebsd/port_spec.rb +9 -9
- data/spec/unit/provider/package/homebrew_spec.rb +9 -9
- data/spec/unit/provider/package/ips_spec.rb +37 -31
- data/spec/unit/provider/package/macports_spec.rb +10 -10
- data/spec/unit/provider/package/openbsd_spec.rb +10 -10
- data/spec/unit/provider/package/pacman_spec.rb +6 -6
- data/spec/unit/provider/package/paludis_spec.rb +7 -7
- data/spec/unit/provider/package/portage_spec.rb +6 -7
- data/spec/unit/provider/package/rpm_spec.rb +23 -23
- data/spec/unit/provider/package/rubygems_spec.rb +38 -38
- data/spec/unit/provider/package/solaris_spec.rb +15 -15
- data/spec/unit/provider/package/windows_spec.rb +2 -1
- data/spec/unit/provider/package/yum_spec.rb +51 -43
- data/spec/unit/provider/package/zypper_spec.rb +34 -34
- data/spec/unit/provider/package_spec.rb +8 -0
- data/spec/unit/provider/remote_file/sftp_spec.rb +3 -3
- data/spec/unit/provider/route_spec.rb +7 -1
- data/spec/unit/provider/script_spec.rb +49 -6
- data/spec/unit/resource/dsc_resource_spec.rb +6 -0
- data/spec/unit/resource/execute_spec.rb +214 -0
- data/spec/unit/resource/file/verification/systemd_unit_spec.rb +103 -0
- data/spec/unit/resource/freebsd_package_spec.rb +2 -2
- data/spec/unit/resource/package_spec.rb +5 -0
- data/spec/unit/resource/yum_package_spec.rb +42 -1
- data/spec/unit/resource_reporter_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +18 -0
- data/spec/unit/server_api_versions_spec.rb +44 -0
- data/spec/unit/util/selinux_spec.rb +3 -14
- data/spec/unit/win32/error_spec.rb +67 -0
- data/spec/unit/win32/security_spec.rb +66 -0
- data/tasks/changelog.rb +1 -1
- data/tasks/dependencies.rb +20 -4
- metadata +39 -18
- data/lib/chef/monkey_patches/net-ssh-multi.rb +0 -141
@@ -40,11 +40,11 @@ class Chef
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def load_current_resource
|
43
|
-
@current_resource = Chef::Resource::Subversion.new(
|
43
|
+
@current_resource = Chef::Resource::Subversion.new(new_resource.name)
|
44
44
|
|
45
|
-
unless [:export, :force_export].include?(Array(
|
45
|
+
unless [:export, :force_export].include?(Array(new_resource.action).first)
|
46
46
|
if current_revision = find_current_revision
|
47
|
-
|
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(
|
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 #{
|
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 #{
|
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 "#{
|
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 "#{
|
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 #{
|
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(
|
90
|
+
if ::File.exist?(::File.join(new_resource.destination, ".svn"))
|
91
91
|
current_rev = find_current_revision
|
92
|
-
Chef::Log.debug "#{
|
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 #{
|
94
|
+
converge_by("sync #{new_resource.destination} from #{new_resource.repository}") do
|
95
95
|
shell_out!(sync_command, run_options)
|
96
|
-
Chef::Log.info "#{
|
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,
|
106
|
-
Chef::Log.debug "#{
|
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,
|
112
|
-
"-r#{revision_int}",
|
113
|
-
Chef::Log.info "#{
|
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 <<
|
120
|
-
"-r#{revision_int}" <<
|
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 "#{
|
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
|
132
|
-
|
131
|
+
if new_resource.revision =~ /^\d+$/
|
132
|
+
new_resource.revision
|
133
133
|
else
|
134
|
-
command = scm(:info,
|
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(
|
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
|
-
(
|
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] =
|
158
|
-
run_opts[:group] =
|
159
|
-
run_opts[: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
|
-
|
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 "#{
|
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
|
194
|
-
result = "--username #{
|
195
|
-
result << "--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(
|
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?(
|
216
|
+
!::File.exist?(new_resource.destination) || Dir.entries(new_resource.destination).sort == [".", ".."]
|
217
217
|
end
|
218
218
|
|
219
219
|
def svn_binary
|
220
|
-
|
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(
|
225
|
+
target_parent_directory = ::File.dirname(new_resource.destination)
|
226
226
|
unless ::File.directory?(target_parent_directory)
|
227
|
-
msg = "Cannot clone #{
|
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(
|
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
|
59
|
-
return true if
|
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
|
|
data/lib/chef/provider/user.rb
CHANGED
@@ -36,8 +36,8 @@ class Chef
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def convert_group_name
|
39
|
-
if
|
40
|
-
|
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(
|
52
|
-
|
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(
|
55
|
+
user_info = Etc.getpwnam(new_resource.username)
|
56
56
|
rescue ArgumentError
|
57
57
|
@user_exists = false
|
58
|
-
Chef::Log.debug("#{
|
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
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
if
|
70
|
-
user_info.gecos.force_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
|
-
|
72
|
+
current_resource.comment(user_info.gecos)
|
73
73
|
|
74
|
-
if
|
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(
|
81
|
-
|
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
|
85
|
+
convert_group_name if new_resource.gid
|
86
86
|
end
|
87
87
|
|
88
|
-
|
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 #{
|
95
|
-
a.whyrun "group name #{
|
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 #{
|
106
|
-
a.whyrun("Assuming user #{
|
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
|
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
|
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 #{
|
127
|
+
converge_by("create user #{new_resource.username}") do
|
128
128
|
create_user
|
129
|
-
Chef::Log.info("#{
|
129
|
+
Chef::Log.info("#{new_resource} created")
|
130
130
|
end
|
131
131
|
elsif compare_user
|
132
|
-
converge_by("alter user #{
|
132
|
+
converge_by("alter user #{new_resource.username}") do
|
133
133
|
manage_user
|
134
|
-
Chef::Log.info("#{
|
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 #{
|
141
|
+
converge_by("remove user #{new_resource.username}") do
|
142
142
|
remove_user
|
143
|
-
Chef::Log.info("#{
|
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 #{
|
149
|
+
converge_by("manage user #{new_resource.username}") do
|
150
150
|
manage_user
|
151
|
-
Chef::Log.info("#{
|
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 #{
|
157
|
+
converge_by("modify user #{new_resource.username}") do
|
158
158
|
manage_user
|
159
|
-
Chef::Log.info("#{
|
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 #{
|
165
|
+
converge_by("lock the user #{new_resource.username}") do
|
166
166
|
lock_user
|
167
|
-
Chef::Log.info("#{
|
167
|
+
Chef::Log.info("#{new_resource} locked")
|
168
168
|
end
|
169
169
|
else
|
170
|
-
Chef::Log.debug("#{
|
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 #{
|
176
|
+
converge_by("unlock user #{new_resource.username}") do
|
177
177
|
unlock_user
|
178
|
-
Chef::Log.info("#{
|
178
|
+
Chef::Log.info("#{new_resource} unlocked")
|
179
179
|
end
|
180
180
|
else
|
181
|
-
Chef::Log.debug("#{
|
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
|
-
|
26
|
-
|
27
|
-
@run_context.events.resource_update_applied(
|
28
|
-
Chef::Log.info("#{
|
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
|