chef 12.13.37-universal-mingw32 → 12.14.60-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +48 -95
- data/Gemfile +6 -1
- data/README.md +9 -11
- data/VERSION +1 -1
- data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +0 -1
- data/acceptance/Gemfile +4 -7
- data/acceptance/Gemfile.lock +59 -92
- data/acceptance/basics/test/integration/helpers/serverspec/Gemfile +8 -0
- data/acceptance/data-collector/test/integration/helpers/serverspec/Gemfile +8 -0
- data/acceptance/fips/test/integration/fips-integration/serverspec/Gemfile +6 -0
- data/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile +4 -0
- data/chef.gemspec +3 -2
- data/lib/chef/application/client.rb +4 -4
- data/lib/chef/application/solo.rb +2 -2
- data/lib/chef/chef_fs/command_line.rb +36 -34
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -2
- data/lib/chef/chef_fs/file_pattern.rb +1 -1
- data/lib/chef/chef_fs/file_system.rb +139 -137
- data/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +2 -6
- data/lib/chef/cookbook/cookbook_version_loader.rb +27 -22
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +3 -3
- data/lib/chef/cookbook_site_streaming_uploader.rb +3 -3
- data/lib/chef/cookbook_uploader.rb +1 -1
- data/lib/chef/cookbook_version.rb +6 -6
- data/lib/chef/dsl/powershell.rb +1 -1
- data/lib/chef/event_dispatch/base.rb +2 -2
- data/lib/chef/exceptions.rb +1 -1
- data/lib/chef/file_cache.rb +1 -1
- data/lib/chef/formatters/base.rb +2 -2
- data/lib/chef/formatters/doc.rb +2 -2
- data/lib/chef/http.rb +48 -18
- data/lib/chef/http/auth_credentials.rb +1 -1
- data/lib/chef/http/basic_client.rb +11 -2
- data/lib/chef/http/socketless_chef_zero_client.rb +2 -2
- data/lib/chef/key.rb +55 -56
- data/lib/chef/knife.rb +70 -61
- data/lib/chef/knife/client_delete.rb +2 -2
- data/lib/chef/knife/cookbook_bulk_delete.rb +1 -1
- data/lib/chef/knife/cookbook_show.rb +1 -1
- data/lib/chef/knife/core/gem_glob_loader.rb +3 -3
- data/lib/chef/knife/search.rb +2 -2
- data/lib/chef/knife/ssh.rb +19 -21
- data/lib/chef/knife/status.rb +2 -2
- data/lib/chef/mixin/command/unix.rb +2 -2
- data/lib/chef/mixin/powershell_type_coercions.rb +1 -1
- data/lib/chef/mixin/properties.rb +3 -0
- data/lib/chef/mixin/securable.rb +2 -2
- data/lib/chef/mixin/shell_out.rb +30 -0
- data/lib/chef/mixin/uris.rb +2 -1
- data/lib/chef/mixin/windows_architecture_helper.rb +3 -4
- data/lib/chef/monkey_patches/webrick-utils.rb +2 -2
- data/lib/chef/monologger.rb +1 -1
- data/lib/chef/node.rb +2 -2
- data/lib/chef/node/attribute.rb +3 -3
- data/lib/chef/platform/provider_mapping.rb +5 -2
- data/lib/chef/property.rb +14 -3
- data/lib/chef/provider/apt_repository.rb +3 -7
- data/lib/chef/provider/apt_update.rb +4 -6
- data/lib/chef/provider/cron.rb +1 -2
- data/lib/chef/provider/dsc_script.rb +4 -4
- data/lib/chef/provider/group/usermod.rb +1 -1
- data/lib/chef/provider/link.rb +10 -3
- data/lib/chef/provider/osx_profile.rb +10 -10
- data/lib/chef/provider/package.rb +2 -12
- data/lib/chef/provider/package/rubygems.rb +17 -16
- data/lib/chef/provider/package/windows.rb +2 -0
- data/lib/chef/provider/package/windows/exe.rb +1 -1
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +0 -2
- data/lib/chef/provider/package/yum/rpm_utils.rb +8 -8
- data/lib/chef/provider/package/yum/yum_cache.rb +1 -1
- data/lib/chef/provider/remote_file/ftp.rb +2 -2
- data/lib/chef/provider/remote_file/sftp.rb +2 -2
- data/lib/chef/provider/service/debian.rb +2 -2
- data/lib/chef/provider/service/simple.rb +4 -3
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +2 -2
- data/lib/chef/provider/service/upstart.rb +8 -5
- data/lib/chef/provider/support/yum_repo.erb +125 -0
- data/lib/chef/provider/systemd_unit.rb +11 -2
- data/lib/chef/provider/template_finder.rb +1 -1
- data/lib/chef/provider/user.rb +20 -16
- data/lib/chef/provider/user/aix.rb +5 -2
- data/lib/chef/provider/user/dscl.rb +1 -0
- data/lib/chef/provider/user/linux.rb +128 -0
- data/lib/chef/provider/user/pw.rb +2 -1
- data/lib/chef/provider/user/solaris.rb +3 -2
- data/lib/chef/provider/user/useradd.rb +5 -4
- data/lib/chef/provider/user/windows.rb +1 -1
- data/lib/chef/provider/windows_script.rb +5 -2
- data/lib/chef/provider/yum_repository.rb +121 -0
- data/lib/chef/providers.rb +4 -2
- data/lib/chef/resource.rb +7 -9
- data/lib/chef/resource/conditional.rb +9 -1
- data/lib/chef/resource/launchd.rb +1 -1
- data/lib/chef/resource/user.rb +3 -3
- data/lib/chef/resource/user/aix_user.rb +31 -0
- data/lib/chef/resource/user/dscl_user.rb +31 -0
- data/lib/chef/resource/user/linux_user.rb +51 -0
- data/lib/chef/resource/user/pw_user.rb +31 -0
- data/lib/chef/resource/user/solaris_user.rb +31 -0
- data/lib/chef/resource/user/windows_user.rb +31 -0
- data/lib/chef/resource/yum_package.rb +13 -12
- data/lib/chef/resource/yum_repository.rb +76 -0
- data/lib/chef/resource_builder.rb +1 -1
- data/lib/chef/resource_collection/stepable_iterator.rb +1 -3
- data/lib/chef/resource_reporter.rb +5 -5
- data/lib/chef/resources.rb +7 -0
- data/lib/chef/run_context.rb +5 -3
- data/lib/chef/run_context/cookbook_compiler.rb +3 -2
- data/lib/chef/run_list.rb +2 -2
- data/lib/chef/search/query.rb +11 -8
- data/lib/chef/shell/ext.rb +2 -2
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/util/dsc/configuration_generator.rb +1 -1
- data/lib/chef/util/powershell/cmdlet.rb +5 -2
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +2 -2
- data/lib/chef/version_constraint.rb +2 -2
- data/lib/chef/win32/api/error.rb +2 -2
- data/lib/chef/win32/api/net.rb +1 -1
- data/lib/chef/win32/eventlog.rb +1 -1
- data/lib/chef/win32/net.rb +1 -1
- data/lib/chef/win32/security/sid.rb +1 -1
- data/spec/functional/assets/testchefsubsys +2 -3
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +11 -8
- data/spec/functional/file_content_management/deploy_strategies_spec.rb +1 -1
- data/spec/functional/http/simple_spec.rb +2 -2
- data/spec/functional/knife/cookbook_delete_spec.rb +5 -5
- data/spec/functional/knife/exec_spec.rb +6 -6
- data/spec/functional/knife/ssh_spec.rb +4 -4
- data/spec/functional/notifications_spec.rb +2 -2
- data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +2 -2
- data/spec/functional/rebooter_spec.rb +5 -5
- data/spec/functional/resource/bash_spec.rb +2 -2
- data/spec/functional/resource/deploy_revision_spec.rb +1 -1
- data/spec/functional/resource/dpkg_package_spec.rb +2 -2
- data/spec/functional/resource/dsc_resource_spec.rb +5 -5
- data/spec/functional/resource/dsc_script_spec.rb +27 -22
- data/spec/functional/resource/env_spec.rb +4 -4
- data/spec/functional/resource/execute_spec.rb +4 -4
- data/spec/functional/resource/group_spec.rb +20 -8
- data/spec/functional/resource/link_spec.rb +34 -0
- data/spec/functional/resource/ohai_spec.rb +6 -6
- data/spec/functional/resource/reboot_spec.rb +2 -2
- data/spec/functional/resource/remote_file_spec.rb +16 -7
- data/spec/functional/resource/user/dscl_spec.rb +3 -3
- data/spec/functional/resource/user/useradd_spec.rb +32 -26
- data/spec/functional/resource/windows_service_spec.rb +15 -15
- data/spec/functional/rest_spec.rb +2 -2
- data/spec/functional/run_lock_spec.rb +9 -9
- data/spec/functional/tiny_server_spec.rb +9 -8
- data/spec/functional/win32/crypto_spec.rb +1 -1
- data/spec/functional/win32/security_spec.rb +8 -8
- data/spec/integration/client/client_spec.rb +6 -4
- data/spec/integration/knife/chef_repo_path_spec.rb +70 -1
- data/spec/integration/knife/upload_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +6 -6
- data/spec/integration/recipes/noop_resource_spec.rb +4 -4
- data/spec/integration/recipes/provider_choice.rb +3 -3
- data/spec/integration/recipes/recipe_dsl_spec.rb +318 -317
- data/spec/integration/recipes/resource_action_spec.rb +50 -54
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +34 -34
- data/spec/integration/recipes/resource_load_spec.rb +24 -24
- data/spec/integration/solo/solo_spec.rb +21 -30
- data/spec/scripts/ssl-serve.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/stress/win32/security_spec.rb +4 -4
- data/spec/support/chef_helpers.rb +22 -0
- data/spec/support/platform_helpers.rb +5 -1
- data/spec/support/shared/context/client.rb +3 -2
- data/spec/support/shared/functional/file_resource.rb +5 -4
- data/spec/support/shared/functional/http.rb +16 -16
- data/spec/support/shared/functional/securable_resource.rb +5 -5
- data/spec/support/shared/functional/win32_service.rb +5 -7
- data/spec/support/shared/integration/app_server_support.rb +1 -3
- data/spec/support/shared/integration/knife_support.rb +0 -2
- data/spec/support/shared/shared_examples.rb +2 -2
- data/spec/support/shared/unit/api_versioning.rb +2 -2
- data/spec/support/shared/unit/application_dot_d.rb +9 -6
- data/spec/support/shared/unit/provider/file.rb +2 -2
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +49 -80
- data/spec/support/shared/unit/resource/static_provider_resolution.rb +2 -2
- data/spec/support/shared/unit/script_resource.rb +4 -4
- data/spec/support/shared/unit/user_and_client_shared.rb +4 -4
- data/spec/tiny_server.rb +51 -66
- data/spec/unit/api_client_v1_spec.rb +2 -2
- data/spec/unit/application_spec.rb +1 -1
- data/spec/unit/audit/audit_event_proxy_spec.rb +34 -27
- data/spec/unit/audit/audit_reporter_spec.rb +32 -23
- data/spec/unit/audit/control_group_data_spec.rb +19 -14
- data/spec/unit/chef_class_spec.rb +1 -1
- data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +1 -1
- data/spec/unit/chef_fs/diff_spec.rb +4 -4
- data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +4 -4
- data/spec/unit/chef_fs/file_system_spec.rb +2 -2
- data/spec/unit/chef_fs/parallelizer.rb +5 -7
- data/spec/unit/cookbook/metadata_spec.rb +98 -98
- data/spec/unit/cookbook/synchronizer_spec.rb +7 -0
- data/spec/unit/cookbook_loader_spec.rb +24 -24
- data/spec/unit/cookbook_version_file_specificity_spec.rb +8 -8
- data/spec/unit/daemon_spec.rb +1 -1
- data/spec/unit/data_bag_item_spec.rb +18 -18
- data/spec/unit/data_bag_spec.rb +2 -2
- data/spec/unit/data_collector/messages/helpers_spec.rb +9 -9
- data/spec/unit/data_collector/messages_spec.rb +2 -2
- data/spec/unit/data_collector_spec.rb +19 -19
- data/spec/unit/dsl/audit_spec.rb +3 -3
- data/spec/unit/dsl/data_query_spec.rb +3 -2
- data/spec/unit/dsl/declare_resource_spec.rb +10 -10
- data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +3 -2
- data/spec/unit/encrypted_data_bag_item_spec.rb +3 -2
- data/spec/unit/environment_spec.rb +6 -6
- data/spec/unit/event_dispatch/dispatcher_spec.rb +2 -2
- data/spec/unit/file_access_control_spec.rb +3 -3
- data/spec/unit/file_content_management/tempfile_spec.rb +2 -2
- data/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb +2 -2
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +2 -2
- data/spec/unit/http/basic_client_spec.rb +20 -0
- data/spec/unit/http/validate_content_length_spec.rb +8 -8
- data/spec/unit/http_spec.rb +14 -0
- data/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb +2 -2
- data/spec/unit/knife/bootstrap/client_builder_spec.rb +2 -2
- data/spec/unit/knife/bootstrap_spec.rb +8 -6
- data/spec/unit/knife/client_bulk_delete_spec.rb +8 -8
- data/spec/unit/knife/client_edit_spec.rb +2 -2
- data/spec/unit/knife/configure_client_spec.rb +2 -2
- data/spec/unit/knife/cookbook_metadata_spec.rb +4 -4
- data/spec/unit/knife/cookbook_site_install_spec.rb +6 -5
- data/spec/unit/knife/cookbook_site_share_spec.rb +2 -2
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +5 -4
- data/spec/unit/knife/core/node_editor_spec.rb +3 -3
- data/spec/unit/knife/core/ui_spec.rb +2 -2
- data/spec/unit/knife/data_bag_from_file_spec.rb +4 -3
- data/spec/unit/knife/data_bag_show_spec.rb +3 -2
- data/spec/unit/knife/key_create_spec.rb +14 -14
- data/spec/unit/knife/key_delete_spec.rb +2 -2
- data/spec/unit/knife/key_edit_spec.rb +16 -16
- data/spec/unit/knife/key_list_spec.rb +6 -6
- data/spec/unit/knife/key_show_spec.rb +4 -4
- data/spec/unit/knife/status_spec.rb +3 -2
- data/spec/unit/knife/user_create_spec.rb +4 -4
- data/spec/unit/knife_spec.rb +7 -6
- data/spec/unit/lwrp_spec.rb +6 -6
- data/spec/unit/mixin/api_version_request_handling_spec.rb +2 -2
- data/spec/unit/mixin/command_spec.rb +17 -14
- data/spec/unit/mixin/deprecation_spec.rb +1 -1
- data/spec/unit/mixin/homebrew_user_spec.rb +2 -2
- data/spec/unit/mixin/params_validate_spec.rb +53 -52
- data/spec/unit/mixin/powershell_out_spec.rb +2 -2
- data/spec/unit/mixin/powershell_type_coercions_spec.rb +2 -2
- data/spec/unit/mixin/shell_out_spec.rb +1 -1
- data/spec/unit/mixin/xml_escape_spec.rb +3 -3
- data/spec/unit/node_spec.rb +2 -2
- data/spec/unit/platform/query_helpers_spec.rb +3 -3
- data/spec/unit/property_spec.rb +4 -4
- data/spec/unit/provider/cookbook_file_spec.rb +4 -4
- data/spec/unit/provider/cron/unix_spec.rb +4 -4
- data/spec/unit/provider/cron_spec.rb +2 -2
- data/spec/unit/provider/deploy_spec.rb +8 -8
- data/spec/unit/provider/dsc_resource_spec.rb +11 -10
- data/spec/unit/provider/dsc_script_spec.rb +9 -9
- data/spec/unit/provider/env/windows_spec.rb +8 -8
- data/spec/unit/provider/file/content_spec.rb +6 -6
- data/spec/unit/provider/file_spec.rb +4 -4
- data/spec/unit/provider/launchd_spec.rb +2 -1
- data/spec/unit/provider/link_spec.rb +155 -0
- data/spec/unit/provider/mount/mount_spec.rb +5 -5
- data/spec/unit/provider/mount/solaris_spec.rb +48 -48
- data/spec/unit/provider/osx_profile_spec.rb +6 -0
- data/spec/unit/provider/package/chocolatey_spec.rb +4 -4
- data/spec/unit/provider/package/freebsd/port_spec.rb +4 -4
- data/spec/unit/provider/package/rubygems_spec.rb +50 -44
- data/spec/unit/provider/package/windows/exe_spec.rb +9 -0
- data/spec/unit/provider/package/yum_spec.rb +61 -60
- data/spec/unit/provider/package_spec.rb +2 -2
- data/spec/unit/provider/powershell_script_spec.rb +4 -4
- data/spec/unit/provider/remote_directory_spec.rb +1 -1
- data/spec/unit/provider/remote_file/ftp_spec.rb +4 -4
- data/spec/unit/provider/remote_file/local_file_spec.rb +4 -2
- data/spec/unit/provider/remote_file/sftp_spec.rb +4 -4
- data/spec/unit/provider/remote_file_spec.rb +4 -4
- data/spec/unit/provider/script_spec.rb +4 -4
- data/spec/unit/provider/service/debian_service_spec.rb +4 -4
- data/spec/unit/provider/service/freebsd_service_spec.rb +12 -8
- data/spec/unit/provider/service/openbsd_service_spec.rb +12 -8
- data/spec/unit/provider/service/systemd_service_spec.rb +4 -4
- data/spec/unit/provider/service/upstart_service_spec.rb +27 -12
- data/spec/unit/provider/service/windows_spec.rb +10 -10
- data/spec/unit/provider/systemd_unit_spec.rb +2 -2
- data/spec/unit/provider/template/content_spec.rb +8 -8
- data/spec/unit/provider/template_spec.rb +8 -8
- data/spec/unit/provider/user/dscl_spec.rb +51 -51
- data/spec/unit/provider/user/linux_spec.rb +76 -0
- data/spec/unit/provider/user/pw_spec.rb +3 -6
- data/spec/unit/provider/user/solaris_spec.rb +5 -5
- data/spec/unit/provider/user/windows_spec.rb +3 -3
- data/spec/unit/provider/user_spec.rb +2 -2
- data/spec/unit/provider/yum_repository_spec.rb +35 -0
- data/spec/unit/provider_resolver_spec.rb +306 -264
- data/spec/unit/recipe_spec.rb +8 -7
- data/spec/unit/resource/apt_repository_spec.rb +4 -4
- data/spec/unit/resource/apt_update_spec.rb +4 -4
- data/spec/unit/resource/conditional_spec.rb +46 -0
- data/spec/unit/resource/dsc_resource_spec.rb +8 -8
- data/spec/unit/resource/dsc_script_spec.rb +4 -4
- data/spec/unit/resource/freebsd_package_spec.rb +6 -6
- data/spec/unit/resource/launchd_spec.rb +3 -2
- data/spec/unit/resource/osx_profile_spec.rb +3 -2
- data/spec/unit/resource/remote_file_spec.rb +6 -6
- data/spec/unit/resource/service_spec.rb +14 -14
- data/spec/unit/resource/user_spec.rb +1 -1
- data/spec/unit/resource/yum_repository_spec.rb +49 -0
- data/spec/unit/resource_collection_spec.rb +4 -4
- data/spec/unit/resource_definition_spec.rb +11 -11
- data/spec/unit/resource_reporter_spec.rb +4 -4
- data/spec/unit/resource_resolver_spec.rb +6 -6
- data/spec/unit/resource_spec.rb +36 -16
- data/spec/unit/run_context/child_run_context_spec.rb +4 -4
- data/spec/unit/run_context/cookbook_compiler_spec.rb +43 -1
- data/spec/unit/run_context_spec.rb +8 -8
- data/spec/unit/run_list/run_list_expansion_spec.rb +2 -2
- data/spec/unit/runner_spec.rb +2 -2
- data/spec/unit/search/query_spec.rb +15 -14
- data/spec/unit/user_v1_spec.rb +8 -8
- data/spec/unit/util/dsc/configuration_generator_spec.rb +12 -12
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +12 -9
- data/spec/unit/util/dsc/resource_store.rb +8 -6
- data/spec/unit/util/editor_spec.rb +6 -6
- data/spec/unit/util/powershell/cmdlet_spec.rb +10 -10
- data/tasks/bin/bundle-platform +1 -0
- data/tasks/bin/bundler_patch.rb +27 -0
- data/tasks/cbgb.rb +2 -2
- data/tasks/maintainers.rb +2 -2
- metadata +37 -8
- data/spec/unit/provider/user/useradd_spec.rb +0 -51
@@ -159,19 +159,22 @@ class Chef
|
|
159
159
|
# Find the newest gem version available from Gem.sources that satisfies
|
160
160
|
# the constraints of +gem_dependency+
|
161
161
|
def find_newest_remote_version(gem_dependency, *sources)
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
162
|
+
spec, source =
|
163
|
+
if Chef::Config[:rubygems_cache_enabled]
|
164
|
+
# This code caches every gem on rubygems.org and uses lots of RAM
|
165
|
+
available_gems = dependency_installer.find_gems_with_sources(gem_dependency)
|
166
|
+
available_gems.pick_best!
|
167
|
+
best_gem = available_gems.set.first
|
168
|
+
best_gem && [best_gem.spec, best_gem.source]
|
169
|
+
else
|
170
|
+
# Use the API that 'gem install' calls which does not pull down the rubygems universe
|
171
|
+
begin
|
172
|
+
rs = dependency_installer.resolve_dependencies gem_dependency.name, gem_dependency.requirement
|
173
|
+
rs.specs.select { |s| s.name == gem_dependency.name }.first
|
174
|
+
rescue Gem::UnsatisfiableDependencyError
|
175
|
+
nil
|
176
|
+
end
|
177
|
+
end
|
175
178
|
|
176
179
|
version = spec && spec.version
|
177
180
|
if version
|
@@ -519,9 +522,7 @@ class Chef
|
|
519
522
|
install_via_gem_command(name, version)
|
520
523
|
end
|
521
524
|
elsif @new_resource.gem_binary.nil?
|
522
|
-
|
523
|
-
# domain can be :local, :remote or :both
|
524
|
-
@gem_env.install(@new_resource.source, domain: :local)
|
525
|
+
@gem_env.install(@new_resource.source)
|
525
526
|
else
|
526
527
|
install_via_gem_command(name, version)
|
527
528
|
end
|
@@ -201,6 +201,7 @@ class Chef
|
|
201
201
|
def resource_for_provider
|
202
202
|
@resource_for_provider = Chef::Resource::WindowsPackage.new(new_resource.name).tap do |r|
|
203
203
|
r.source(Chef::Util::PathHelper.validate_path(source_location)) unless source_location.nil?
|
204
|
+
r.cookbook_name = new_resource.cookbook_name
|
204
205
|
r.version(new_resource.version)
|
205
206
|
r.timeout(new_resource.timeout)
|
206
207
|
r.returns(new_resource.returns)
|
@@ -216,6 +217,7 @@ class Chef
|
|
216
217
|
def source_resource
|
217
218
|
@source_resource ||= Chef::Resource::RemoteFile.new(default_download_cache_path, run_context).tap do |r|
|
218
219
|
r.source(new_resource.source)
|
220
|
+
r.cookbook_name = new_resource.cookbook_name
|
219
221
|
r.checksum(new_resource.checksum)
|
220
222
|
r.backup(false)
|
221
223
|
|
@@ -71,7 +71,7 @@ class Chef
|
|
71
71
|
uninstall_entries.select { |entry| [uninstall_version].flatten.include?(entry.display_version) }
|
72
72
|
.map { |version| version.uninstall_string }.uniq.each do |uninstall_string|
|
73
73
|
Chef::Log.debug("Registry provided uninstall string for #{new_resource} is '#{uninstall_string}'")
|
74
|
-
shell_out!(uninstall_command(uninstall_string), {
|
74
|
+
shell_out!(uninstall_command(uninstall_string), { :timeout => new_resource.timeout, :returns => new_resource.returns })
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -243,16 +243,16 @@ class Chef
|
|
243
243
|
self.new(*args)
|
244
244
|
end
|
245
245
|
|
246
|
-
def <=>(
|
247
|
-
compare_versions(
|
246
|
+
def <=>(other)
|
247
|
+
compare_versions(other)
|
248
248
|
end
|
249
249
|
|
250
|
-
def compare(
|
251
|
-
compare_versions(
|
250
|
+
def compare(other)
|
251
|
+
compare_versions(other, false)
|
252
252
|
end
|
253
253
|
|
254
|
-
def partial_compare(
|
255
|
-
compare_versions(
|
254
|
+
def partial_compare(other)
|
255
|
+
compare_versions(other, true)
|
256
256
|
end
|
257
257
|
|
258
258
|
# RPM::Version rpm_version_to_s equivalent
|
@@ -352,8 +352,8 @@ class Chef
|
|
352
352
|
alias :name :n
|
353
353
|
alias :arch :a
|
354
354
|
|
355
|
-
def <=>(
|
356
|
-
compare(
|
355
|
+
def <=>(other)
|
356
|
+
compare(other)
|
357
357
|
end
|
358
358
|
|
359
359
|
def compare(y)
|
@@ -153,9 +153,9 @@ class Chef
|
|
153
153
|
def parse_path
|
154
154
|
path = uri.path.sub(%r{\A/}, "%2F") # re-encode the beginning slash because uri library decodes it.
|
155
155
|
directories = path.split(%r{/}, -1)
|
156
|
-
directories.each
|
156
|
+
directories.each do |d|
|
157
157
|
d.gsub!(/%([0-9A-Fa-f][0-9A-Fa-f])/) { [$1].pack("H2") }
|
158
|
-
|
158
|
+
end
|
159
159
|
unless filename = directories.pop
|
160
160
|
raise ArgumentError, "no filename: #{path.inspect}"
|
161
161
|
end
|
@@ -68,9 +68,9 @@ class Chef
|
|
68
68
|
def validate_path!
|
69
69
|
path = uri.path.sub(%r{\A/}, "%2F") # re-encode the beginning slash because uri library decodes it.
|
70
70
|
directories = path.split(%r{/}, -1)
|
71
|
-
directories.each
|
71
|
+
directories.each do |d|
|
72
72
|
d.gsub!(/%([0-9A-Fa-f][0-9A-Fa-f])/) { [$1].pack("H2") }
|
73
|
-
|
73
|
+
end
|
74
74
|
unless filename = directories.pop
|
75
75
|
raise ArgumentError, "no filename: #{path.inspect}"
|
76
76
|
end
|
@@ -106,13 +106,13 @@ class Chef
|
|
106
106
|
|
107
107
|
def service_currently_enabled?(priority)
|
108
108
|
enabled = false
|
109
|
-
priority.each
|
109
|
+
priority.each do |runlevel, arguments|
|
110
110
|
Chef::Log.debug("#{new_resource} runlevel #{runlevel}, action #{arguments[0]}, priority #{arguments[1]}")
|
111
111
|
# if we are in a update-rc.d default startup runlevel && we start in this runlevel
|
112
112
|
if %w{ 1 2 3 4 5 S }.include?(runlevel) && arguments[0] == :start
|
113
113
|
enabled = true
|
114
114
|
end
|
115
|
-
|
115
|
+
end
|
116
116
|
|
117
117
|
enabled
|
118
118
|
end
|
@@ -76,8 +76,9 @@ class Chef
|
|
76
76
|
end
|
77
77
|
|
78
78
|
requirements.assert(:all_actions) do |a|
|
79
|
-
a.assertion
|
80
|
-
|
79
|
+
a.assertion do
|
80
|
+
@new_resource.status_command || supports[:status] ||
|
81
|
+
(!ps_cmd.nil? && !ps_cmd.empty?) end
|
81
82
|
a.failure_message Chef::Exceptions::Service, "#{@new_resource} could not determine how to inspect the process table, please set this node's 'command.ps' attribute"
|
82
83
|
end
|
83
84
|
requirements.assert(:all_actions) do |a|
|
@@ -108,7 +109,7 @@ class Chef
|
|
108
109
|
shell_out_with_systems_locale!(@new_resource.reload_command)
|
109
110
|
end
|
110
111
|
|
111
|
-
|
112
|
+
protected
|
112
113
|
|
113
114
|
def determine_current_status!
|
114
115
|
if @new_resource.status_command
|
@@ -40,7 +40,7 @@ class Chef
|
|
40
40
|
@current_resource.service_name(@new_resource.service_name)
|
41
41
|
|
42
42
|
[@init_command, @status_command].each do |cmd|
|
43
|
-
unless ::File.executable? cmd
|
43
|
+
unless ::File.executable? cmd
|
44
44
|
raise Chef::Exceptions::Service, "#{cmd} not executable!"
|
45
45
|
end
|
46
46
|
end
|
@@ -78,10 +78,10 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
|
|
78
78
|
if new_resource.user
|
79
79
|
uid = node["etc"]["passwd"][new_resource.user]["uid"]
|
80
80
|
options = {
|
81
|
-
|
81
|
+
:environment => {
|
82
82
|
"DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/#{uid}/bus",
|
83
83
|
},
|
84
|
-
|
84
|
+
:user => new_resource.user,
|
85
85
|
}
|
86
86
|
args = "--user"
|
87
87
|
else
|
@@ -80,8 +80,11 @@ class Chef
|
|
80
80
|
shared_resource_requirements
|
81
81
|
requirements.assert(:all_actions) do |a|
|
82
82
|
if !@command_success
|
83
|
-
whyrun_msg =
|
84
|
-
|
83
|
+
whyrun_msg = if @new_resource.status_command
|
84
|
+
"Provided status command #{@new_resource.status_command} failed."
|
85
|
+
else
|
86
|
+
"Could not determine upstart state for service"
|
87
|
+
end
|
85
88
|
end
|
86
89
|
a.assertion { @command_success }
|
87
90
|
# no failure here, just document the assumptions made.
|
@@ -116,7 +119,7 @@ class Chef
|
|
116
119
|
end
|
117
120
|
else
|
118
121
|
begin
|
119
|
-
if
|
122
|
+
if upstart_goal_state == "start"
|
120
123
|
@current_resource.running true
|
121
124
|
else
|
122
125
|
@current_resource.running false
|
@@ -220,7 +223,7 @@ class Chef
|
|
220
223
|
conf.write_file
|
221
224
|
end
|
222
225
|
|
223
|
-
def
|
226
|
+
def upstart_goal_state
|
224
227
|
command = "/sbin/status #{@job}"
|
225
228
|
status = popen4(command) do |pid, stdin, stdout, stderr|
|
226
229
|
stdout.each_line do |line|
|
@@ -231,7 +234,7 @@ class Chef
|
|
231
234
|
# service (goal) state
|
232
235
|
line =~ UPSTART_STATE_FORMAT
|
233
236
|
data = Regexp.last_match
|
234
|
-
return data[
|
237
|
+
return data[1]
|
235
238
|
end
|
236
239
|
end
|
237
240
|
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# This file was generated by Chef
|
2
|
+
# Do NOT modify this file by hand.
|
3
|
+
|
4
|
+
[<%= @config.repositoryid %>]
|
5
|
+
name=<%= @config.description %>
|
6
|
+
<% if @config.baseurl %>
|
7
|
+
baseurl=<%= @config.baseurl %>
|
8
|
+
<% end %>
|
9
|
+
<% if @config.cost %>
|
10
|
+
cost=<%= @config.cost %>
|
11
|
+
<% end %>
|
12
|
+
<% if @config.enabled %>
|
13
|
+
enabled=1
|
14
|
+
<% else %>
|
15
|
+
enabled=0
|
16
|
+
<% end %>
|
17
|
+
<% if @config.enablegroups %>
|
18
|
+
enablegroups=1
|
19
|
+
<% end %>
|
20
|
+
<% if @config.exclude %>
|
21
|
+
exclude=<%= @config.exclude %>
|
22
|
+
<% end %>
|
23
|
+
<% if @config.failovermethod %>
|
24
|
+
failovermethod=<%= @config.failovermethod %>
|
25
|
+
<% end %>
|
26
|
+
<% if @config.fastestmirror_enabled %>
|
27
|
+
fastestmirror_enabled=<%= @config.fastestmirror_enabled %>
|
28
|
+
<% end %>
|
29
|
+
<% if @config.gpgcheck %>
|
30
|
+
gpgcheck=1
|
31
|
+
<% else %>
|
32
|
+
gpgcheck=0
|
33
|
+
<% end %>
|
34
|
+
<% if @config.gpgkey %>
|
35
|
+
gpgkey=<%= case @config.gpgkey
|
36
|
+
when Array
|
37
|
+
@config.gpgkey.join("\n ")
|
38
|
+
else
|
39
|
+
@config.gpgkey
|
40
|
+
end %>
|
41
|
+
<% end -%>
|
42
|
+
<% if @config.http_caching %>
|
43
|
+
http_caching=<%= @config.http_caching %>
|
44
|
+
<% end %>
|
45
|
+
<% if @config.include_config %>
|
46
|
+
include=<%= @config.include_config %>
|
47
|
+
<% end %>
|
48
|
+
<% if @config.includepkgs %>
|
49
|
+
includepkgs=<%= @config.includepkgs %>
|
50
|
+
<% end %>
|
51
|
+
<% if @config.keepalive %>
|
52
|
+
keepalive=1
|
53
|
+
<% end %>
|
54
|
+
<% if @config.metadata_expire %>
|
55
|
+
metadata_expire=<%= @config.metadata_expire %>
|
56
|
+
<% end %>
|
57
|
+
<% if @config.mirrorlist %>
|
58
|
+
mirrorlist=<%= @config.mirrorlist %>
|
59
|
+
<% end %>
|
60
|
+
<% if @config.mirror_expire %>
|
61
|
+
mirror_expire=<%= @config.mirror_expire %>
|
62
|
+
<% end %>
|
63
|
+
<% if @config.mirrorlist_expire %>
|
64
|
+
mirrorlist_expire=<%= @config.mirrorlist_expire %>
|
65
|
+
<% end %>
|
66
|
+
<% if @config.priority %>
|
67
|
+
priority=<%= @config.priority %>
|
68
|
+
<% end %>
|
69
|
+
<% if @config.proxy %>
|
70
|
+
proxy=<%= @config.proxy %>
|
71
|
+
<% end %>
|
72
|
+
<% if @config.proxy_username %>
|
73
|
+
proxy_username=<%= @config.proxy_username %>
|
74
|
+
<% end %>
|
75
|
+
<% if @config.proxy_password %>
|
76
|
+
proxy_password=<%= @config.proxy_password %>
|
77
|
+
<% end %>
|
78
|
+
<% if @config.username %>
|
79
|
+
username=<%= @config.username %>
|
80
|
+
<% end %>
|
81
|
+
<% if @config.password %>
|
82
|
+
password=<%= @config.password %>
|
83
|
+
<% end %>
|
84
|
+
<% if @config.repo_gpgcheck %>
|
85
|
+
repo_gpgcheck=1
|
86
|
+
<% end %>
|
87
|
+
<% if @config.max_retries %>
|
88
|
+
retries=<%= @config.max_retries %>
|
89
|
+
<% end %>
|
90
|
+
<% if @config.report_instanceid %>
|
91
|
+
report_instanceid=<%= @config.report_instanceid %>
|
92
|
+
<% end %>
|
93
|
+
<% if @config.skip_if_unavailable %>
|
94
|
+
skip_if_unavailable=1
|
95
|
+
<% end %>
|
96
|
+
<% if @config.sslcacert %>
|
97
|
+
sslcacert=<%= @config.sslcacert %>
|
98
|
+
<% end %>
|
99
|
+
<% if @config.sslclientcert %>
|
100
|
+
sslclientcert=<%= @config.sslclientcert %>
|
101
|
+
<% end %>
|
102
|
+
<% if @config.sslclientkey %>
|
103
|
+
sslclientkey=<%= @config.sslclientkey %>
|
104
|
+
<% end %>
|
105
|
+
<% unless @config.sslverify.nil? %>
|
106
|
+
sslverify=<%= ( @config.sslverify ) ? 'true' : 'false' %>
|
107
|
+
<% end %>
|
108
|
+
<% if @config.timeout %>
|
109
|
+
timeout=<%= @config.timeout %>
|
110
|
+
<% end %>
|
111
|
+
<% if @config.options -%>
|
112
|
+
<% @config.options.each do |key, value| -%>
|
113
|
+
<%= key %>=<%=
|
114
|
+
case value
|
115
|
+
when Array
|
116
|
+
value.join("\n ")
|
117
|
+
when TrueClass
|
118
|
+
'1'
|
119
|
+
when FalseClass
|
120
|
+
'0'
|
121
|
+
else
|
122
|
+
value
|
123
|
+
end %>
|
124
|
+
<% end -%>
|
125
|
+
<% end -%>
|
@@ -193,6 +193,7 @@ class Chef
|
|
193
193
|
f.group "root"
|
194
194
|
f.mode "0644"
|
195
195
|
f.content new_resource.to_ini
|
196
|
+
f.verify systemd_analyze_cmd if systemd_analyze_path
|
196
197
|
end.run_action(action)
|
197
198
|
end
|
198
199
|
|
@@ -224,8 +225,8 @@ class Chef
|
|
224
225
|
@systemctl_opts ||=
|
225
226
|
if new_resource.user
|
226
227
|
{
|
227
|
-
|
228
|
-
|
228
|
+
:user => new_resource.user,
|
229
|
+
:environment => {
|
229
230
|
"DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/#{node['etc']['passwd'][new_resource.user]['uid']}/bus",
|
230
231
|
},
|
231
232
|
}
|
@@ -233,6 +234,14 @@ class Chef
|
|
233
234
|
{}
|
234
235
|
end
|
235
236
|
end
|
237
|
+
|
238
|
+
def systemd_analyze_cmd
|
239
|
+
@systemd_analyze_cmd ||= "#{systemd_analyze_path} verify %{path}"
|
240
|
+
end
|
241
|
+
|
242
|
+
def systemd_analyze_path
|
243
|
+
@systemd_analyze_path ||= which("systemd-analyze")
|
244
|
+
end
|
236
245
|
end
|
237
246
|
end
|
238
247
|
end
|
data/lib/chef/provider/user.rb
CHANGED
@@ -147,10 +147,6 @@ class Chef
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
-
def remove_user
|
151
|
-
raise NotImplementedError
|
152
|
-
end
|
153
|
-
|
154
150
|
def action_manage
|
155
151
|
if @user_exists && compare_user
|
156
152
|
converge_by("manage user #{@new_resource.username}") do
|
@@ -160,10 +156,6 @@ class Chef
|
|
160
156
|
end
|
161
157
|
end
|
162
158
|
|
163
|
-
def manage_user
|
164
|
-
raise NotImplementedError
|
165
|
-
end
|
166
|
-
|
167
159
|
def action_modify
|
168
160
|
if compare_user
|
169
161
|
converge_by("modify user #{@new_resource.username}") do
|
@@ -184,14 +176,6 @@ class Chef
|
|
184
176
|
end
|
185
177
|
end
|
186
178
|
|
187
|
-
def check_lock
|
188
|
-
raise NotImplementedError
|
189
|
-
end
|
190
|
-
|
191
|
-
def lock_user
|
192
|
-
raise NotImplementedError
|
193
|
-
end
|
194
|
-
|
195
179
|
def action_unlock
|
196
180
|
if check_lock() == true
|
197
181
|
converge_by("unlock user #{@new_resource.username}") do
|
@@ -203,9 +187,29 @@ class Chef
|
|
203
187
|
end
|
204
188
|
end
|
205
189
|
|
190
|
+
def create_user
|
191
|
+
raise NotImplementedError
|
192
|
+
end
|
193
|
+
|
194
|
+
def remove_user
|
195
|
+
raise NotImplementedError
|
196
|
+
end
|
197
|
+
|
198
|
+
def manage_user
|
199
|
+
raise NotImplementedError
|
200
|
+
end
|
201
|
+
|
202
|
+
def lock_user
|
203
|
+
raise NotImplementedError
|
204
|
+
end
|
205
|
+
|
206
206
|
def unlock_user
|
207
207
|
raise NotImplementedError
|
208
208
|
end
|
209
|
+
|
210
|
+
def check_lock
|
211
|
+
raise NotImplementedError
|
212
|
+
end
|
209
213
|
end
|
210
214
|
end
|
211
215
|
end
|