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
@@ -62,14 +62,14 @@ module ResourceActionSpec
|
|
62
62
|
end
|
63
63
|
|
64
64
|
it "the action cannot access private methods" do
|
65
|
-
expect
|
65
|
+
expect do
|
66
66
|
converge(<<-EOM, __FILE__, __LINE__ + 1)
|
67
67
|
#{resource_dsl} "hi" do
|
68
68
|
foo "foo!"
|
69
69
|
action :access_private_method
|
70
70
|
end
|
71
71
|
EOM
|
72
|
-
|
72
|
+
end.to raise_error(NameError)
|
73
73
|
expect(ActionJackson.ran_action).to eq :access_private_method
|
74
74
|
end
|
75
75
|
|
@@ -139,26 +139,6 @@ module ResourceActionSpec
|
|
139
139
|
attr_accessor :ruby_block_converged
|
140
140
|
end
|
141
141
|
|
142
|
-
public
|
143
|
-
|
144
|
-
def foo_public
|
145
|
-
"foo_public!"
|
146
|
-
end
|
147
|
-
|
148
|
-
protected
|
149
|
-
|
150
|
-
def foo_protected
|
151
|
-
"foo_protected!"
|
152
|
-
end
|
153
|
-
|
154
|
-
private
|
155
|
-
|
156
|
-
def foo_private
|
157
|
-
"foo_private!"
|
158
|
-
end
|
159
|
-
|
160
|
-
public
|
161
|
-
|
162
142
|
action :access_recipe_dsl do
|
163
143
|
ActionJackson.ran_action = :access_recipe_dsl
|
164
144
|
ruby_block "hi there" do
|
@@ -199,13 +179,29 @@ module ResourceActionSpec
|
|
199
179
|
ActionJackson.ran_action = :access_class_method
|
200
180
|
ActionJackson.succeeded = ActionJackson.ruby_block_converged
|
201
181
|
end
|
182
|
+
|
183
|
+
def foo_public
|
184
|
+
"foo_public!"
|
185
|
+
end
|
186
|
+
|
187
|
+
protected
|
188
|
+
|
189
|
+
def foo_protected
|
190
|
+
"foo_protected!"
|
191
|
+
end
|
192
|
+
|
193
|
+
private
|
194
|
+
|
195
|
+
def foo_private
|
196
|
+
"foo_private!"
|
197
|
+
end
|
202
198
|
end
|
203
199
|
|
204
|
-
before(:each)
|
200
|
+
before(:each) do
|
205
201
|
ActionJackson.ran_action = :error
|
206
202
|
ActionJackson.succeeded = :error
|
207
203
|
ActionJackson.ruby_block_converged = :error
|
208
|
-
|
204
|
+
end
|
209
205
|
|
210
206
|
it_behaves_like "ActionJackson" do
|
211
207
|
let(:resource_dsl) { :action_jackson }
|
@@ -217,11 +213,11 @@ module ResourceActionSpec
|
|
217
213
|
end
|
218
214
|
|
219
215
|
context "And 'action_jackgrandson' inheriting from ActionJackson and changing nothing" do
|
220
|
-
before(:context)
|
216
|
+
before(:context) do
|
221
217
|
class ActionJackgrandson < ActionJackson
|
222
218
|
use_automatic_resource_name
|
223
219
|
end
|
224
|
-
|
220
|
+
end
|
225
221
|
|
226
222
|
it_behaves_like "ActionJackson" do
|
227
223
|
let(:resource_dsl) { :action_jackgrandson }
|
@@ -267,38 +263,38 @@ module ResourceActionSpec
|
|
267
263
|
end
|
268
264
|
|
269
265
|
it "the default action remains the same even though new actions were specified first" do
|
270
|
-
converge
|
266
|
+
converge do
|
271
267
|
action_jackalope "hi" do
|
272
268
|
foo "foo!"
|
273
269
|
bar "bar!"
|
274
270
|
end
|
275
|
-
|
271
|
+
end
|
276
272
|
expect(ActionJackson.ran_action).to eq :access_recipe_dsl
|
277
273
|
expect(ActionJackson.succeeded).to eq true
|
278
274
|
end
|
279
275
|
|
280
276
|
it "new actions run, and can access overridden, new, and overridden attributes" do
|
281
|
-
converge
|
277
|
+
converge do
|
282
278
|
action_jackalope "hi" do
|
283
279
|
foo "foo!"
|
284
280
|
bar "bar!"
|
285
281
|
blarghle "blarghle!"
|
286
282
|
action :access_jackalope
|
287
283
|
end
|
288
|
-
|
284
|
+
end
|
289
285
|
expect(ActionJackalope.jackalope_ran).to eq :access_jackalope
|
290
286
|
expect(ActionJackalope.succeeded).to eq "foo!alope blarghle! bar!alope"
|
291
287
|
end
|
292
288
|
|
293
289
|
it "overridden actions run, call super, and can access overridden, new, and overridden attributes" do
|
294
|
-
converge
|
290
|
+
converge do
|
295
291
|
action_jackalope "hi" do
|
296
292
|
foo "foo!"
|
297
293
|
bar "bar!"
|
298
294
|
blarghle "blarghle!"
|
299
295
|
action :access_attribute
|
300
296
|
end
|
301
|
-
|
297
|
+
end
|
302
298
|
expect(ActionJackson.ran_action).to eq :access_attribute
|
303
299
|
expect(ActionJackson.succeeded).to eq "foo!alope blarghle! bar!alope"
|
304
300
|
expect(ActionJackalope.jackalope_ran).to eq :access_attribute
|
@@ -306,14 +302,14 @@ module ResourceActionSpec
|
|
306
302
|
end
|
307
303
|
|
308
304
|
it "non-overridden actions run and can access overridden and non-overridden variables (but not necessarily new ones)" do
|
309
|
-
converge
|
305
|
+
converge do
|
310
306
|
action_jackalope "hi" do
|
311
307
|
foo "foo!"
|
312
308
|
bar "bar!"
|
313
309
|
blarghle "blarghle!"
|
314
310
|
action :access_attribute2
|
315
311
|
end
|
316
|
-
|
312
|
+
end
|
317
313
|
expect(ActionJackson.ran_action).to eq :access_attribute2
|
318
314
|
expect(ActionJackson.succeeded).to eq("foo!alope blarghle! bar!alope").or(eq("foo!alope blarghle!"))
|
319
315
|
end
|
@@ -335,12 +331,12 @@ module ResourceActionSpec
|
|
335
331
|
end
|
336
332
|
|
337
333
|
it "the default action is :nothing" do
|
338
|
-
converge
|
334
|
+
converge do
|
339
335
|
no_action_jackson "hi" do
|
340
336
|
foo "foo!"
|
341
337
|
NoActionJackson.action_was = action
|
342
338
|
end
|
343
|
-
|
339
|
+
end
|
344
340
|
expect(NoActionJackson.action_was).to eq [:nothing]
|
345
341
|
end
|
346
342
|
end
|
@@ -359,9 +355,9 @@ module ResourceActionSpec
|
|
359
355
|
end
|
360
356
|
|
361
357
|
it "Running the action works" do
|
362
|
-
expect_recipe
|
358
|
+
expect_recipe do
|
363
359
|
weird_action_jackson "hi"
|
364
|
-
|
360
|
+
end.to be_up_to_date
|
365
361
|
expect(WeirdActionJackson.action_was).to eq :"a-b-c d"
|
366
362
|
end
|
367
363
|
end
|
@@ -404,41 +400,41 @@ module ResourceActionSpec
|
|
404
400
|
attr_reader :x_warning_line
|
405
401
|
|
406
402
|
it "Using the enclosing resource to set x to x emits a warning that you're using the wrong x" do
|
407
|
-
recipe = converge
|
403
|
+
recipe = converge do
|
408
404
|
resource_action_spec_also_with_x "hi" do
|
409
405
|
x 1
|
410
406
|
action :set_x_to_x
|
411
407
|
end
|
412
|
-
|
408
|
+
end
|
413
409
|
warnings = recipe.logs.lines.select { |l| l =~ /warn/i }
|
414
410
|
expect(warnings.size).to eq 1
|
415
411
|
expect(warnings[0]).to match(/property x is declared in both resource_action_spec_with_x\[hi\] and resource_action_spec_also_with_x\[hi\] action :set_x_to_x. Use new_resource.x instead. At #{__FILE__}:#{ResourceActionSpecAlsoWithX.x_warning_line}/)
|
416
412
|
end
|
417
413
|
|
418
414
|
it "Using the enclosing resource to set x to x outside the initializer emits no warning" do
|
419
|
-
expect_recipe
|
415
|
+
expect_recipe do
|
420
416
|
resource_action_spec_also_with_x "hi" do
|
421
417
|
x 1
|
422
418
|
action :set_x_to_x_in_non_initializer
|
423
419
|
end
|
424
|
-
|
420
|
+
end.to emit_no_warnings_or_errors
|
425
421
|
end
|
426
422
|
|
427
423
|
it "Using the enclosing resource to set x to 10 emits no warning" do
|
428
|
-
expect_recipe
|
424
|
+
expect_recipe do
|
429
425
|
resource_action_spec_also_with_x "hi" do
|
430
426
|
x 1
|
431
427
|
action :set_x_to_10
|
432
428
|
end
|
433
|
-
|
429
|
+
end.to emit_no_warnings_or_errors
|
434
430
|
end
|
435
431
|
|
436
432
|
it "Using the enclosing resource to set x to 10 emits no warning" do
|
437
|
-
expect_recipe
|
433
|
+
expect_recipe do
|
438
434
|
r = resource_action_spec_also_with_x "hi"
|
439
435
|
r.x 1
|
440
436
|
r.action :set_x_to_10
|
441
|
-
|
437
|
+
end.to emit_no_warnings_or_errors
|
442
438
|
end
|
443
439
|
end
|
444
440
|
|
@@ -464,11 +460,11 @@ module ResourceActionSpec
|
|
464
460
|
end
|
465
461
|
|
466
462
|
it "Setting group to nil in an action does not emit a warning about it being defined in two places" do
|
467
|
-
expect_recipe
|
463
|
+
expect_recipe do
|
468
464
|
resource_action_spec_set_group_to_nil "hi" do
|
469
465
|
action :set_group_to_nil
|
470
466
|
end
|
471
|
-
|
467
|
+
end.to emit_no_warnings_or_errors
|
472
468
|
end
|
473
469
|
end
|
474
470
|
|
@@ -484,9 +480,9 @@ module ResourceActionSpec
|
|
484
480
|
end
|
485
481
|
|
486
482
|
it "Raises an error when attempting to use a template in the action" do
|
487
|
-
expect_converge
|
483
|
+
expect_converge do
|
488
484
|
has_property_named_template "hi"
|
489
|
-
|
485
|
+
end.to raise_error(/Property template of has_property_named_template\[hi\] cannot be passed a block! If you meant to create a resource named template instead, you'll need to first rename the property./)
|
490
486
|
end
|
491
487
|
end
|
492
488
|
|
@@ -528,9 +524,9 @@ module ResourceActionSpec
|
|
528
524
|
|
529
525
|
it "the methods are available to the action" do
|
530
526
|
r = nil
|
531
|
-
expect_recipe
|
527
|
+
expect_recipe do
|
532
528
|
r = declares_action_class_methods "hi"
|
533
|
-
|
529
|
+
end.to emit_no_warnings_or_errors
|
534
530
|
expect(r.x).to eq(10)
|
535
531
|
end
|
536
532
|
|
@@ -557,9 +553,9 @@ module ResourceActionSpec
|
|
557
553
|
|
558
554
|
it "the methods are available to the action" do
|
559
555
|
r = nil
|
560
|
-
expect_recipe
|
556
|
+
expect_recipe do
|
561
557
|
r = declares_action_class_methods_too "hi"
|
562
|
-
|
558
|
+
end.to emit_no_warnings_or_errors
|
563
559
|
expect(r.x).to eq(15)
|
564
560
|
end
|
565
561
|
end
|
@@ -19,7 +19,7 @@ describe "Resource::ActionClass#converge_if_changed" do
|
|
19
19
|
|
20
20
|
context "when the resource has identity, state and control properties" do
|
21
21
|
let(:resource_name) { :"converge_if_changed_dsl#{Namer.current_index}" }
|
22
|
-
let(:resource_class)
|
22
|
+
let(:resource_class) do
|
23
23
|
result = Class.new(Chef::Resource) do
|
24
24
|
def self.to_s; resource_name.to_s; end
|
25
25
|
|
@@ -36,7 +36,7 @@ describe "Resource::ActionClass#converge_if_changed" do
|
|
36
36
|
end
|
37
37
|
result.resource_name resource_name
|
38
38
|
result
|
39
|
-
|
39
|
+
end
|
40
40
|
let(:converged_recipe) { converge(converge_recipe) }
|
41
41
|
let(:resource) { converged_recipe.resources.first }
|
42
42
|
|
@@ -70,13 +70,13 @@ describe "Resource::ActionClass#converge_if_changed" do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
context "and state1 is set to a new value" do
|
73
|
-
let(:converge_recipe)
|
73
|
+
let(:converge_recipe) do
|
74
74
|
<<-EOM
|
75
75
|
#{resource_name} 'blah' do
|
76
76
|
state1 'new_state1'
|
77
77
|
end
|
78
78
|
EOM
|
79
|
-
|
79
|
+
end
|
80
80
|
|
81
81
|
it "the resource updates state1" do
|
82
82
|
expect(resource.converged).to eq 1
|
@@ -90,14 +90,14 @@ describe "Resource::ActionClass#converge_if_changed" do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
context "and state1 and state2 are set to new values" do
|
93
|
-
let(:converge_recipe)
|
93
|
+
let(:converge_recipe) do
|
94
94
|
<<-EOM
|
95
95
|
#{resource_name} 'blah' do
|
96
96
|
state1 'new_state1'
|
97
97
|
state2 'new_state2'
|
98
98
|
end
|
99
99
|
EOM
|
100
|
-
|
100
|
+
end
|
101
101
|
|
102
102
|
it "the resource updates state1 and state2" do
|
103
103
|
expect(resource.converged).to eq 1
|
@@ -112,7 +112,7 @@ EOM
|
|
112
112
|
end
|
113
113
|
|
114
114
|
context "and state1 and state2 are set to new sensitive values" do
|
115
|
-
let(:converge_recipe)
|
115
|
+
let(:converge_recipe) do
|
116
116
|
<<-EOM
|
117
117
|
#{resource_name} 'blah' do
|
118
118
|
sensitive true
|
@@ -120,7 +120,7 @@ EOM
|
|
120
120
|
state2 'new_state2'
|
121
121
|
end
|
122
122
|
EOM
|
123
|
-
|
123
|
+
end
|
124
124
|
|
125
125
|
it "the resource updates state1 and state2" do
|
126
126
|
expect(resource.converged).to eq 1
|
@@ -135,14 +135,14 @@ EOM
|
|
135
135
|
end
|
136
136
|
|
137
137
|
context "and state1 is set to its current value but state2 is set to a new value" do
|
138
|
-
let(:converge_recipe)
|
138
|
+
let(:converge_recipe) do
|
139
139
|
<<-EOM
|
140
140
|
#{resource_name} 'blah' do
|
141
141
|
state1 'current_state1'
|
142
142
|
state2 'new_state2'
|
143
143
|
end
|
144
144
|
EOM
|
145
|
-
|
145
|
+
end
|
146
146
|
|
147
147
|
it "the resource updates state2" do
|
148
148
|
expect(resource.converged).to eq 1
|
@@ -156,14 +156,14 @@ EOM
|
|
156
156
|
end
|
157
157
|
|
158
158
|
context "and state1 and state2 are set to their current values" do
|
159
|
-
let(:converge_recipe)
|
159
|
+
let(:converge_recipe) do
|
160
160
|
<<-EOM
|
161
161
|
#{resource_name} 'blah' do
|
162
162
|
state1 'current_state1'
|
163
163
|
state2 'current_state2'
|
164
164
|
end
|
165
165
|
EOM
|
166
|
-
|
166
|
+
end
|
167
167
|
|
168
168
|
it "the resource updates nothing" do
|
169
169
|
expect(resource.converged).to eq 0
|
@@ -175,14 +175,14 @@ EOM
|
|
175
175
|
end
|
176
176
|
|
177
177
|
context "and identity1 and control1 are set to new values" do
|
178
|
-
let(:converge_recipe)
|
178
|
+
let(:converge_recipe) do
|
179
179
|
<<-EOM
|
180
180
|
#{resource_name} 'blah' do
|
181
181
|
identity1 'new_identity1'
|
182
182
|
control1 'new_control1'
|
183
183
|
end
|
184
184
|
EOM
|
185
|
-
|
185
|
+
end
|
186
186
|
|
187
187
|
# Because the identity value is copied over to the new resource, by
|
188
188
|
# default they do not register as "changed"
|
@@ -205,14 +205,14 @@ EOM
|
|
205
205
|
end
|
206
206
|
|
207
207
|
context "and identity1 and control1 are set to new values" do
|
208
|
-
let(:converge_recipe)
|
208
|
+
let(:converge_recipe) do
|
209
209
|
<<-EOM
|
210
210
|
#{resource_name} 'blah' do
|
211
211
|
identity1 'new_identity1'
|
212
212
|
control1 'new_control1'
|
213
213
|
end
|
214
214
|
EOM
|
215
|
-
|
215
|
+
end
|
216
216
|
|
217
217
|
# Control values are not desired state and are therefore not considered
|
218
218
|
# a reason for converging.
|
@@ -252,14 +252,14 @@ EOM
|
|
252
252
|
end
|
253
253
|
|
254
254
|
context "and state1 and state2 are set" do
|
255
|
-
let(:converge_recipe)
|
255
|
+
let(:converge_recipe) do
|
256
256
|
<<-EOM
|
257
257
|
#{resource_name} 'blah' do
|
258
258
|
state1 'new_state1'
|
259
259
|
state2 'new_state2'
|
260
260
|
end
|
261
261
|
EOM
|
262
|
-
|
262
|
+
end
|
263
263
|
|
264
264
|
it "the resource is created" do
|
265
265
|
expect(resource.converged).to eq 1
|
@@ -275,7 +275,7 @@ EOM
|
|
275
275
|
end
|
276
276
|
|
277
277
|
context "and state1 and state2 are set with sensitive property" do
|
278
|
-
let(:converge_recipe)
|
278
|
+
let(:converge_recipe) do
|
279
279
|
<<-EOM
|
280
280
|
#{resource_name} 'blah' do
|
281
281
|
sensitive true
|
@@ -283,7 +283,7 @@ EOM
|
|
283
283
|
state2 'new_state2'
|
284
284
|
end
|
285
285
|
EOM
|
286
|
-
|
286
|
+
end
|
287
287
|
|
288
288
|
it "the resource is created" do
|
289
289
|
expect(resource.converged).to eq 1
|
@@ -334,13 +334,13 @@ EOM
|
|
334
334
|
|
335
335
|
context "and state1 is set to a new value" do
|
336
336
|
|
337
|
-
let(:converge_recipe)
|
337
|
+
let(:converge_recipe) do
|
338
338
|
<<-EOM
|
339
339
|
#{resource_name} 'blah' do
|
340
340
|
state1 'new_state1'
|
341
341
|
end
|
342
342
|
EOM
|
343
|
-
|
343
|
+
end
|
344
344
|
|
345
345
|
it "the resource updates state1" do
|
346
346
|
expect(resource.converged).to eq 1
|
@@ -354,14 +354,14 @@ EOM
|
|
354
354
|
end
|
355
355
|
|
356
356
|
context "and state1 and state2 are set to new values" do
|
357
|
-
let(:converge_recipe)
|
357
|
+
let(:converge_recipe) do
|
358
358
|
<<-EOM
|
359
359
|
#{resource_name} 'blah' do
|
360
360
|
state1 'new_state1'
|
361
361
|
state2 'new_state2'
|
362
362
|
end
|
363
363
|
EOM
|
364
|
-
|
364
|
+
end
|
365
365
|
|
366
366
|
it "the resource updates state1 and state2" do
|
367
367
|
expect(resource.converged).to eq 2
|
@@ -377,14 +377,14 @@ EOM
|
|
377
377
|
end
|
378
378
|
|
379
379
|
context "and state1 is set to its current value but state2 is set to a new value" do
|
380
|
-
let(:converge_recipe)
|
380
|
+
let(:converge_recipe) do
|
381
381
|
<<-EOM
|
382
382
|
#{resource_name} 'blah' do
|
383
383
|
state1 'current_state1'
|
384
384
|
state2 'new_state2'
|
385
385
|
end
|
386
386
|
EOM
|
387
|
-
|
387
|
+
end
|
388
388
|
|
389
389
|
it "the resource updates state2" do
|
390
390
|
expect(resource.converged).to eq 1
|
@@ -398,14 +398,14 @@ EOM
|
|
398
398
|
end
|
399
399
|
|
400
400
|
context "and state1 and state2 are set to their current values" do
|
401
|
-
let(:converge_recipe)
|
401
|
+
let(:converge_recipe) do
|
402
402
|
<<-EOM
|
403
403
|
#{resource_name} 'blah' do
|
404
404
|
state1 'current_state1'
|
405
405
|
state2 'current_state2'
|
406
406
|
end
|
407
407
|
EOM
|
408
|
-
|
408
|
+
end
|
409
409
|
|
410
410
|
it "the resource updates nothing" do
|
411
411
|
expect(resource.converged).to eq 0
|
@@ -425,9 +425,9 @@ EOM
|
|
425
425
|
end
|
426
426
|
|
427
427
|
context "and nothing is set" do
|
428
|
-
let(:converge_recipe)
|
428
|
+
let(:converge_recipe) do
|
429
429
|
"#{resource_name} 'blah'"
|
430
|
-
|
430
|
+
end
|
431
431
|
|
432
432
|
it "the resource is created" do
|
433
433
|
expect(resource.converged).to eq 2
|
@@ -443,14 +443,14 @@ EOM
|
|
443
443
|
end
|
444
444
|
|
445
445
|
context "and state1 and state2 are set to new values" do
|
446
|
-
let(:converge_recipe)
|
446
|
+
let(:converge_recipe) do
|
447
447
|
<<-EOM
|
448
448
|
#{resource_name} 'blah' do
|
449
449
|
state1 'new_state1'
|
450
450
|
state2 'new_state2'
|
451
451
|
end
|
452
452
|
EOM
|
453
|
-
|
453
|
+
end
|
454
454
|
|
455
455
|
it "the resource is created" do
|
456
456
|
expect(resource.converged).to eq 2
|
@@ -466,7 +466,7 @@ EOM
|
|
466
466
|
end
|
467
467
|
|
468
468
|
context "and state1 and state2 are set to new sensitive values" do
|
469
|
-
let(:converge_recipe)
|
469
|
+
let(:converge_recipe) do
|
470
470
|
<<-EOM
|
471
471
|
#{resource_name} 'blah' do
|
472
472
|
sensitive true
|
@@ -474,7 +474,7 @@ EOM
|
|
474
474
|
state2 'new_state2'
|
475
475
|
end
|
476
476
|
EOM
|
477
|
-
|
477
|
+
end
|
478
478
|
|
479
479
|
it "the resource is created" do
|
480
480
|
expect(resource.converged).to eq 2
|