summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:25:16 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:25:16 -0700
commit35603c7ce1bd3ccf35334ed65152140f0ecaf080 (patch)
tree452c84ce196ce00d672c71a8fa65f86c5a074fac
parenteda2808dce8146bfdb308dd658b1dd565df3562b (diff)
downloadchef-35603c7ce1bd3ccf35334ed65152140f0ecaf080.tar.gz
fix Style/HashSyntax
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rwxr-xr-xbin/chef-service-manager12
-rw-r--r--chef-config/Rakefile2
-rw-r--r--chef-config/lib/chef-config/config.rb2
-rw-r--r--chef-config/lib/chef-config/package_task.rb18
-rw-r--r--chef-config/spec/spec_helper.rb4
-rw-r--r--ext/win32-eventlog/Rakefile14
-rw-r--r--lib/chef/api_client.rb20
-rw-r--r--lib/chef/api_client/registration.rb10
-rw-r--r--lib/chef/api_client_v1.rb28
-rw-r--r--lib/chef/application/apply.rb112
-rw-r--r--lib/chef/application/client.rb323
-rw-r--r--lib/chef/application/knife.rb154
-rw-r--r--lib/chef/application/solo.rb224
-rw-r--r--lib/chef/application/windows_service.rb34
-rw-r--r--lib/chef/application/windows_service_manager.rb70
-rw-r--r--lib/chef/audit/audit_event_proxy.rb12
-rw-r--r--lib/chef/audit/control_group_data.rb30
-rw-r--r--lib/chef/audit/runner.rb2
-rw-r--r--lib/chef/chef_fs/config.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb2
-rw-r--r--lib/chef/chef_fs/knife.rb12
-rw-r--r--lib/chef/chef_fs/parallelizer.rb2
-rw-r--r--lib/chef/cookbook/cookbook_version_loader.rb2
-rw-r--r--lib/chef/cookbook/metadata.rb52
-rw-r--r--lib/chef/cookbook_manifest.rb10
-rw-r--r--lib/chef/cookbook_site_streaming_uploader.rb8
-rw-r--r--lib/chef/cookbook_uploader.rb4
-rw-r--r--lib/chef/data_bag.rb2
-rw-r--r--lib/chef/data_bag_item.rb2
-rw-r--r--lib/chef/dsl/reboot_pending.rb2
-rw-r--r--lib/chef/encrypted_data_bag_item/encryptor.rb2
-rw-r--r--lib/chef/environment.rb18
-rw-r--r--lib/chef/event_loggers/windows_eventlog.rb32
-rw-r--r--lib/chef/file_cache.rb28
-rw-r--r--lib/chef/formatters/doc.rb10
-rw-r--r--lib/chef/formatters/indentable_output_stream.rb8
-rw-r--r--lib/chef/guard_interpreter/resource_guard_interpreter.rb4
-rw-r--r--lib/chef/http/auth_credentials.rb2
-rw-r--r--lib/chef/http/authenticator.rb10
-rw-r--r--lib/chef/key.rb12
-rw-r--r--lib/chef/knife/bootstrap.rb232
-rw-r--r--lib/chef/knife/bootstrap/client_builder.rb2
-rw-r--r--lib/chef/knife/client_bulk_delete.rb6
-rw-r--r--lib/chef/knife/client_create.rb34
-rw-r--r--lib/chef/knife/client_delete.rb6
-rw-r--r--lib/chef/knife/client_list.rb6
-rw-r--r--lib/chef/knife/client_reregister.rb6
-rw-r--r--lib/chef/knife/configure.rb40
-rw-r--r--lib/chef/knife/cookbook_bulk_delete.rb2
-rw-r--r--lib/chef/knife/cookbook_delete.rb4
-rw-r--r--lib/chef/knife/cookbook_download.rb22
-rw-r--r--lib/chef/knife/cookbook_list.rb12
-rw-r--r--lib/chef/knife/cookbook_metadata.rb14
-rw-r--r--lib/chef/knife/cookbook_show.rb24
-rw-r--r--lib/chef/knife/cookbook_site_download.rb20
-rw-r--r--lib/chef/knife/cookbook_site_install.rb46
-rw-r--r--lib/chef/knife/cookbook_site_list.rb16
-rw-r--r--lib/chef/knife/cookbook_site_search.rb10
-rw-r--r--lib/chef/knife/cookbook_site_share.rb36
-rw-r--r--lib/chef/knife/cookbook_site_show.rb10
-rw-r--r--lib/chef/knife/cookbook_site_unshare.rb10
-rw-r--r--lib/chef/knife/cookbook_test.rb14
-rw-r--r--lib/chef/knife/cookbook_upload.rb50
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb2
-rw-r--r--lib/chef/knife/core/cookbook_scm_repo.rb2
-rw-r--r--lib/chef/knife/core/generic_presenter.rb14
-rw-r--r--lib/chef/knife/core/node_presenter.rb20
-rw-r--r--lib/chef/knife/core/status_presenter.rb20
-rw-r--r--lib/chef/knife/data_bag_from_file.rb6
-rw-r--r--lib/chef/knife/data_bag_list.rb6
-rw-r--r--lib/chef/knife/data_bag_secret_options.rb22
-rw-r--r--lib/chef/knife/delete.rb26
-rw-r--r--lib/chef/knife/deps.rb18
-rw-r--r--lib/chef/knife/diff.rb28
-rw-r--r--lib/chef/knife/download.rb46
-rw-r--r--lib/chef/knife/edit.rb6
-rw-r--r--lib/chef/knife/environment_compare.rb16
-rw-r--r--lib/chef/knife/environment_create.rb6
-rw-r--r--lib/chef/knife/environment_from_file.rb6
-rw-r--r--lib/chef/knife/environment_list.rb6
-rw-r--r--lib/chef/knife/exec.rb14
-rw-r--r--lib/chef/knife/key_create_base.rb24
-rw-r--r--lib/chef/knife/key_edit_base.rb30
-rw-r--r--lib/chef/knife/key_list_base.rb18
-rw-r--r--lib/chef/knife/list.rb38
-rw-r--r--lib/chef/knife/node_edit.rb8
-rw-r--r--lib/chef/knife/node_list.rb6
-rw-r--r--lib/chef/knife/node_run_list_add.rb12
-rw-r--r--lib/chef/knife/node_show.rb12
-rw-r--r--lib/chef/knife/osc_user_create.rb26
-rw-r--r--lib/chef/knife/osc_user_list.rb6
-rw-r--r--lib/chef/knife/osc_user_reregister.rb6
-rw-r--r--lib/chef/knife/raw.rb32
-rw-r--r--lib/chef/knife/role_create.rb6
-rw-r--r--lib/chef/knife/role_env_run_list_add.rb6
-rw-r--r--lib/chef/knife/role_list.rb6
-rw-r--r--lib/chef/knife/role_run_list_add.rb6
-rw-r--r--lib/chef/knife/search.rb46
-rw-r--r--lib/chef/knife/serve.rb12
-rw-r--r--lib/chef/knife/show.rb6
-rw-r--r--lib/chef/knife/ssh.rb130
-rw-r--r--lib/chef/knife/status.rb22
-rw-r--r--lib/chef/knife/upload.rb50
-rw-r--r--lib/chef/knife/user_create.rb34
-rw-r--r--lib/chef/knife/user_list.rb6
-rw-r--r--lib/chef/knife/user_reregister.rb6
-rw-r--r--lib/chef/knife/xargs.rb72
-rw-r--r--lib/chef/log/winevt.rb40
-rw-r--r--lib/chef/mixin/deprecation.rb2
-rw-r--r--lib/chef/mixin/securable.rb22
-rw-r--r--lib/chef/node.rb10
-rw-r--r--lib/chef/org.rb16
-rw-r--r--lib/chef/policy_builder/expand_node_object.rb2
-rw-r--r--lib/chef/provider/cron/unix.rb4
-rw-r--r--lib/chef/provider/dsc_resource.rb2
-rw-r--r--lib/chef/provider/dsc_script.rb16
-rw-r--r--lib/chef/provider/execute.rb2
-rw-r--r--lib/chef/provider/mdadm.rb2
-rw-r--r--lib/chef/provider/mount/windows.rb8
-rw-r--r--lib/chef/provider/reboot.rb8
-rw-r--r--lib/chef/provider/remote_file/sftp.rb2
-rw-r--r--lib/chef/provider/service/redhat.rb2
-rw-r--r--lib/chef/provider/service/solaris.rb2
-rw-r--r--lib/chef/provider/service/systemd.rb4
-rw-r--r--lib/chef/provider/service/windows.rb4
-rw-r--r--lib/chef/provider/subversion.rb4
-rw-r--r--lib/chef/provider/systemd_unit.rb4
-rw-r--r--lib/chef/provider/template/content.rb2
-rw-r--r--lib/chef/resource.rb2
-rw-r--r--lib/chef/resource/cron.rb10
-rw-r--r--lib/chef/resource/dsc_script.rb10
-rw-r--r--lib/chef/resource/execute.rb2
-rw-r--r--lib/chef/resource/file/verification.rb2
-rw-r--r--lib/chef/resource/freebsd_package.rb2
-rw-r--r--lib/chef/resource/group.rb4
-rw-r--r--lib/chef/resource/hostname.rb2
-rw-r--r--lib/chef/resource/http_request.rb2
-rw-r--r--lib/chef/resource/powershell_script.rb4
-rw-r--r--lib/chef/resource/remote_directory.rb6
-rw-r--r--lib/chef/resource/remote_file.rb4
-rw-r--r--lib/chef/resource/service.rb34
-rw-r--r--lib/chef/resource/template.rb2
-rw-r--r--lib/chef/resource/user.rb30
-rw-r--r--lib/chef/resource/windows_script.rb2
-rw-r--r--lib/chef/resource_reporter.rb4
-rw-r--r--lib/chef/role.rb8
-rw-r--r--lib/chef/run_list/run_list_expansion.rb10
-rw-r--r--lib/chef/run_list/versioned_recipe_list.rb4
-rw-r--r--lib/chef/run_status.rb20
-rw-r--r--lib/chef/shell.rb104
-rw-r--r--lib/chef/shell/ext.rb54
-rw-r--r--lib/chef/shell/shell_session.rb4
-rw-r--r--lib/chef/user.rb22
-rw-r--r--lib/chef/user_v1.rb50
-rw-r--r--lib/chef/util/backup.rb2
-rw-r--r--lib/chef/util/diff.rb2
-rw-r--r--lib/chef/util/dsc/configuration_generator.rb2
-rw-r--r--lib/chef/util/dsc/lcm_output_parser.rb2
-rw-r--r--lib/chef/util/file_edit.rb2
-rw-r--r--lib/chef/util/powershell/cmdlet.rb6
-rw-r--r--lib/chef/util/selinux.rb2
-rw-r--r--lib/chef/win32/registry.rb16
-rw-r--r--lib/chef/win32/security/securable_object.rb12
-rw-r--r--lib/chef/win32/version.rb30
-rw-r--r--spec/functional/audit/rspec_formatter_spec.rb2
-rw-r--r--spec/functional/audit/runner_spec.rb2
-rw-r--r--spec/functional/dsl/reboot_pending_spec.rb6
-rw-r--r--spec/functional/dsl/registry_helper_spec.rb6
-rw-r--r--spec/functional/http/simple_spec.rb2
-rw-r--r--spec/functional/knife/ssh_spec.rb4
-rw-r--r--spec/functional/mixin/shell_out_spec.rb8
-rw-r--r--spec/functional/rebooter_spec.rb12
-rwxr-xr-xspec/functional/resource/aixinit_service_spec.rb2
-rw-r--r--spec/functional/resource/apt_package_spec.rb34
-rw-r--r--spec/functional/resource/bff_spec.rb2
-rw-r--r--spec/functional/resource/cron_spec.rb2
-rw-r--r--spec/functional/resource/dnf_package_spec.rb2
-rw-r--r--spec/functional/resource/dsc_script_spec.rb4
-rw-r--r--spec/functional/resource/execute_spec.rb8
-rw-r--r--spec/functional/resource/file_spec.rb2
-rw-r--r--spec/functional/resource/git_spec.rb30
-rw-r--r--spec/functional/resource/ifconfig_spec.rb10
-rw-r--r--spec/functional/resource/mount_spec.rb4
-rw-r--r--spec/functional/resource/powershell_script_spec.rb6
-rw-r--r--spec/functional/resource/reboot_spec.rb6
-rw-r--r--spec/functional/resource/registry_spec.rb152
-rw-r--r--spec/functional/resource/rpm_spec.rb2
-rw-r--r--spec/functional/resource/template_spec.rb8
-rw-r--r--spec/functional/resource/user/dscl_spec.rb6
-rw-r--r--spec/functional/resource/windows_service_spec.rb2
-rw-r--r--spec/functional/resource/yum_package_spec.rb2
-rw-r--r--spec/functional/run_lock_spec.rb6
-rw-r--r--spec/functional/shell_spec.rb2
-rw-r--r--spec/functional/util/powershell/cmdlet_spec.rb14
-rw-r--r--spec/functional/version_spec.rb2
-rw-r--r--spec/functional/win32/registry_spec.rb124
-rw-r--r--spec/integration/client/client_spec.rb96
-rw-r--r--spec/integration/client/exit_code_spec.rb4
-rw-r--r--spec/integration/client/ipv6_spec.rb6
-rw-r--r--spec/integration/knife/chef_fs_data_store_spec.rb10
-rw-r--r--spec/integration/knife/chef_repo_path_spec.rb6
-rw-r--r--spec/integration/knife/chef_repository_file_system_spec.rb6
-rw-r--r--spec/integration/knife/chefignore_spec.rb4
-rw-r--r--spec/integration/knife/common_options_spec.rb4
-rw-r--r--spec/integration/knife/cookbook_api_ipv6_spec.rb8
-rw-r--r--spec/integration/knife/delete_spec.rb12
-rw-r--r--spec/integration/knife/deps_spec.rb114
-rw-r--r--spec/integration/knife/diff_spec.rb16
-rw-r--r--spec/integration/knife/download_spec.rb14
-rw-r--r--spec/integration/knife/list_spec.rb6
-rw-r--r--spec/integration/knife/raw_spec.rb10
-rw-r--r--spec/integration/knife/show_spec.rb6
-rw-r--r--spec/integration/knife/upload_spec.rb24
-rw-r--r--spec/integration/recipes/accumulator_spec.rb4
-rw-r--r--spec/integration/recipes/lwrp_inline_resources_spec.rb2
-rw-r--r--spec/integration/recipes/lwrp_spec.rb2
-rw-r--r--spec/integration/recipes/notifies_spec.rb20
-rw-r--r--spec/integration/recipes/notifying_block_spec.rb4
-rw-r--r--spec/integration/recipes/remote_directory.rb2
-rw-r--r--spec/integration/solo/solo_spec.rb16
-rw-r--r--spec/scripts/ssl-serve.rb22
-rw-r--r--spec/spec_helper.rb126
-rw-r--r--spec/stress/win32/file_spec.rb4
-rw-r--r--spec/stress/win32/security_spec.rb4
-rw-r--r--spec/support/platform_helpers.rb2
-rw-r--r--spec/support/shared/context/client.rb20
-rw-r--r--spec/support/shared/functional/securable_resource.rb22
-rw-r--r--spec/support/shared/functional/securable_resource_with_reporting.rb10
-rw-r--r--spec/support/shared/functional/win32_service.rb10
-rw-r--r--spec/support/shared/functional/windows_script.rb6
-rw-r--r--spec/support/shared/integration/app_server_support.rb6
-rw-r--r--spec/support/shared/integration/integration_helper.rb4
-rw-r--r--spec/support/shared/integration/knife_support.rb4
-rw-r--r--spec/support/shared/unit/api_error_inspector.rb10
-rw-r--r--spec/support/shared/unit/api_versioning.rb4
-rw-r--r--spec/support/shared/unit/execute_resource.rb4
-rw-r--r--spec/support/shared/unit/provider/file.rb24
-rw-r--r--spec/support/shared/unit/provider/useradd_based_user_provider.rb20
-rw-r--r--spec/support/shared/unit/user_and_client_shared.rb6
-rw-r--r--spec/tiny_server.rb4
-rw-r--r--spec/unit/api_client/registration_spec.rb8
-rw-r--r--spec/unit/api_client_spec.rb4
-rw-r--r--spec/unit/api_client_v1_spec.rb12
-rw-r--r--spec/unit/application/apply_spec.rb4
-rw-r--r--spec/unit/application/client_spec.rb18
-rw-r--r--spec/unit/application/knife_spec.rb6
-rw-r--r--spec/unit/application/solo_spec.rb4
-rw-r--r--spec/unit/application_spec.rb2
-rw-r--r--spec/unit/audit/audit_event_proxy_spec.rb54
-rw-r--r--spec/unit/audit/audit_reporter_spec.rb38
-rw-r--r--spec/unit/audit/control_group_data_spec.rb32
-rw-r--r--spec/unit/audit/runner_spec.rb4
-rw-r--r--spec/unit/chef_fs/diff_spec.rb90
-rw-r--r--spec/unit/chef_fs/file_pattern_spec.rb4
-rw-r--r--spec/unit/chef_fs/file_system/repository/directory_spec.rb2
-rw-r--r--spec/unit/chef_fs/file_system_spec.rb16
-rw-r--r--spec/unit/chef_fs/parallelizer.rb24
-rw-r--r--spec/unit/client_spec.rb12
-rw-r--r--spec/unit/config_fetcher_spec.rb2
-rw-r--r--spec/unit/cookbook/metadata_spec.rb154
-rw-r--r--spec/unit/cookbook/synchronizer_spec.rb8
-rw-r--r--spec/unit/cookbook_site_streaming_uploader_spec.rb12
-rw-r--r--spec/unit/cookbook_uploader_spec.rb4
-rw-r--r--spec/unit/cookbook_version_file_specificity_spec.rb270
-rw-r--r--spec/unit/daemon_spec.rb6
-rw-r--r--spec/unit/data_bag_item_spec.rb4
-rw-r--r--spec/unit/data_bag_spec.rb2
-rw-r--r--spec/unit/data_collector/resource_report_spec.rb2
-rw-r--r--spec/unit/data_collector_spec.rb4
-rw-r--r--spec/unit/dsl/audit_spec.rb2
-rw-r--r--spec/unit/dsl/platform_introspection_spec.rb32
-rw-r--r--spec/unit/dsl/reboot_pending_spec.rb2
-rw-r--r--spec/unit/environment_spec.rb32
-rw-r--r--spec/unit/file_access_control_spec.rb12
-rw-r--r--spec/unit/file_content_management/deploy/mv_unix_spec.rb6
-rw-r--r--spec/unit/file_content_management/deploy/mv_windows_spec.rb12
-rw-r--r--spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb8
-rw-r--r--spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb8
-rw-r--r--spec/unit/handler/json_file_spec.rb2
-rw-r--r--spec/unit/http/api_versions_spec.rb2
-rw-r--r--spec/unit/http/authenticator_spec.rb2
-rw-r--r--spec/unit/http/validate_content_length_spec.rb4
-rw-r--r--spec/unit/knife/bootstrap/client_builder_spec.rb6
-rw-r--r--spec/unit/knife/client_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/client_delete_spec.rb2
-rw-r--r--spec/unit/knife/client_reregister_spec.rb2
-rw-r--r--spec/unit/knife/configure_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_download_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_show_spec.rb48
-rw-r--r--spec/unit/knife/cookbook_site_download_spec.rb4
-rw-r--r--spec/unit/knife/cookbook_site_install_spec.rb6
-rw-r--r--spec/unit/knife/cookbook_site_share_spec.rb16
-rw-r--r--spec/unit/knife/cookbook_site_unshare_spec.rb4
-rw-r--r--spec/unit/knife/cookbook_upload_spec.rb8
-rw-r--r--spec/unit/knife/core/bootstrap_context_spec.rb62
-rw-r--r--spec/unit/knife/core/cookbook_scm_repo_spec.rb40
-rw-r--r--spec/unit/knife/core/ui_spec.rb18
-rw-r--r--spec/unit/knife/data_bag_create_spec.rb4
-rw-r--r--spec/unit/knife/data_bag_edit_spec.rb2
-rw-r--r--spec/unit/knife/data_bag_secret_options_spec.rb10
-rw-r--r--spec/unit/knife/environment_from_file_spec.rb2
-rw-r--r--spec/unit/knife/node_delete_spec.rb2
-rw-r--r--spec/unit/knife/node_edit_spec.rb14
-rw-r--r--spec/unit/knife/node_from_file_spec.rb2
-rw-r--r--spec/unit/knife/node_run_list_add_spec.rb2
-rw-r--r--spec/unit/knife/osc_user_edit_spec.rb2
-rw-r--r--spec/unit/knife/osc_user_reregister_spec.rb2
-rw-r--r--spec/unit/knife/role_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/role_create_spec.rb2
-rw-r--r--spec/unit/knife/role_delete_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_add_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_clear_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_remove_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_replace_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_set_spec.rb2
-rw-r--r--spec/unit/knife/role_from_file_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_add_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_clear_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_remove_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_replace_spec.rb2
-rw-r--r--spec/unit/knife/role_run_list_set_spec.rb2
-rw-r--r--spec/unit/knife/ssh_spec.rb18
-rw-r--r--spec/unit/knife/user_reregister_spec.rb2
-rw-r--r--spec/unit/knife_spec.rb38
-rw-r--r--spec/unit/log/syslog_spec.rb2
-rw-r--r--spec/unit/lwrp_spec.rb4
-rw-r--r--spec/unit/mash_spec.rb6
-rw-r--r--spec/unit/mixin/api_version_request_handling_spec.rb4
-rw-r--r--spec/unit/mixin/checksum_spec.rb2
-rw-r--r--spec/unit/mixin/enforce_ownership_and_permissions_spec.rb16
-rw-r--r--spec/unit/mixin/homebrew_user_spec.rb2
-rw-r--r--spec/unit/mixin/params_validate_spec.rb192
-rw-r--r--spec/unit/mixin/securable_spec.rb46
-rw-r--r--spec/unit/mixin/shell_out_spec.rb60
-rw-r--r--spec/unit/mixin/user_context_spec.rb2
-rw-r--r--spec/unit/node/attribute_spec.rb6
-rw-r--r--spec/unit/node/vivid_mash_spec.rb6
-rw-r--r--spec/unit/node_map_spec.rb6
-rw-r--r--spec/unit/node_spec.rb26
-rw-r--r--spec/unit/org_spec.rb4
-rw-r--r--spec/unit/policy_builder/expand_node_object_spec.rb6
-rw-r--r--spec/unit/policy_builder/policyfile_spec.rb8
-rw-r--r--spec/unit/property_spec.rb8
-rw-r--r--spec/unit/provider/apt_repository_spec.rb8
-rw-r--r--spec/unit/provider/cookbook_file/content_spec.rb2
-rw-r--r--spec/unit/provider/cookbook_file_spec.rb2
-rw-r--r--spec/unit/provider/cron/unix_spec.rb14
-rw-r--r--spec/unit/provider/dsc_resource_spec.rb8
-rw-r--r--spec/unit/provider/execute_spec.rb2
-rw-r--r--spec/unit/provider/file/content_spec.rb2
-rw-r--r--spec/unit/provider/file_spec.rb2
-rw-r--r--spec/unit/provider/git_spec.rb212
-rw-r--r--spec/unit/provider/group_spec.rb6
-rw-r--r--spec/unit/provider/link_spec.rb12
-rw-r--r--spec/unit/provider/mdadm_spec.rb6
-rw-r--r--spec/unit/provider/mount/aix_spec.rb10
-rw-r--r--spec/unit/provider/mount/mount_spec.rb36
-rw-r--r--spec/unit/provider/mount/solaris_spec.rb4
-rw-r--r--spec/unit/provider/mount/windows_spec.rb8
-rw-r--r--spec/unit/provider/ohai_spec.rb18
-rw-r--r--spec/unit/provider/osx_profile_spec.rb2
-rw-r--r--spec/unit/provider/package/apt_spec.rb134
-rw-r--r--spec/unit/provider/package/bff_spec.rb24
-rw-r--r--spec/unit/provider/package/chocolatey_spec.rb46
-rw-r--r--spec/unit/provider/package/dpkg_spec.rb8
-rw-r--r--spec/unit/provider/package/freebsd/pkg_spec.rb26
-rw-r--r--spec/unit/provider/package/freebsd/pkgng_spec.rb10
-rw-r--r--spec/unit/provider/package/freebsd/port_spec.rb18
-rw-r--r--spec/unit/provider/package/homebrew_spec.rb8
-rw-r--r--spec/unit/provider/package/ips_spec.rb4
-rw-r--r--spec/unit/provider/package/macports_spec.rb8
-rw-r--r--spec/unit/provider/package/openbsd_spec.rb22
-rw-r--r--spec/unit/provider/package/pacman_spec.rb8
-rw-r--r--spec/unit/provider/package/paludis_spec.rb10
-rw-r--r--spec/unit/provider/package/portage_spec.rb8
-rw-r--r--spec/unit/provider/package/powershell_spec.rb176
-rw-r--r--spec/unit/provider/package/smartos_spec.rb20
-rw-r--r--spec/unit/provider/package/solaris_spec.rb12
-rw-r--r--spec/unit/provider/package/windows/exe_spec.rb2
-rw-r--r--spec/unit/provider/package/windows/msi_spec.rb2
-rw-r--r--spec/unit/provider/package/windows_spec.rb2
-rw-r--r--spec/unit/provider/package/zypper_spec.rb12
-rw-r--r--spec/unit/provider/powershell_script_spec.rb2
-rw-r--r--spec/unit/provider/registry_key_spec.rb44
-rw-r--r--spec/unit/provider/remote_file/content_spec.rb8
-rw-r--r--spec/unit/provider/remote_file/fetcher_spec.rb10
-rw-r--r--spec/unit/provider/remote_file/http_spec.rb2
-rw-r--r--spec/unit/provider/remote_file/local_file_spec.rb4
-rw-r--r--spec/unit/provider/remote_file/network_file_spec.rb6
-rw-r--r--spec/unit/provider/remote_file/sftp_spec.rb2
-rw-r--r--spec/unit/provider/remote_file_spec.rb2
-rw-r--r--spec/unit/provider/script_spec.rb2
-rw-r--r--spec/unit/provider/service/aix_service_spec.rb16
-rw-r--r--spec/unit/provider/service/aixinit_service_spec.rb2
-rw-r--r--spec/unit/provider/service/arch_service_spec.rb28
-rw-r--r--spec/unit/provider/service/debian_service_spec.rb2
-rw-r--r--spec/unit/provider/service/freebsd_service_spec.rb20
-rw-r--r--spec/unit/provider/service/gentoo_service_spec.rb2
-rw-r--r--spec/unit/provider/service/init_service_spec.rb14
-rw-r--r--spec/unit/provider/service/insserv_service_spec.rb4
-rw-r--r--spec/unit/provider/service/invokercd_service_spec.rb20
-rw-r--r--spec/unit/provider/service/macosx_spec.rb8
-rw-r--r--spec/unit/provider/service/openbsd_service_spec.rb10
-rw-r--r--spec/unit/provider/service/redhat_spec.rb54
-rw-r--r--spec/unit/provider/service/simple_service_spec.rb10
-rw-r--r--spec/unit/provider/service/solaris_smf_service_spec.rb38
-rw-r--r--spec/unit/provider/service/systemd_service_spec.rb16
-rw-r--r--spec/unit/provider/service/upstart_service_spec.rb8
-rw-r--r--spec/unit/provider/service/windows_spec.rb70
-rw-r--r--spec/unit/provider/service_spec.rb6
-rw-r--r--spec/unit/provider/subversion_spec.rb18
-rw-r--r--spec/unit/provider/systemd_unit_spec.rb12
-rw-r--r--spec/unit/provider/template/content_spec.rb58
-rw-r--r--spec/unit/provider/template_spec.rb4
-rw-r--r--spec/unit/provider/user/pw_spec.rb2
-rw-r--r--spec/unit/provider/windows_task_spec.rb30
-rw-r--r--spec/unit/recipe_spec.rb26
-rw-r--r--spec/unit/resource/conditional_spec.rb2
-rw-r--r--spec/unit/resource/cookbook_file_spec.rb4
-rw-r--r--spec/unit/resource/dnf_package_spec.rb6
-rw-r--r--spec/unit/resource/execute_spec.rb4
-rw-r--r--spec/unit/resource/file/verification/systemd_unit_spec.rb2
-rw-r--r--spec/unit/resource/file/verification_spec.rb2
-rw-r--r--spec/unit/resource/file_spec.rb6
-rw-r--r--spec/unit/resource/freebsd_package_spec.rb8
-rw-r--r--spec/unit/resource/group_spec.rb8
-rw-r--r--spec/unit/resource/mount_spec.rb6
-rw-r--r--spec/unit/resource/package_spec.rb4
-rw-r--r--spec/unit/resource/powershell_package_source_spec.rb4
-rw-r--r--spec/unit/resource/powershell_script_spec.rb16
-rw-r--r--spec/unit/resource/registry_key_spec.rb38
-rw-r--r--spec/unit/resource/remote_file_spec.rb4
-rw-r--r--spec/unit/resource/resource_notification_spec.rb16
-rw-r--r--spec/unit/resource/service_spec.rb6
-rw-r--r--spec/unit/resource/template_spec.rb4
-rw-r--r--spec/unit/resource/user_spec.rb4
-rw-r--r--spec/unit/resource/yum_package_spec.rb6
-rw-r--r--spec/unit/resource_collection/resource_set_spec.rb12
-rw-r--r--spec/unit/resource_collection_spec.rb10
-rw-r--r--spec/unit/resource_definition_spec.rb4
-rw-r--r--spec/unit/resource_reporter_spec.rb24
-rw-r--r--spec/unit/resource_spec.rb42
-rw-r--r--spec/unit/role_spec.rb30
-rw-r--r--spec/unit/run_context_spec.rb2
-rw-r--r--spec/unit/run_list/run_list_item_spec.rb6
-rw-r--r--spec/unit/run_list/versioned_recipe_list_spec.rb24
-rw-r--r--spec/unit/run_list_spec.rb10
-rw-r--r--spec/unit/scan_access_control_spec.rb6
-rw-r--r--spec/unit/shell/model_wrapper_spec.rb8
-rw-r--r--spec/unit/shell/shell_ext_spec.rb8
-rw-r--r--spec/unit/shell/shell_session_spec.rb52
-rw-r--r--spec/unit/user_spec.rb4
-rw-r--r--spec/unit/user_v1_spec.rb50
-rw-r--r--spec/unit/util/diff_spec.rb2
-rw-r--r--spec/unit/util/dsc/configuration_generator_spec.rb8
-rw-r--r--spec/unit/util/dsc/local_configuration_manager_spec.rb4
-rw-r--r--spec/unit/util/powershell/cmdlet_spec.rb2
-rw-r--r--spec/unit/util/selinux_spec.rb12
-rw-r--r--spec/unit/win32/registry_spec.rb4
-rw-r--r--spec/unit/windows_service_spec.rb4
-rw-r--r--tasks/cbgb.rb2
-rw-r--r--tasks/dependencies.rb8
-rw-r--r--tasks/maintainers.rb4
-rw-r--r--tasks/rspec.rb4
470 files changed, 4144 insertions, 4145 deletions
diff --git a/bin/chef-service-manager b/bin/chef-service-manager
index c894b10f4f..bbdfe005df 100755
--- a/bin/chef-service-manager
+++ b/bin/chef-service-manager
@@ -25,12 +25,12 @@ require "chef/application/windows_service_manager"
if Chef::Platform.windows?
chef_client_service = {
- :service_name => "chef-client",
- :service_display_name => "Chef Client Service",
- :service_description => "Runs Chef Client on regular, configurable intervals.",
- :service_file_path => File.expand_path("../chef-windows-service", $PROGRAM_NAME),
- :delayed_start => true,
- :dependencies => ["Winmgmt"],
+ service_name: "chef-client",
+ service_display_name: "Chef Client Service",
+ service_description: "Runs Chef Client on regular, configurable intervals.",
+ service_file_path: File.expand_path("../chef-windows-service", $PROGRAM_NAME),
+ delayed_start: true,
+ dependencies: ["Winmgmt"],
}
Chef::Application::WindowsServiceManager.new(chef_client_service).run
else
diff --git a/chef-config/Rakefile b/chef-config/Rakefile
index fd6497a287..324dbbdcf4 100644
--- a/chef-config/Rakefile
+++ b/chef-config/Rakefile
@@ -4,7 +4,7 @@ ChefConfig::PackageTask.new(File.expand_path("..", __FILE__), "ChefConfig", "che
package.module_path = "chef-config"
end
-task :default => :spec
+task default: :spec
begin
require "rspec/core/rake_task"
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index ed8fab9ee4..07be3e9ef6 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -698,7 +698,7 @@ module ChefConfig
# Deprecated:
# Move this to the default value of syntax_cache_path when this is removed.
- default(:cache_options) { { :path => PathHelper.join(config_dir, "syntaxcache") } }
+ default(:cache_options) { { path: PathHelper.join(config_dir, "syntaxcache") } }
# Whether errors should be raised for deprecation warnings. When set to
# `false` (the default setting), a warning is emitted but code using
diff --git a/chef-config/lib/chef-config/package_task.rb b/chef-config/lib/chef-config/package_task.rb
index 3ab273532d..f55c0e3a58 100644
--- a/chef-config/lib/chef-config/package_task.rb
+++ b/chef-config/lib/chef-config/package_task.rb
@@ -131,10 +131,10 @@ module ChefConfig
end
end
- task :package => :package_components
+ task package: :package_components
desc "Build and install component dependencies"
- task :install_components => :package_components do
+ task install_components: :package_components do
component_full_paths.each do |component_path|
Dir.chdir(component_path) do
sh "rake install"
@@ -142,7 +142,7 @@ module ChefConfig
end
end
- task :install => :install_components
+ task install: :install_components
desc "Clean up builds of component dependencies"
task :clobber_component_packages do
@@ -153,7 +153,7 @@ module ChefConfig
end
end
- task :clobber_package => :clobber_component_packages
+ task clobber_package: :clobber_component_packages
desc "Update the version number for component dependencies"
task :update_components_versions do
@@ -166,12 +166,12 @@ module ChefConfig
namespace :version do
desc "Regenerate lib/#{module_path}/version.rb from VERSION file"
- task :update => :update_components_versions do
+ task update: :update_components_versions do
update_version_rb
update_gemfile_lock
end
- task :bump => %w{version:bump_patch version:update}
+ task bump: %w{version:bump_patch version:update}
task :show do
puts version
@@ -252,7 +252,7 @@ end
end
end
- task :version => "version:update"
+ task version: "version:update"
gemspec_platform_to_install = ""
Dir[File.expand_path("*.gemspec", root_path)].reverse_each do |gemspec_path|
@@ -264,7 +264,7 @@ end
end
desc "Build and install a #{module_path} gem"
- task :install => [:package] do
+ task install: [:package] do
with_clean_env do
full_module_path = File.join(full_package_dir, module_path)
sh %{gem install #{full_module_path}-#{version}#{gemspec_platform_to_install}.gem --no-rdoc --no-ri}
@@ -276,7 +276,7 @@ end
end
desc "Build it, tag it and ship it"
- task :ship => [:clobber_package, :gem] do
+ task ship: [:clobber_package, :gem] do
sh("git tag #{version}")
sh("git push #{git_remote} --tags")
Dir[File.expand_path("*.gem", full_package_dir)].reverse_each do |built_gem|
diff --git a/chef-config/spec/spec_helper.rb b/chef-config/spec/spec_helper.rb
index 107becb9eb..6a324474e1 100644
--- a/chef-config/spec/spec_helper.rb
+++ b/chef-config/spec/spec_helper.rb
@@ -32,8 +32,8 @@ RSpec.configure do |config|
config.filter_run :focus
config.run_all_when_everything_filtered = true
- config.filter_run_excluding :windows_only => true unless ChefConfig.windows?
- config.filter_run_excluding :unix_only => true if ChefConfig.windows?
+ config.filter_run_excluding windows_only: true unless ChefConfig.windows?
+ config.filter_run_excluding unix_only: true if ChefConfig.windows?
# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
diff --git a/ext/win32-eventlog/Rakefile b/ext/win32-eventlog/Rakefile
index 5b1186cf13..3bdf7f91d8 100644
--- a/ext/win32-eventlog/Rakefile
+++ b/ext/win32-eventlog/Rakefile
@@ -22,8 +22,8 @@ CC = "gcc"
ensure_present [MC, RC, CC]
-task :build => [EVT_RESOURCE_OBJECT, EVT_SHARED_OBJECT]
-task :default => [:build, :register]
+task build: [EVT_RESOURCE_OBJECT, EVT_SHARED_OBJECT]
+task default: [:build, :register]
file EVT_RC_FILE => EVT_MC_FILE do
sh "#{MC} #{EVT_MC_FILE}"
@@ -37,15 +37,15 @@ file EVT_SHARED_OBJECT => EVT_RESOURCE_OBJECT do
sh "#{CC} -o #{EVT_SHARED_OBJECT} -shared #{EVT_RESOURCE_OBJECT}"
end
-task :register => EVT_SHARED_OBJECT do
+task register: EVT_SHARED_OBJECT do
require "win32/eventlog"
dll_file = File.expand_path(EVT_SHARED_OBJECT)
begin
Win32::EventLog.add_event_source(
- :source => "Application",
- :key_name => "Chef",
- :event_message_file => dll_file,
- :category_message_file => dll_file
+ source: "Application",
+ key_name: "Chef",
+ event_message_file: dll_file,
+ category_message_file: dll_file
)
rescue Errno::EIO => e
puts "Skipping event log registration due to missing privileges: #{e}"
diff --git a/lib/chef/api_client.rb b/lib/chef/api_client.rb
index 656a0e364f..3120b58cc0 100644
--- a/lib/chef/api_client.rb
+++ b/lib/chef/api_client.rb
@@ -53,7 +53,7 @@ class Chef
set_or_return(
:name,
arg,
- :regex => /^[\-[:alnum:]_\.]+$/
+ regex: /^[\-[:alnum:]_\.]+$/
)
end
@@ -65,7 +65,7 @@ class Chef
set_or_return(
:admin,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
@@ -77,7 +77,7 @@ class Chef
set_or_return(
:public_key,
arg,
- :kind_of => String
+ kind_of: String
)
end
@@ -90,7 +90,7 @@ class Chef
set_or_return(
:validator,
arg,
- :kind_of => [TrueClass, FalseClass]
+ kind_of: [TrueClass, FalseClass]
)
end
@@ -102,7 +102,7 @@ class Chef
set_or_return(
:private_key,
arg,
- :kind_of => [String, FalseClass]
+ kind_of: [String, FalseClass]
)
end
@@ -145,7 +145,7 @@ class Chef
end
def self.http_api
- Chef::ServerAPI.new(Chef::Config[:chef_server_url], { :api_version => "0" })
+ Chef::ServerAPI.new(Chef::Config[:chef_server_url], { api_version: "0" })
end
def self.reregister(name)
@@ -183,18 +183,18 @@ class Chef
# Save this client via the REST API, returns a hash including the private key
def save
- http_api.put("clients/#{name}", { :name => name, :admin => admin, :validator => validator })
+ http_api.put("clients/#{name}", { name: name, admin: admin, validator: validator })
rescue Net::HTTPServerException => e
# If that fails, go ahead and try and update it
if e.response.code == "404"
- http_api.post("clients", { :name => name, :admin => admin, :validator => validator })
+ http_api.post("clients", { name: name, admin: admin, validator: validator })
else
raise e
end
end
def reregister
- reregistered_self = http_api.put("clients/#{name}", { :name => name, :admin => admin, :validator => validator, :private_key => true })
+ reregistered_self = http_api.put("clients/#{name}", { name: name, admin: admin, validator: validator, private_key: true })
if reregistered_self.respond_to?(:[])
private_key(reregistered_self["private_key"])
else
@@ -219,7 +219,7 @@ class Chef
end
def http_api
- @http_api ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url], { :api_version => "0" })
+ @http_api ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url], { api_version: "0" })
end
end
diff --git a/lib/chef/api_client/registration.rb b/lib/chef/api_client/registration.rb
index 27e1f18c17..6cbb071020 100644
--- a/lib/chef/api_client/registration.rb
+++ b/lib/chef/api_client/registration.rb
@@ -139,7 +139,7 @@ class Chef
end
def put_data
- base_put_data = { :name => name, :admin => false }
+ base_put_data = { name: name, admin: false }
if self_generate_keys?
base_put_data[:public_key] = generated_public_key
else
@@ -149,7 +149,7 @@ class Chef
end
def post_data
- post_data = { :name => name, :admin => false }
+ post_data = { name: name, admin: false }
post_data[:public_key] = generated_public_key if self_generate_keys?
post_data
end
@@ -157,9 +157,9 @@ class Chef
def http_api
@http_api ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url],
{
- :api_version => "0",
- :client_name => Chef::Config[:validation_client_name],
- :signing_key_filename => Chef::Config[:validation_key],
+ api_version: "0",
+ client_name: Chef::Config[:validation_client_name],
+ signing_key_filename: Chef::Config[:validation_key],
}
)
end
diff --git a/lib/chef/api_client_v1.rb b/lib/chef/api_client_v1.rb
index 7fbff6d6ba..645016c5b9 100644
--- a/lib/chef/api_client_v1.rb
+++ b/lib/chef/api_client_v1.rb
@@ -57,15 +57,15 @@ class Chef
end
def chef_rest_v0
- @chef_rest_v0 ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url], { :api_version => "0", :inflate_json_class => false })
+ @chef_rest_v0 ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url], { api_version: "0", inflate_json_class: false })
end
def chef_rest_v1
- @chef_rest_v1 ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url], { :api_version => "1", :inflate_json_class => false })
+ @chef_rest_v1 ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url], { api_version: "1", inflate_json_class: false })
end
def self.http_api
- Chef::ServerAPI.new(Chef::Config[:chef_server_url], { :api_version => "1", :inflate_json_class => false })
+ Chef::ServerAPI.new(Chef::Config[:chef_server_url], { api_version: "1", inflate_json_class: false })
end
# Gets or sets the client name.
@@ -76,7 +76,7 @@ class Chef
set_or_return(
:name,
arg,
- :regex => /^[\-[:alnum:]_\.]+$/
+ regex: /^[\-[:alnum:]_\.]+$/
)
end
@@ -88,7 +88,7 @@ class Chef
set_or_return(
:admin,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
@@ -100,7 +100,7 @@ class Chef
set_or_return(
:public_key,
arg,
- :kind_of => String
+ kind_of: String
)
end
@@ -113,7 +113,7 @@ class Chef
set_or_return(
:validator,
arg,
- :kind_of => [TrueClass, FalseClass]
+ kind_of: [TrueClass, FalseClass]
)
end
@@ -126,7 +126,7 @@ class Chef
set_or_return(
:private_key,
arg,
- :kind_of => [String, TrueClass, FalseClass]
+ kind_of: [String, TrueClass, FalseClass]
)
end
@@ -138,7 +138,7 @@ class Chef
set_or_return(
:create_key,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
@@ -226,7 +226,7 @@ class Chef
def reregister
# Try API V0 and if it fails due to V0 not being supported, raise the proper error message.
# reregister only supported in API V0 or lesser.
- reregistered_self = chef_rest_v0.put("clients/#{name}", { :name => name, :admin => admin, :validator => validator, :private_key => true })
+ reregistered_self = chef_rest_v0.put("clients/#{name}", { name: name, admin: admin, validator: validator, private_key: true })
if reregistered_self.respond_to?(:[])
private_key(reregistered_self["private_key"])
else
@@ -254,7 +254,7 @@ class Chef
# it was never implemented, we will simply ignore that functionality
# as it is being deprecated.
# Delete this comment after V0 support is dropped.
- payload = { :name => name }
+ payload = { name: name }
payload[:validator] = validator unless validator.nil?
# DEPRECATION
@@ -277,11 +277,11 @@ class Chef
# Create the client via the REST API
def create
payload = {
- :name => name,
- :validator => validator,
+ name: name,
+ validator: validator,
# this field is ignored in API V1, but left for backwards-compat,
# can remove after OSC 11 support is finished?
- :admin => admin,
+ admin: admin,
}
begin
# try API V1
diff --git a/lib/chef/application/apply.rb b/lib/chef/application/apply.rb
index ec627ada2e..7325d89e1e 100644
--- a/lib/chef/application/apply.rb
+++ b/lib/chef/application/apply.rb
@@ -32,86 +32,86 @@ class Chef::Application::Apply < Chef::Application
banner "Usage: chef-apply [RECIPE_FILE | -e RECIPE_TEXT | -s] [OPTIONS]"
option :execute,
- :short => "-e RECIPE_TEXT",
- :long => "--execute RECIPE_TEXT",
- :description => "Execute resources supplied in a string",
- :proc => nil
+ short: "-e RECIPE_TEXT",
+ long: "--execute RECIPE_TEXT",
+ description: "Execute resources supplied in a string",
+ proc: nil
option :stdin,
- :short => "-s",
- :long => "--stdin",
- :description => "Execute resources read from STDIN",
- :boolean => true
+ short: "-s",
+ long: "--stdin",
+ description: "Execute resources read from STDIN",
+ boolean: true
option :json_attribs,
- :short => "-j JSON_ATTRIBS",
- :long => "--json-attributes JSON_ATTRIBS",
- :description => "Load attributes from a JSON file or URL",
- :proc => nil
+ short: "-j JSON_ATTRIBS",
+ long: "--json-attributes JSON_ATTRIBS",
+ description: "Load attributes from a JSON file or URL",
+ proc: nil
option :force_logger,
- :long => "--force-logger",
- :description => "Use logger output instead of formatter output",
- :boolean => true,
- :default => false
+ long: "--force-logger",
+ description: "Use logger output instead of formatter output",
+ boolean: true,
+ default: false
option :force_formatter,
- :long => "--force-formatter",
- :description => "Use formatter output instead of logger output",
- :boolean => true,
- :default => false
+ long: "--force-formatter",
+ description: "Use formatter output instead of logger output",
+ boolean: true,
+ default: false
option :formatter,
- :short => "-F FORMATTER",
- :long => "--format FORMATTER",
- :description => "output format to use",
- :proc => lambda { |format| Chef::Config.add_formatter(format) }
+ short: "-F FORMATTER",
+ long: "--format FORMATTER",
+ description: "output format to use",
+ proc: lambda { |format| Chef::Config.add_formatter(format) }
option :log_level,
- :short => "-l LEVEL",
- :long => "--log_level LEVEL",
- :description => "Set the log level (trace, debug, info, warn, error, fatal)",
- :proc => lambda { |l| l.to_sym }
+ short: "-l LEVEL",
+ long: "--log_level LEVEL",
+ description: "Set the log level (trace, debug, info, warn, error, fatal)",
+ proc: lambda { |l| l.to_sym }
option :help,
- :short => "-h",
- :long => "--help",
- :description => "Show this message",
- :on => :tail,
- :boolean => true,
- :show_options => true,
- :exit => 0
+ short: "-h",
+ long: "--help",
+ description: "Show this message",
+ on: :tail,
+ boolean: true,
+ show_options: true,
+ exit: 0
option :version,
- :short => "-v",
- :long => "--version",
- :description => "Show chef version",
- :boolean => true,
- :proc => lambda { |v| puts "Chef: #{::Chef::VERSION}" },
- :exit => 0
+ short: "-v",
+ long: "--version",
+ description: "Show chef version",
+ boolean: true,
+ proc: lambda { |v| puts "Chef: #{::Chef::VERSION}" },
+ exit: 0
option :why_run,
- :short => "-W",
- :long => "--why-run",
- :description => "Enable whyrun mode",
- :boolean => true
+ short: "-W",
+ long: "--why-run",
+ description: "Enable whyrun mode",
+ boolean: true
option :profile_ruby,
- :long => "--[no-]profile-ruby",
- :description => "Dump complete Ruby call graph stack of entire Chef run (expert only)",
- :boolean => true,
- :default => false
+ long: "--[no-]profile-ruby",
+ description: "Dump complete Ruby call graph stack of entire Chef run (expert only)",
+ boolean: true,
+ default: false
option :color,
- :long => "--[no-]color",
- :boolean => true,
- :default => true,
- :description => "Use colored output, defaults to enabled"
+ long: "--[no-]color",
+ boolean: true,
+ default: true,
+ description: "Use colored output, defaults to enabled"
option :minimal_ohai,
- :long => "--minimal-ohai",
- :description => "Only run the bare minimum ohai plugins chef needs to function",
- :boolean => true
+ long: "--minimal-ohai",
+ description: "Only run the bare minimum ohai plugins chef needs to function",
+ boolean: true
attr_reader :json_attribs
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index ffb997f187..7e376fdd9f 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -38,172 +38,171 @@ class Chef::Application::Client < Chef::Application
SELF_PIPE = []
option :config_file,
- :short => "-c CONFIG",
- :long => "--config CONFIG",
- :description => "The configuration file to use"
+ short: "-c CONFIG",
+ long: "--config CONFIG",
+ description: "The configuration file to use"
option :config_option,
- :long => "--config-option OPTION=VALUE",
- :description => "Override a single configuration option",
- :proc => lambda { |option, existing|
+ long: "--config-option OPTION=VALUE",
+ description: "Override a single configuration option",
+ proc: lambda { |option, existing|
(existing ||= []) << option
existing
}
option :formatter,
- :short => "-F FORMATTER",
- :long => "--format FORMATTER",
- :description => "output format to use",
- :proc => lambda { |format| Chef::Config.add_formatter(format) }
+ short: "-F FORMATTER",
+ long: "--format FORMATTER",
+ description: "output format to use",
+ proc: lambda { |format| Chef::Config.add_formatter(format) }
option :force_logger,
- :long => "--force-logger",
- :description => "Use logger output instead of formatter output",
- :boolean => true,
- :default => false
+ long: "--force-logger",
+ description: "Use logger output instead of formatter output",
+ boolean: true,
+ default: false
option :force_formatter,
- :long => "--force-formatter",
- :description => "Use formatter output instead of logger output",
- :boolean => true,
- :default => false
+ long: "--force-formatter",
+ description: "Use formatter output instead of logger output",
+ boolean: true,
+ default: false
option :profile_ruby,
- :long => "--[no-]profile-ruby",
- :description => "Dump complete Ruby call graph stack of entire Chef run (expert only)",
- :boolean => true,
- :default => false
+ long: "--[no-]profile-ruby",
+ description: "Dump complete Ruby call graph stack of entire Chef run (expert only)",
+ boolean: true,
+ default: false
option :color,
- :long => "--[no-]color",
- :boolean => true,
- :default => true,
- :description => "Use colored output, defaults to enabled"
+ long: "--[no-]color",
+ boolean: true,
+ default: true,
+ description: "Use colored output, defaults to enabled"
option :log_level,
- :short => "-l LEVEL",
- :long => "--log_level LEVEL",
- :description => "Set the log level (auto, trace, debug, info, warn, error, fatal)",
- :proc => lambda { |l| l.to_sym }
+ short: "-l LEVEL",
+ long: "--log_level LEVEL",
+ description: "Set the log level (auto, trace, debug, info, warn, error, fatal)",
+ proc: lambda { |l| l.to_sym }
option :log_location,
- :short => "-L LOGLOCATION",
- :long => "--logfile LOGLOCATION",
- :description => "Set the log file location, defaults to STDOUT - recommended for daemonizing",
- :proc => nil
+ short: "-L LOGLOCATION",
+ long: "--logfile LOGLOCATION",
+ description: "Set the log file location, defaults to STDOUT - recommended for daemonizing",
+ proc: nil
option :help,
- :short => "-h",
- :long => "--help",
- :description => "Show this message",
- :on => :tail,
- :boolean => true,
- :show_options => true,
- :exit => 0
+ short: "-h",
+ long: "--help",
+ description: "Show this message",
+ on: :tail,
+ boolean: true,
+ show_options: true,
+ exit: 0
option :user,
- :short => "-u USER",
- :long => "--user USER",
- :description => "User to set privilege to",
- :proc => nil
+ short: "-u USER",
+ long: "--user USER",
+ description: "User to set privilege to",
+ proc: nil
option :group,
- :short => "-g GROUP",
- :long => "--group GROUP",
- :description => "Group to set privilege to",
- :proc => nil
+ short: "-g GROUP",
+ long: "--group GROUP",
+ description: "Group to set privilege to",
+ proc: nil
unless Chef::Platform.windows?
option :daemonize,
- :short => "-d [WAIT]",
- :long => "--daemonize [WAIT]",
- :description =>
- "Daemonize the process. Accepts an optional integer which is the " \
+ short: "-d [WAIT]",
+ long: "--daemonize [WAIT]",
+ description: "Daemonize the process. Accepts an optional integer which is the " \
"number of seconds to wait before the first daemonized run.",
- :proc => lambda { |wait| wait =~ /^\d+$/ ? wait.to_i : true }
+ proc: lambda { |wait| wait =~ /^\d+$/ ? wait.to_i : true }
end
option :pid_file,
- :short => "-P PID_FILE",
- :long => "--pid PIDFILE",
- :description => "Set the PID file location, for the chef-client daemon process. Defaults to /tmp/chef-client.pid",
- :proc => nil
+ short: "-P PID_FILE",
+ long: "--pid PIDFILE",
+ description: "Set the PID file location, for the chef-client daemon process. Defaults to /tmp/chef-client.pid",
+ proc: nil
option :lockfile,
- :long => "--lockfile LOCKFILE",
- :description => "Set the lockfile location. Prevents multiple client processes from converging at the same time",
- :proc => nil
+ long: "--lockfile LOCKFILE",
+ description: "Set the lockfile location. Prevents multiple client processes from converging at the same time",
+ proc: nil
option :interval,
- :short => "-i SECONDS",
- :long => "--interval SECONDS",
- :description => "Run chef-client periodically, in seconds",
- :proc => lambda { |s| s.to_i }
+ short: "-i SECONDS",
+ long: "--interval SECONDS",
+ description: "Run chef-client periodically, in seconds",
+ proc: lambda { |s| s.to_i }
option :once,
- :long => "--once",
- :description => "Cancel any interval or splay options, run chef once and exit",
- :boolean => true
+ long: "--once",
+ description: "Cancel any interval or splay options, run chef once and exit",
+ boolean: true
option :json_attribs,
- :short => "-j JSON_ATTRIBS",
- :long => "--json-attributes JSON_ATTRIBS",
- :description => "Load attributes from a JSON file or URL",
- :proc => nil
+ short: "-j JSON_ATTRIBS",
+ long: "--json-attributes JSON_ATTRIBS",
+ description: "Load attributes from a JSON file or URL",
+ proc: nil
option :node_name,
- :short => "-N NODE_NAME",
- :long => "--node-name NODE_NAME",
- :description => "The node name for this client",
- :proc => nil
+ short: "-N NODE_NAME",
+ long: "--node-name NODE_NAME",
+ description: "The node name for this client",
+ proc: nil
option :splay,
- :short => "-s SECONDS",
- :long => "--splay SECONDS",
- :description => "The splay time for running at intervals, in seconds",
- :proc => lambda { |s| s.to_i }
+ short: "-s SECONDS",
+ long: "--splay SECONDS",
+ description: "The splay time for running at intervals, in seconds",
+ proc: lambda { |s| s.to_i }
option :chef_server_url,
- :short => "-S CHEFSERVERURL",
- :long => "--server CHEFSERVERURL",
- :description => "The chef server URL",
- :proc => nil
+ short: "-S CHEFSERVERURL",
+ long: "--server CHEFSERVERURL",
+ description: "The chef server URL",
+ proc: nil
option :validation_key,
- :short => "-K KEY_FILE",
- :long => "--validation_key KEY_FILE",
- :description => "Set the validation key file location, used for registering new clients",
- :proc => nil
+ short: "-K KEY_FILE",
+ long: "--validation_key KEY_FILE",
+ description: "Set the validation key file location, used for registering new clients",
+ proc: nil
option :client_key,
- :short => "-k KEY_FILE",
- :long => "--client_key KEY_FILE",
- :description => "Set the client key file location",
- :proc => nil
+ short: "-k KEY_FILE",
+ long: "--client_key KEY_FILE",
+ description: "Set the client key file location",
+ proc: nil
option :named_run_list,
- :short => "-n NAMED_RUN_LIST",
- :long => "--named-run-list NAMED_RUN_LIST",
- :description => "Use a policyfile's named run list instead of the default run list"
+ short: "-n NAMED_RUN_LIST",
+ long: "--named-run-list NAMED_RUN_LIST",
+ description: "Use a policyfile's named run list instead of the default run list"
option :environment,
- :short => "-E ENVIRONMENT",
- :long => "--environment ENVIRONMENT",
- :description => "Set the Chef Environment on the node"
+ short: "-E ENVIRONMENT",
+ long: "--environment ENVIRONMENT",
+ description: "Set the Chef Environment on the node"
option :version,
- :short => "-v",
- :long => "--version",
- :description => "Show chef version",
- :boolean => true,
- :proc => lambda { |v| puts "Chef: #{::Chef::VERSION}" },
- :exit => 0
+ short: "-v",
+ long: "--version",
+ description: "Show chef version",
+ boolean: true,
+ proc: lambda { |v| puts "Chef: #{::Chef::VERSION}" },
+ exit: 0
option :override_runlist,
- :short => "-o RunlistItem,RunlistItem...",
- :long => "--override-runlist RunlistItem,RunlistItem...",
- :description => "Replace current run list with specified items for a single run",
- :proc => lambda { |items|
+ short: "-o RunlistItem,RunlistItem...",
+ long: "--override-runlist RunlistItem,RunlistItem...",
+ description: "Replace current run list with specified items for a single run",
+ proc: lambda { |items|
items = items.split(",")
items.compact.map do |item|
Chef::RunList::RunListItem.new(item)
@@ -211,97 +210,97 @@ class Chef::Application::Client < Chef::Application
}
option :runlist,
- :short => "-r RunlistItem,RunlistItem...",
- :long => "--runlist RunlistItem,RunlistItem...",
- :description => "Permanently replace current run list with specified items",
- :proc => lambda { |items|
+ short: "-r RunlistItem,RunlistItem...",
+ long: "--runlist RunlistItem,RunlistItem...",
+ description: "Permanently replace current run list with specified items",
+ proc: lambda { |items|
items = items.split(",")
items.compact.map do |item|
Chef::RunList::RunListItem.new(item)
end
}
option :why_run,
- :short => "-W",
- :long => "--why-run",
- :description => "Enable whyrun mode",
- :boolean => true
+ short: "-W",
+ long: "--why-run",
+ description: "Enable whyrun mode",
+ boolean: true
option :client_fork,
- :short => "-f",
- :long => "--[no-]fork",
- :description => "Fork client"
+ short: "-f",
+ long: "--[no-]fork",
+ description: "Fork client"
option :recipe_url,
- :long => "--recipe-url=RECIPE_URL",
- :description => "Pull down a remote archive of recipes and unpack it to the cookbook cache. Only used in local mode."
+ long: "--recipe-url=RECIPE_URL",
+ description: "Pull down a remote archive of recipes and unpack it to the cookbook cache. Only used in local mode."
option :enable_reporting,
- :short => "-R",
- :long => "--enable-reporting",
- :description => "Enable reporting data collection for chef runs",
- :boolean => true
+ short: "-R",
+ long: "--enable-reporting",
+ description: "Enable reporting data collection for chef runs",
+ boolean: true
option :local_mode,
- :short => "-z",
- :long => "--local-mode",
- :description => "Point chef-client at local repository",
- :boolean => true
+ short: "-z",
+ long: "--local-mode",
+ description: "Point chef-client at local repository",
+ boolean: true
option :chef_zero_host,
- :long => "--chef-zero-host HOST",
- :description => "Host to start chef-zero on"
+ long: "--chef-zero-host HOST",
+ description: "Host to start chef-zero on"
option :chef_zero_port,
- :long => "--chef-zero-port PORT",
- :description => "Port (or port range) to start chef-zero on. Port ranges like 1000,1010 or 8889-9999 will try all given ports until one works."
+ long: "--chef-zero-port PORT",
+ description: "Port (or port range) to start chef-zero on. Port ranges like 1000,1010 or 8889-9999 will try all given ports until one works."
option :disable_config,
- :long => "--disable-config",
- :description => "Refuse to load a config file and use defaults. This is for development and not a stable API",
- :boolean => true
+ long: "--disable-config",
+ description: "Refuse to load a config file and use defaults. This is for development and not a stable API",
+ boolean: true
option :run_lock_timeout,
- :long => "--run-lock-timeout SECONDS",
- :description => "Set maximum duration to wait for another client run to finish, default is indefinitely.",
- :proc => lambda { |s| s.to_i }
+ long: "--run-lock-timeout SECONDS",
+ description: "Set maximum duration to wait for another client run to finish, default is indefinitely.",
+ proc: lambda { |s| s.to_i }
if Chef::Platform.windows?
option :fatal_windows_admin_check,
- :short => "-A",
- :long => "--fatal-windows-admin-check",
- :description => "Fail the run when chef-client doesn't have administrator privileges on Windows",
- :boolean => true
+ short: "-A",
+ long: "--fatal-windows-admin-check",
+ description: "Fail the run when chef-client doesn't have administrator privileges on Windows",
+ boolean: true
end
option :audit_mode,
- :long => "--audit-mode MODE",
- :description => "Enable audit-mode with `enabled`. Disable audit-mode with `disabled`. Skip converge and only perform audits with `audit-only`",
- :proc => lambda { |mo| mo.tr("-", "_").to_sym }
+ long: "--audit-mode MODE",
+ description: "Enable audit-mode with `enabled`. Disable audit-mode with `disabled`. Skip converge and only perform audits with `audit-only`",
+ proc: lambda { |mo| mo.tr("-", "_").to_sym }
option :minimal_ohai,
- :long => "--minimal-ohai",
- :description => "Only run the bare minimum ohai plugins chef needs to function",
- :boolean => true
+ long: "--minimal-ohai",
+ description: "Only run the bare minimum ohai plugins chef needs to function",
+ boolean: true
option :listen,
- :long => "--[no-]listen",
- :description => "Whether a local mode (-z) server binds to a port",
- :boolean => false
+ long: "--[no-]listen",
+ description: "Whether a local mode (-z) server binds to a port",
+ boolean: false
option :fips,
- :long => "--[no-]fips",
- :description => "Enable fips mode",
- :boolean => true
+ long: "--[no-]fips",
+ description: "Enable fips mode",
+ boolean: true
option :delete_entire_chef_repo,
- :long => "--delete-entire-chef-repo",
- :description => "DANGEROUS: does what it says, only useful with --recipe-url",
- :boolean => true
+ long: "--delete-entire-chef-repo",
+ description: "DANGEROUS: does what it says, only useful with --recipe-url",
+ boolean: true
option :skip_cookbook_sync,
- :long => "--[no-]skip-cookbook-sync",
- :description => "Use cached cookbooks without overwriting local differences from the server",
- :boolean => false
+ long: "--[no-]skip-cookbook-sync",
+ description: "Use cached cookbooks without overwriting local differences from the server",
+ boolean: false
IMMEDIATE_RUN_SIGNAL = "1".freeze
RECONFIGURE_SIGNAL = "H".freeze
@@ -338,7 +337,7 @@ class Chef::Application::Client < Chef::Application
else
if Chef::Config[:delete_entire_chef_repo]
Chef::Log.trace "Cleanup path #{Chef::Config.chef_repo_path} before extract recipes into it"
- FileUtils.rm_rf(recipes_path, :secure => true)
+ FileUtils.rm_rf(recipes_path, secure: true)
end
Chef::Log.trace "Creating path #{Chef::Config.chef_repo_path} to extract recipes into"
FileUtils.mkdir_p(Chef::Config.chef_repo_path)
diff --git a/lib/chef/application/knife.rb b/lib/chef/application/knife.rb
index c972e9313e..2c8d886b27 100644
--- a/lib/chef/application/knife.rb
+++ b/lib/chef/application/knife.rb
@@ -28,129 +28,129 @@ class Chef::Application::Knife < Chef::Application
banner "Usage: knife sub-command (options)"
option :config_file,
- :short => "-c CONFIG",
- :long => "--config CONFIG",
- :description => "The configuration file to use",
- :proc => lambda { |path| File.expand_path(path, Dir.pwd) }
+ short: "-c CONFIG",
+ long: "--config CONFIG",
+ description: "The configuration file to use",
+ proc: lambda { |path| File.expand_path(path, Dir.pwd) }
option :config_option,
- :long => "--config-option OPTION=VALUE",
- :description => "Override a single configuration option",
- :proc => lambda { |option, existing|
+ long: "--config-option OPTION=VALUE",
+ description: "Override a single configuration option",
+ proc: lambda { |option, existing|
(existing ||= []) << option
existing
}
verbosity_level = 0
option :verbosity,
- :short => "-V",
- :long => "--verbose",
- :description => "More verbose output. Use twice for max verbosity",
- :proc => Proc.new { verbosity_level += 1 },
- :default => 0
+ short: "-V",
+ long: "--verbose",
+ description: "More verbose output. Use twice for max verbosity",
+ proc: Proc.new { verbosity_level += 1 },
+ default: 0
option :color,
- :long => "--[no-]color",
- :boolean => true,
- :default => true,
- :description => "Use colored output, defaults to enabled"
+ long: "--[no-]color",
+ boolean: true,
+ default: true,
+ description: "Use colored output, defaults to enabled"
option :environment,
- :short => "-E ENVIRONMENT",
- :long => "--environment ENVIRONMENT",
- :description => "Set the Chef environment (except for in searches, where this will be flagrantly ignored)"
+ short: "-E ENVIRONMENT",
+ long: "--environment ENVIRONMENT",
+ description: "Set the Chef environment (except for in searches, where this will be flagrantly ignored)"
option :editor,
- :short => "-e EDITOR",
- :long => "--editor EDITOR",
- :description => "Set the editor to use for interactive commands",
- :default => ENV["EDITOR"]
+ short: "-e EDITOR",
+ long: "--editor EDITOR",
+ description: "Set the editor to use for interactive commands",
+ default: ENV["EDITOR"]
option :disable_editing,
- :short => "-d",
- :long => "--disable-editing",
- :description => "Do not open EDITOR, just accept the data as is",
- :boolean => true,
- :default => false
+ short: "-d",
+ long: "--disable-editing",
+ description: "Do not open EDITOR, just accept the data as is",
+ boolean: true,
+ default: false
option :help,
- :short => "-h",
- :long => "--help",
- :description => "Show this message",
- :on => :tail,
- :boolean => true
+ short: "-h",
+ long: "--help",
+ description: "Show this message",
+ on: :tail,
+ boolean: true
option :node_name,
- :short => "-u USER",
- :long => "--user USER",
- :description => "API Client Username"
+ short: "-u USER",
+ long: "--user USER",
+ description: "API Client Username"
option :client_key,
- :short => "-k KEY",
- :long => "--key KEY",
- :description => "API Client Key",
- :proc => lambda { |path| File.expand_path(path, Dir.pwd) }
+ short: "-k KEY",
+ long: "--key KEY",
+ description: "API Client Key",
+ proc: lambda { |path| File.expand_path(path, Dir.pwd) }
option :chef_server_url,
- :short => "-s URL",
- :long => "--server-url URL",
- :description => "Chef Server URL"
+ short: "-s URL",
+ long: "--server-url URL",
+ description: "Chef Server URL"
option :yes,
- :short => "-y",
- :long => "--yes",
- :description => "Say yes to all prompts for confirmation"
+ short: "-y",
+ long: "--yes",
+ description: "Say yes to all prompts for confirmation"
option :defaults,
- :long => "--defaults",
- :description => "Accept default values for all questions"
+ long: "--defaults",
+ description: "Accept default values for all questions"
option :print_after,
- :long => "--print-after",
- :description => "Show the data after a destructive operation"
+ long: "--print-after",
+ description: "Show the data after a destructive operation"
option :format,
- :short => "-F FORMAT",
- :long => "--format FORMAT",
- :description => "Which format to use for output",
- :default => "summary"
+ short: "-F FORMAT",
+ long: "--format FORMAT",
+ description: "Which format to use for output",
+ default: "summary"
option :local_mode,
- :short => "-z",
- :long => "--local-mode",
- :description => "Point knife commands at local repository instead of server",
- :boolean => true
+ short: "-z",
+ long: "--local-mode",
+ description: "Point knife commands at local repository instead of server",
+ boolean: true
option :chef_zero_host,
- :long => "--chef-zero-host HOST",
- :description => "Host to start chef-zero on"
+ long: "--chef-zero-host HOST",
+ description: "Host to start chef-zero on"
option :chef_zero_port,
- :long => "--chef-zero-port PORT",
- :description => "Port (or port range) to start chef-zero on. Port ranges like 1000,1010 or 8889-9999 will try all given ports until one works."
+ long: "--chef-zero-port PORT",
+ description: "Port (or port range) to start chef-zero on. Port ranges like 1000,1010 or 8889-9999 will try all given ports until one works."
option :listen,
- :long => "--[no-]listen",
- :description => "Whether a local mode (-z) server binds to a port",
- :boolean => false
+ long: "--[no-]listen",
+ description: "Whether a local mode (-z) server binds to a port",
+ boolean: false
option :version,
- :short => "-v",
- :long => "--version",
- :description => "Show chef version",
- :boolean => true,
- :proc => lambda { |v| puts "Chef: #{::Chef::VERSION}" },
- :exit => 0
+ short: "-v",
+ long: "--version",
+ description: "Show chef version",
+ boolean: true,
+ proc: lambda { |v| puts "Chef: #{::Chef::VERSION}" },
+ exit: 0
option :fips,
- :long => "--[no-]fips",
- :description => "Enable fips mode",
- :boolean => true,
- :default => nil
+ long: "--[no-]fips",
+ description: "Enable fips mode",
+ boolean: true,
+ default: nil
option :profile,
- :long => "--profile PROFILE",
- :description => "The credentials profile to select"
+ long: "--profile PROFILE",
+ description: "The credentials profile to select"
# Run knife
def run
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index 646d68182c..345cf40e65 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -35,137 +35,137 @@ class Chef::Application::Solo < Chef::Application
include ChefConfig::Mixin::DotD
option :config_file,
- :short => "-c CONFIG",
- :long => "--config CONFIG",
- :default => Chef::Config.platform_specific_path("/etc/chef/solo.rb"),
- :description => "The configuration file to use"
+ short: "-c CONFIG",
+ long: "--config CONFIG",
+ default: Chef::Config.platform_specific_path("/etc/chef/solo.rb"),
+ description: "The configuration file to use"
option :config_option,
- :long => "--config-option OPTION=VALUE",
- :description => "Override a single configuration option",
- :proc => lambda { |option, existing|
+ long: "--config-option OPTION=VALUE",
+ description: "Override a single configuration option",
+ proc: lambda { |option, existing|
(existing ||= []) << option
existing
}
option :formatter,
- :short => "-F FORMATTER",
- :long => "--format FORMATTER",
- :description => "output format to use",
- :proc => lambda { |format| Chef::Config.add_formatter(format) }
+ short: "-F FORMATTER",
+ long: "--format FORMATTER",
+ description: "output format to use",
+ proc: lambda { |format| Chef::Config.add_formatter(format) }
option :force_logger,
- :long => "--force-logger",
- :description => "Use logger output instead of formatter output",
- :boolean => true,
- :default => false
+ long: "--force-logger",
+ description: "Use logger output instead of formatter output",
+ boolean: true,
+ default: false
option :force_formatter,
- :long => "--force-formatter",
- :description => "Use formatter output instead of logger output",
- :boolean => true,
- :default => false
+ long: "--force-formatter",
+ description: "Use formatter output instead of logger output",
+ boolean: true,
+ default: false
option :profile_ruby,
- :long => "--[no-]profile-ruby",
- :description => "Dump complete Ruby call graph stack of entire Chef run (expert only)",
- :boolean => true,
- :default => false
+ long: "--[no-]profile-ruby",
+ description: "Dump complete Ruby call graph stack of entire Chef run (expert only)",
+ boolean: true,
+ default: false
option :color,
- :long => "--[no-]color",
- :boolean => true,
- :default => !Chef::Platform.windows?,
- :description => "Use colored output, defaults to enabled"
+ long: "--[no-]color",
+ boolean: true,
+ default: !Chef::Platform.windows?,
+ description: "Use colored output, defaults to enabled"
option :log_level,
- :short => "-l LEVEL",
- :long => "--log_level LEVEL",
- :description => "Set the log level (trace, debug, info, warn, error, fatal)",
- :proc => lambda { |l| l.to_sym }
+ short: "-l LEVEL",
+ long: "--log_level LEVEL",
+ description: "Set the log level (trace, debug, info, warn, error, fatal)",
+ proc: lambda { |l| l.to_sym }
option :log_location,
- :short => "-L LOGLOCATION",
- :long => "--logfile LOGLOCATION",
- :description => "Set the log file location, defaults to STDOUT",
- :proc => nil
+ short: "-L LOGLOCATION",
+ long: "--logfile LOGLOCATION",
+ description: "Set the log file location, defaults to STDOUT",
+ proc: nil
option :help,
- :short => "-h",
- :long => "--help",
- :description => "Show this message",
- :on => :tail,
- :boolean => true,
- :show_options => true,
- :exit => 0
+ short: "-h",
+ long: "--help",
+ description: "Show this message",
+ on: :tail,
+ boolean: true,
+ show_options: true,
+ exit: 0
option :user,
- :short => "-u USER",
- :long => "--user USER",
- :description => "User to set privilege to",
- :proc => nil
+ short: "-u USER",
+ long: "--user USER",
+ description: "User to set privilege to",
+ proc: nil
option :group,
- :short => "-g GROUP",
- :long => "--group GROUP",
- :description => "Group to set privilege to",
- :proc => nil
+ short: "-g GROUP",
+ long: "--group GROUP",
+ description: "Group to set privilege to",
+ proc: nil
unless Chef::Platform.windows?
option :daemonize,
- :short => "-d",
- :long => "--daemonize",
- :description => "Daemonize the process",
- :proc => lambda { |p| true }
+ short: "-d",
+ long: "--daemonize",
+ description: "Daemonize the process",
+ proc: lambda { |p| true }
end
option :lockfile,
- :long => "--lockfile LOCKFILE",
- :description => "Set the lockfile location. Prevents multiple processes from converging at the same time",
- :proc => nil
+ long: "--lockfile LOCKFILE",
+ description: "Set the lockfile location. Prevents multiple processes from converging at the same time",
+ proc: nil
option :interval,
- :short => "-i SECONDS",
- :long => "--interval SECONDS",
- :description => "Run chef-client periodically, in seconds",
- :proc => lambda { |s| s.to_i }
+ short: "-i SECONDS",
+ long: "--interval SECONDS",
+ description: "Run chef-client periodically, in seconds",
+ proc: lambda { |s| s.to_i }
option :json_attribs,
- :short => "-j JSON_ATTRIBS",
- :long => "--json-attributes JSON_ATTRIBS",
- :description => "Load attributes from a JSON file or URL",
- :proc => nil
+ short: "-j JSON_ATTRIBS",
+ long: "--json-attributes JSON_ATTRIBS",
+ description: "Load attributes from a JSON file or URL",
+ proc: nil
option :node_name,
- :short => "-N NODE_NAME",
- :long => "--node-name NODE_NAME",
- :description => "The node name for this client",
- :proc => nil
+ short: "-N NODE_NAME",
+ long: "--node-name NODE_NAME",
+ description: "The node name for this client",
+ proc: nil
option :splay,
- :short => "-s SECONDS",
- :long => "--splay SECONDS",
- :description => "The splay time for running at intervals, in seconds",
- :proc => lambda { |s| s.to_i }
+ short: "-s SECONDS",
+ long: "--splay SECONDS",
+ description: "The splay time for running at intervals, in seconds",
+ proc: lambda { |s| s.to_i }
option :recipe_url,
- :short => "-r RECIPE_URL",
- :long => "--recipe-url RECIPE_URL",
- :description => "Pull down a remote gzipped tarball of recipes and untar it to the cookbook cache."
+ short: "-r RECIPE_URL",
+ long: "--recipe-url RECIPE_URL",
+ description: "Pull down a remote gzipped tarball of recipes and untar it to the cookbook cache."
option :version,
- :short => "-v",
- :long => "--version",
- :description => "Show chef version",
- :boolean => true,
- :proc => lambda { |v| puts "Chef: #{::Chef::VERSION}" },
- :exit => 0
+ short: "-v",
+ long: "--version",
+ description: "Show chef version",
+ boolean: true,
+ proc: lambda { |v| puts "Chef: #{::Chef::VERSION}" },
+ exit: 0
option :override_runlist,
- :short => "-o RunlistItem,RunlistItem...",
- :long => "--override-runlist RunlistItem,RunlistItem...",
- :description => "Replace current run list with specified items",
- :proc => lambda { |items|
+ short: "-o RunlistItem,RunlistItem...",
+ long: "--override-runlist RunlistItem,RunlistItem...",
+ description: "Replace current run list with specified items",
+ proc: lambda { |items|
items = items.split(",")
items.compact.map do |item|
Chef::RunList::RunListItem.new(item)
@@ -173,45 +173,45 @@ class Chef::Application::Solo < Chef::Application
}
option :client_fork,
- :short => "-f",
- :long => "--[no-]fork",
- :description => "Fork client"
+ short: "-f",
+ long: "--[no-]fork",
+ description: "Fork client"
option :why_run,
- :short => "-W",
- :long => "--why-run",
- :description => "Enable whyrun mode",
- :boolean => true
+ short: "-W",
+ long: "--why-run",
+ description: "Enable whyrun mode",
+ boolean: true
option :ez,
- :long => "--ez",
- :description => "A memorial for Ezra Zygmuntowicz",
- :boolean => true
+ long: "--ez",
+ description: "A memorial for Ezra Zygmuntowicz",
+ boolean: true
option :environment,
- :short => "-E ENVIRONMENT",
- :long => "--environment ENVIRONMENT",
- :description => "Set the Chef Environment on the node"
+ short: "-E ENVIRONMENT",
+ long: "--environment ENVIRONMENT",
+ description: "Set the Chef Environment on the node"
option :run_lock_timeout,
- :long => "--run-lock-timeout SECONDS",
- :description => "Set maximum duration to wait for another client run to finish, default is indefinitely.",
- :proc => lambda { |s| s.to_i }
+ long: "--run-lock-timeout SECONDS",
+ description: "Set maximum duration to wait for another client run to finish, default is indefinitely.",
+ proc: lambda { |s| s.to_i }
option :minimal_ohai,
- :long => "--minimal-ohai",
- :description => "Only run the bare minimum ohai plugins chef needs to function",
- :boolean => true
+ long: "--minimal-ohai",
+ description: "Only run the bare minimum ohai plugins chef needs to function",
+ boolean: true
option :delete_entire_chef_repo,
- :long => "--delete-entire-chef-repo",
- :description => "DANGEROUS: does what it says, only useful with --recipe-url",
- :boolean => true
+ long: "--delete-entire-chef-repo",
+ description: "DANGEROUS: does what it says, only useful with --recipe-url",
+ boolean: true
option :solo_legacy_mode,
- :long => "--legacy-mode",
- :description => "Run chef-solo in legacy mode",
- :boolean => true
+ long: "--legacy-mode",
+ description: "Run chef-solo in legacy mode",
+ boolean: true
attr_reader :chef_client_json
@@ -273,7 +273,7 @@ class Chef::Application::Solo < Chef::Application
if Chef::Config[:delete_entire_chef_repo]
Chef::Log.trace "Cleanup path #{recipes_path} before extract recipes into it"
- FileUtils.rm_rf(recipes_path, :secure => true)
+ FileUtils.rm_rf(recipes_path, secure: true)
end
Chef::Log.trace "Creating path #{recipes_path} to extract recipes into"
FileUtils.mkdir_p(recipes_path)
diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb
index 41dcc55d70..7ebfa762df 100644
--- a/lib/chef/application/windows_service.rb
+++ b/lib/chef/application/windows_service.rb
@@ -37,27 +37,27 @@ class Chef
include Chef::Mixin::ShellOut
option :config_file,
- :short => "-c CONFIG",
- :long => "--config CONFIG",
- :default => "#{ENV['SYSTEMDRIVE']}/chef/client.rb",
- :description => ""
+ short: "-c CONFIG",
+ long: "--config CONFIG",
+ default: "#{ENV['SYSTEMDRIVE']}/chef/client.rb",
+ description: ""
option :log_location,
- :short => "-L LOGLOCATION",
- :long => "--logfile LOGLOCATION",
- :description => "Set the log file location"
+ short: "-L LOGLOCATION",
+ long: "--logfile LOGLOCATION",
+ description: "Set the log file location"
option :splay,
- :short => "-s SECONDS",
- :long => "--splay SECONDS",
- :description => "The splay time for running at intervals, in seconds",
- :proc => lambda { |s| s.to_i }
+ short: "-s SECONDS",
+ long: "--splay SECONDS",
+ description: "The splay time for running at intervals, in seconds",
+ proc: lambda { |s| s.to_i }
option :interval,
- :short => "-i SECONDS",
- :long => "--interval SECONDS",
- :description => "Set the number of seconds to wait between chef-client runs",
- :proc => lambda { |s| s.to_i }
+ short: "-i SECONDS",
+ long: "--interval SECONDS",
+ description: "Set the number of seconds to wait between chef-client runs",
+ proc: lambda { |s| s.to_i }
DEFAULT_LOG_LOCATION ||= "#{ENV['SYSTEMDRIVE']}/chef/client.log"
@@ -197,8 +197,8 @@ class Chef
result = shell_out(
"chef-client.bat #{config_params}",
- :timeout => Chef::Config[:windows_service][:watchdog_timeout],
- :logger => Chef::Log
+ timeout: Chef::Config[:windows_service][:watchdog_timeout],
+ logger: Chef::Log
)
Chef::Log.trace "#{result.stdout}"
Chef::Log.trace "#{result.stderr}"
diff --git a/lib/chef/application/windows_service_manager.rb b/lib/chef/application/windows_service_manager.rb
index 5c572bc260..bff4a7511a 100644
--- a/lib/chef/application/windows_service_manager.rb
+++ b/lib/chef/application/windows_service_manager.rb
@@ -37,38 +37,38 @@ class Chef
include Mixlib::CLI
option :action,
- :short => "-a ACTION",
- :long => "--action ACTION",
- :default => "status",
- :description => "Action to carry out on chef-service (install, uninstall, status, start, stop, pause, or resume)"
+ short: "-a ACTION",
+ long: "--action ACTION",
+ default: "status",
+ description: "Action to carry out on chef-service (install, uninstall, status, start, stop, pause, or resume)"
option :config_file,
- :short => "-c CONFIG",
- :long => "--config CONFIG",
- :default => "#{ENV['SYSTEMDRIVE']}/chef/client.rb",
- :description => "The configuration file to use for chef runs"
+ short: "-c CONFIG",
+ long: "--config CONFIG",
+ default: "#{ENV['SYSTEMDRIVE']}/chef/client.rb",
+ description: "The configuration file to use for chef runs"
option :log_location,
- :short => "-L LOGLOCATION",
- :long => "--logfile LOGLOCATION",
- :description => "Set the log file location for chef-service"
+ short: "-L LOGLOCATION",
+ long: "--logfile LOGLOCATION",
+ description: "Set the log file location for chef-service"
option :help,
- :short => "-h",
- :long => "--help",
- :description => "Show this message",
- :on => :tail,
- :boolean => true,
- :show_options => true,
- :exit => 0
+ short: "-h",
+ long: "--help",
+ description: "Show this message",
+ on: :tail,
+ boolean: true,
+ show_options: true,
+ exit: 0
option :version,
- :short => "-v",
- :long => "--version",
- :description => "Show chef version",
- :boolean => true,
- :proc => lambda { |v| puts "Chef: #{::Chef::VERSION}" },
- :exit => 0
+ short: "-v",
+ long: "--version",
+ description: "Show chef version",
+ boolean: true,
+ proc: lambda { |v| puts "Chef: #{::Chef::VERSION}" },
+ exit: 0
def initialize(service_options)
# having to call super in initialize is the most annoying
@@ -114,22 +114,22 @@ class Chef
cmd = "\"#{ruby}\" \"#{@service_file_path}\" #{opts}".gsub(File::SEPARATOR, File::ALT_SEPARATOR)
::Win32::Service.new(
- :service_name => @service_name,
- :display_name => @service_display_name,
- :description => @service_description,
+ service_name: @service_name,
+ display_name: @service_display_name,
+ description: @service_description,
# Prior to 0.8.5, win32-service creates interactive services by default,
# and we don't want that, so we need to override the service type.
- :service_type => ::Win32::Service::SERVICE_WIN32_OWN_PROCESS,
- :start_type => ::Win32::Service::SERVICE_AUTO_START,
- :binary_path_name => cmd,
- :service_start_name => @service_start_name,
- :password => @password,
- :dependencies => @dependencies
+ service_type: ::Win32::Service::SERVICE_WIN32_OWN_PROCESS,
+ start_type: ::Win32::Service::SERVICE_AUTO_START,
+ binary_path_name: cmd,
+ service_start_name: @service_start_name,
+ password: @password,
+ dependencies: @dependencies
)
unless @delayed_start.nil?
::Win32::Service.configure(
- :service_name => @service_name,
- :delayed_start => @delayed_start
+ service_name: @service_name,
+ delayed_start: @delayed_start
)
end
puts "Service '#{@service_name}' has successfully been installed."
diff --git a/lib/chef/audit/audit_event_proxy.rb b/lib/chef/audit/audit_event_proxy.rb
index e2e6ab1ede..1cb8545d28 100644
--- a/lib/chef/audit/audit_event_proxy.rb
+++ b/lib/chef/audit/audit_event_proxy.rb
@@ -79,12 +79,12 @@ class Chef
outermost_group_desc = describe_groups.shift
[outermost_group_desc, {
- :name => example.description,
- :desc => example.full_description,
- :resource_type => resource_type,
- :resource_name => resource_name,
- :context => describe_groups,
- :line_number => example.metadata[:line_number],
+ name: example.description,
+ desc: example.full_description,
+ resource_type: resource_type,
+ resource_name: resource_name,
+ context: describe_groups,
+ line_number: example.metadata[:line_number],
}]
end
diff --git a/lib/chef/audit/control_group_data.rb b/lib/chef/audit/control_group_data.rb
index 476ebe95e9..8825860023 100644
--- a/lib/chef/audit/control_group_data.rb
+++ b/lib/chef/audit/control_group_data.rb
@@ -37,11 +37,11 @@ class Chef
def to_hash
{
- :node_name => node_name,
- :run_id => run_id,
- :start_time => start_time,
- :end_time => end_time,
- :control_groups => control_groups.collect { |c| c.to_hash },
+ node_name: node_name,
+ run_id: run_id,
+ start_time: start_time,
+ end_time: end_time,
+ control_groups: control_groups.collect { |c| c.to_hash },
}
end
end
@@ -81,11 +81,11 @@ class Chef
# they appeared in the recipe
controls.sort! { |x, y| x.line_number <=> y.line_number }
h = {
- :name => name,
- :status => status,
- :number_succeeded => number_succeeded,
- :number_failed => number_failed,
- :controls => controls.collect { |c| c.to_hash },
+ name: name,
+ status: status,
+ number_succeeded: number_succeeded,
+ number_failed: number_failed,
+ controls: controls.collect { |c| c.to_hash },
}
# If there is a duplicate key, metadata will overwrite it
add_display_only_data(h).merge(metadata)
@@ -124,11 +124,11 @@ class Chef
def to_hash
h = {
- :name => name,
- :status => status,
- :details => details,
- :resource_type => resource_type,
- :resource_name => resource_name,
+ name: name,
+ status: status,
+ details: details,
+ resource_type: resource_type,
+ resource_name: resource_name,
}
h[:context] = context || []
h
diff --git a/lib/chef/audit/runner.rb b/lib/chef/audit/runner.rb
index f6fed3fc64..847d5efbd5 100644
--- a/lib/chef/audit/runner.rb
+++ b/lib/chef/audit/runner.rb
@@ -148,7 +148,7 @@ class Chef
def configure_specinfra
if Chef::Platform.windows?
Specinfra.configuration.backend = :cmd
- Specinfra.configuration.os = { :family => "windows" }
+ Specinfra.configuration.os = { family: "windows" }
else
Specinfra.configuration.backend = :exec
end
diff --git a/lib/chef/chef_fs/config.rb b/lib/chef/chef_fs/config.rb
index 0725426275..2a41fb5870 100644
--- a/lib/chef/chef_fs/config.rb
+++ b/lib/chef/chef_fs/config.rb
@@ -173,7 +173,7 @@ class Chef
def create_chef_fs
require "chef/chef_fs/file_system/chef_server/chef_server_root_dir"
- Chef::ChefFS::FileSystem::ChefServer::ChefServerRootDir.new("remote", @chef_config, :cookbook_version => @cookbook_version)
+ Chef::ChefFS::FileSystem::ChefServer::ChefServerRootDir.new("remote", @chef_config, cookbook_version: @cookbook_version)
end
def local_fs
diff --git a/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb b/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb
index 63ce71ef40..3447e3500a 100644
--- a/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb
@@ -99,7 +99,7 @@ class Chef
end
def rest
- Chef::ServerAPI.new(chef_server_url, :client_name => chef_username, :signing_key_filename => chef_private_key, :raw_output => true, :api_version => "0")
+ Chef::ServerAPI.new(chef_server_url, client_name: chef_username, signing_key_filename: chef_private_key, raw_output: true, api_version: "0")
end
def get_json(path)
@@ -107,7 +107,7 @@ class Chef
end
def chef_rest
- Chef::ServerAPI.new(chef_server_url, :client_name => chef_username, :signing_key_filename => chef_private_key, :api_version => "0")
+ Chef::ServerAPI.new(chef_server_url, client_name: chef_username, signing_key_filename: chef_private_key, api_version: "0")
end
def api_path
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
index 4e8e68e364..e0eca5f6de 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb
@@ -74,7 +74,7 @@ class Chef
def upload_cookbook(other, options)
cookbook_to_upload = other.chef_object
cookbook_to_upload.freeze_version if options[:freeze]
- uploader = Chef::CookbookUploader.new(cookbook_to_upload, :force => options[:force], :rest => chef_rest)
+ uploader = Chef::CookbookUploader.new(cookbook_to_upload, force: options[:force], rest: chef_rest)
with_actual_cookbooks_dir(other.parent.file_path) do
uploader.upload_cookbooks
diff --git a/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb b/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb
index adaffb99a7..344a3deecc 100644
--- a/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb
@@ -40,7 +40,7 @@ class Chef
end
def write(contents)
- desired_invites = minimize_value(Chef::JSONCompat.parse(contents, :create_additions => false))
+ desired_invites = minimize_value(Chef::JSONCompat.parse(contents, create_additions: false))
actual_invites = _read_json.inject({}) { |h, val| h[val["username"]] = val["id"]; h }
invites = actual_invites.keys
(desired_invites - invites).each do |invite|
diff --git a/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb b/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
index 7e9c7141c4..a780ddd97b 100644
--- a/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb
@@ -40,7 +40,7 @@ class Chef
end
def write(contents)
- desired_members = minimize_value(Chef::JSONCompat.parse(contents, :create_additions => false))
+ desired_members = minimize_value(Chef::JSONCompat.parse(contents, create_additions: false))
members = minimize_value(_read_json)
(desired_members - members).each do |member|
begin
diff --git a/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb b/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb
index 8da3718136..94c1a5b695 100644
--- a/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb
@@ -78,7 +78,7 @@ class Chef
cookbook_to_upload.freeze_version if options[:freeze]
# Instantiate a new uploader based on the proxy loader
- uploader = Chef::CookbookUploader.new(cookbook_to_upload, :force => options[:force], :rest => chef_rest)
+ uploader = Chef::CookbookUploader.new(cookbook_to_upload, force: options[:force], rest: chef_rest)
with_actual_cookbooks_dir(temp_cookbooks_path) do
uploader.upload_cookbooks
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
index b296901dd1..8e64e3ca06 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb
@@ -64,7 +64,7 @@ class Chef
def write(cookbook_path, cookbook_version_json, from_fs)
# Use the copy/diff algorithm to copy it down so we don't destroy
# chefignored data. This is terribly un-thread-safe.
- Chef::ChefFS::FileSystem.copy_to(Chef::ChefFS::FilePattern.new("/#{cookbook_path}"), from_fs, self, nil, { :purge => true })
+ Chef::ChefFS::FileSystem.copy_to(Chef::ChefFS::FilePattern.new("/#{cookbook_path}"), from_fs, self, nil, { purge: true })
# Write out .uploaded-cookbook-version.json
# cookbook_file_path = File.join(file_path, cookbook_name) <- this should be the same as self.file_path
diff --git a/lib/chef/chef_fs/knife.rb b/lib/chef/chef_fs/knife.rb
index 1731e19ce1..36445e5680 100644
--- a/lib/chef/chef_fs/knife.rb
+++ b/lib/chef/chef_fs/knife.rb
@@ -45,16 +45,16 @@ class Chef
end
option :repo_mode,
- :long => "--repo-mode MODE",
- :description => "Specifies the local repository layout. Values: static, everything, hosted_everything. Default: everything/hosted_everything"
+ long: "--repo-mode MODE",
+ description: "Specifies the local repository layout. Values: static, everything, hosted_everything. Default: everything/hosted_everything"
option :chef_repo_path,
- :long => "--chef-repo-path PATH",
- :description => "Overrides the location of chef repo. Default is specified by chef_repo_path in the config"
+ long: "--chef-repo-path PATH",
+ description: "Overrides the location of chef repo. Default is specified by chef_repo_path in the config"
option :concurrency,
- :long => "--concurrency THREADS",
- :description => "Maximum number of simultaneous requests to send (default: 10)"
+ long: "--concurrency THREADS",
+ description: "Maximum number of simultaneous requests to send (default: 10)"
def configure_chef
super
diff --git a/lib/chef/chef_fs/parallelizer.rb b/lib/chef/chef_fs/parallelizer.rb
index 32de61e048..eee555fc93 100644
--- a/lib/chef/chef_fs/parallelizer.rb
+++ b/lib/chef/chef_fs/parallelizer.rb
@@ -45,7 +45,7 @@ class Chef
end
def parallel_do(enumerable, options = {}, &block)
- ParallelEnumerable.new(@tasks, enumerable, options.merge(:ordered => false), &block).wait
+ ParallelEnumerable.new(@tasks, enumerable, options.merge(ordered: false), &block).wait
end
def stop(wait = true, timeout = nil)
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb
index b139a8d489..c864c30505 100644
--- a/lib/chef/cookbook/cookbook_version_loader.rb
+++ b/lib/chef/cookbook/cookbook_version_loader.rb
@@ -34,7 +34,7 @@ class Chef
@relative_path = /#{Regexp.escape(@cookbook_path)}\/(.+)$/
@metadata_loaded = false
@cookbook_settings = {
- :all_files => {},
+ all_files: {},
}
@metadata_filenames = []
diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb
index c378cb75b6..94604ea0d9 100644
--- a/lib/chef/cookbook/metadata.rb
+++ b/lib/chef/cookbook/metadata.rb
@@ -61,10 +61,10 @@ class Chef
:source_url, :issues_url, :privacy, :chef_versions, :ohai_versions,
:gems ]
- VERSION_CONSTRAINTS = { :depends => DEPENDENCIES,
- :provides => PROVIDING,
- :chef_version => CHEF_VERSIONS,
- :ohai_version => OHAI_VERSIONS }
+ VERSION_CONSTRAINTS = { depends: DEPENDENCIES,
+ provides: PROVIDING,
+ chef_version: CHEF_VERSIONS,
+ ohai_version: OHAI_VERSIONS }
include Chef::Mixin::ParamsValidate
include Chef::Mixin::FromFile
@@ -161,7 +161,7 @@ class Chef
set_or_return(
:maintainer,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -176,7 +176,7 @@ class Chef
set_or_return(
:maintainer_email,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -191,7 +191,7 @@ class Chef
set_or_return(
:license,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -206,7 +206,7 @@ class Chef
set_or_return(
:description,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -221,7 +221,7 @@ class Chef
set_or_return(
:long_description,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -252,7 +252,7 @@ class Chef
set_or_return(
:name,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -409,17 +409,17 @@ class Chef
validate(
options,
{
- :display_name => { :kind_of => String },
- :description => { :kind_of => String },
- :choice => { :kind_of => [ Array ], :default => [] },
- :calculated => { :equal_to => [ true, false ], :default => false },
- :type => { :equal_to => %w{string array hash symbol boolean numeric}, :default => "string" },
- :required => { :equal_to => [ "required", "recommended", "optional", true, false ], :default => "optional" },
- :recipes => { :kind_of => [ Array ], :default => [] },
- :default => { :kind_of => [ String, Array, Hash, Symbol, Numeric, TrueClass, FalseClass ] },
- :source_url => { :kind_of => String },
- :issues_url => { :kind_of => String },
- :privacy => { :kind_of => [ TrueClass, FalseClass ] },
+ display_name: { kind_of: String },
+ description: { kind_of: String },
+ choice: { kind_of: [ Array ], default: [] },
+ calculated: { equal_to: [ true, false ], default: false },
+ type: { equal_to: %w{string array hash symbol boolean numeric}, default: "string" },
+ required: { equal_to: [ "required", "recommended", "optional", true, false ], default: "optional" },
+ recipes: { kind_of: [ Array ], default: [] },
+ default: { kind_of: [ String, Array, Hash, Symbol, Numeric, TrueClass, FalseClass ] },
+ source_url: { kind_of: String },
+ issues_url: { kind_of: String },
+ privacy: { kind_of: [ TrueClass, FalseClass ] },
}
)
options[:required] = remap_required_attribute(options[:required]) unless options[:required].nil?
@@ -556,7 +556,7 @@ class Chef
set_or_return(
:source_url,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -571,7 +571,7 @@ class Chef
set_or_return(
:issues_url,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -588,7 +588,7 @@ class Chef
set_or_return(
:privacy,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
@@ -689,7 +689,7 @@ INVALID
def validate_string_array(arry)
if arry.kind_of?(Array)
arry.each do |choice|
- validate( { :choice => choice }, { :choice => { :kind_of => String } } )
+ validate( { choice: choice }, { choice: { kind_of: String } } )
end
end
end
@@ -717,7 +717,7 @@ INVALID
end
opts[:choice].each do |choice|
- validate( { :choice => choice }, { :choice => { :kind_of => validator } } )
+ validate( { choice: choice }, { choice: { kind_of: validator } } )
end
end
end
diff --git a/lib/chef/cookbook_manifest.rb b/lib/chef/cookbook_manifest.rb
index 9adcee6b78..c0c5b57a60 100644
--- a/lib/chef/cookbook_manifest.rb
+++ b/lib/chef/cookbook_manifest.rb
@@ -236,13 +236,13 @@ class Chef
csum = checksum_cookbook_file(file)
@checksums[csum] = file
rs = Mash.new({
- :name => name,
- :path => path,
- :checksum => csum,
- :specificity => specificity,
+ name: name,
+ path: path,
+ checksum: csum,
+ specificity: specificity,
# full_path is not a part of the normal manifest, but is very useful to keep around.
# uploaders should strip this out.
- :full_path => file,
+ full_path: file,
})
manifest[:all_files] << rs
diff --git a/lib/chef/cookbook_site_streaming_uploader.rb b/lib/chef/cookbook_site_streaming_uploader.rb
index e4b45532f0..8611357e1a 100644
--- a/lib/chef/cookbook_site_streaming_uploader.rb
+++ b/lib/chef/cookbook_site_streaming_uploader.rb
@@ -115,10 +115,10 @@ class Chef
content_file.rewind if content_file # we consumed the file for the above operation, so rewind it.
signing_options = {
- :http_method => http_verb,
- :path => url.path,
- :user_id => user_id,
- :timestamp => timestamp }
+ http_method: http_verb,
+ path: url.path,
+ user_id: user_id,
+ timestamp: timestamp }
(content_file && signing_options[:file] = content_file) || (signing_options[:body] = (content_body || ""))
headers.merge!(Mixlib::Authentication::SignedHeaderAuth.signing_object(signing_options).sign(secret_key))
diff --git a/lib/chef/cookbook_uploader.rb b/lib/chef/cookbook_uploader.rb
index e79a7774eb..5780c61cc9 100644
--- a/lib/chef/cookbook_uploader.rb
+++ b/lib/chef/cookbook_uploader.rb
@@ -56,7 +56,7 @@ class Chef
end
checksums = checksum_files.inject({}) { |memo, elt| memo[elt.first] = nil; memo }
- new_sandbox = rest.post("sandboxes", { :checksums => checksums })
+ new_sandbox = rest.post("sandboxes", { checksums: checksums })
Chef::Log.info("Uploading files")
@@ -83,7 +83,7 @@ class Chef
# in eventual consistency)
retries = 0
begin
- rest.put(sandbox_url, { :is_completed => true })
+ rest.put(sandbox_url, { is_completed: true })
rescue Net::HTTPServerException => e
if e.message =~ /^400/ && (retries += 1) <= 5
sleep 2
diff --git a/lib/chef/data_bag.rb b/lib/chef/data_bag.rb
index c5e2b38c94..1e23cdfb1c 100644
--- a/lib/chef/data_bag.rb
+++ b/lib/chef/data_bag.rb
@@ -54,7 +54,7 @@ class Chef
set_or_return(
:name,
arg,
- :regex => VALID_NAME
+ regex: VALID_NAME
)
end
diff --git a/lib/chef/data_bag_item.rb b/lib/chef/data_bag_item.rb
index 388da78dad..01ec4cf77e 100644
--- a/lib/chef/data_bag_item.rb
+++ b/lib/chef/data_bag_item.rb
@@ -81,7 +81,7 @@ class Chef
set_or_return(
:data_bag,
arg,
- :regex => /^[\-[:alnum:]_]+$/
+ regex: /^[\-[:alnum:]_]+$/
)
end
diff --git a/lib/chef/dsl/reboot_pending.rb b/lib/chef/dsl/reboot_pending.rb
index 2ebad7e039..1dc0a8d41b 100644
--- a/lib/chef/dsl/reboot_pending.rb
+++ b/lib/chef/dsl/reboot_pending.rb
@@ -37,7 +37,7 @@ class Chef
# due to a file being in use (usually a temporary file and a system file)
# \??\c:\temp\test.sys!\??\c:\winnt\system32\test.sys
# http://technet.microsoft.com/en-us/library/cc960241.aspx
- registry_value_exists?('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => "PendingFileRenameOperations" }) ||
+ registry_value_exists?('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { name: "PendingFileRenameOperations" }) ||
# RebootRequired key contains Update IDs with a value of 1 if they require a reboot.
# The existence of RebootRequired alone is sufficient on my Windows 8.1 workstation in Windows Update
diff --git a/lib/chef/encrypted_data_bag_item/encryptor.rb b/lib/chef/encrypted_data_bag_item/encryptor.rb
index 8d34033db6..21783503f4 100644
--- a/lib/chef/encrypted_data_bag_item/encryptor.rb
+++ b/lib/chef/encrypted_data_bag_item/encryptor.rb
@@ -123,7 +123,7 @@ class Chef::EncryptedDataBagItem
# Strings) that do not produce valid JSON when serialized without the
# wrapper.
def serialized_data
- FFI_Yajl::Encoder.encode(:json_wrapper => plaintext_data)
+ FFI_Yajl::Encoder.encode(json_wrapper: plaintext_data)
end
def self.encryptor_keys
diff --git a/lib/chef/environment.rb b/lib/chef/environment.rb
index be05b58989..61777fb7b4 100644
--- a/lib/chef/environment.rb
+++ b/lib/chef/environment.rb
@@ -57,7 +57,7 @@ class Chef
set_or_return(
:name,
arg,
- { :regex => /^[\-[:alnum:]_]+$/, :kind_of => String }
+ { regex: /^[\-[:alnum:]_]+$/, kind_of: String }
)
end
@@ -65,7 +65,7 @@ class Chef
set_or_return(
:description,
arg,
- :kind_of => String
+ kind_of: String
)
end
@@ -73,7 +73,7 @@ class Chef
set_or_return(
:default_attributes,
arg,
- :kind_of => Hash
+ kind_of: Hash
)
end
@@ -85,7 +85,7 @@ class Chef
set_or_return(
:override_attributes,
arg,
- :kind_of => Hash
+ kind_of: Hash
)
end
@@ -98,8 +98,8 @@ class Chef
:cookbook_versions,
arg,
{
- :kind_of => Hash,
- :callbacks => {
+ kind_of: Hash,
+ callbacks: {
"should be a valid set of cookbook version requirements" => lambda { |cv| Chef::Environment.validate_cookbook_versions(cv) },
},
}
@@ -108,10 +108,10 @@ class Chef
def cookbook(cookbook, version)
validate({
- :version => version,
+ version: version,
}, {
- :version => {
- :callbacks => { "should be a valid version requirement" => lambda { |v| Chef::Environment.validate_cookbook_version(v) } },
+ version: {
+ callbacks: { "should be a valid version requirement" => lambda { |v| Chef::Environment.validate_cookbook_version(v) } },
},
})
@cookbook_versions[cookbook] = version
diff --git a/lib/chef/event_loggers/windows_eventlog.rb b/lib/chef/event_loggers/windows_eventlog.rb
index 1ff87945e7..a9473ed1f6 100644
--- a/lib/chef/event_loggers/windows_eventlog.rb
+++ b/lib/chef/event_loggers/windows_eventlog.rb
@@ -47,29 +47,29 @@ class Chef
def run_start(version)
@eventlog.report_event(
- :event_type => ::Win32::EventLog::INFO_TYPE,
- :source => SOURCE,
- :event_id => RUN_START_EVENT_ID,
- :data => [version]
+ event_type: ::Win32::EventLog::INFO_TYPE,
+ source: SOURCE,
+ event_id: RUN_START_EVENT_ID,
+ data: [version]
)
end
def run_started(run_status)
@run_status = run_status
@eventlog.report_event(
- :event_type => ::Win32::EventLog::INFO_TYPE,
- :source => SOURCE,
- :event_id => RUN_STARTED_EVENT_ID,
- :data => [run_status.run_id]
+ event_type: ::Win32::EventLog::INFO_TYPE,
+ source: SOURCE,
+ event_id: RUN_STARTED_EVENT_ID,
+ data: [run_status.run_id]
)
end
def run_completed(node)
@eventlog.report_event(
- :event_type => ::Win32::EventLog::INFO_TYPE,
- :source => SOURCE,
- :event_id => RUN_COMPLETED_EVENT_ID,
- :data => [@run_status.run_id, @run_status.elapsed_time.to_s]
+ event_type: ::Win32::EventLog::INFO_TYPE,
+ source: SOURCE,
+ event_id: RUN_COMPLETED_EVENT_ID,
+ data: [@run_status.run_id, @run_status.elapsed_time.to_s]
)
end
@@ -87,10 +87,10 @@ class Chef
end
@eventlog.report_event(
- :event_type => ::Win32::EventLog::ERROR_TYPE,
- :source => SOURCE,
- :event_id => RUN_FAILED_EVENT_ID,
- :data => data + [e.class.name,
+ event_type: ::Win32::EventLog::ERROR_TYPE,
+ source: SOURCE,
+ event_id: RUN_FAILED_EVENT_ID,
+ data: data + [e.class.name,
e.message,
e.backtrace.join("\n")]
)
diff --git a/lib/chef/file_cache.rb b/lib/chef/file_cache.rb
index 8e9bb1e3e4..f1c261ecd0 100644
--- a/lib/chef/file_cache.rb
+++ b/lib/chef/file_cache.rb
@@ -42,12 +42,12 @@ class Chef
def store(path, contents, perm = 0640)
validate(
{
- :path => path,
- :contents => contents,
+ path: path,
+ contents: contents,
},
{
- :path => { :kind_of => String },
- :contents => { :kind_of => String },
+ path: { kind_of: String },
+ contents: { kind_of: String },
}
)
@@ -68,12 +68,12 @@ class Chef
def move_to(file, path)
validate(
{
- :file => file,
- :path => path,
+ file: file,
+ path: path,
},
{
- :file => { :kind_of => String },
- :path => { :kind_of => String },
+ file: { kind_of: String },
+ path: { kind_of: String },
}
)
@@ -105,10 +105,10 @@ class Chef
def load(path, read = true)
validate(
{
- :path => path,
+ path: path,
},
{
- :path => { :kind_of => String },
+ path: { kind_of: String },
}
)
cache_path = create_cache_path(path, false)
@@ -131,10 +131,10 @@ class Chef
def delete(path)
validate(
{
- :path => path,
+ path: path,
},
{
- :path => { :kind_of => String },
+ path: { kind_of: String },
}
)
cache_path = create_cache_path(path, false)
@@ -178,10 +178,10 @@ class Chef
def has_key?(path)
validate(
{
- :path => path,
+ path: path,
},
{
- :path => { :kind_of => String },
+ path: { kind_of: String },
}
)
full_path = create_cache_path(path, false)
diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb
index d47ab73a30..d498ef7c72 100644
--- a/lib/chef/formatters/doc.rb
+++ b/lib/chef/formatters/doc.rb
@@ -285,7 +285,7 @@ class Chef
indent
end
# TODO: info about notifies
- start_line "* #{resource} action #{action}", :stream => resource
+ start_line "* #{resource} action #{action}", stream: resource
indent
end
@@ -318,7 +318,7 @@ class Chef
def resource_skipped(resource, action, conditional)
@skipped_resources += 1
# TODO: more info about conditional
- puts " (skipped due to #{conditional.short_description})", :stream => resource
+ puts " (skipped due to #{conditional.short_description})", stream: resource
unindent
end
@@ -329,12 +329,12 @@ class Chef
# Called when a resource has no converge actions, e.g., it was already correct.
def resource_up_to_date(resource, action)
@up_to_date_resources += 1
- puts " (up to date)", :stream => resource
+ puts " (up to date)", stream: resource
unindent
end
def resource_bypassed(resource, action, provider)
- puts " (Skipped: whyrun not supported by provider #{provider.class.name})", :stream => resource
+ puts " (Skipped: whyrun not supported by provider #{provider.class.name})", stream: resource
unindent
end
@@ -375,7 +375,7 @@ class Chef
end
def stream_output(stream, output, options = {})
- print(output, { :stream => stream }.merge(options))
+ print(output, { stream: stream }.merge(options))
end
# Called before handlers run
diff --git a/lib/chef/formatters/indentable_output_stream.rb b/lib/chef/formatters/indentable_output_stream.rb
index e5e84e0f65..7882527327 100644
--- a/lib/chef/formatters/indentable_output_stream.rb
+++ b/lib/chef/formatters/indentable_output_stream.rb
@@ -35,19 +35,19 @@ class Chef
# cause indentation but will not move to the next line yet (future 'print'
# and 'puts' statements will stay on this line).
def start_line(string, *args)
- print(string, from_args(args, :start_line => true))
+ print(string, from_args(args, start_line: true))
end
# Print a line. This will continue from the last start_line or print,
# or start a new line and indent if necessary.
def puts(string, *args)
- print(string, from_args(args, :end_line => true))
+ print(string, from_args(args, end_line: true))
end
# Print an entire line from start to end. This will terminate any existing
# lines and cause indentation.
def puts_line(string, *args)
- print(string, from_args(args, :start_line => true, :end_line => true))
+ print(string, from_args(args, start_line: true, end_line: true))
end
# Print a raw chunk
@@ -103,7 +103,7 @@ class Chef
if colors.size == 1 && colors[0].kind_of?(Hash)
merge_options.merge(colors[0])
else
- merge_options.merge({ :colors => colors })
+ merge_options.merge({ colors: colors })
end
end
diff --git a/lib/chef/guard_interpreter/resource_guard_interpreter.rb b/lib/chef/guard_interpreter/resource_guard_interpreter.rb
index e245eab2c7..b1d497181b 100644
--- a/lib/chef/guard_interpreter/resource_guard_interpreter.rb
+++ b/lib/chef/guard_interpreter/resource_guard_interpreter.rb
@@ -42,9 +42,9 @@ class Chef
# We need to make sure we check for Script first because any resource
# that can get to here is an Execute resource.
if @resource.is_a? Chef::Resource::Script
- block_attributes = @command_opts.merge({ :code => @command })
+ block_attributes = @command_opts.merge({ code: @command })
else
- block_attributes = @command_opts.merge({ :command => @command })
+ block_attributes = @command_opts.merge({ command: @command })
end
# Handles cases like powershell_script where default
diff --git a/lib/chef/http/auth_credentials.rb b/lib/chef/http/auth_credentials.rb
index eeb9136607..e84f6a0c5b 100644
--- a/lib/chef/http/auth_credentials.rb
+++ b/lib/chef/http/auth_credentials.rb
@@ -50,7 +50,7 @@ class Chef
host = request_params.delete(:host) || "localhost"
sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(request_params)
- signed = sign_obj.sign(key, use_ssh_agent: @use_ssh_agent).merge({ :host => host })
+ signed = sign_obj.sign(key, use_ssh_agent: @use_ssh_agent).merge({ host: host })
signed.inject({}) { |memo, kv| memo["#{kv[0].to_s.upcase}"] = kv[1]; memo }
end
diff --git a/lib/chef/http/authenticator.rb b/lib/chef/http/authenticator.rb
index 8e050832f0..bfb85785c8 100644
--- a/lib/chef/http/authenticator.rb
+++ b/lib/chef/http/authenticator.rb
@@ -104,11 +104,11 @@ class Chef
def authentication_headers(method, url, json_body = nil, headers = nil)
request_params = {
- :http_method => method,
- :path => url.path,
- :body => json_body,
- :host => "#{url.host}:#{url.port}",
- :headers => headers,
+ http_method: method,
+ path: url.path,
+ body: json_body,
+ host: "#{url.host}:#{url.port}",
+ headers: headers,
}
request_params[:body] ||= ""
auth_credentials.signature_headers(request_params)
diff --git a/lib/chef/key.rb b/lib/chef/key.rb
index bf8e533d62..ef006f8ace 100644
--- a/lib/chef/key.rb
+++ b/lib/chef/key.rb
@@ -77,23 +77,23 @@ class Chef
def actor(arg = nil)
set_or_return(:actor, arg,
- :regex => /^[a-z0-9\-_]+$/)
+ regex: /^[a-z0-9\-_]+$/)
end
def name(arg = nil)
set_or_return(:name, arg,
- :kind_of => String)
+ kind_of: String)
end
def public_key(arg = nil)
raise Chef::Exceptions::InvalidKeyAttribute, "you cannot set the public_key if create_key is true" if !arg.nil? && @create_key
set_or_return(:public_key, arg,
- :kind_of => String)
+ kind_of: String)
end
def private_key(arg = nil)
set_or_return(:private_key, arg,
- :kind_of => String)
+ kind_of: String)
end
def delete_public_key
@@ -107,12 +107,12 @@ class Chef
def create_key(arg = nil)
raise Chef::Exceptions::InvalidKeyAttribute, "you cannot set create_key to true if the public_key field exists" if arg == true && !@public_key.nil?
set_or_return(:create_key, arg,
- :kind_of => [TrueClass, FalseClass])
+ kind_of: [TrueClass, FalseClass])
end
def expiration_date(arg = nil)
set_or_return(:expiration_date, arg,
- :regex => /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z|infinity)$/)
+ regex: /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z|infinity)$/)
end
def to_hash
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index 15d0f1be18..797080abe3 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -45,180 +45,180 @@ class Chef
banner "knife bootstrap [SSH_USER@]FQDN (options)"
option :ssh_user,
- :short => "-x USERNAME",
- :long => "--ssh-user USERNAME",
- :description => "The ssh username",
- :default => "root"
+ short: "-x USERNAME",
+ long: "--ssh-user USERNAME",
+ description: "The ssh username",
+ default: "root"
option :ssh_password,
- :short => "-P PASSWORD",
- :long => "--ssh-password PASSWORD",
- :description => "The ssh password"
+ short: "-P PASSWORD",
+ long: "--ssh-password PASSWORD",
+ description: "The ssh password"
option :ssh_port,
- :short => "-p PORT",
- :long => "--ssh-port PORT",
- :description => "The ssh port",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_port] = key }
+ short: "-p PORT",
+ long: "--ssh-port PORT",
+ description: "The ssh port",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_port] = key }
option :ssh_gateway,
- :short => "-G GATEWAY",
- :long => "--ssh-gateway GATEWAY",
- :description => "The ssh gateway",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key }
+ short: "-G GATEWAY",
+ long: "--ssh-gateway GATEWAY",
+ description: "The ssh gateway",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key }
option :ssh_gateway_identity,
- :long => "--ssh-gateway-identity SSH_GATEWAY_IDENTITY",
- :description => "The SSH identity file used for gateway authentication",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway_identity] = key }
+ long: "--ssh-gateway-identity SSH_GATEWAY_IDENTITY",
+ description: "The SSH identity file used for gateway authentication",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_gateway_identity] = key }
option :forward_agent,
- :short => "-A",
- :long => "--forward-agent",
- :description => "Enable SSH agent forwarding",
- :boolean => true
+ short: "-A",
+ long: "--forward-agent",
+ description: "Enable SSH agent forwarding",
+ boolean: true
option :identity_file,
- :long => "--identity-file IDENTITY_FILE",
- :description => "The SSH identity file used for authentication. [DEPRECATED] Use --ssh-identity-file instead."
+ long: "--identity-file IDENTITY_FILE",
+ description: "The SSH identity file used for authentication. [DEPRECATED] Use --ssh-identity-file instead."
option :ssh_identity_file,
- :short => "-i IDENTITY_FILE",
- :long => "--ssh-identity-file IDENTITY_FILE",
- :description => "The SSH identity file used for authentication"
+ short: "-i IDENTITY_FILE",
+ long: "--ssh-identity-file IDENTITY_FILE",
+ description: "The SSH identity file used for authentication"
option :chef_node_name,
- :short => "-N NAME",
- :long => "--node-name NAME",
- :description => "The Chef node name for your new node"
+ short: "-N NAME",
+ long: "--node-name NAME",
+ description: "The Chef node name for your new node"
option :prerelease,
- :long => "--prerelease",
- :description => "Install the pre-release chef gems"
+ long: "--prerelease",
+ description: "Install the pre-release chef gems"
option :bootstrap_version,
- :long => "--bootstrap-version VERSION",
- :description => "The version of Chef to install",
- :proc => lambda { |v| Chef::Config[:knife][:bootstrap_version] = v }
+ long: "--bootstrap-version VERSION",
+ description: "The version of Chef to install",
+ proc: lambda { |v| Chef::Config[:knife][:bootstrap_version] = v }
option :bootstrap_proxy,
- :long => "--bootstrap-proxy PROXY_URL",
- :description => "The proxy server for the node being bootstrapped",
- :proc => Proc.new { |p| Chef::Config[:knife][:bootstrap_proxy] = p }
+ long: "--bootstrap-proxy PROXY_URL",
+ description: "The proxy server for the node being bootstrapped",
+ proc: Proc.new { |p| Chef::Config[:knife][:bootstrap_proxy] = p }
option :bootstrap_proxy_user,
- :long => "--bootstrap-proxy-user PROXY_USER",
- :description => "The proxy authentication username for the node being bootstrapped"
+ long: "--bootstrap-proxy-user PROXY_USER",
+ description: "The proxy authentication username for the node being bootstrapped"
option :bootstrap_proxy_pass,
- :long => "--bootstrap-proxy-pass PROXY_PASS",
- :description => "The proxy authentication password for the node being bootstrapped"
+ long: "--bootstrap-proxy-pass PROXY_PASS",
+ description: "The proxy authentication password for the node being bootstrapped"
option :bootstrap_no_proxy,
- :long => "--bootstrap-no-proxy [NO_PROXY_URL|NO_PROXY_IP]",
- :description => "Do not proxy locations for the node being bootstrapped; this option is used internally by Opscode",
- :proc => Proc.new { |np| Chef::Config[:knife][:bootstrap_no_proxy] = np }
+ long: "--bootstrap-no-proxy [NO_PROXY_URL|NO_PROXY_IP]",
+ description: "Do not proxy locations for the node being bootstrapped; this option is used internally by Opscode",
+ proc: Proc.new { |np| Chef::Config[:knife][:bootstrap_no_proxy] = np }
option :bootstrap_template,
- :short => "-t TEMPLATE",
- :long => "--bootstrap-template TEMPLATE",
- :description => "Bootstrap Chef using a built-in or custom template. Set to the full path of an erb template or use one of the built-in templates."
+ short: "-t TEMPLATE",
+ long: "--bootstrap-template TEMPLATE",
+ description: "Bootstrap Chef using a built-in or custom template. Set to the full path of an erb template or use one of the built-in templates."
option :use_sudo,
- :long => "--sudo",
- :description => "Execute the bootstrap via sudo",
- :boolean => true
+ long: "--sudo",
+ description: "Execute the bootstrap via sudo",
+ boolean: true
option :preserve_home,
- :long => "--sudo-preserve-home",
- :description => "Preserve non-root user HOME environment variable with sudo",
- :boolean => true
+ long: "--sudo-preserve-home",
+ description: "Preserve non-root user HOME environment variable with sudo",
+ boolean: true
option :use_sudo_password,
- :long => "--use-sudo-password",
- :description => "Execute the bootstrap via sudo with password",
- :boolean => false
+ long: "--use-sudo-password",
+ description: "Execute the bootstrap via sudo with password",
+ boolean: false
option :run_list,
- :short => "-r RUN_LIST",
- :long => "--run-list RUN_LIST",
- :description => "Comma separated list of roles/recipes to apply",
- :proc => lambda { |o| o.split(/[\s,]+/) },
- :default => []
+ short: "-r RUN_LIST",
+ long: "--run-list RUN_LIST",
+ description: "Comma separated list of roles/recipes to apply",
+ proc: lambda { |o| o.split(/[\s,]+/) },
+ default: []
option :policy_name,
- :long => "--policy-name POLICY_NAME",
- :description => "Policyfile name to use (--policy-group must also be given)",
- :default => nil
+ long: "--policy-name POLICY_NAME",
+ description: "Policyfile name to use (--policy-group must also be given)",
+ default: nil
option :policy_group,
- :long => "--policy-group POLICY_GROUP",
- :description => "Policy group name to use (--policy-name must also be given)",
- :default => nil
+ long: "--policy-group POLICY_GROUP",
+ description: "Policy group name to use (--policy-name must also be given)",
+ default: nil
option :tags,
- :long => "--tags TAGS",
- :description => "Comma separated list of tags to apply to the node",
- :proc => lambda { |o| o.split(/[\s,]+/) },
- :default => []
+ long: "--tags TAGS",
+ description: "Comma separated list of tags to apply to the node",
+ proc: lambda { |o| o.split(/[\s,]+/) },
+ default: []
option :first_boot_attributes,
- :short => "-j JSON_ATTRIBS",
- :long => "--json-attributes",
- :description => "A JSON string to be added to the first run of chef-client",
- :proc => lambda { |o| Chef::JSONCompat.parse(o) },
- :default => nil
+ short: "-j JSON_ATTRIBS",
+ long: "--json-attributes",
+ description: "A JSON string to be added to the first run of chef-client",
+ proc: lambda { |o| Chef::JSONCompat.parse(o) },
+ default: nil
option :first_boot_attributes_from_file,
- :long => "--json-attribute-file FILE",
- :description => "A JSON file to be used to the first run of chef-client",
- :proc => lambda { |o| Chef::JSONCompat.parse(File.read(o)) },
- :default => nil
+ long: "--json-attribute-file FILE",
+ description: "A JSON file to be used to the first run of chef-client",
+ proc: lambda { |o| Chef::JSONCompat.parse(File.read(o)) },
+ default: nil
option :host_key_verify,
- :long => "--[no-]host-key-verify",
- :description => "Verify host key, enabled by default.",
- :boolean => true,
- :default => true
+ long: "--[no-]host-key-verify",
+ description: "Verify host key, enabled by default.",
+ boolean: true,
+ default: true
option :hint,
- :long => "--hint HINT_NAME[=HINT_FILE]",
- :description => "Specify Ohai Hint to be set on the bootstrap target. Use multiple --hint options to specify multiple hints.",
- :proc => Proc.new { |h|
+ long: "--hint HINT_NAME[=HINT_FILE]",
+ description: "Specify Ohai Hint to be set on the bootstrap target. Use multiple --hint options to specify multiple hints.",
+ proc: Proc.new { |h|
Chef::Config[:knife][:hints] ||= Hash.new
name, path = h.split("=")
Chef::Config[:knife][:hints][name] = path ? Chef::JSONCompat.parse(::File.read(path)) : Hash.new
}
option :bootstrap_url,
- :long => "--bootstrap-url URL",
- :description => "URL to a custom installation script",
- :proc => Proc.new { |u| Chef::Config[:knife][:bootstrap_url] = u }
+ long: "--bootstrap-url URL",
+ description: "URL to a custom installation script",
+ proc: Proc.new { |u| Chef::Config[:knife][:bootstrap_url] = u }
option :bootstrap_install_command,
- :long => "--bootstrap-install-command COMMANDS",
- :description => "Custom command to install chef-client",
- :proc => Proc.new { |ic| Chef::Config[:knife][:bootstrap_install_command] = ic }
+ long: "--bootstrap-install-command COMMANDS",
+ description: "Custom command to install chef-client",
+ proc: Proc.new { |ic| Chef::Config[:knife][:bootstrap_install_command] = ic }
option :bootstrap_preinstall_command,
- :long => "--bootstrap-preinstall-command COMMANDS",
- :description => "Custom commands to run before installing chef-client",
- :proc => Proc.new { |preic| Chef::Config[:knife][:bootstrap_preinstall_command] = preic }
+ long: "--bootstrap-preinstall-command COMMANDS",
+ description: "Custom commands to run before installing chef-client",
+ proc: Proc.new { |preic| Chef::Config[:knife][:bootstrap_preinstall_command] = preic }
option :bootstrap_wget_options,
- :long => "--bootstrap-wget-options OPTIONS",
- :description => "Add options to wget when installing chef-client",
- :proc => Proc.new { |wo| Chef::Config[:knife][:bootstrap_wget_options] = wo }
+ long: "--bootstrap-wget-options OPTIONS",
+ description: "Add options to wget when installing chef-client",
+ proc: Proc.new { |wo| Chef::Config[:knife][:bootstrap_wget_options] = wo }
option :bootstrap_curl_options,
- :long => "--bootstrap-curl-options OPTIONS",
- :description => "Add options to curl when install chef-client",
- :proc => Proc.new { |co| Chef::Config[:knife][:bootstrap_curl_options] = co }
+ long: "--bootstrap-curl-options OPTIONS",
+ description: "Add options to curl when install chef-client",
+ proc: Proc.new { |co| Chef::Config[:knife][:bootstrap_curl_options] = co }
option :node_ssl_verify_mode,
- :long => "--node-ssl-verify-mode [peer|none]",
- :description => "Whether or not to verify the SSL cert for all HTTPS requests.",
- :proc => Proc.new { |v|
+ long: "--node-ssl-verify-mode [peer|none]",
+ description: "Whether or not to verify the SSL cert for all HTTPS requests.",
+ proc: Proc.new { |v|
valid_values = %w{none peer}
unless valid_values.include?(v)
raise "Invalid value '#{v}' for --node-ssl-verify-mode. Valid values are: #{valid_values.join(", ")}"
@@ -227,22 +227,22 @@ class Chef
}
option :node_verify_api_cert,
- :long => "--[no-]node-verify-api-cert",
- :description => "Verify the SSL cert for HTTPS requests to the Chef server API.",
- :boolean => true
+ long: "--[no-]node-verify-api-cert",
+ description: "Verify the SSL cert for HTTPS requests to the Chef server API.",
+ boolean: true
option :bootstrap_vault_file,
- :long => "--bootstrap-vault-file VAULT_FILE",
- :description => "A JSON file with a list of vault(s) and item(s) to be updated"
+ long: "--bootstrap-vault-file VAULT_FILE",
+ description: "A JSON file with a list of vault(s) and item(s) to be updated"
option :bootstrap_vault_json,
- :long => "--bootstrap-vault-json VAULT_JSON",
- :description => "A JSON string with the vault(s) and item(s) to be updated"
+ long: "--bootstrap-vault-json VAULT_JSON",
+ description: "A JSON string with the vault(s) and item(s) to be updated"
option :bootstrap_vault_item,
- :long => "--bootstrap-vault-item VAULT_ITEM",
- :description => 'A single vault and item to update as "vault:item"',
- :proc => Proc.new { |i|
+ long: "--bootstrap-vault-item VAULT_ITEM",
+ description: 'A single vault and item to update as "vault:item"',
+ proc: Proc.new { |i|
(vault, item) = i.split(/:/)
Chef::Config[:knife][:bootstrap_vault_item] ||= {}
Chef::Config[:knife][:bootstrap_vault_item][vault] ||= []
diff --git a/lib/chef/knife/bootstrap/client_builder.rb b/lib/chef/knife/bootstrap/client_builder.rb
index cab33cd811..f5c49ab620 100644
--- a/lib/chef/knife/bootstrap/client_builder.rb
+++ b/lib/chef/knife/bootstrap/client_builder.rb
@@ -194,7 +194,7 @@ class Chef
# @return [Chef::ServerAPI] REST client using the client credentials
def client_rest
- @client_rest ||= Chef::ServerAPI.new(chef_server_url, :client_name => node_name, :signing_key_filename => client_path)
+ @client_rest ||= Chef::ServerAPI.new(chef_server_url, client_name: node_name, signing_key_filename: client_path)
end
# @return [Chef::ServerAPI] REST client using the cli user's knife credentials
diff --git a/lib/chef/knife/client_bulk_delete.rb b/lib/chef/knife/client_bulk_delete.rb
index a7fa7142c8..a5fe94681d 100644
--- a/lib/chef/knife/client_bulk_delete.rb
+++ b/lib/chef/knife/client_bulk_delete.rb
@@ -28,9 +28,9 @@ class Chef
end
option :delete_validators,
- :short => "-D",
- :long => "--delete-validators",
- :description => "Force deletion of clients if they're validators"
+ short: "-D",
+ long: "--delete-validators",
+ description: "Force deletion of clients if they're validators"
banner "knife client bulk delete REGEX (options)"
diff --git a/lib/chef/knife/client_create.rb b/lib/chef/knife/client_create.rb
index e28378cd4a..b821a8a56b 100644
--- a/lib/chef/knife/client_create.rb
+++ b/lib/chef/knife/client_create.rb
@@ -28,31 +28,31 @@ class Chef
end
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file if the server generated one."
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file if the server generated one."
option :admin,
- :short => "-a",
- :long => "--admin",
- :description => "Open Source Chef Server 11 only. Create the client as an admin.",
- :boolean => true
+ short: "-a",
+ long: "--admin",
+ description: "Open Source Chef Server 11 only. Create the client as an admin.",
+ boolean: true
option :validator,
- :long => "--validator",
- :description => "Create the client as a validator.",
- :boolean => true
+ long: "--validator",
+ description: "Create the client as a validator.",
+ boolean: true
option :public_key,
- :short => "-p FILE",
- :long => "--public-key",
- :description => "Set the initial default key for the client from a file on disk (cannot pass with --prevent-keygen)."
+ short: "-p FILE",
+ long: "--public-key",
+ description: "Set the initial default key for the client from a file on disk (cannot pass with --prevent-keygen)."
option :prevent_keygen,
- :short => "-k",
- :long => "--prevent-keygen",
- :description => "API V1 (Chef Server 12.1+) only. Prevent server from generating a default key pair for you. Cannot be passed with --public-key.",
- :boolean => true
+ short: "-k",
+ long: "--prevent-keygen",
+ description: "API V1 (Chef Server 12.1+) only. Prevent server from generating a default key pair for you. Cannot be passed with --public-key.",
+ boolean: true
banner "knife client create CLIENTNAME (options)"
diff --git a/lib/chef/knife/client_delete.rb b/lib/chef/knife/client_delete.rb
index 82b521c7d1..a043b6f731 100644
--- a/lib/chef/knife/client_delete.rb
+++ b/lib/chef/knife/client_delete.rb
@@ -28,9 +28,9 @@ class Chef
end
option :delete_validators,
- :short => "-D",
- :long => "--delete-validators",
- :description => "Force deletion of client if it's a validator"
+ short: "-D",
+ long: "--delete-validators",
+ description: "Force deletion of client if it's a validator"
banner "knife client delete [CLIENT [CLIENT]] (options)"
diff --git a/lib/chef/knife/client_list.rb b/lib/chef/knife/client_list.rb
index b17de0f3ad..794d8c9411 100644
--- a/lib/chef/knife/client_list.rb
+++ b/lib/chef/knife/client_list.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife client list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::ApiClientV1.list))
diff --git a/lib/chef/knife/client_reregister.rb b/lib/chef/knife/client_reregister.rb
index cc2b218e87..ce34884803 100644
--- a/lib/chef/knife/client_reregister.rb
+++ b/lib/chef/knife/client_reregister.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife client reregister CLIENT (options)"
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the key to a file"
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the key to a file"
def run
@client_name = @name_args[0]
diff --git a/lib/chef/knife/configure.rb b/lib/chef/knife/configure.rb
index df021826ae..fb2954c982 100644
--- a/lib/chef/knife/configure.rb
+++ b/lib/chef/knife/configure.rb
@@ -34,31 +34,31 @@ class Chef
banner "knife configure (options)"
option :repository,
- :short => "-r REPO",
- :long => "--repository REPO",
- :description => "The path to the chef-repo"
+ short: "-r REPO",
+ long: "--repository REPO",
+ description: "The path to the chef-repo"
option :initial,
- :short => "-i",
- :long => "--initial",
- :boolean => true,
- :description => "Use to create a API client, typically an administrator client on a freshly-installed server"
+ short: "-i",
+ long: "--initial",
+ boolean: true,
+ description: "Use to create a API client, typically an administrator client on a freshly-installed server"
option :admin_client_name,
- :long => "--admin-client-name NAME",
- :description => "The name of the client, typically the name of the admin client"
+ long: "--admin-client-name NAME",
+ description: "The name of the client, typically the name of the admin client"
option :admin_client_key,
- :long => "--admin-client-key PATH",
- :description => "The path to the private key used by the client, typically a file named admin.pem"
+ long: "--admin-client-key PATH",
+ description: "The path to the private key used by the client, typically a file named admin.pem"
option :validation_client_name,
- :long => "--validation-client-name NAME",
- :description => "The name of the validation client, typically a client named chef-validator"
+ long: "--validation-client-name NAME",
+ description: "The name of the validation client, typically a client named chef-validator"
option :validation_key,
- :long => "--validation-key PATH",
- :description => "The path to the validation key used by the client, typically a file named validation.pem"
+ long: "--validation-key PATH",
+ description: "The path to the validation key used by the client, typically a file named validation.pem"
def configure_chef
# We are just faking out the system so that you can do this without a key specified
@@ -112,14 +112,14 @@ EOH
def ask_user_for_config
server_name = guess_servername
- @chef_server = config[:chef_server_url] || ask_question("Please enter the chef server URL: ", :default => "https://#{server_name}/organizations/myorg")
+ @chef_server = config[:chef_server_url] || ask_question("Please enter the chef server URL: ", default: "https://#{server_name}/organizations/myorg")
if config[:initial]
- @new_client_name = config[:node_name] || ask_question("Please enter a name for the new user: ", :default => Etc.getlogin)
- @admin_client_name = config[:admin_client_name] || ask_question("Please enter the existing admin name: ", :default => "admin")
- @admin_client_key = config[:admin_client_key] || ask_question("Please enter the location of the existing admin's private key: ", :default => "/etc/chef-server/admin.pem")
+ @new_client_name = config[:node_name] || ask_question("Please enter a name for the new user: ", default: Etc.getlogin)
+ @admin_client_name = config[:admin_client_name] || ask_question("Please enter the existing admin name: ", default: "admin")
+ @admin_client_key = config[:admin_client_key] || ask_question("Please enter the location of the existing admin's private key: ", default: "/etc/chef-server/admin.pem")
@admin_client_key = File.expand_path(@admin_client_key)
else
- @new_client_name = config[:node_name] || ask_question("Please enter an existing username or clientname for the API: ", :default => Etc.getlogin)
+ @new_client_name = config[:node_name] || ask_question("Please enter an existing username or clientname for the API: ", default: Etc.getlogin)
end
@new_client_key = config[:client_key] || File.join(chef_config_path, "#{@new_client_name}.pem")
diff --git a/lib/chef/knife/cookbook_bulk_delete.rb b/lib/chef/knife/cookbook_bulk_delete.rb
index cdd1584e36..a68e8f00f4 100644
--- a/lib/chef/knife/cookbook_bulk_delete.rb
+++ b/lib/chef/knife/cookbook_bulk_delete.rb
@@ -28,7 +28,7 @@ class Chef
require "chef/cookbook_version"
end
- option :purge, :short => "-p", :long => "--purge", :boolean => true, :description => "Permanently remove files from backing data store"
+ option :purge, short: "-p", long: "--purge", boolean: true, description: "Permanently remove files from backing data store"
banner "knife cookbook bulk delete REGEX (options)"
diff --git a/lib/chef/knife/cookbook_delete.rb b/lib/chef/knife/cookbook_delete.rb
index b1bb88b388..4f2ada53cb 100644
--- a/lib/chef/knife/cookbook_delete.rb
+++ b/lib/chef/knife/cookbook_delete.rb
@@ -28,9 +28,9 @@ class Chef
require "chef/cookbook_version"
end
- option :all, :short => "-a", :long => "--all", :boolean => true, :description => "delete all versions"
+ option :all, short: "-a", long: "--all", boolean: true, description: "delete all versions"
- option :purge, :short => "-p", :long => "--purge", :boolean => true, :description => "Permanently remove files from backing data store"
+ option :purge, short: "-p", long: "--purge", boolean: true, description: "Permanently remove files from backing data store"
banner "knife cookbook delete COOKBOOK VERSION (options)"
diff --git a/lib/chef/knife/cookbook_download.rb b/lib/chef/knife/cookbook_download.rb
index 77e7aa0d09..a321d217db 100644
--- a/lib/chef/knife/cookbook_download.rb
+++ b/lib/chef/knife/cookbook_download.rb
@@ -33,21 +33,21 @@ class Chef
banner "knife cookbook download COOKBOOK [VERSION] (options)"
option :latest,
- :short => "-N",
- :long => "--latest",
- :description => "The version of the cookbook to download",
- :boolean => true
+ short: "-N",
+ long: "--latest",
+ description: "The version of the cookbook to download",
+ boolean: true
option :download_directory,
- :short => "-d DOWNLOAD_DIRECTORY",
- :long => "--dir DOWNLOAD_DIRECTORY",
- :description => "The directory to download the cookbook into",
- :default => Dir.pwd
+ short: "-d DOWNLOAD_DIRECTORY",
+ long: "--dir DOWNLOAD_DIRECTORY",
+ description: "The directory to download the cookbook into",
+ default: Dir.pwd
option :force,
- :short => "-f",
- :long => "--force",
- :description => "Force download over the download directory if it exists"
+ short: "-f",
+ long: "--force",
+ description: "Force download over the download directory if it exists"
# TODO: tim/cw: 5-23-2010: need to implement knife-side
# specificity for downloads - need to implement --platform and
diff --git a/lib/chef/knife/cookbook_list.rb b/lib/chef/knife/cookbook_list.rb
index ea81f5d286..deb36baef4 100644
--- a/lib/chef/knife/cookbook_list.rb
+++ b/lib/chef/knife/cookbook_list.rb
@@ -26,14 +26,14 @@ class Chef
banner "knife cookbook list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
option :all_versions,
- :short => "-a",
- :long => "--all",
- :description => "Show all available versions."
+ short: "-a",
+ long: "--all",
+ description: "Show all available versions."
def run
env = config[:environment]
diff --git a/lib/chef/knife/cookbook_metadata.rb b/lib/chef/knife/cookbook_metadata.rb
index babb4ac4d1..8a9c57f1c3 100644
--- a/lib/chef/knife/cookbook_metadata.rb
+++ b/lib/chef/knife/cookbook_metadata.rb
@@ -30,15 +30,15 @@ class Chef
banner "knife cookbook metadata COOKBOOK (options)"
option :cookbook_path,
- :short => "-o PATH:PATH",
- :long => "--cookbook-path PATH:PATH",
- :description => "A colon-separated path to look for cookbooks in",
- :proc => lambda { |o| o.split(":") }
+ short: "-o PATH:PATH",
+ long: "--cookbook-path PATH:PATH",
+ description: "A colon-separated path to look for cookbooks in",
+ proc: lambda { |o| o.split(":") }
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Generate metadata for all cookbooks, rather than just a single cookbook"
+ short: "-a",
+ long: "--all",
+ description: "Generate metadata for all cookbooks, rather than just a single cookbook"
def run
config[:cookbook_path] ||= Chef::Config[:cookbook_path]
diff --git a/lib/chef/knife/cookbook_show.rb b/lib/chef/knife/cookbook_show.rb
index 1d9983632d..78951d00c7 100644
--- a/lib/chef/knife/cookbook_show.rb
+++ b/lib/chef/knife/cookbook_show.rb
@@ -31,24 +31,24 @@ class Chef
banner "knife cookbook show COOKBOOK [VERSION] [PART] [FILENAME] (options)"
option :fqdn,
- :short => "-f FQDN",
- :long => "--fqdn FQDN",
- :description => "The FQDN of the host to see the file for"
+ short: "-f FQDN",
+ long: "--fqdn FQDN",
+ description: "The FQDN of the host to see the file for"
option :platform,
- :short => "-p PLATFORM",
- :long => "--platform PLATFORM",
- :description => "The platform to see the file for"
+ short: "-p PLATFORM",
+ long: "--platform PLATFORM",
+ description: "The platform to see the file for"
option :platform_version,
- :short => "-V VERSION",
- :long => "--platform-version VERSION",
- :description => "The platform version to see the file for"
+ short: "-V VERSION",
+ long: "--platform-version VERSION",
+ description: "The platform version to see the file for"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
cookbook_name, cookbook_version, segment, filename = @name_args
diff --git a/lib/chef/knife/cookbook_site_download.rb b/lib/chef/knife/cookbook_site_download.rb
index b957b0a362..ad4a2a83a2 100644
--- a/lib/chef/knife/cookbook_site_download.rb
+++ b/lib/chef/knife/cookbook_site_download.rb
@@ -30,20 +30,20 @@ class Chef
category "cookbook site"
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "The filename to write to"
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "The filename to write to"
option :force,
- :long => "--force",
- :description => "Force download deprecated version"
+ long: "--force",
+ description: "Force download deprecated version"
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
if current_cookbook_deprecated?
diff --git a/lib/chef/knife/cookbook_site_install.rb b/lib/chef/knife/cookbook_site_install.rb
index f4d692e13c..faa8c54c4b 100644
--- a/lib/chef/knife/cookbook_site_install.rb
+++ b/lib/chef/knife/cookbook_site_install.rb
@@ -35,37 +35,37 @@ class Chef
category "cookbook site"
option :no_deps,
- :short => "-D",
- :long => "--skip-dependencies",
- :boolean => true,
- :default => false,
- :description => "Skips automatic dependency installation."
+ short: "-D",
+ long: "--skip-dependencies",
+ boolean: true,
+ default: false,
+ description: "Skips automatic dependency installation."
option :cookbook_path,
- :short => "-o PATH:PATH",
- :long => "--cookbook-path PATH:PATH",
- :description => "A colon-separated path to look for cookbooks in",
- :proc => lambda { |o| o.split(":") }
+ short: "-o PATH:PATH",
+ long: "--cookbook-path PATH:PATH",
+ description: "A colon-separated path to look for cookbooks in",
+ proc: lambda { |o| o.split(":") }
option :default_branch,
- :short => "-B BRANCH",
- :long => "--branch BRANCH",
- :description => "Default branch to work with",
- :default => "master"
+ short: "-B BRANCH",
+ long: "--branch BRANCH",
+ description: "Default branch to work with",
+ default: "master"
option :use_current_branch,
- :short => "-b",
- :long => "--use-current-branch",
- :description => "Use the current branch",
- :boolean => true,
- :default => false
+ short: "-b",
+ long: "--use-current-branch",
+ description: "Use the current branch",
+ boolean: true,
+ default: false
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
attr_reader :cookbook_name
attr_reader :vendor_path
diff --git a/lib/chef/knife/cookbook_site_list.rb b/lib/chef/knife/cookbook_site_list.rb
index 3bdef8abe5..3b0b20a4df 100644
--- a/lib/chef/knife/cookbook_site_list.rb
+++ b/lib/chef/knife/cookbook_site_list.rb
@@ -26,16 +26,16 @@ class Chef
category "cookbook site"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
if config[:with_uri]
diff --git a/lib/chef/knife/cookbook_site_search.rb b/lib/chef/knife/cookbook_site_search.rb
index 0fee993f30..6a598bd22b 100644
--- a/lib/chef/knife/cookbook_site_search.rb
+++ b/lib/chef/knife/cookbook_site_search.rb
@@ -26,11 +26,11 @@ class Chef
category "cookbook site"
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
output(search_cookbook(name_args[0]))
diff --git a/lib/chef/knife/cookbook_site_share.rb b/lib/chef/knife/cookbook_site_share.rb
index 5d5b3ddcc4..144085c2a2 100644
--- a/lib/chef/knife/cookbook_site_share.rb
+++ b/lib/chef/knife/cookbook_site_share.rb
@@ -39,24 +39,24 @@ class Chef
category "cookbook site"
option :cookbook_path,
- :short => "-o PATH:PATH",
- :long => "--cookbook-path PATH:PATH",
- :description => "A colon-separated path to look for cookbooks in",
- :proc => lambda { |o| Chef::Config.cookbook_path = o.split(":") }
+ short: "-o PATH:PATH",
+ long: "--cookbook-path PATH:PATH",
+ description: "A colon-separated path to look for cookbooks in",
+ proc: lambda { |o| Chef::Config.cookbook_path = o.split(":") }
option :dry_run,
- :long => "--dry-run",
- :short => "-n",
- :boolean => true,
- :default => false,
- :description => "Don't take action, only print what files will be uploaded to Supermarket."
+ long: "--dry-run",
+ short: "-n",
+ boolean: true,
+ default: false,
+ description: "Don't take action, only print what files will be uploaded to Supermarket."
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
config[:cookbook_path] ||= Chef::Config[:cookbook_path]
@@ -81,7 +81,7 @@ class Chef
begin
Chef::Log.trace("Temp cookbook directory is #{tmp_cookbook_dir.inspect}")
ui.info("Making tarball #{cookbook_name}.tgz")
- shell_out!("#{tar_cmd} -czf #{cookbook_name}.tgz #{cookbook_name}", :cwd => tmp_cookbook_dir)
+ shell_out!("#{tar_cmd} -czf #{cookbook_name}.tgz #{cookbook_name}", cwd: tmp_cookbook_dir)
rescue => e
ui.error("Error making tarball #{cookbook_name}.tgz: #{e.message}. Increase log verbosity (-VV) for more information.")
Chef::Log.trace("\n#{e.backtrace.join("\n")}")
@@ -90,7 +90,7 @@ class Chef
if config[:dry_run]
ui.info("Not uploading #{cookbook_name}.tgz due to --dry-run flag.")
- result = shell_out!("#{tar_cmd} -tzf #{cookbook_name}.tgz", :cwd => tmp_cookbook_dir)
+ result = shell_out!("#{tar_cmd} -tzf #{cookbook_name}.tgz", cwd: tmp_cookbook_dir)
ui.info(result.stdout)
FileUtils.rm_rf tmp_cookbook_dir
return
@@ -129,8 +129,8 @@ class Chef
category_string = Chef::JSONCompat.to_json({ "category" => cookbook_category })
http_resp = Chef::CookbookSiteStreamingUploader.post(uri, user_id, user_secret_filename, {
- :tarball => File.open(cookbook_filename),
- :cookbook => category_string,
+ tarball: File.open(cookbook_filename),
+ cookbook: category_string,
})
res = Chef::JSONCompat.from_json(http_resp.body)
diff --git a/lib/chef/knife/cookbook_site_show.rb b/lib/chef/knife/cookbook_site_show.rb
index 397d0067ad..1ae242d051 100644
--- a/lib/chef/knife/cookbook_site_show.rb
+++ b/lib/chef/knife/cookbook_site_show.rb
@@ -26,11 +26,11 @@ class Chef
category "cookbook site"
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
output(format_for_display(get_cookbook_data))
diff --git a/lib/chef/knife/cookbook_site_unshare.rb b/lib/chef/knife/cookbook_site_unshare.rb
index bdabff0b94..5f24781f38 100644
--- a/lib/chef/knife/cookbook_site_unshare.rb
+++ b/lib/chef/knife/cookbook_site_unshare.rb
@@ -31,11 +31,11 @@ class Chef
category "cookbook site"
option :supermarket_site,
- :short => "-m SUPERMARKET_SITE",
- :long => "--supermarket-site SUPERMARKET_SITE",
- :description => "Supermarket Site",
- :default => "https://supermarket.chef.io",
- :proc => Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
+ short: "-m SUPERMARKET_SITE",
+ long: "--supermarket-site SUPERMARKET_SITE",
+ description: "Supermarket Site",
+ default: "https://supermarket.chef.io",
+ proc: Proc.new { |supermarket| Chef::Config[:knife][:supermarket_site] = supermarket }
def run
@cookbook_name = @name_args[0]
diff --git a/lib/chef/knife/cookbook_test.rb b/lib/chef/knife/cookbook_test.rb
index b4adf6c84f..2f600bf964 100644
--- a/lib/chef/knife/cookbook_test.rb
+++ b/lib/chef/knife/cookbook_test.rb
@@ -32,15 +32,15 @@ class Chef
banner "knife cookbook test [COOKBOOKS...] (options)"
option :cookbook_path,
- :short => "-o PATH:PATH",
- :long => "--cookbook-path PATH:PATH",
- :description => "A colon-separated path to look for cookbooks in",
- :proc => lambda { |o| o.split(":") }
+ short: "-o PATH:PATH",
+ long: "--cookbook-path PATH:PATH",
+ description: "A colon-separated path to look for cookbooks in",
+ proc: lambda { |o| o.split(":") }
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Test all cookbooks, rather than just a single cookbook"
+ short: "-a",
+ long: "--all",
+ description: "Test all cookbooks, rather than just a single cookbook"
def run
ui.warn("DEPRECATED: Please use ChefSpec or Cookstyle to syntax-check cookbooks.")
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb
index f67a26dc9a..241eb03862 100644
--- a/lib/chef/knife/cookbook_upload.rb
+++ b/lib/chef/knife/cookbook_upload.rb
@@ -37,42 +37,42 @@ class Chef
banner "knife cookbook upload [COOKBOOKS...] (options)"
option :cookbook_path,
- :short => "-o PATH:PATH",
- :long => "--cookbook-path PATH:PATH",
- :description => "A colon-separated path to look for cookbooks in",
- :proc => lambda { |o| o.split(":") }
+ short: "-o PATH:PATH",
+ long: "--cookbook-path PATH:PATH",
+ description: "A colon-separated path to look for cookbooks in",
+ proc: lambda { |o| o.split(":") }
option :freeze,
- :long => "--freeze",
- :description => "Freeze this version of the cookbook so that it cannot be overwritten",
- :boolean => true
+ long: "--freeze",
+ description: "Freeze this version of the cookbook so that it cannot be overwritten",
+ boolean: true
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Upload all cookbooks, rather than just a single cookbook"
+ short: "-a",
+ long: "--all",
+ description: "Upload all cookbooks, rather than just a single cookbook"
option :force,
- :long => "--force",
- :boolean => true,
- :description => "Update cookbook versions even if they have been frozen"
+ long: "--force",
+ boolean: true,
+ description: "Update cookbook versions even if they have been frozen"
option :concurrency,
- :long => "--concurrency NUMBER_OF_THREADS",
- :description => "How many concurrent threads will be used",
- :default => 10,
- :proc => lambda { |o| o.to_i }
+ long: "--concurrency NUMBER_OF_THREADS",
+ description: "How many concurrent threads will be used",
+ default: 10,
+ proc: lambda { |o| o.to_i }
option :environment,
- :short => "-E",
- :long => "--environment ENVIRONMENT",
- :description => "Set ENVIRONMENT's version dependency match the version you're uploading.",
- :default => nil
+ short: "-E",
+ long: "--environment ENVIRONMENT",
+ description: "Set ENVIRONMENT's version dependency match the version you're uploading.",
+ default: nil
option :depends,
- :short => "-d",
- :long => "--include-dependencies",
- :description => "Also upload cookbook dependencies"
+ short: "-d",
+ long: "--include-dependencies",
+ description: "Also upload cookbook dependencies"
def run
# Sanity check before we load anything from the server
@@ -242,7 +242,7 @@ WARNING
check_for_broken_links!(cb)
check_for_dependencies!(cb)
end
- Chef::CookbookUploader.new(cookbooks, :force => config[:force], :concurrency => config[:concurrency]).upload_cookbooks
+ Chef::CookbookUploader.new(cookbooks, force: config[:force], concurrency: config[:concurrency]).upload_cookbooks
rescue Chef::Exceptions::CookbookFrozen => e
ui.error e
raise
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb
index deb7f8a3b4..17d62f597f 100644
--- a/lib/chef/knife/core/bootstrap_context.rb
+++ b/lib/chef/knife/core/bootstrap_context.rb
@@ -228,7 +228,7 @@ validation_client_name "#{@chef_config[:validation_client_name]}"
end
attributes.delete(:run_list) if attributes[:policy_name] && !attributes[:policy_name].empty?
- attributes.merge!(:tags => @config[:tags]) if @config[:tags] && !@config[:tags].empty?
+ attributes.merge!(tags: @config[:tags]) if @config[:tags] && !@config[:tags].empty?
end
end
diff --git a/lib/chef/knife/core/cookbook_scm_repo.rb b/lib/chef/knife/core/cookbook_scm_repo.rb
index 38f432e5bb..f583f0bd8e 100644
--- a/lib/chef/knife/core/cookbook_scm_repo.rb
+++ b/lib/chef/knife/core/cookbook_scm_repo.rb
@@ -151,7 +151,7 @@ class Chef
end
def git(command)
- shell_out!("git #{command}", :cwd => repo_path)
+ shell_out!("git #{command}", cwd: repo_path)
end
end
diff --git a/lib/chef/knife/core/generic_presenter.rb b/lib/chef/knife/core/generic_presenter.rb
index 861bf1510d..7b3fee00b5 100644
--- a/lib/chef/knife/core/generic_presenter.rb
+++ b/lib/chef/knife/core/generic_presenter.rb
@@ -29,15 +29,15 @@ class Chef
def self.included(includer)
includer.class_eval do
option :field_separator,
- :short => "-S SEPARATOR",
- :long => "--field-separator SEPARATOR",
- :description => "Character separator used to delineate nesting in --attribute filters (default \".\")"
+ short: "-S SEPARATOR",
+ long: "--field-separator SEPARATOR",
+ description: "Character separator used to delineate nesting in --attribute filters (default \".\")"
option :attribute,
- :short => "-a ATTR1 [-a ATTR2]",
- :long => "--attribute ATTR1 [--attribute ATTR2] ",
- :description => "Show one or more attributes",
- :proc => Proc.new { |a|
+ short: "-a ATTR1 [-a ATTR2]",
+ long: "--attribute ATTR1 [--attribute ATTR2] ",
+ description: "Show one or more attributes",
+ proc: Proc.new { |a|
Chef::Config[:knife][:attribute] ||= []
Chef::Config[:knife][:attribute].push(a)
}
diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb
index cdb664ec33..0c00601981 100644
--- a/lib/chef/knife/core/node_presenter.rb
+++ b/lib/chef/knife/core/node_presenter.rb
@@ -32,18 +32,18 @@ class Chef
def self.included(includer)
includer.class_eval do
option :medium_output,
- :short => "-m",
- :long => "--medium",
- :boolean => true,
- :default => false,
- :description => "Include normal attributes in the output"
+ short: "-m",
+ long: "--medium",
+ boolean: true,
+ default: false,
+ description: "Include normal attributes in the output"
option :long_output,
- :short => "-l",
- :long => "--long",
- :boolean => true,
- :default => false,
- :description => "Include all attributes in the output"
+ short: "-l",
+ long: "--long",
+ boolean: true,
+ default: false,
+ description: "Include all attributes in the output"
end
end
end
diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb
index 1e2d9b41b6..4bb27d1277 100644
--- a/lib/chef/knife/core/status_presenter.rb
+++ b/lib/chef/knife/core/status_presenter.rb
@@ -32,18 +32,18 @@ class Chef
def self.included(includer)
includer.class_eval do
option :medium_output,
- :short => "-m",
- :long => "--medium",
- :boolean => true,
- :default => false,
- :description => "Include normal attributes in the output"
+ short: "-m",
+ long: "--medium",
+ boolean: true,
+ default: false,
+ description: "Include normal attributes in the output"
option :long_output,
- :short => "-l",
- :long => "--long",
- :boolean => true,
- :default => false,
- :description => "Include all attributes in the output"
+ short: "-l",
+ long: "--long",
+ boolean: true,
+ default: false,
+ description: "Include all attributes in the output"
end
end
end
diff --git a/lib/chef/knife/data_bag_from_file.rb b/lib/chef/knife/data_bag_from_file.rb
index 30b9de3386..3e8d3b6f59 100644
--- a/lib/chef/knife/data_bag_from_file.rb
+++ b/lib/chef/knife/data_bag_from_file.rb
@@ -38,9 +38,9 @@ class Chef
category "data bag"
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Upload all data bags or all items for specified data bags"
+ short: "-a",
+ long: "--all",
+ description: "Upload all data bags or all items for specified data bags"
def loader
@loader ||= Knife::Core::ObjectLoader.new(DataBagItem, ui)
diff --git a/lib/chef/knife/data_bag_list.rb b/lib/chef/knife/data_bag_list.rb
index d507925ec8..454b0a4908 100644
--- a/lib/chef/knife/data_bag_list.rb
+++ b/lib/chef/knife/data_bag_list.rb
@@ -30,9 +30,9 @@ class Chef
category "data bag"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::DataBag.list))
diff --git a/lib/chef/knife/data_bag_secret_options.rb b/lib/chef/knife/data_bag_secret_options.rb
index a612004e15..62a3e71ec5 100644
--- a/lib/chef/knife/data_bag_secret_options.rb
+++ b/lib/chef/knife/data_bag_secret_options.rb
@@ -35,23 +35,23 @@ class Chef
def self.included(base)
base.option :secret,
- :short => "-s SECRET",
- :long => "--secret ",
- :description => "The secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret'",
+ short: "-s SECRET",
+ long: "--secret ",
+ description: "The secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret'",
# Need to store value from command line in separate variable - knife#merge_configs populates same keys
# on config object from
- :proc => Proc.new { |s| set_cl_secret(s) }
+ proc: Proc.new { |s| set_cl_secret(s) }
base.option :secret_file,
- :long => "--secret-file SECRET_FILE",
- :description => "A file containing the secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret_file'",
- :proc => Proc.new { |sf| set_cl_secret_file(sf) }
+ long: "--secret-file SECRET_FILE",
+ description: "A file containing the secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret_file'",
+ proc: Proc.new { |sf| set_cl_secret_file(sf) }
base.option :encrypt,
- :long => "--encrypt",
- :description => "If 'secret' or 'secret_file' is present in your config, then encrypt data bags using it",
- :boolean => true,
- :default => false
+ long: "--encrypt",
+ description: "If 'secret' or 'secret_file' is present in your config, then encrypt data bags using it",
+ boolean: true,
+ default: false
end
def encryption_secret_provided?
diff --git a/lib/chef/knife/delete.rb b/lib/chef/knife/delete.rb
index 19f75df012..1c05fba3cf 100644
--- a/lib/chef/knife/delete.rb
+++ b/lib/chef/knife/delete.rb
@@ -28,21 +28,21 @@ class Chef
end
option :recurse,
- :short => "-r",
- :long => "--[no-]recurse",
- :boolean => true,
- :default => false,
- :description => "Delete directories recursively."
+ short: "-r",
+ long: "--[no-]recurse",
+ boolean: true,
+ default: false,
+ description: "Delete directories recursively."
option :both,
- :long => "--both",
- :boolean => true,
- :default => false,
- :description => "Delete both the local and remote copies."
+ long: "--both",
+ boolean: true,
+ default: false,
+ description: "Delete both the local and remote copies."
option :local,
- :long => "--local",
- :boolean => true,
- :default => false,
- :description => "Delete the local copy (leave the remote copy)."
+ long: "--local",
+ boolean: true,
+ default: false,
+ description: "Delete the local copy (leave the remote copy)."
def run
if name_args.length == 0
diff --git a/lib/chef/knife/deps.rb b/lib/chef/knife/deps.rb
index fb2a8bb40f..4cb77eea46 100644
--- a/lib/chef/knife/deps.rb
+++ b/lib/chef/knife/deps.rb
@@ -29,17 +29,17 @@ class Chef
end
option :recurse,
- :long => "--[no-]recurse",
- :boolean => true,
- :description => "List dependencies recursively (default: true). Only works with --tree."
+ long: "--[no-]recurse",
+ boolean: true,
+ description: "List dependencies recursively (default: true). Only works with --tree."
option :tree,
- :long => "--tree",
- :boolean => true,
- :description => "Show dependencies in a visual tree. May show duplicates."
+ long: "--tree",
+ boolean: true,
+ description: "Show dependencies in a visual tree. May show duplicates."
option :remote,
- :long => "--remote",
- :boolean => true,
- :description => "List dependencies on the server instead of the local filesystem"
+ long: "--remote",
+ boolean: true,
+ description: "List dependencies on the server instead of the local filesystem"
attr_accessor :exit_code
diff --git a/lib/chef/knife/diff.rb b/lib/chef/knife/diff.rb
index a14335c296..aac42ed5c5 100644
--- a/lib/chef/knife/diff.rb
+++ b/lib/chef/knife/diff.rb
@@ -28,29 +28,29 @@ class Chef
end
option :recurse,
- :long => "--[no-]recurse",
- :boolean => true,
- :default => true,
- :description => "List directories recursively."
+ long: "--[no-]recurse",
+ boolean: true,
+ default: true,
+ description: "List directories recursively."
option :name_only,
- :long => "--name-only",
- :boolean => true,
- :description => "Only show names of modified files."
+ long: "--name-only",
+ boolean: true,
+ description: "Only show names of modified files."
option :name_status,
- :long => "--name-status",
- :boolean => true,
- :description => "Only show names and statuses of modified files: Added, Deleted, Modified, and Type Changed."
+ long: "--name-status",
+ boolean: true,
+ description: "Only show names and statuses of modified files: Added, Deleted, Modified, and Type Changed."
option :diff_filter,
- :long => "--diff-filter=[(A|D|M|T)...[*]]",
- :description => "Select only files that are Added (A), Deleted (D), Modified (M), or have their type (i.e. regular file, directory) changed (T). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if
+ long: "--diff-filter=[(A|D|M|T)...[*]]",
+ description: "Select only files that are Added (A), Deleted (D), Modified (M), or have their type (i.e. regular file, directory) changed (T). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if
there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected."
option :cookbook_version,
- :long => "--cookbook-version VERSION",
- :description => "Version of cookbook to download (if there are multiple versions and cookbook_versions is false)"
+ long: "--cookbook-version VERSION",
+ description: "Version of cookbook to download (if there are multiple versions and cookbook_versions is false)"
def run
if config[:name_only]
diff --git a/lib/chef/knife/download.rb b/lib/chef/knife/download.rb
index 942d17d330..f1dfd13326 100644
--- a/lib/chef/knife/download.rb
+++ b/lib/chef/knife/download.rb
@@ -28,39 +28,39 @@ class Chef
end
option :recurse,
- :long => "--[no-]recurse",
- :boolean => true,
- :default => true,
- :description => "List directories recursively."
+ long: "--[no-]recurse",
+ boolean: true,
+ default: true,
+ description: "List directories recursively."
option :purge,
- :long => "--[no-]purge",
- :boolean => true,
- :default => false,
- :description => "Delete matching local files and directories that do not exist remotely."
+ long: "--[no-]purge",
+ boolean: true,
+ default: false,
+ description: "Delete matching local files and directories that do not exist remotely."
option :force,
- :long => "--[no-]force",
- :boolean => true,
- :default => false,
- :description => "Force upload of files even if they match (quicker and harmless, but doesn't print out what it changed)"
+ long: "--[no-]force",
+ boolean: true,
+ default: false,
+ description: "Force upload of files even if they match (quicker and harmless, but doesn't print out what it changed)"
option :dry_run,
- :long => "--dry-run",
- :short => "-n",
- :boolean => true,
- :default => false,
- :description => "Don't take action, only print what would happen"
+ long: "--dry-run",
+ short: "-n",
+ boolean: true,
+ default: false,
+ description: "Don't take action, only print what would happen"
option :diff,
- :long => "--[no-]diff",
- :boolean => true,
- :default => true,
- :description => "Turn off to avoid uploading existing files; only new (and possibly deleted) files with --no-diff"
+ long: "--[no-]diff",
+ boolean: true,
+ default: true,
+ description: "Turn off to avoid uploading existing files; only new (and possibly deleted) files with --no-diff"
option :cookbook_version,
- :long => "--cookbook-version VERSION",
- :description => "Version of cookbook to download (if there are multiple versions and cookbook_versions is false)"
+ long: "--cookbook-version VERSION",
+ description: "Version of cookbook to download (if there are multiple versions and cookbook_versions is false)"
def run
if name_args.length == 0
diff --git a/lib/chef/knife/edit.rb b/lib/chef/knife/edit.rb
index 597b284356..e150babc31 100644
--- a/lib/chef/knife/edit.rb
+++ b/lib/chef/knife/edit.rb
@@ -29,9 +29,9 @@ class Chef
end
option :local,
- :long => "--local",
- :boolean => true,
- :description => "Show local files instead of remote"
+ long: "--local",
+ boolean: true,
+ description: "Show local files instead of remote"
def run
# Get the matches (recursively)
diff --git a/lib/chef/knife/environment_compare.rb b/lib/chef/knife/environment_compare.rb
index 9131f06068..1395db3f34 100644
--- a/lib/chef/knife/environment_compare.rb
+++ b/lib/chef/knife/environment_compare.rb
@@ -29,16 +29,16 @@ class Chef
banner "knife environment compare [ENVIRONMENT..] (options)"
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Show all cookbooks",
- :boolean => true
+ short: "-a",
+ long: "--all",
+ description: "Show all cookbooks",
+ boolean: true
option :mismatch,
- :short => "-m",
- :long => "--mismatch",
- :description => "Only show mismatching versions",
- :boolean => true
+ short: "-m",
+ long: "--mismatch",
+ description: "Only show mismatching versions",
+ boolean: true
def run
# Get the commandline environments or all if none are provided.
diff --git a/lib/chef/knife/environment_create.rb b/lib/chef/knife/environment_create.rb
index cfc1bc268c..e533a70172 100644
--- a/lib/chef/knife/environment_create.rb
+++ b/lib/chef/knife/environment_create.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife environment create ENVIRONMENT (options)"
option :description,
- :short => "-d DESCRIPTION",
- :long => "--description DESCRIPTION",
- :description => "The environment description"
+ short: "-d DESCRIPTION",
+ long: "--description DESCRIPTION",
+ description: "The environment description"
def run
env_name = @name_args[0]
diff --git a/lib/chef/knife/environment_from_file.rb b/lib/chef/knife/environment_from_file.rb
index b16c3331bd..6e22e8b0f6 100644
--- a/lib/chef/knife/environment_from_file.rb
+++ b/lib/chef/knife/environment_from_file.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife environment from file FILE [FILE..] (options)"
option :all,
- :short => "-a",
- :long => "--all",
- :description => "Upload all environments"
+ short: "-a",
+ long: "--all",
+ description: "Upload all environments"
def loader
@loader ||= Knife::Core::ObjectLoader.new(Chef::Environment, ui)
diff --git a/lib/chef/knife/environment_list.rb b/lib/chef/knife/environment_list.rb
index f278046bf9..c3f2ef2e39 100644
--- a/lib/chef/knife/environment_list.rb
+++ b/lib/chef/knife/environment_list.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife environment list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::Environment.list))
diff --git a/lib/chef/knife/exec.rb b/lib/chef/knife/exec.rb
index 7b27a51b85..ed7101c0cc 100644
--- a/lib/chef/knife/exec.rb
+++ b/lib/chef/knife/exec.rb
@@ -24,15 +24,15 @@ class Chef::Knife::Exec < Chef::Knife
banner "knife exec [SCRIPT] (options)"
option :exec,
- :short => "-E CODE",
- :long => "--exec CODE",
- :description => "a string of Chef code to execute"
+ short: "-E CODE",
+ long: "--exec CODE",
+ description: "a string of Chef code to execute"
option :script_path,
- :short => "-p PATH:PATH",
- :long => "--script-path PATH:PATH",
- :description => "A colon-separated path to look for scripts in",
- :proc => lambda { |o| o.split(":") }
+ short: "-p PATH:PATH",
+ long: "--script-path PATH:PATH",
+ description: "A colon-separated path to look for scripts in",
+ proc: lambda { |o| o.split(":") }
deps do
require "chef/shell/ext"
diff --git a/lib/chef/knife/key_create_base.rb b/lib/chef/knife/key_create_base.rb
index d02d5ee180..d69f442e71 100644
--- a/lib/chef/knife/key_create_base.rb
+++ b/lib/chef/knife/key_create_base.rb
@@ -25,24 +25,24 @@ class Chef
def self.included(includer)
includer.class_eval do
option :public_key,
- :short => "-p FILENAME",
- :long => "--public-key FILENAME",
- :description => "Public key for newly created key. If not passed, the server will create a key pair for you, but you must pass --key-name NAME in that case."
+ short: "-p FILENAME",
+ long: "--public-key FILENAME",
+ description: "Public key for newly created key. If not passed, the server will create a key pair for you, but you must pass --key-name NAME in that case."
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file, if you requested the server to create one."
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file, if you requested the server to create one."
option :key_name,
- :short => "-k NAME",
- :long => "--key-name NAME",
- :description => "The name for your key. If you do not pass a name, you must pass --public-key, and the name will default to the fingerprint of the public key passed."
+ short: "-k NAME",
+ long: "--key-name NAME",
+ description: "The name for your key. If you do not pass a name, you must pass --public-key, and the name will default to the fingerprint of the public key passed."
option :expiration_date,
- :short => "-e DATE",
- :long => "--expiration-date DATE",
- :description => "Optionally pass the expiration date for the key in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z. Defaults to infinity if not passed. UTC timezone assumed."
+ short: "-e DATE",
+ long: "--expiration-date DATE",
+ description: "Optionally pass the expiration date for the key in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z. Defaults to infinity if not passed. UTC timezone assumed."
end
end
end
diff --git a/lib/chef/knife/key_edit_base.rb b/lib/chef/knife/key_edit_base.rb
index 1a613ef1bc..ecdb4b0038 100644
--- a/lib/chef/knife/key_edit_base.rb
+++ b/lib/chef/knife/key_edit_base.rb
@@ -25,29 +25,29 @@ class Chef
def self.included(includer)
includer.class_eval do
option :public_key,
- :short => "-p FILENAME",
- :long => "--public-key FILENAME",
- :description => "Replace the public_key field from a file on disk. If not passed, the public_key field will not change."
+ short: "-p FILENAME",
+ long: "--public-key FILENAME",
+ description: "Replace the public_key field from a file on disk. If not passed, the public_key field will not change."
option :create_key,
- :short => "-c",
- :long => "--create-key",
- :description => "Replace the public_key field with a key generated by the server. The private key will be returned."
+ short: "-c",
+ long: "--create-key",
+ description: "Replace the public_key field with a key generated by the server. The private key will be returned."
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file, if you requested the server to create one via --create-key."
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file, if you requested the server to create one via --create-key."
option :key_name,
- :short => "-k NAME",
- :long => "--key-name NAME",
- :description => "The new name for your key. Pass if you wish to update the name field of your key."
+ short: "-k NAME",
+ long: "--key-name NAME",
+ description: "The new name for your key. Pass if you wish to update the name field of your key."
option :expiration_date,
- :short => "-e DATE",
- :long => "--expiration-date DATE",
- :description => "Updates the expiration_date field of your key if passed. Pass in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z or infinity. UTC timezone assumed."
+ short: "-e DATE",
+ long: "--expiration-date DATE",
+ description: "Updates the expiration_date field of your key if passed. Pass in ISO 8601 fomatted string: YYYY-MM-DDTHH:MM:SSZ e.g. 2013-12-24T21:00:00Z or infinity. UTC timezone assumed."
end
end
end
diff --git a/lib/chef/knife/key_list_base.rb b/lib/chef/knife/key_list_base.rb
index 95858e9ba1..6470bf78ad 100644
--- a/lib/chef/knife/key_list_base.rb
+++ b/lib/chef/knife/key_list_base.rb
@@ -25,19 +25,19 @@ class Chef
def self.included(includer)
includer.class_eval do
option :with_details,
- :short => "-w",
- :long => "--with-details",
- :description => "Show corresponding URIs and whether the key has expired or not."
+ short: "-w",
+ long: "--with-details",
+ description: "Show corresponding URIs and whether the key has expired or not."
option :only_expired,
- :short => "-e",
- :long => "--only-expired",
- :description => "Only show expired keys."
+ short: "-e",
+ long: "--only-expired",
+ description: "Only show expired keys."
option :only_non_expired,
- :short => "-n",
- :long => "--only-non-expired",
- :description => "Only show non-expired keys."
+ short: "-n",
+ long: "--only-non-expired",
+ description: "Only show non-expired keys."
end
end
end
diff --git a/lib/chef/knife/list.rb b/lib/chef/knife/list.rb
index 7dc91d7266..9452478ddb 100644
--- a/lib/chef/knife/list.rb
+++ b/lib/chef/knife/list.rb
@@ -29,30 +29,30 @@ class Chef
end
option :recursive,
- :short => "-R",
- :boolean => true,
- :description => "List directories recursively"
+ short: "-R",
+ boolean: true,
+ description: "List directories recursively"
option :bare_directories,
- :short => "-d",
- :boolean => true,
- :description => "When directories match the pattern, do not show the directories' children"
+ short: "-d",
+ boolean: true,
+ description: "When directories match the pattern, do not show the directories' children"
option :local,
- :long => "--local",
- :boolean => true,
- :description => "List local directory instead of remote"
+ long: "--local",
+ boolean: true,
+ description: "List local directory instead of remote"
option :flat,
- :short => "-f",
- :long => "--flat",
- :boolean => true,
- :description => "Show a list of filenames rather than the prettified ls-like output normally produced"
+ short: "-f",
+ long: "--flat",
+ boolean: true,
+ description: "Show a list of filenames rather than the prettified ls-like output normally produced"
option :one_column,
- :short => "-1",
- :boolean => true,
- :description => "Show only one column of results"
+ short: "-1",
+ boolean: true,
+ description: "Show only one column of results"
option :trailing_slashes,
- :short => "-p",
- :boolean => true,
- :description => "Show trailing slashes after directories"
+ short: "-p",
+ boolean: true,
+ description: "Show trailing slashes after directories"
attr_accessor :exit_code
diff --git a/lib/chef/knife/node_edit.rb b/lib/chef/knife/node_edit.rb
index 4632c0a5b4..7551a8a7da 100644
--- a/lib/chef/knife/node_edit.rb
+++ b/lib/chef/knife/node_edit.rb
@@ -32,10 +32,10 @@ class Chef
banner "knife node edit NODE (options)"
option :all_attributes,
- :short => "-a",
- :long => "--all",
- :boolean => true,
- :description => "Display all attributes when editing"
+ short: "-a",
+ long: "--all",
+ boolean: true,
+ description: "Display all attributes when editing"
def run
if node_name.nil?
diff --git a/lib/chef/knife/node_list.rb b/lib/chef/knife/node_list.rb
index 4885208136..4bc2c34508 100644
--- a/lib/chef/knife/node_list.rb
+++ b/lib/chef/knife/node_list.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife node list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
env = Chef::Config[:environment]
diff --git a/lib/chef/knife/node_run_list_add.rb b/lib/chef/knife/node_run_list_add.rb
index fb4ce3bc12..3fc28c041d 100644
--- a/lib/chef/knife/node_run_list_add.rb
+++ b/lib/chef/knife/node_run_list_add.rb
@@ -30,14 +30,14 @@ class Chef
banner "knife node run_list add [NODE] [ENTRY [ENTRY]] (options)"
option :after,
- :short => "-a ITEM",
- :long => "--after ITEM",
- :description => "Place the ENTRY in the run list after ITEM"
+ short: "-a ITEM",
+ long: "--after ITEM",
+ description: "Place the ENTRY in the run list after ITEM"
option :before,
- :short => "-b ITEM",
- :long => "--before ITEM",
- :description => "Place the ENTRY in the run list before ITEM"
+ short: "-b ITEM",
+ long: "--before ITEM",
+ description: "Place the ENTRY in the run list before ITEM"
def run
node = Chef::Node.load(@name_args[0])
diff --git a/lib/chef/knife/node_show.rb b/lib/chef/knife/node_show.rb
index 3092b3fc27..43e7e9dbee 100644
--- a/lib/chef/knife/node_show.rb
+++ b/lib/chef/knife/node_show.rb
@@ -34,14 +34,14 @@ class Chef
banner "knife node show NODE (options)"
option :run_list,
- :short => "-r",
- :long => "--run-list",
- :description => "Show only the run list"
+ short: "-r",
+ long: "--run-list",
+ description: "Show only the run list"
option :environment,
- :short => "-E",
- :long => "--environment",
- :description => "Show only the Chef environment"
+ short: "-E",
+ long: "--environment",
+ description: "Show only the Chef environment"
def run
ui.use_presenter Knife::Core::NodePresenter
diff --git a/lib/chef/knife/osc_user_create.rb b/lib/chef/knife/osc_user_create.rb
index 74b50a4ef4..9ebf268110 100644
--- a/lib/chef/knife/osc_user_create.rb
+++ b/lib/chef/knife/osc_user_create.rb
@@ -32,25 +32,25 @@ class Chef
end
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file"
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file"
option :admin,
- :short => "-a",
- :long => "--admin",
- :description => "Create the user as an admin",
- :boolean => true
+ short: "-a",
+ long: "--admin",
+ description: "Create the user as an admin",
+ boolean: true
option :user_password,
- :short => "-p PASSWORD",
- :long => "--password PASSWORD",
- :description => "Password for newly created user",
- :default => ""
+ short: "-p PASSWORD",
+ long: "--password PASSWORD",
+ description: "Password for newly created user",
+ default: ""
option :user_key,
- :long => "--user-key FILENAME",
- :description => "Public key for newly created user. By default a key will be created for you."
+ long: "--user-key FILENAME",
+ description: "Public key for newly created user. By default a key will be created for you."
banner "knife osc_user create USER (options)"
diff --git a/lib/chef/knife/osc_user_list.rb b/lib/chef/knife/osc_user_list.rb
index f1002c4f54..17a7a781d9 100644
--- a/lib/chef/knife/osc_user_list.rb
+++ b/lib/chef/knife/osc_user_list.rb
@@ -35,9 +35,9 @@ class Chef
banner "knife osc_user list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::User.list))
diff --git a/lib/chef/knife/osc_user_reregister.rb b/lib/chef/knife/osc_user_reregister.rb
index dee1cf41b1..5f5d3fb246 100644
--- a/lib/chef/knife/osc_user_reregister.rb
+++ b/lib/chef/knife/osc_user_reregister.rb
@@ -35,9 +35,9 @@ class Chef
banner "knife osc_user reregister USER (options)"
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file"
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file"
def run
@user_name = @name_args[0]
diff --git a/lib/chef/knife/raw.rb b/lib/chef/knife/raw.rb
index dfbf423e92..2d49c457fc 100644
--- a/lib/chef/knife/raw.rb
+++ b/lib/chef/knife/raw.rb
@@ -33,27 +33,27 @@ class Chef
end
option :method,
- :long => "--method METHOD",
- :short => "-m METHOD",
- :default => "GET",
- :description => "Request method (GET, POST, PUT or DELETE). Default: GET"
+ long: "--method METHOD",
+ short: "-m METHOD",
+ default: "GET",
+ description: "Request method (GET, POST, PUT or DELETE). Default: GET"
option :pretty,
- :long => "--[no-]pretty",
- :boolean => true,
- :default => true,
- :description => "Pretty-print JSON output. Default: true"
+ long: "--[no-]pretty",
+ boolean: true,
+ default: true,
+ description: "Pretty-print JSON output. Default: true"
option :input,
- :long => "--input FILE",
- :short => "-i FILE",
- :description => "Name of file to use for PUT or POST"
+ long: "--input FILE",
+ short: "-i FILE",
+ description: "Name of file to use for PUT or POST"
option :proxy_auth,
- :long => "--proxy-auth",
- :boolean => true,
- :default => false,
- :description => "Use webui proxy authentication. Client key must be the webui key."
+ long: "--proxy-auth",
+ boolean: true,
+ default: false,
+ description: "Use webui proxy authentication. Client key must be the webui key."
# We need a custom HTTP client class here because we don't want to even
# try to decode the body, in case we get back corrupted JSON or whatnot.
@@ -105,7 +105,7 @@ class Chef
result = Chef::JSONCompat.to_json_pretty(result)
end
else
- chef_rest = RawInputServerAPI.new(:raw_output => true)
+ chef_rest = RawInputServerAPI.new(raw_output: true)
result = chef_rest.request(method, name_args[0], headers, data)
end
output result
diff --git a/lib/chef/knife/role_create.rb b/lib/chef/knife/role_create.rb
index a389d849f7..6b953f31c8 100644
--- a/lib/chef/knife/role_create.rb
+++ b/lib/chef/knife/role_create.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife role create ROLE (options)"
option :description,
- :short => "-d DESC",
- :long => "--description DESC",
- :description => "The role description"
+ short: "-d DESC",
+ long: "--description DESC",
+ description: "The role description"
def run
@role_name = @name_args[0]
diff --git a/lib/chef/knife/role_env_run_list_add.rb b/lib/chef/knife/role_env_run_list_add.rb
index c24ae3d331..0f4bee9dbf 100644
--- a/lib/chef/knife/role_env_run_list_add.rb
+++ b/lib/chef/knife/role_env_run_list_add.rb
@@ -31,9 +31,9 @@ class Chef
banner "knife role env_run_list add [ROLE] [ENVIRONMENT] [ENTRY [ENTRY]] (options)"
option :after,
- :short => "-a ITEM",
- :long => "--after ITEM",
- :description => "Place the ENTRY in the run list after ITEM"
+ short: "-a ITEM",
+ long: "--after ITEM",
+ description: "Place the ENTRY in the run list after ITEM"
def add_to_env_run_list(role, environment, entries, after = nil)
if after
diff --git a/lib/chef/knife/role_list.rb b/lib/chef/knife/role_list.rb
index 1247478ef5..3d6c3b4574 100644
--- a/lib/chef/knife/role_list.rb
+++ b/lib/chef/knife/role_list.rb
@@ -30,9 +30,9 @@ class Chef
banner "knife role list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::Role.list))
diff --git a/lib/chef/knife/role_run_list_add.rb b/lib/chef/knife/role_run_list_add.rb
index df06d91725..c6564f9d04 100644
--- a/lib/chef/knife/role_run_list_add.rb
+++ b/lib/chef/knife/role_run_list_add.rb
@@ -31,9 +31,9 @@ class Chef
banner "knife role run_list add [ROLE] [ENTRY [ENTRY]] (options)"
option :after,
- :short => "-a ITEM",
- :long => "--after ITEM",
- :description => "Place the ENTRY in the run list after ITEM"
+ short: "-a ITEM",
+ long: "--after ITEM",
+ description: "Place the ENTRY in the run list after ITEM"
def add_to_env_run_list(role, environment, entries, after = nil)
if after
diff --git a/lib/chef/knife/search.rb b/lib/chef/knife/search.rb
index 94c33aa594..1bc9ce9f7e 100644
--- a/lib/chef/knife/search.rb
+++ b/lib/chef/knife/search.rb
@@ -38,38 +38,38 @@ class Chef
banner "knife search INDEX QUERY (options)"
option :start,
- :short => "-b ROW",
- :long => "--start ROW",
- :description => "The row to start returning results at",
- :default => 0,
- :proc => lambda { |i| i.to_i }
+ short: "-b ROW",
+ long: "--start ROW",
+ description: "The row to start returning results at",
+ default: 0,
+ proc: lambda { |i| i.to_i }
option :rows,
- :short => "-R INT",
- :long => "--rows INT",
- :description => "The number of rows to return",
- :default => nil,
- :proc => lambda { |i| i.to_i }
+ short: "-R INT",
+ long: "--rows INT",
+ description: "The number of rows to return",
+ default: nil,
+ proc: lambda { |i| i.to_i }
option :run_list,
- :short => "-r",
- :long => "--run-list",
- :description => "Show only the run list"
+ short: "-r",
+ long: "--run-list",
+ description: "Show only the run list"
option :id_only,
- :short => "-i",
- :long => "--id-only",
- :description => "Show only the ID of matching objects"
+ short: "-i",
+ long: "--id-only",
+ description: "Show only the ID of matching objects"
option :query,
- :short => "-q QUERY",
- :long => "--query QUERY",
- :description => "The search query; useful to protect queries starting with -"
+ short: "-q QUERY",
+ long: "--query QUERY",
+ description: "The search query; useful to protect queries starting with -"
option :filter_result,
- :short => "-f FILTER",
- :long => "--filter-result FILTER",
- :description => "Only return specific attributes of the matching objects; for example: \"ServerName=name, Kernel=kernel.version\""
+ short: "-f FILTER",
+ long: "--filter-result FILTER",
+ description: "Only return specific attributes of the matching objects; for example: \"ServerName=name, Kernel=kernel.version\""
def run
read_cli_args
@@ -116,7 +116,7 @@ class Chef
end
if ui.interchange?
- output({ :results => result_count, :rows => result_items })
+ output({ results: result_count, rows: result_items })
else
ui.log "#{result_count} items found"
ui.log("\n")
diff --git a/lib/chef/knife/serve.rb b/lib/chef/knife/serve.rb
index cac7fe8884..eb5c98963c 100644
--- a/lib/chef/knife/serve.rb
+++ b/lib/chef/knife/serve.rb
@@ -24,16 +24,16 @@ class Chef
banner "knife serve (options)"
option :repo_mode,
- :long => "--repo-mode MODE",
- :description => "Specifies the local repository layout. Values: static (only environments/roles/data_bags/cookbooks), everything (includes nodes/clients/users), hosted_everything (includes acls/groups/etc. for Enterprise/Hosted Chef). Default: everything/hosted_everything"
+ long: "--repo-mode MODE",
+ description: "Specifies the local repository layout. Values: static (only environments/roles/data_bags/cookbooks), everything (includes nodes/clients/users), hosted_everything (includes acls/groups/etc. for Enterprise/Hosted Chef). Default: everything/hosted_everything"
option :chef_repo_path,
- :long => "--chef-repo-path PATH",
- :description => "Overrides the location of chef repo. Default is specified by chef_repo_path in the config"
+ long: "--chef-repo-path PATH",
+ description: "Overrides the location of chef repo. Default is specified by chef_repo_path in the config"
option :chef_zero_host,
- :long => "--chef-zero-host IP",
- :description => "Overrides the host upon which chef-zero listens. Default is 127.0.0.1."
+ long: "--chef-zero-host IP",
+ description: "Overrides the host upon which chef-zero listens. Default is 127.0.0.1."
def configure_chef
super
diff --git a/lib/chef/knife/show.rb b/lib/chef/knife/show.rb
index 92b7ce1483..4511a86004 100644
--- a/lib/chef/knife/show.rb
+++ b/lib/chef/knife/show.rb
@@ -29,9 +29,9 @@ class Chef
end
option :local,
- :long => "--local",
- :boolean => true,
- :description => "Show local files instead of remote"
+ long: "--local",
+ boolean: true,
+ description: "Show local files instead of remote"
def run
# Get the matches (recursively)
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index c38dc43e74..5bdbfd5498 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -40,100 +40,100 @@ class Chef
banner "knife ssh QUERY COMMAND (options)"
option :concurrency,
- :short => "-C NUM",
- :long => "--concurrency NUM",
- :description => "The number of concurrent connections",
- :default => nil,
- :proc => lambda { |o| o.to_i }
+ short: "-C NUM",
+ long: "--concurrency NUM",
+ description: "The number of concurrent connections",
+ default: nil,
+ proc: lambda { |o| o.to_i }
option :ssh_attribute,
- :short => "-a ATTR",
- :long => "--attribute ATTR",
- :description => "The attribute to use for opening the connection - default depends on the context"
+ short: "-a ATTR",
+ long: "--attribute ATTR",
+ description: "The attribute to use for opening the connection - default depends on the context"
option :manual,
- :short => "-m",
- :long => "--manual-list",
- :boolean => true,
- :description => "QUERY is a space separated list of servers",
- :default => false
+ short: "-m",
+ long: "--manual-list",
+ boolean: true,
+ description: "QUERY is a space separated list of servers",
+ default: false
option :prefix_attribute,
- :long => "--prefix-attribute ATTR",
- :description => "The attribute to use for prefixing the ouput - default depends on the context"
+ long: "--prefix-attribute ATTR",
+ description: "The attribute to use for prefixing the ouput - default depends on the context"
option :ssh_user,
- :short => "-x USERNAME",
- :long => "--ssh-user USERNAME",
- :description => "The ssh username"
+ short: "-x USERNAME",
+ long: "--ssh-user USERNAME",
+ description: "The ssh username"
option :ssh_password_ng,
- :short => "-P [PASSWORD]",
- :long => "--ssh-password [PASSWORD]",
- :description => "The ssh password - will prompt if flag is specified but no password is given",
+ short: "-P [PASSWORD]",
+ long: "--ssh-password [PASSWORD]",
+ description: "The ssh password - will prompt if flag is specified but no password is given",
# default to a value that can not be a password (boolean)
# so we can effectively test if this parameter was specified
# without a value
- :default => false
+ default: false
option :ssh_port,
- :short => "-p PORT",
- :long => "--ssh-port PORT",
- :description => "The ssh port",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_port] = key.strip }
+ short: "-p PORT",
+ long: "--ssh-port PORT",
+ description: "The ssh port",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_port] = key.strip }
option :ssh_timeout,
- :short => "-t SECONDS",
- :long => "--ssh-timeout SECONDS",
- :description => "The ssh connection timeout",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_timeout] = key.strip.to_i },
- :default => 120
+ short: "-t SECONDS",
+ long: "--ssh-timeout SECONDS",
+ description: "The ssh connection timeout",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_timeout] = key.strip.to_i },
+ default: 120
option :ssh_gateway,
- :short => "-G GATEWAY",
- :long => "--ssh-gateway GATEWAY",
- :description => "The ssh gateway",
- :proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key.strip }
+ short: "-G GATEWAY",
+ long: "--ssh-gateway GATEWAY",
+ description: "The ssh gateway",
+ proc: Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key.strip }
option :ssh_gateway_identity,
- :long => "--ssh-gateway-identity SSH_GATEWAY_IDENTITY",
- :description => "The SSH identity file used for gateway authentication"
+ long: "--ssh-gateway-identity SSH_GATEWAY_IDENTITY",
+ description: "The SSH identity file used for gateway authentication"
option :forward_agent,
- :short => "-A",
- :long => "--forward-agent",
- :description => "Enable SSH agent forwarding",
- :boolean => true
+ short: "-A",
+ long: "--forward-agent",
+ description: "Enable SSH agent forwarding",
+ boolean: true
option :ssh_identity_file,
- :short => "-i IDENTITY_FILE",
- :long => "--ssh-identity-file IDENTITY_FILE",
- :description => "The SSH identity file used for authentication"
+ short: "-i IDENTITY_FILE",
+ long: "--ssh-identity-file IDENTITY_FILE",
+ description: "The SSH identity file used for authentication"
option :host_key_verify,
- :long => "--[no-]host-key-verify",
- :description => "Verify host key, enabled by default.",
- :boolean => true,
- :default => true
+ long: "--[no-]host-key-verify",
+ description: "Verify host key, enabled by default.",
+ boolean: true,
+ default: true
option :on_error,
- :short => "-e",
- :long => "--exit-on-error",
- :description => "Immediately exit if an error is encountered",
- :boolean => true,
- :default => false
+ short: "-e",
+ long: "--exit-on-error",
+ description: "Immediately exit if an error is encountered",
+ boolean: true,
+ default: false
option :duplicated_fqdns,
- :long => "--duplicated-fqdns",
- :description => "Behavior if FQDNs are duplicated, ignored by default",
- :proc => Proc.new { |key| Chef::Config[:knife][:duplicated_fqdns] = key.strip.to_sym },
- :default => :ignore
+ long: "--duplicated-fqdns",
+ description: "Behavior if FQDNs are duplicated, ignored by default",
+ proc: Proc.new { |key| Chef::Config[:knife][:duplicated_fqdns] = key.strip.to_sym },
+ default: :ignore
option :tmux_split,
- :long => "--tmux-split",
- :description => "Split tmux window.",
- :boolean => true,
- :default => false
+ long: "--tmux-split",
+ description: "Split tmux window.",
+ boolean: true,
+ default: false
def session
ssh_error_handler = Proc.new do |server|
@@ -146,7 +146,7 @@ class Chef
end
end
- @session ||= Net::SSH::Multi.start(:concurrent_connections => config[:concurrency], :on_error => ssh_error_handler)
+ @session ||= Net::SSH::Multi.start(concurrent_connections: config[:concurrency], on_error: ssh_error_handler)
end
def configure_gateway
@@ -505,18 +505,18 @@ class Chef
end
Appscript.app("/Applications/Utilities/Terminal.app").windows.first.activate
- Appscript.app("System Events").application_processes["Terminal.app"].keystroke("n", :using => :command_down)
+ Appscript.app("System Events").application_processes["Terminal.app"].keystroke("n", using: :command_down)
term = Appscript.app("Terminal")
window = term.windows.first.get
(session.servers_for.size - 1).times do |i|
window.activate
- Appscript.app("System Events").application_processes["Terminal.app"].keystroke("t", :using => :command_down)
+ Appscript.app("System Events").application_processes["Terminal.app"].keystroke("t", using: :command_down)
end
session.servers_for.each_with_index do |server, tab_number|
cmd = "unset PROMPT_COMMAND; echo -e \"\\033]0;#{server.host}\\007\"; ssh #{server.user ? "#{server.user}@#{server.host}" : server.host}"
- Appscript.app("Terminal").do_script(cmd, :in => window.tabs[tab_number + 1].get)
+ Appscript.app("Terminal").do_script(cmd, in: window.tabs[tab_number + 1].get)
end
end
diff --git a/lib/chef/knife/status.rb b/lib/chef/knife/status.rb
index 0e3cd7e7d6..413bff4f66 100644
--- a/lib/chef/knife/status.rb
+++ b/lib/chef/knife/status.rb
@@ -32,23 +32,23 @@ class Chef
banner "knife status QUERY (options)"
option :run_list,
- :short => "-r",
- :long => "--run-list",
- :description => "Show the run list"
+ short: "-r",
+ long: "--run-list",
+ description: "Show the run list"
option :sort_reverse,
- :short => "-s",
- :long => "--sort-reverse",
- :description => "Sort the status list by last run time descending"
+ short: "-s",
+ long: "--sort-reverse",
+ description: "Sort the status list by last run time descending"
option :hide_healthy,
- :short => "-H",
- :long => "--hide-healthy",
- :description => "Hide nodes that have run chef in the last hour. [DEPRECATED] Use --hide-by-mins MINS instead"
+ short: "-H",
+ long: "--hide-healthy",
+ description: "Hide nodes that have run chef in the last hour. [DEPRECATED] Use --hide-by-mins MINS instead"
option :hide_by_mins,
- :long => "--hide-by-mins MINS",
- :description => "Hide nodes that have run chef in the last MINS minutes"
+ long: "--hide-by-mins MINS",
+ description: "Hide nodes that have run chef in the last MINS minutes"
def append_to_query(term)
@query << " AND " unless @query.empty?
diff --git a/lib/chef/knife/upload.rb b/lib/chef/knife/upload.rb
index 063ed26892..e4e0a74b28 100644
--- a/lib/chef/knife/upload.rb
+++ b/lib/chef/knife/upload.rb
@@ -28,41 +28,41 @@ class Chef
end
option :recurse,
- :long => "--[no-]recurse",
- :boolean => true,
- :default => true,
- :description => "List directories recursively."
+ long: "--[no-]recurse",
+ boolean: true,
+ default: true,
+ description: "List directories recursively."
option :purge,
- :long => "--[no-]purge",
- :boolean => true,
- :default => false,
- :description => "Delete matching local files and directories that do not exist remotely."
+ long: "--[no-]purge",
+ boolean: true,
+ default: false,
+ description: "Delete matching local files and directories that do not exist remotely."
option :force,
- :long => "--[no-]force",
- :boolean => true,
- :default => false,
- :description => "Force upload of files even if they match (quicker for many files). Will overwrite frozen cookbooks."
+ long: "--[no-]force",
+ boolean: true,
+ default: false,
+ description: "Force upload of files even if they match (quicker for many files). Will overwrite frozen cookbooks."
option :freeze,
- :long => "--[no-]freeze",
- :boolean => true,
- :default => false,
- :description => "Freeze cookbooks that get uploaded."
+ long: "--[no-]freeze",
+ boolean: true,
+ default: false,
+ description: "Freeze cookbooks that get uploaded."
option :dry_run,
- :long => "--dry-run",
- :short => "-n",
- :boolean => true,
- :default => false,
- :description => "Don't take action, only print what would happen"
+ long: "--dry-run",
+ short: "-n",
+ boolean: true,
+ default: false,
+ description: "Don't take action, only print what would happen"
option :diff,
- :long => "--[no-]diff",
- :boolean => true,
- :default => true,
- :description => "Turn off to avoid uploading existing files; only new (and possibly deleted) files with --no-diff"
+ long: "--[no-]diff",
+ boolean: true,
+ default: true,
+ description: "Turn off to avoid uploading existing files; only new (and possibly deleted) files with --no-diff"
def run
if name_args.length == 0
diff --git a/lib/chef/knife/user_create.rb b/lib/chef/knife/user_create.rb
index c4a89f3707..9273f0344d 100644
--- a/lib/chef/knife/user_create.rb
+++ b/lib/chef/knife/user_create.rb
@@ -32,31 +32,31 @@ class Chef
end
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file if the server generated one."
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file if the server generated one."
option :user_key,
- :long => "--user-key FILENAME",
- :description => "Set the initial default key for the user from a file on disk (cannot pass with --prevent-keygen)."
+ long: "--user-key FILENAME",
+ description: "Set the initial default key for the user from a file on disk (cannot pass with --prevent-keygen)."
option :prevent_keygen,
- :short => "-k",
- :long => "--prevent-keygen",
- :description => "API V1 (Chef Server 12.1+) only. Prevent server from generating a default key pair for you. Cannot be passed with --user-key.",
- :boolean => true
+ short: "-k",
+ long: "--prevent-keygen",
+ description: "API V1 (Chef Server 12.1+) only. Prevent server from generating a default key pair for you. Cannot be passed with --user-key.",
+ boolean: true
option :admin,
- :short => "-a",
- :long => "--admin",
- :description => "DEPRECATED: Open Source Chef 11 only. Create the user as an admin.",
- :boolean => true
+ short: "-a",
+ long: "--admin",
+ description: "DEPRECATED: Open Source Chef 11 only. Create the user as an admin.",
+ boolean: true
option :user_password,
- :short => "-p PASSWORD",
- :long => "--password PASSWORD",
- :description => "DEPRECATED: Open Source Chef 11 only. Password for newly created user.",
- :default => ""
+ short: "-p PASSWORD",
+ long: "--password PASSWORD",
+ description: "DEPRECATED: Open Source Chef 11 only. Password for newly created user.",
+ default: ""
banner "knife user create USERNAME DISPLAY_NAME FIRST_NAME LAST_NAME EMAIL PASSWORD (options)"
diff --git a/lib/chef/knife/user_list.rb b/lib/chef/knife/user_list.rb
index 88e834025d..eccb8d15a4 100644
--- a/lib/chef/knife/user_list.rb
+++ b/lib/chef/knife/user_list.rb
@@ -32,9 +32,9 @@ class Chef
banner "knife user list (options)"
option :with_uri,
- :short => "-w",
- :long => "--with-uri",
- :description => "Show corresponding URIs"
+ short: "-w",
+ long: "--with-uri",
+ description: "Show corresponding URIs"
def run
output(format_list_for_display(Chef::UserV1.list))
diff --git a/lib/chef/knife/user_reregister.rb b/lib/chef/knife/user_reregister.rb
index fec6792134..b993dfc636 100644
--- a/lib/chef/knife/user_reregister.rb
+++ b/lib/chef/knife/user_reregister.rb
@@ -50,9 +50,9 @@ EOF
end
option :file,
- :short => "-f FILE",
- :long => "--file FILE",
- :description => "Write the private key to a file"
+ short: "-f FILE",
+ long: "--file FILE",
+ description: "Write the private key to a file"
def run
@user_name = @name_args[0]
diff --git a/lib/chef/knife/xargs.rb b/lib/chef/knife/xargs.rb
index f663b480e8..bb3ce39717 100644
--- a/lib/chef/knife/xargs.rb
+++ b/lib/chef/knife/xargs.rb
@@ -30,61 +30,61 @@ class Chef
# TODO modify to remote-only / local-only pattern (more like delete)
option :local,
- :long => "--local",
- :boolean => true,
- :description => "Xargs local files instead of remote"
+ long: "--local",
+ boolean: true,
+ description: "Xargs local files instead of remote"
option :patterns,
- :long => "--pattern [PATTERN]",
- :short => "-p [PATTERN]",
- :description => "Pattern on command line (if these are not specified, a list of patterns is expected on standard input). Multiple patterns may be passed in this way.",
- :arg_arity => [1, -1]
+ long: "--pattern [PATTERN]",
+ short: "-p [PATTERN]",
+ description: "Pattern on command line (if these are not specified, a list of patterns is expected on standard input). Multiple patterns may be passed in this way.",
+ arg_arity: [1, -1]
option :diff,
- :long => "--[no-]diff",
- :default => true,
- :boolean => true,
- :description => "Whether to show a diff when files change (default: true)"
+ long: "--[no-]diff",
+ default: true,
+ boolean: true,
+ description: "Whether to show a diff when files change (default: true)"
option :dry_run,
- :long => "--dry-run",
- :boolean => true,
- :description => "Prevents changes from actually being uploaded to the server."
+ long: "--dry-run",
+ boolean: true,
+ description: "Prevents changes from actually being uploaded to the server."
option :force,
- :long => "--[no-]force",
- :boolean => true,
- :default => false,
- :description => "Force upload of files even if they are not changed (quicker and harmless, but doesn't print out what it changed)"
+ long: "--[no-]force",
+ boolean: true,
+ default: false,
+ description: "Force upload of files even if they are not changed (quicker and harmless, but doesn't print out what it changed)"
option :replace_first,
- :long => "--replace-first REPLACESTR",
- :short => "-J REPLACESTR",
- :description => "String to replace with filenames. -J will only replace the FIRST occurrence of the replacement string."
+ long: "--replace-first REPLACESTR",
+ short: "-J REPLACESTR",
+ description: "String to replace with filenames. -J will only replace the FIRST occurrence of the replacement string."
option :replace_all,
- :long => "--replace REPLACESTR",
- :short => "-I REPLACESTR",
- :description => "String to replace with filenames. -I will replace ALL occurrence of the replacement string."
+ long: "--replace REPLACESTR",
+ short: "-I REPLACESTR",
+ description: "String to replace with filenames. -I will replace ALL occurrence of the replacement string."
option :max_arguments_per_command,
- :long => "--max-args MAXARGS",
- :short => "-n MAXARGS",
- :description => "Maximum number of arguments per command line."
+ long: "--max-args MAXARGS",
+ short: "-n MAXARGS",
+ description: "Maximum number of arguments per command line."
option :max_command_line,
- :long => "--max-chars LENGTH",
- :short => "-s LENGTH",
- :description => "Maximum size of command line, in characters"
+ long: "--max-chars LENGTH",
+ short: "-s LENGTH",
+ description: "Maximum size of command line, in characters"
option :verbose_commands,
- :short => "-t",
- :description => "Print command to be run on the command line"
+ short: "-t",
+ description: "Print command to be run on the command line"
option :null_separator,
- :short => "-0",
- :boolean => true,
- :description => "Use the NULL character (\0) as a separator, instead of whitespace"
+ short: "-0",
+ boolean: true,
+ description: "Use the NULL character (\0) as a separator, instead of whitespace"
def run
error = false
@@ -175,7 +175,7 @@ class Chef
# Create the temporary files
files.each do |file|
tempfile = Tempfile.new(file.name)
- tempfiles[tempfile] = { :file => file }
+ tempfiles[tempfile] = { file: file }
end
rescue
destroy_tempfiles(files)
diff --git a/lib/chef/log/winevt.rb b/lib/chef/log/winevt.rb
index 506d4c9a6c..a35f99c52c 100644
--- a/lib/chef/log/winevt.rb
+++ b/lib/chef/log/winevt.rb
@@ -51,46 +51,46 @@ class Chef
def info(msg)
@eventlog.report_event(
- :event_type => ::Win32::EventLog::INFO_TYPE,
- :source => SOURCE,
- :event_id => INFO_EVENT_ID,
- :data => [msg]
+ event_type: ::Win32::EventLog::INFO_TYPE,
+ source: SOURCE,
+ event_id: INFO_EVENT_ID,
+ data: [msg]
)
end
def warn(msg)
@eventlog.report_event(
- :event_type => ::Win32::EventLog::WARN_TYPE,
- :source => SOURCE,
- :event_id => WARN_EVENT_ID,
- :data => [msg]
+ event_type: ::Win32::EventLog::WARN_TYPE,
+ source: SOURCE,
+ event_id: WARN_EVENT_ID,
+ data: [msg]
)
end
def debug(msg)
@eventlog.report_event(
- :event_type => ::Win32::EventLog::INFO_TYPE,
- :source => SOURCE,
- :event_id => DEBUG_EVENT_ID,
- :data => [msg]
+ event_type: ::Win32::EventLog::INFO_TYPE,
+ source: SOURCE,
+ event_id: DEBUG_EVENT_ID,
+ data: [msg]
)
end
def error(msg)
@eventlog.report_event(
- :event_type => ::Win32::EventLog::ERROR_TYPE,
- :source => SOURCE,
- :event_id => ERROR_EVENT_ID,
- :data => [msg]
+ event_type: ::Win32::EventLog::ERROR_TYPE,
+ source: SOURCE,
+ event_id: ERROR_EVENT_ID,
+ data: [msg]
)
end
def fatal(msg)
@eventlog.report_event(
- :event_type => ::Win32::EventLog::ERROR_TYPE,
- :source => SOURCE,
- :event_id => FATAL_EVENT_ID,
- :data => [msg]
+ event_type: ::Win32::EventLog::ERROR_TYPE,
+ source: SOURCE,
+ event_id: FATAL_EVENT_ID,
+ data: [msg]
)
end
diff --git a/lib/chef/mixin/deprecation.rb b/lib/chef/mixin/deprecation.rb
index 6621555585..06726b5252 100644
--- a/lib/chef/mixin/deprecation.rb
+++ b/lib/chef/mixin/deprecation.rb
@@ -33,7 +33,7 @@ class Chef
# Chef::Mixin::RecipeDefinitionDSLCore is deprecated, use Chef::DSL::Recipe instead.
# EOM
def self.deprecate_constant(name, replacement, message)
- deprecated_constants[name] = { :replacement => replacement, :message => message }
+ deprecated_constants[name] = { replacement: replacement, message: message }
end
# Const missing hook to look up deprecated constants defined with
diff --git a/lib/chef/mixin/securable.rb b/lib/chef/mixin/securable.rb
index 788b236d94..eb59f184d1 100644
--- a/lib/chef/mixin/securable.rb
+++ b/lib/chef/mixin/securable.rb
@@ -24,7 +24,7 @@ class Chef
set_or_return(
:owner,
arg,
- :regex => Chef::Config[:user_valid_regex]
+ regex: Chef::Config[:user_valid_regex]
)
end
@@ -34,7 +34,7 @@ class Chef
set_or_return(
:group,
arg,
- :regex => Chef::Config[:group_valid_regex]
+ regex: Chef::Config[:group_valid_regex]
)
end
@@ -42,7 +42,7 @@ class Chef
set_or_return(
:mode,
arg,
- :callbacks => {
+ callbacks: {
"not in valid numeric range" => lambda do |m|
if m.kind_of?(String)
m =~ /^0/ || m = "0#{m}"
@@ -110,16 +110,16 @@ class Chef
rights = instance_variable_get("@#{name}".to_sym)
unless permissions.nil?
input = {
- :permissions => permissions,
- :principals => principals,
+ permissions: permissions,
+ principals: principals,
}
input.merge!(args_hash) unless args_hash.nil?
- validations = { :permissions => { :required => true },
- :principals => { :required => true, :kind_of => [String, Array] },
- :applies_to_children => { :equal_to => [ true, false, :containers_only, :objects_only ] },
- :applies_to_self => { :kind_of => [ TrueClass, FalseClass ] },
- :one_level_deep => { :kind_of => [ TrueClass, FalseClass ] },
+ validations = { permissions: { required: true },
+ principals: { required: true, kind_of: [String, Array] },
+ applies_to_children: { equal_to: [ true, false, :containers_only, :objects_only ] },
+ applies_to_self: { kind_of: [ TrueClass, FalseClass ] },
+ one_level_deep: { kind_of: [ TrueClass, FalseClass ] },
}
validate(input, validations)
@@ -167,7 +167,7 @@ class Chef
set_or_return(
:inherits,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
end
diff --git a/lib/chef/node.rb b/lib/chef/node.rb
index f03e0ca0b1..10cad24921 100644
--- a/lib/chef/node.rb
+++ b/lib/chef/node.rb
@@ -115,10 +115,10 @@ class Chef
def name(arg = nil)
if !arg.nil?
validate(
- { :name => arg },
- { :name => { :kind_of => String,
- :cannot_be => :blank,
- :regex => /^[\-[:alnum:]_:.]+$/ },
+ { name: arg },
+ { name: { kind_of: String,
+ cannot_be: :blank,
+ regex: /^[\-[:alnum:]_:.]+$/ },
})
@name = arg
else
@@ -130,7 +130,7 @@ class Chef
set_or_return(
:chef_environment,
arg,
- { :regex => /^[\-[:alnum:]_]+$/, :kind_of => String }
+ { regex: /^[\-[:alnum:]_]+$/, kind_of: String }
)
end
diff --git a/lib/chef/org.rb b/lib/chef/org.rb
index 73a129c7c1..ea1c411b67 100644
--- a/lib/chef/org.rb
+++ b/lib/chef/org.rb
@@ -40,22 +40,22 @@ class Chef
def name(arg = nil)
set_or_return(:name, arg,
- :regex => /^[a-z0-9\-_]+$/)
+ regex: /^[a-z0-9\-_]+$/)
end
def full_name(arg = nil)
set_or_return(:full_name,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def private_key(arg = nil)
set_or_return(:private_key,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def guid(arg = nil)
set_or_return(:guid,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def to_hash
@@ -73,13 +73,13 @@ class Chef
end
def create
- payload = { :name => name, :full_name => full_name }
+ payload = { name: name, full_name: full_name }
new_org = chef_rest.post("organizations", payload)
Chef::Org.from_hash(to_hash.merge(new_org))
end
def update
- payload = { :name => name, :full_name => full_name }
+ payload = { name: name, full_name: full_name }
new_org = chef_rest.put("organizations/#{name}", payload)
Chef::Org.from_hash(to_hash.merge(new_org))
end
@@ -99,10 +99,10 @@ class Chef
end
def associate_user(username)
- request_body = { :user => username }
+ request_body = { user: username }
response = chef_rest.post "organizations/#{@name}/association_requests", request_body
association_id = response["uri"].split("/").last
- chef_rest.put "users/#{username}/association_requests/#{association_id}", { :response => "accept" }
+ chef_rest.put "users/#{username}/association_requests/#{association_id}", { response: "accept" }
end
def dissociate_user(username)
diff --git a/lib/chef/policy_builder/expand_node_object.rb b/lib/chef/policy_builder/expand_node_object.rb
index b390042ea7..c91c74b047 100644
--- a/lib/chef/policy_builder/expand_node_object.rb
+++ b/lib/chef/policy_builder/expand_node_object.rb
@@ -175,7 +175,7 @@ class Chef
begin
events.cookbook_resolution_start(@expanded_run_list_with_versions)
cookbook_hash = api_service.post("environments/#{node.chef_environment}/cookbook_versions",
- { :run_list => @expanded_run_list_with_versions })
+ { run_list: @expanded_run_list_with_versions })
cookbook_hash = cookbook_hash.inject({}) do |memo, (key, value)|
memo[key] = Chef::CookbookVersion.from_hash(value)
diff --git a/lib/chef/provider/cron/unix.rb b/lib/chef/provider/cron/unix.rb
index 15195dbb88..4edd5ba206 100644
--- a/lib/chef/provider/cron/unix.rb
+++ b/lib/chef/provider/cron/unix.rb
@@ -33,7 +33,7 @@ class Chef
private
def read_crontab
- crontab = shell_out("/usr/bin/crontab -l", :user => @new_resource.user)
+ crontab = shell_out("/usr/bin/crontab -l", user: @new_resource.user)
status = crontab.status.exitstatus
logger.trace crontab.format_for_exception if status > 0
@@ -53,7 +53,7 @@ class Chef
exit_status = 0
error_message = ""
begin
- crontab_write = shell_out("/usr/bin/crontab #{tempcron.path}", :user => @new_resource.user)
+ crontab_write = shell_out("/usr/bin/crontab #{tempcron.path}", user: @new_resource.user)
stderr = crontab_write.stderr
exit_status = crontab_write.status.exitstatus
# solaris9, 10 on some failures for example invalid 'mins' in crontab fails with exit code of zero :(
diff --git a/lib/chef/provider/dsc_resource.rb b/lib/chef/provider/dsc_resource.rb
index 9c147cb634..3a209a08a1 100644
--- a/lib/chef/provider/dsc_resource.rb
+++ b/lib/chef/provider/dsc_resource.rb
@@ -169,7 +169,7 @@ class Chef
"Invoke-DscResource #{switches}",
output_format
)
- cmdlet.run!({}, { :timeout => new_resource.timeout })
+ cmdlet.run!({}, { timeout: new_resource.timeout })
end
def return_dsc_resource_result(result, property_name)
diff --git a/lib/chef/provider/dsc_script.rb b/lib/chef/provider/dsc_script.rb
index 7a101fa68b..fd20f34786 100644
--- a/lib/chef/provider/dsc_script.rb
+++ b/lib/chef/provider/dsc_script.rb
@@ -32,10 +32,10 @@ class Chef
@dsc_resource = dsc_resource
@resource_converged = false
@operations = {
- :set => Proc.new do |config_manager, document, shellout_flags|
+ set: Proc.new do |config_manager, document, shellout_flags|
config_manager.set_configuration(document, shellout_flags)
end,
- :test => Proc.new do |config_manager, document, shellout_flags|
+ test: Proc.new do |config_manager, document, shellout_flags|
config_manager.test_configuration(document, shellout_flags)
end }
end
@@ -86,9 +86,9 @@ class Chef
config_manager = Chef::Util::DSC::LocalConfigurationManager.new(@run_context.node, config_directory)
shellout_flags = {
- :cwd => @dsc_resource.cwd,
- :environment => @dsc_resource.environment,
- :timeout => @dsc_resource.timeout,
+ cwd: @dsc_resource.cwd,
+ environment: @dsc_resource.environment,
+ timeout: @dsc_resource.timeout,
}
begin
@@ -113,9 +113,9 @@ class Chef
def generate_configuration_document(config_directory, configuration_flags)
shellout_flags = {
- :cwd => @dsc_resource.cwd,
- :environment => @dsc_resource.environment,
- :timeout => @dsc_resource.timeout,
+ cwd: @dsc_resource.cwd,
+ environment: @dsc_resource.environment,
+ timeout: @dsc_resource.timeout,
}
generator = Chef::Util::DSC::ConfigurationGenerator.new(@run_context.node, config_directory)
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb
index 3d3255260f..1b97dbf464 100644
--- a/lib/chef/provider/execute.rb
+++ b/lib/chef/provider/execute.rb
@@ -102,7 +102,7 @@ class Chef
opts[:log_tag] = new_resource.to_s
if (logger.info? || live_stream?) && !sensitive?
if run_context.events.formatter?
- opts[:live_stream] = Chef::EventDispatch::EventsOutputStream.new(run_context.events, :name => :execute)
+ opts[:live_stream] = Chef::EventDispatch::EventsOutputStream.new(run_context.events, name: :execute)
elsif stream_to_stdout?
opts[:live_stream] = STDOUT
end
diff --git a/lib/chef/provider/mdadm.rb b/lib/chef/provider/mdadm.rb
index c5f15a851a..9b023b1a65 100644
--- a/lib/chef/provider/mdadm.rb
+++ b/lib/chef/provider/mdadm.rb
@@ -31,7 +31,7 @@ class Chef
logger.trace("#{new_resource} checking for software raid device #{current_resource.raid_device}")
device_not_found = 4
- mdadm = shell_out!("mdadm --detail --test #{new_resource.raid_device}", :returns => [0, device_not_found])
+ mdadm = shell_out!("mdadm --detail --test #{new_resource.raid_device}", returns: [0, device_not_found])
exists = (mdadm.status == 0)
current_resource.exists(exists)
end
diff --git a/lib/chef/provider/mount/windows.rb b/lib/chef/provider/mount/windows.rb
index 590b2bfa52..0fb9184783 100644
--- a/lib/chef/provider/mount/windows.rb
+++ b/lib/chef/provider/mount/windows.rb
@@ -61,10 +61,10 @@ class Chef
def mount_fs
unless @current_resource.mounted
- @mount.add(:remote => @new_resource.device,
- :username => @new_resource.username,
- :domainname => @new_resource.domain,
- :password => @new_resource.password)
+ @mount.add(remote: @new_resource.device,
+ username: @new_resource.username,
+ domainname: @new_resource.domain,
+ password: @new_resource.password)
logger.trace("#{@new_resource} is mounted at #{@new_resource.mount_point}")
else
logger.trace("#{@new_resource} is already mounted at #{@new_resource.mount_point}")
diff --git a/lib/chef/provider/reboot.rb b/lib/chef/provider/reboot.rb
index f054af0567..dd07e7448d 100644
--- a/lib/chef/provider/reboot.rb
+++ b/lib/chef/provider/reboot.rb
@@ -45,10 +45,10 @@ class Chef
# @return [void]
def request_reboot
node.run_context.request_reboot(
- :delay_mins => new_resource.delay_mins,
- :reason => new_resource.reason,
- :timestamp => Time.now,
- :requested_by => new_resource.name
+ delay_mins: new_resource.delay_mins,
+ reason: new_resource.reason,
+ timestamp: Time.now,
+ requested_by: new_resource.name
)
end
diff --git a/lib/chef/provider/remote_file/sftp.rb b/lib/chef/provider/remote_file/sftp.rb
index 21c5c4ca04..66540fea8c 100644
--- a/lib/chef/provider/remote_file/sftp.rb
+++ b/lib/chef/provider/remote_file/sftp.rb
@@ -58,7 +58,7 @@ class Chef
def sftp
host = port ? "#{hostname}:#{port}" : hostname
- @sftp ||= Net::SFTP.start(host, user, :password => pass)
+ @sftp ||= Net::SFTP.start(host, user, password: pass)
end
def pass
diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb
index 1da3d7c01a..18ef245083 100644
--- a/lib/chef/provider/service/redhat.rb
+++ b/lib/chef/provider/service/redhat.rb
@@ -81,7 +81,7 @@ class Chef
super
if ::File.exists?("/sbin/chkconfig")
- chkconfig = shell_out!("/sbin/chkconfig --list #{current_resource.service_name}", :returns => [0, 1])
+ chkconfig = shell_out!("/sbin/chkconfig --list #{current_resource.service_name}", returns: [0, 1])
unless run_levels.nil? || run_levels.empty?
all_levels_match = true
chkconfig.stdout.split(/\s+/)[1..-1].each do |level|
diff --git a/lib/chef/provider/service/solaris.rb b/lib/chef/provider/service/solaris.rb
index f2b1ec4262..51105bd06f 100644
--- a/lib/chef/provider/service/solaris.rb
+++ b/lib/chef/provider/service/solaris.rb
@@ -80,7 +80,7 @@ class Chef
end
def service_status
- cmd = shell_out!(@status_command, "-l", @current_resource.service_name, :returns => [0, 1])
+ cmd = shell_out!(@status_command, "-l", @current_resource.service_name, returns: [0, 1])
# Example output
# $ svcs -l rsyslog
# fmri svc:/application/rsyslog:default
diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb
index badd7695a5..6d5bc338c7 100644
--- a/lib/chef/provider/service/systemd.rb
+++ b/lib/chef/provider/service/systemd.rb
@@ -79,10 +79,10 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
if new_resource.user
uid = Etc.getpwnam(new_resource.user).uid
options = {
- :environment => {
+ environment: {
"DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/#{uid}/bus",
},
- :user => new_resource.user,
+ user: new_resource.user,
}
args = "--user"
else
diff --git a/lib/chef/provider/service/windows.rb b/lib/chef/provider/service/windows.rb
index 487940e84e..3e177d744b 100644
--- a/lib/chef/provider/service/windows.rb
+++ b/lib/chef/provider/service/windows.rb
@@ -361,8 +361,8 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
logger.trace "#{@new_resource.name} setting start_type to #{type}"
Win32::Service.configure(
- :service_name => @new_resource.service_name,
- :start_type => startup_type
+ service_name: @new_resource.service_name,
+ start_type: startup_type
)
@new_resource.updated_by_last_action(true)
end
diff --git a/lib/chef/provider/subversion.rb b/lib/chef/provider/subversion.rb
index abcc260a78..c5c2439d84 100644
--- a/lib/chef/provider/subversion.rb
+++ b/lib/chef/provider/subversion.rb
@@ -126,7 +126,7 @@ class Chef
new_resource.revision
else
command = scm(:info, new_resource.repository, new_resource.svn_info_args, authentication, "-r#{new_resource.revision}")
- svn_info = shell_out!(command, run_options(:cwd => cwd, :returns => [0, 1])).stdout
+ svn_info = shell_out!(command, run_options(cwd: cwd, returns: [0, 1])).stdout
extract_revision_info(svn_info)
end
@@ -138,7 +138,7 @@ class Chef
def find_current_revision
return nil unless ::File.exist?(::File.join(new_resource.destination, ".svn"))
command = scm(:info)
- svn_info = shell_out!(command, run_options(:cwd => cwd, :returns => [0, 1])).stdout
+ svn_info = shell_out!(command, run_options(cwd: cwd, returns: [0, 1])).stdout
extract_revision_info(svn_info)
end
diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb
index 0450516d58..44f34fb8d7 100644
--- a/lib/chef/provider/systemd_unit.rb
+++ b/lib/chef/provider/systemd_unit.rb
@@ -247,8 +247,8 @@ class Chef
if new_resource.user
uid = Etc.getpwnam(new_resource.user).uid
{
- :user => new_resource.user,
- :environment => {
+ user: new_resource.user,
+ environment: {
"DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/#{uid}/bus",
},
}
diff --git a/lib/chef/provider/template/content.rb b/lib/chef/provider/template/content.rb
index b40794564a..9ac5a89b3e 100644
--- a/lib/chef/provider/template/content.rb
+++ b/lib/chef/provider/template/content.rb
@@ -29,7 +29,7 @@ class Chef
def template_location
@template_file_cache_location ||= begin
- template_finder.find(new_resource.source, :local => new_resource.local, :cookbook => new_resource.cookbook)
+ template_finder.find(new_resource.source, local: new_resource.local, cookbook: new_resource.cookbook)
end
end
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index 478637ff4e..a30504bc91 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -469,7 +469,7 @@ class Chef
if arg.nil?
@guard_interpreter || @default_guard_interpreter
else
- set_or_return(:guard_interpreter, arg, :kind_of => Symbol)
+ set_or_return(:guard_interpreter, arg, kind_of: Symbol)
end
end
diff --git a/lib/chef/resource/cron.rb b/lib/chef/resource/cron.rb
index ea6d692709..57cc483c8a 100644
--- a/lib/chef/resource/cron.rb
+++ b/lib/chef/resource/cron.rb
@@ -55,7 +55,7 @@ class Chef
set_or_return(
:minute,
converted_arg,
- :kind_of => String
+ kind_of: String
)
end
@@ -72,7 +72,7 @@ class Chef
set_or_return(
:hour,
converted_arg,
- :kind_of => String
+ kind_of: String
)
end
@@ -89,7 +89,7 @@ class Chef
set_or_return(
:day,
converted_arg,
- :kind_of => String
+ kind_of: String
)
end
@@ -106,7 +106,7 @@ class Chef
set_or_return(
:month,
converted_arg,
- :kind_of => String
+ kind_of: String
)
end
@@ -130,7 +130,7 @@ class Chef
set_or_return(
:weekday,
converted_arg,
- :kind_of => [String, Symbol]
+ kind_of: [String, Symbol]
)
end
diff --git a/lib/chef/resource/dsc_script.rb b/lib/chef/resource/dsc_script.rb
index f3fa5d0314..7d1e11b659 100644
--- a/lib/chef/resource/dsc_script.rb
+++ b/lib/chef/resource/dsc_script.rb
@@ -54,7 +54,7 @@ class Chef
set_or_return(
:code,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -65,7 +65,7 @@ class Chef
set_or_return(
:configuration_name,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -76,7 +76,7 @@ class Chef
set_or_return(
:command,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -87,7 +87,7 @@ class Chef
set_or_return(
:configuration_data,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -98,7 +98,7 @@ class Chef
set_or_return(
:configuration_data_script,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb
index 7003b546fe..dfccfeb138 100644
--- a/lib/chef/resource/execute.rb
+++ b/lib/chef/resource/execute.rb
@@ -52,7 +52,7 @@ class Chef
set_or_return(
:command,
arg,
- :kind_of => [ String, Array ]
+ kind_of: [ String, Array ]
)
end
property :umask, [ String, Integer ]
diff --git a/lib/chef/resource/file/verification.rb b/lib/chef/resource/file/verification.rb
index 578e6066a2..ae4f9043b2 100644
--- a/lib/chef/resource/file/verification.rb
+++ b/lib/chef/resource/file/verification.rb
@@ -113,7 +113,7 @@ class Chef
if @command.include?("%{file}")
raise ArgumentError, "The %{file} expansion for verify commands has been removed. Please use %{path} instead."
end
- command = @command % { :path => path }
+ command = @command % { path: path }
interpreter = Chef::GuardInterpreter.for_resource(@parent_resource, command, @command_opts)
interpreter.evaluate
end
diff --git a/lib/chef/resource/freebsd_package.rb b/lib/chef/resource/freebsd_package.rb
index e85a75e906..f5e4010ee7 100644
--- a/lib/chef/resource/freebsd_package.rb
+++ b/lib/chef/resource/freebsd_package.rb
@@ -46,7 +46,7 @@ class Chef
#
# @return [Boolean] do we support pkgng
def supports_pkgng?
- ships_with_pkgng? || !!shell_out!("make", "-V", "WITH_PKGNG", :env => nil).stdout.match(/yes/i)
+ ships_with_pkgng? || !!shell_out!("make", "-V", "WITH_PKGNG", env: nil).stdout.match(/yes/i)
end
private
diff --git a/lib/chef/resource/group.rb b/lib/chef/resource/group.rb
index 9298fbc150..b67bfe188e 100644
--- a/lib/chef/resource/group.rb
+++ b/lib/chef/resource/group.rb
@@ -41,7 +41,7 @@ class Chef
set_or_return(
:members,
converted_members,
- :kind_of => [ Array ]
+ kind_of: [ Array ]
)
end
@@ -52,7 +52,7 @@ class Chef
set_or_return(
:excluded_members,
converted_members,
- :kind_of => [ Array ]
+ kind_of: [ Array ]
)
end
diff --git a/lib/chef/resource/hostname.rb b/lib/chef/resource/hostname.rb
index 02996f4464..f213ae47ad 100644
--- a/lib/chef/resource/hostname.rb
+++ b/lib/chef/resource/hostname.rb
@@ -132,7 +132,7 @@ class Chef
# this must come before other methods like /etc/hostname and /etc/sysconfig/network
declare_resource(:execute, "hostnamectl set-hostname #{new_resource.hostname}") do
notifies :reload, "ohai[reload hostname]"
- not_if { shell_out!("hostnamectl status", { :returns => [0, 1] }).stdout =~ /Static hostname:\s*#{new_resource.hostname}\s*$/ }
+ not_if { shell_out!("hostnamectl status", { returns: [0, 1] }).stdout =~ /Static hostname:\s*#{new_resource.hostname}\s*$/ }
end
when ::File.exist?("/etc/hostname")
# debian family uses /etc/hostname
diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb
index 3493cec9db..6e92fb821c 100644
--- a/lib/chef/resource/http_request.rb
+++ b/lib/chef/resource/http_request.rb
@@ -48,7 +48,7 @@ class Chef
set_or_return(
:message,
args,
- :kind_of => Object
+ kind_of: Object
)
end
diff --git a/lib/chef/resource/powershell_script.rb b/lib/chef/resource/powershell_script.rb
index 99821bcefd..95efadd4e6 100644
--- a/lib/chef/resource/powershell_script.rb
+++ b/lib/chef/resource/powershell_script.rb
@@ -40,7 +40,7 @@ class Chef
set_or_return(
:convert_boolean_return,
arg,
- :kind_of => [ FalseClass, TrueClass ]
+ kind_of: [ FalseClass, TrueClass ]
)
end
@@ -52,7 +52,7 @@ class Chef
# guard context and recipe resource context will have the
# same behavior.
def self.get_default_attributes(opts)
- { :convert_boolean_return => true }
+ { convert_boolean_return: true }
end
end
end
diff --git a/lib/chef/resource/remote_directory.rb b/lib/chef/resource/remote_directory.rb
index daeb7b35bb..f03b13ef02 100644
--- a/lib/chef/resource/remote_directory.rb
+++ b/lib/chef/resource/remote_directory.rb
@@ -63,7 +63,7 @@ class Chef
set_or_return(
:files_group,
arg,
- :regex => Chef::Config[:group_valid_regex]
+ regex: Chef::Config[:group_valid_regex]
)
end
@@ -71,7 +71,7 @@ class Chef
set_or_return(
:files_mode,
arg,
- :regex => /^\d{3,4}$/
+ regex: /^\d{3,4}$/
)
end
@@ -79,7 +79,7 @@ class Chef
set_or_return(
:files_owner,
arg,
- :regex => Chef::Config[:user_valid_regex]
+ regex: Chef::Config[:user_valid_regex]
)
end
end
diff --git a/lib/chef/resource/remote_file.rb b/lib/chef/resource/remote_file.rb
index 832fd3568e..3607a3cbc5 100644
--- a/lib/chef/resource/remote_file.rb
+++ b/lib/chef/resource/remote_file.rb
@@ -48,8 +48,8 @@ class Chef
arg = parse_source_args(args)
ret = set_or_return(:source,
arg,
- { :callbacks => {
- :validate_source => method(:validate_source),
+ { callbacks: {
+ validate_source: method(:validate_source),
} })
if ret.is_a? String
Array(ret)
diff --git a/lib/chef/resource/service.rb b/lib/chef/resource/service.rb
index 07473c9709..fe13c433cb 100644
--- a/lib/chef/resource/service.rb
+++ b/lib/chef/resource/service.rb
@@ -62,7 +62,7 @@ class Chef
set_or_return(
:service_name,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -71,7 +71,7 @@ class Chef
set_or_return(
:pattern,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -80,7 +80,7 @@ class Chef
set_or_return(
:start_command,
arg,
- :kind_of => [ String, NilClass, FalseClass ]
+ kind_of: [ String, NilClass, FalseClass ]
)
end
@@ -89,7 +89,7 @@ class Chef
set_or_return(
:stop_command,
arg,
- :kind_of => [ String, NilClass, FalseClass ]
+ kind_of: [ String, NilClass, FalseClass ]
)
end
@@ -98,7 +98,7 @@ class Chef
set_or_return(
:status_command,
arg,
- :kind_of => [ String, NilClass, FalseClass ]
+ kind_of: [ String, NilClass, FalseClass ]
)
end
@@ -107,7 +107,7 @@ class Chef
set_or_return(
:restart_command,
arg,
- :kind_of => [ String, NilClass, FalseClass ]
+ kind_of: [ String, NilClass, FalseClass ]
)
end
@@ -115,7 +115,7 @@ class Chef
set_or_return(
:reload_command,
arg,
- :kind_of => [ String, NilClass, FalseClass ]
+ kind_of: [ String, NilClass, FalseClass ]
)
end
@@ -128,7 +128,7 @@ class Chef
set_or_return(
:init_command,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -137,7 +137,7 @@ class Chef
set_or_return(
:enabled,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
@@ -146,7 +146,7 @@ class Chef
set_or_return(
:running,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
@@ -155,7 +155,7 @@ class Chef
set_or_return(
:masked,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
@@ -163,7 +163,7 @@ class Chef
set_or_return(
:options,
arg.respond_to?(:split) ? arg.shellsplit : arg,
- :kind_of => [ Array, String ]
+ kind_of: [ Array, String ]
)
end
@@ -181,7 +181,7 @@ class Chef
set_or_return(
:priority,
arg,
- :kind_of => [ Integer, String, Hash ]
+ kind_of: [ Integer, String, Hash ]
)
end
@@ -190,7 +190,7 @@ class Chef
set_or_return(
:timeout,
arg,
- :kind_of => Integer
+ kind_of: Integer
)
end
@@ -198,7 +198,7 @@ class Chef
set_or_return(
:parameters,
arg,
- :kind_of => [ Hash ]
+ kind_of: [ Hash ]
)
end
@@ -206,14 +206,14 @@ class Chef
set_or_return(
:run_levels,
arg,
- :kind_of => [ Array ] )
+ kind_of: [ Array ] )
end
def user(arg = nil)
set_or_return(
:user,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
end
diff --git a/lib/chef/resource/template.rb b/lib/chef/resource/template.rb
index 5fc29ec1c6..45879db8e6 100644
--- a/lib/chef/resource/template.rb
+++ b/lib/chef/resource/template.rb
@@ -53,7 +53,7 @@ class Chef
set_or_return(
:source,
file,
- :kind_of => [ String, Array ]
+ kind_of: [ String, Array ]
)
end
diff --git a/lib/chef/resource/user.rb b/lib/chef/resource/user.rb
index 39d8159d4f..df52ebb083 100644
--- a/lib/chef/resource/user.rb
+++ b/lib/chef/resource/user.rb
@@ -51,7 +51,7 @@ class Chef
set_or_return(
:username,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -59,7 +59,7 @@ class Chef
set_or_return(
:comment,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -67,8 +67,8 @@ class Chef
set_or_return(
:uid,
arg,
- :kind_of => [ String, Integer, NilClass ],
- :coerce => proc { |x| x || nil }
+ kind_of: [ String, Integer, NilClass ],
+ coerce: proc { |x| x || nil }
)
end
@@ -76,8 +76,8 @@ class Chef
set_or_return(
:gid,
arg,
- :kind_of => [ String, Integer, NilClass ],
- :coerce => proc { |x| x || nil }
+ kind_of: [ String, Integer, NilClass ],
+ coerce: proc { |x| x || nil }
)
end
@@ -87,7 +87,7 @@ class Chef
set_or_return(
:home,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -95,7 +95,7 @@ class Chef
set_or_return(
:shell,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -103,7 +103,7 @@ class Chef
set_or_return(
:password,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -111,7 +111,7 @@ class Chef
set_or_return(
:salt,
arg,
- :kind_of => [ String ]
+ kind_of: [ String ]
)
end
@@ -119,7 +119,7 @@ class Chef
set_or_return(
:iterations,
arg,
- :kind_of => [ Integer ]
+ kind_of: [ Integer ]
)
end
@@ -127,7 +127,7 @@ class Chef
set_or_return(
:system,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
@@ -135,7 +135,7 @@ class Chef
set_or_return(
:manage_home,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
@@ -143,7 +143,7 @@ class Chef
set_or_return(
:force,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
@@ -151,7 +151,7 @@ class Chef
set_or_return(
:non_unique,
arg,
- :kind_of => [ TrueClass, FalseClass ]
+ kind_of: [ TrueClass, FalseClass ]
)
end
end
diff --git a/lib/chef/resource/windows_script.rb b/lib/chef/resource/windows_script.rb
index 7c39d9fba0..fe3e37989d 100644
--- a/lib/chef/resource/windows_script.rb
+++ b/lib/chef/resource/windows_script.rb
@@ -45,7 +45,7 @@ class Chef
result = set_or_return(
:architecture,
arg,
- :kind_of => Symbol
+ kind_of: Symbol
)
end
diff --git a/lib/chef/resource_reporter.rb b/lib/chef/resource_reporter.rb
index c76ac0a4a3..aa1e427bc5 100644
--- a/lib/chef/resource_reporter.rb
+++ b/lib/chef/resource_reporter.rb
@@ -120,8 +120,8 @@ class Chef
if reporting_enabled?
begin
resource_history_url = "reports/nodes/#{node_name}/runs"
- server_response = @rest_client.post(resource_history_url, { :action => :start, :run_id => run_id,
- :start_time => start_time.to_s }, headers)
+ server_response = @rest_client.post(resource_history_url, { action: :start, run_id: run_id,
+ start_time: start_time.to_s }, headers)
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
handle_error_starting_run(e, resource_history_url)
end
diff --git a/lib/chef/role.rb b/lib/chef/role.rb
index ad01e9fa26..96aa2185ff 100644
--- a/lib/chef/role.rb
+++ b/lib/chef/role.rb
@@ -55,7 +55,7 @@ class Chef
set_or_return(
:name,
arg,
- :regex => /^[\-[:alnum:]_]+$/
+ regex: /^[\-[:alnum:]_]+$/
)
end
@@ -63,7 +63,7 @@ class Chef
set_or_return(
:description,
arg,
- :kind_of => String
+ kind_of: String
)
end
@@ -118,7 +118,7 @@ class Chef
set_or_return(
:default_attributes,
arg,
- :kind_of => Hash
+ kind_of: Hash
)
end
@@ -126,7 +126,7 @@ class Chef
set_or_return(
:override_attributes,
arg,
- :kind_of => Hash
+ kind_of: Hash
)
end
diff --git a/lib/chef/run_list/run_list_expansion.rb b/lib/chef/run_list/run_list_expansion.rb
index b895b53523..085dd9f6be 100644
--- a/lib/chef/run_list/run_list_expansion.rb
+++ b/lib/chef/run_list/run_list_expansion.rb
@@ -148,8 +148,8 @@ class Chef
end
def to_hash
- seen_items = { :recipe => {}, :role => {} }
- { :id => @environment, :run_list => convert_run_list_trace("top level", seen_items) }
+ seen_items = { recipe: {}, role: {} }
+ { id: @environment, run_list: convert_run_list_trace("top level", seen_items) }
end
private
@@ -185,12 +185,12 @@ class Chef
seen_items[item.type][item.name] = true
case item.type
when :recipe
- { :type => "recipe", :name => item.name, :version => item.version, :skipped => !!skipped }
+ { type: "recipe", name: item.name, version: item.version, skipped: !!skipped }
when :role
error = @role_errors[item.name]
missing = @all_missing_roles[item.name]
- { :type => :role, :name => item.name, :children => (missing || error || skipped) ? [] : convert_run_list_trace(item.to_s, seen_items),
- :missing => missing, :error => error, :skipped => skipped }
+ { type: :role, name: item.name, children: (missing || error || skipped) ? [] : convert_run_list_trace(item.to_s, seen_items),
+ missing: missing, error: error, skipped: skipped }
end
end
end
diff --git a/lib/chef/run_list/versioned_recipe_list.rb b/lib/chef/run_list/versioned_recipe_list.rb
index ad769ee952..d9b3c17db3 100644
--- a/lib/chef/run_list/versioned_recipe_list.rb
+++ b/lib/chef/run_list/versioned_recipe_list.rb
@@ -40,7 +40,7 @@ class Chef
end
def with_versions
- map { |recipe_name| { :name => recipe_name, :version => @versions[recipe_name] } }
+ map { |recipe_name| { name: recipe_name, version: @versions[recipe_name] } }
end
# Return an Array of Hashes, each of the form:
@@ -48,7 +48,7 @@ class Chef
def with_version_constraints
map do |recipe_name|
constraint = Chef::VersionConstraint.new(@versions[recipe_name])
- { :name => recipe_name, :version_constraint => constraint }
+ { name: recipe_name, version_constraint: constraint }
end
end
diff --git a/lib/chef/run_status.rb b/lib/chef/run_status.rb
index c3b7945bc9..9a52f846c7 100644
--- a/lib/chef/run_status.rb
+++ b/lib/chef/run_status.rb
@@ -104,16 +104,16 @@ class Chef::RunStatus
# * :backtrace
def to_hash
# use a flat hash here so we can't errors from intermediate values being nil
- { :node => node,
- :success => success?,
- :start_time => start_time,
- :end_time => end_time,
- :elapsed_time => elapsed_time,
- :all_resources => all_resources,
- :updated_resources => updated_resources,
- :exception => formatted_exception,
- :backtrace => backtrace,
- :run_id => run_id }
+ { node: node,
+ success: success?,
+ start_time: start_time,
+ end_time: end_time,
+ elapsed_time: elapsed_time,
+ all_resources: all_resources,
+ updated_resources: updated_resources,
+ exception: formatted_exception,
+ backtrace: backtrace,
+ run_id: run_id }
end
# Returns a string of the format "ExceptionClass: message" or +nil+ if no
diff --git a/lib/chef/shell.rb b/lib/chef/shell.rb
index 88d26e78fc..70c93f653b 100644
--- a/lib/chef/shell.rb
+++ b/lib/chef/shell.rb
@@ -218,80 +218,80 @@ When no CONFIG is specified, chef-shell attempts to load a default configuration
FOOTER
option :config_file,
- :short => "-c CONFIG",
- :long => "--config CONFIG",
- :description => "The configuration file to use"
+ short: "-c CONFIG",
+ long: "--config CONFIG",
+ description: "The configuration file to use"
option :help,
- :short => "-h",
- :long => "--help",
- :description => "Show this message",
- :on => :tail,
- :boolean => true,
- :proc => proc { print_help }
+ short: "-h",
+ long: "--help",
+ description: "Show this message",
+ on: :tail,
+ boolean: true,
+ proc: proc { print_help }
option :log_level,
- :short => "-l LOG_LEVEL",
- :long => "--log-level LOG_LEVEL",
- :description => "Set the logging level",
- :proc => proc { |level| Chef::Config.log_level = level.to_sym; Shell.setup_logger }
+ short: "-l LOG_LEVEL",
+ long: "--log-level LOG_LEVEL",
+ description: "Set the logging level",
+ proc: proc { |level| Chef::Config.log_level = level.to_sym; Shell.setup_logger }
option :standalone,
- :short => "-a",
- :long => "--standalone",
- :description => "standalone session",
- :default => true,
- :boolean => true
+ short: "-a",
+ long: "--standalone",
+ description: "standalone session",
+ default: true,
+ boolean: true
option :solo_shell,
- :short => "-s",
- :long => "--solo",
- :description => "chef-solo session",
- :boolean => true,
- :proc => proc { Chef::Config[:solo] = true }
+ short: "-s",
+ long: "--solo",
+ description: "chef-solo session",
+ boolean: true,
+ proc: proc { Chef::Config[:solo] = true }
option :client,
- :short => "-z",
- :long => "--client",
- :description => "chef-client session",
- :boolean => true
+ short: "-z",
+ long: "--client",
+ description: "chef-client session",
+ boolean: true
option :solo_legacy_shell,
- :long => "--solo-legacy-mode",
- :description => "chef-solo legacy session",
- :boolean => true,
- :proc => proc { Chef::Config[:solo_legacy_mode] = true }
+ long: "--solo-legacy-mode",
+ description: "chef-solo legacy session",
+ boolean: true,
+ proc: proc { Chef::Config[:solo_legacy_mode] = true }
option :json_attribs,
- :short => "-j JSON_ATTRIBS",
- :long => "--json-attributes JSON_ATTRIBS",
- :description => "Load attributes from a JSON file or URL",
- :proc => nil
+ short: "-j JSON_ATTRIBS",
+ long: "--json-attributes JSON_ATTRIBS",
+ description: "Load attributes from a JSON file or URL",
+ proc: nil
option :chef_server_url,
- :short => "-S CHEFSERVERURL",
- :long => "--server CHEFSERVERURL",
- :description => "The chef server URL",
- :proc => nil
+ short: "-S CHEFSERVERURL",
+ long: "--server CHEFSERVERURL",
+ description: "The chef server URL",
+ proc: nil
option :version,
- :short => "-v",
- :long => "--version",
- :description => "Show chef version",
- :boolean => true,
- :proc => lambda { |v| puts "Chef: #{::Chef::VERSION}" },
- :exit => 0
+ short: "-v",
+ long: "--version",
+ description: "Show chef version",
+ boolean: true,
+ proc: lambda { |v| puts "Chef: #{::Chef::VERSION}" },
+ exit: 0
option :override_runlist,
- :short => "-o RunlistItem,RunlistItem...",
- :long => "--override-runlist RunlistItem,RunlistItem...",
- :description => "Replace current run list with specified items",
- :proc => lambda { |items| items.split(",").map { |item| Chef::RunList::RunListItem.new(item) } }
+ short: "-o RunlistItem,RunlistItem...",
+ long: "--override-runlist RunlistItem,RunlistItem...",
+ description: "Replace current run list with specified items",
+ proc: lambda { |items| items.split(",").map { |item| Chef::RunList::RunListItem.new(item) } }
option :skip_cookbook_sync,
- :long => "--[no-]skip-cookbook-sync",
- :description => "Use cached cookbooks without overwriting local differences from the server",
- :boolean => false
+ long: "--[no-]skip-cookbook-sync",
+ description: "Use cached cookbooks without overwriting local differences from the server",
+ boolean: false
def self.print_help
instance = new
diff --git a/lib/chef/shell/ext.rb b/lib/chef/shell/ext.rb
index fb0733e96e..727eb6b344 100644
--- a/lib/chef/shell/ext.rb
+++ b/lib/chef/shell/ext.rb
@@ -239,10 +239,10 @@ module Shell
end
desc "returns an object to control a paused chef run"
- subcommands :resume => "resume the chef run",
- :step => "run only the next resource",
- :skip_back => "move back in the run list",
- :skip_forward => "move forward in the run list"
+ subcommands resume: "resume the chef run",
+ step: "run only the next resource",
+ skip_back: "move back in the run list",
+ skip_forward: "move forward in the run list"
def chef_run
Shell.session.resource_collection.iterator
end
@@ -393,18 +393,18 @@ module Shell
This will strip the admin privileges from any client named after borat.
E
- subcommands :all => "list all api clients",
- :show => "load an api client by name",
- :search => "search for API clients",
- :transform => "edit all api clients via a code block and save them"
+ subcommands all: "list all api clients",
+ show: "load an api client by name",
+ search: "search for API clients",
+ transform: "edit all api clients via a code block and save them"
def clients
@clients ||= Shell::ModelWrapper.new(Chef::ApiClient, :client)
end
desc "Find and edit cookbooks"
- subcommands :all => "list all cookbooks",
- :show => "load a cookbook by name",
- :transform => "edit all cookbooks via a code block and save them"
+ subcommands all: "list all cookbooks",
+ show: "load a cookbook by name",
+ transform: "edit all cookbooks via a code block and save them"
def cookbooks
@cookbooks ||= Shell::ModelWrapper.new(Chef::CookbookVersion)
end
@@ -455,10 +455,10 @@ module Shell
This will assign the attribute to every node with a FQDN matching the regex.
E
- subcommands :all => "list all nodes",
- :show => "load a node by name",
- :search => "search for nodes",
- :transform => "edit all nodes via a code block and save them"
+ subcommands all: "list all nodes",
+ show: "load a node by name",
+ search: "search for nodes",
+ transform: "edit all nodes via a code block and save them"
def nodes
@nodes ||= Shell::ModelWrapper.new(Chef::Node)
end
@@ -477,10 +477,10 @@ module Shell
## SEE ALSO ##
See the help for +nodes+ for more information about the subcommands.
E
- subcommands :all => "list all roles",
- :show => "load a role by name",
- :search => "search for roles",
- :transform => "edit all roles via a code block and save them"
+ subcommands all: "list all roles",
+ show: "load a role by name",
+ search: "search for roles",
+ transform: "edit all roles via a code block and save them"
def roles
@roles ||= Shell::ModelWrapper.new(Chef::Role)
end
@@ -503,10 +503,10 @@ module Shell
See the help for +nodes+ for more information about the subcommands.
E
- subcommands :all => "list all items in the data bag",
- :show => "load a data bag item by id",
- :search => "search for items in the data bag",
- :transform => "edit all items via a code block and save them"
+ subcommands all: "list all items in the data bag",
+ show: "load a data bag item by id",
+ search: "search for items in the data bag",
+ transform: "edit all items via a code block and save them"
def databags(databag_name)
@named_databags_wrappers ||= {}
@named_databags_wrappers[databag_name] ||= Shell::NamedDataBagWrapper.new(databag_name)
@@ -526,10 +526,10 @@ module Shell
## SEE ALSO ##
See the help for +nodes+ for more information about the subcommands.
E
- subcommands :all => "list all environments",
- :show => "load an environment by name",
- :search => "search for environments",
- :transform => "edit all environments via a code block and save them"
+ subcommands all: "list all environments",
+ show: "load an environment by name",
+ search: "search for environments",
+ transform: "edit all environments via a code block and save them"
def environments
@environments ||= Shell::ModelWrapper.new(Chef::Environment)
end
diff --git a/lib/chef/shell/shell_session.rb b/lib/chef/shell/shell_session.rb
index aec2152063..789a022b56 100644
--- a/lib/chef/shell/shell_session.rb
+++ b/lib/chef/shell/shell_session.rb
@@ -264,8 +264,8 @@ module Shell
end
def register
- @rest = Chef::ServerAPI.new(Chef::Config[:chef_server_url], :client_name => Chef::Config[:node_name],
- :signing_key_filename => Chef::Config[:client_key])
+ @rest = Chef::ServerAPI.new(Chef::Config[:chef_server_url], client_name: Chef::Config[:node_name],
+ signing_key_filename: Chef::Config[:client_key])
end
end
diff --git a/lib/chef/user.rb b/lib/chef/user.rb
index f52d0e2555..eba55c4186 100644
--- a/lib/chef/user.rb
+++ b/lib/chef/user.rb
@@ -49,32 +49,32 @@ class Chef
end
def chef_rest_v0
- @chef_rest_v0 ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url], { :api_version => "0" })
+ @chef_rest_v0 ||= Chef::ServerAPI.new(Chef::Config[:chef_server_url], { api_version: "0" })
end
def name(arg = nil)
set_or_return(:name, arg,
- :regex => /^[a-z0-9\-_]+$/)
+ regex: /^[a-z0-9\-_]+$/)
end
def admin(arg = nil)
set_or_return(:admin,
- arg, :kind_of => [TrueClass, FalseClass])
+ arg, kind_of: [TrueClass, FalseClass])
end
def public_key(arg = nil)
set_or_return(:public_key,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def private_key(arg = nil)
set_or_return(:private_key,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def password(arg = nil)
set_or_return(:password,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def to_hash
@@ -97,14 +97,14 @@ class Chef
end
def create
- payload = { :name => name, :admin => admin, :password => password }
+ payload = { name: name, admin: admin, password: password }
payload[:public_key] = public_key if public_key
new_user = chef_rest_v0.post("users", payload)
Chef::User.from_hash(to_hash.merge(new_user))
end
def update(new_key = false)
- payload = { :name => name, :admin => admin }
+ payload = { name: name, admin: admin }
payload[:private_key] = new_key if new_key
payload[:password] = password if password
updated_user = chef_rest_v0.put("users/#{name}", payload)
@@ -122,7 +122,7 @@ class Chef
end
def reregister
- reregistered_self = chef_rest_v0.put("users/#{name}", { :name => name, :admin => admin, :private_key => true })
+ reregistered_self = chef_rest_v0.put("users/#{name}", { name: name, admin: admin, private_key: true })
private_key(reregistered_self["private_key"])
self
end
@@ -153,7 +153,7 @@ class Chef
end
def self.list(inflate = false)
- response = Chef::ServerAPI.new(Chef::Config[:chef_server_url], { :api_version => "0" }).get("users")
+ response = Chef::ServerAPI.new(Chef::Config[:chef_server_url], { api_version: "0" }).get("users")
users = if response.is_a?(Array)
transform_ohc_list_response(response) # OHC/OPC
else
@@ -170,7 +170,7 @@ class Chef
end
def self.load(name)
- response = Chef::ServerAPI.new(Chef::Config[:chef_server_url], { :api_version => "0" }).get("users/#{name}")
+ response = Chef::ServerAPI.new(Chef::Config[:chef_server_url], { api_version: "0" }).get("users/#{name}")
Chef::User.from_hash(response)
end
diff --git a/lib/chef/user_v1.rb b/lib/chef/user_v1.rb
index 0ca17c6ed6..8bd92dfab8 100644
--- a/lib/chef/user_v1.rb
+++ b/lib/chef/user_v1.rb
@@ -55,61 +55,61 @@ class Chef
end
def chef_root_rest_v0
- @chef_root_rest_v0 ||= Chef::ServerAPI.new(Chef::Config[:chef_server_root], { :api_version => "0" })
+ @chef_root_rest_v0 ||= Chef::ServerAPI.new(Chef::Config[:chef_server_root], { api_version: "0" })
end
def chef_root_rest_v1
- @chef_root_rest_v1 ||= Chef::ServerAPI.new(Chef::Config[:chef_server_root], { :api_version => "1" })
+ @chef_root_rest_v1 ||= Chef::ServerAPI.new(Chef::Config[:chef_server_root], { api_version: "1" })
end
def username(arg = nil)
set_or_return(:username, arg,
- :regex => /^[a-z0-9\-_]+$/)
+ regex: /^[a-z0-9\-_]+$/)
end
def display_name(arg = nil)
set_or_return(:display_name,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def first_name(arg = nil)
set_or_return(:first_name,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def middle_name(arg = nil)
set_or_return(:middle_name,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def last_name(arg = nil)
set_or_return(:last_name,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def email(arg = nil)
set_or_return(:email,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def create_key(arg = nil)
set_or_return(:create_key, arg,
- :kind_of => [TrueClass, FalseClass])
+ kind_of: [TrueClass, FalseClass])
end
def public_key(arg = nil)
set_or_return(:public_key,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def private_key(arg = nil)
set_or_return(:private_key,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def password(arg = nil)
set_or_return(:password,
- arg, :kind_of => String)
+ arg, kind_of: String)
end
def to_hash
@@ -141,12 +141,12 @@ class Chef
# try v1, fail back to v0 if v1 not supported
begin
payload = {
- :username => @username,
- :display_name => @display_name,
- :first_name => @first_name,
- :last_name => @last_name,
- :email => @email,
- :password => @password,
+ username: @username,
+ display_name: @display_name,
+ first_name: @first_name,
+ last_name: @last_name,
+ email: @email,
+ password: @password,
}
payload[:public_key] = @public_key unless @public_key.nil?
payload[:create_key] = @create_key unless @create_key.nil?
@@ -167,12 +167,12 @@ class Chef
supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)
raise e unless supported_versions && supported_versions.include?(0)
payload = {
- :username => @username,
- :display_name => @display_name,
- :first_name => @first_name,
- :last_name => @last_name,
- :email => @email,
- :password => @password,
+ username: @username,
+ display_name: @display_name,
+ first_name: @first_name,
+ last_name: @last_name,
+ email: @email,
+ password: @password,
}
payload[:middle_name] = @middle_name unless @middle_name.nil?
payload[:public_key] = @public_key unless @public_key.nil?
@@ -185,7 +185,7 @@ class Chef
def update(new_key = false)
begin
- payload = { :username => username }
+ payload = { username: username }
payload[:display_name] = display_name unless display_name.nil?
payload[:first_name] = first_name unless first_name.nil?
payload[:middle_name] = middle_name unless middle_name.nil?
diff --git a/lib/chef/util/backup.rb b/lib/chef/util/backup.rb
index 8bf2b3f25b..a14f006d59 100644
--- a/lib/chef/util/backup.rb
+++ b/lib/chef/util/backup.rb
@@ -69,7 +69,7 @@ class Chef
def do_backup
FileUtils.mkdir_p(::File.dirname(backup_path)) if Chef::Config[:file_backup_path]
- FileUtils.cp(path, backup_path, :preserve => true)
+ FileUtils.cp(path, backup_path, preserve: true)
Chef::Log.info("#{@new_resource} backed up to #{backup_path}")
end
diff --git a/lib/chef/util/diff.rb b/lib/chef/util/diff.rb
index b5c85df56d..decff35d85 100644
--- a/lib/chef/util/diff.rb
+++ b/lib/chef/util/diff.rb
@@ -176,7 +176,7 @@ class Chef
end
def encode_diff_for_json(diff_str)
- diff_str.encode!("UTF-8", :invalid => :replace, :undef => :replace, :replace => "?")
+ diff_str.encode!("UTF-8", invalid: :replace, undef: :replace, replace: "?")
end
end
diff --git a/lib/chef/util/dsc/configuration_generator.rb b/lib/chef/util/dsc/configuration_generator.rb
index 3e9475bac2..78092b3c0d 100644
--- a/lib/chef/util/dsc/configuration_generator.rb
+++ b/lib/chef/util/dsc/configuration_generator.rb
@@ -68,7 +68,7 @@ class Chef::Util::DSC
end
def get_merged_configuration_flags!(configuration_flags, configuration_name)
- merged_configuration_flags = { :outputpath => configuration_document_directory(configuration_name) }
+ merged_configuration_flags = { outputpath: configuration_document_directory(configuration_name) }
if configuration_flags
configuration_flags.map do |switch, value|
if merged_configuration_flags.key?(switch.to_s.downcase.to_sym)
diff --git a/lib/chef/util/dsc/lcm_output_parser.rb b/lib/chef/util/dsc/lcm_output_parser.rb
index 658d5c7d8f..b164db6b19 100644
--- a/lib/chef/util/dsc/lcm_output_parser.rb
+++ b/lib/chef/util/dsc/lcm_output_parser.rb
@@ -128,7 +128,7 @@ class Chef
if current_resource[:name]
resources.push(current_resource)
end
- current_resource = { :name => info }
+ current_resource = { name: info }
else
Chef::Log.trace("Ignoring op_action #{op_action}: Read line #{line}")
end
diff --git a/lib/chef/util/file_edit.rb b/lib/chef/util/file_edit.rb
index 5aa33fd169..74e2ca6a5f 100644
--- a/lib/chef/util/file_edit.rb
+++ b/lib/chef/util/file_edit.rb
@@ -84,7 +84,7 @@ class Chef
def write_file
if @changes
backup_pathname = original_pathname + ".old"
- FileUtils.cp(original_pathname, backup_pathname, :preserve => true)
+ FileUtils.cp(original_pathname, backup_pathname, preserve: true)
File.open(original_pathname, "w") do |newfile|
editor.lines.each do |line|
newfile.puts(line)
diff --git a/lib/chef/util/powershell/cmdlet.rb b/lib/chef/util/powershell/cmdlet.rb
index e300266b1e..edd3e92da1 100644
--- a/lib/chef/util/powershell/cmdlet.rb
+++ b/lib/chef/util/powershell/cmdlet.rb
@@ -48,8 +48,8 @@ class Chef
attr_reader :output_format
def run(switches = {}, execution_options = {}, *arguments)
- streams = { :json => CmdletStream.new("json"),
- :verbose => CmdletStream.new("verbose"),
+ streams = { json: CmdletStream.new("json"),
+ verbose: CmdletStream.new("verbose"),
}
arguments_string = arguments.join(" ")
@@ -74,7 +74,7 @@ class Chef
"#{arguments_string} #{redirections}"\
"#{json_command}\";if ( ! $? ) { exit 1 }"
- augmented_options = { :returns => [0], :live_stream => false }.merge(execution_options)
+ augmented_options = { returns: [0], live_stream: false }.merge(execution_options)
command = Mixlib::ShellOut.new(command_string, augmented_options)
status = nil
diff --git a/lib/chef/util/selinux.rb b/lib/chef/util/selinux.rb
index fb0c98cff5..a46e486f96 100644
--- a/lib/chef/util/selinux.rb
+++ b/lib/chef/util/selinux.rb
@@ -72,7 +72,7 @@ class Chef
def check_selinux_enabled?
if selinuxenabled_path
- cmd = shell_out!(selinuxenabled_path, :returns => [0, 1])
+ cmd = shell_out!(selinuxenabled_path, returns: [0, 1])
case cmd.exitstatus
when 1
return false
diff --git a/lib/chef/win32/registry.rb b/lib/chef/win32/registry.rb
index 1193911b00..b1365fd61b 100644
--- a/lib/chef/win32/registry.rb
+++ b/lib/chef/win32/registry.rb
@@ -56,7 +56,7 @@ class Chef
hive, key = get_hive_and_key(key_path)
key_exists!(key_path)
values = hive.open(key, ::Win32::Registry::KEY_READ | registry_system_architecture) do |reg|
- reg.map { |name, type, data| { :name => name, :type => get_name_from_type(type), :data => data } }
+ reg.map { |name, type, data| { name: name, type: get_name_from_type(type), data: data } }
end
end
@@ -321,13 +321,13 @@ class Chef
def _type_name_map
{
- :binary => ::Win32::Registry::REG_BINARY,
- :string => ::Win32::Registry::REG_SZ,
- :multi_string => ::Win32::Registry::REG_MULTI_SZ,
- :expand_string => ::Win32::Registry::REG_EXPAND_SZ,
- :dword => ::Win32::Registry::REG_DWORD,
- :dword_big_endian => ::Win32::Registry::REG_DWORD_BIG_ENDIAN,
- :qword => ::Win32::Registry::REG_QWORD,
+ binary: ::Win32::Registry::REG_BINARY,
+ string: ::Win32::Registry::REG_SZ,
+ multi_string: ::Win32::Registry::REG_MULTI_SZ,
+ expand_string: ::Win32::Registry::REG_EXPAND_SZ,
+ dword: ::Win32::Registry::REG_DWORD,
+ dword_big_endian: ::Win32::Registry::REG_DWORD_BIG_ENDIAN,
+ qword: ::Win32::Registry::REG_QWORD,
}
end
diff --git a/lib/chef/win32/security/securable_object.rb b/lib/chef/win32/security/securable_object.rb
index aef1a72c8c..16841413b7 100644
--- a/lib/chef/win32/security/securable_object.rb
+++ b/lib/chef/win32/security/securable_object.rb
@@ -71,36 +71,36 @@ class Chef
end
def dacl=(val)
- Security.set_named_security_info(path, type, :dacl => val)
+ Security.set_named_security_info(path, type, dacl: val)
end
# You don't set dacl_inherits without also setting dacl,
# because Windows gets angry and denies you access. So
# if you want to do that, you may as well do both at once.
def set_dacl(dacl, dacl_inherits)
- Security.set_named_security_info(path, type, :dacl => dacl, :dacl_inherits => dacl_inherits)
+ Security.set_named_security_info(path, type, dacl: dacl, dacl_inherits: dacl_inherits)
end
def group=(val)
- Security.set_named_security_info(path, type, :group => val)
+ Security.set_named_security_info(path, type, group: val)
end
def owner=(val)
# TODO to fix serious permissions problems, we may need to enable SeBackupPrivilege. But we might need it (almost) everywhere else, too.
Security.with_privileges("SeTakeOwnershipPrivilege", "SeRestorePrivilege") do
- Security.set_named_security_info(path, type, :owner => val)
+ Security.set_named_security_info(path, type, owner: val)
end
end
def sacl=(val)
Security.with_privileges("SeSecurityPrivilege") do
- Security.set_named_security_info(path, type, :sacl => val)
+ Security.set_named_security_info(path, type, sacl: val)
end
end
def set_sacl(sacl, sacl_inherits)
Security.with_privileges("SeSecurityPrivilege") do
- Security.set_named_security_info(path, type, :sacl => sacl, :sacl_inherits => sacl_inherits)
+ Security.set_named_security_info(path, type, sacl: sacl, sacl_inherits: sacl_inherits)
end
end
end
diff --git a/lib/chef/win32/version.rb b/lib/chef/win32/version.rb
index 944cb207f5..f96fd18316 100644
--- a/lib/chef/win32/version.rb
+++ b/lib/chef/win32/version.rb
@@ -50,21 +50,21 @@ class Chef
private_class_method :method_name_from_marketing_name
WIN_VERSIONS = {
- "Windows 10" => { :major => 10, :minor => 0, :callable => lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } },
- "Windows Server 2016" => { :major => 10, :minor => 0, :callable => lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } },
- "Windows 8.1" => { :major => 6, :minor => 3, :callable => lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } },
- "Windows Server 2012 R2" => { :major => 6, :minor => 3, :callable => lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } },
- "Windows 8" => { :major => 6, :minor => 2, :callable => lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } },
- "Windows Server 2012" => { :major => 6, :minor => 2, :callable => lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } },
- "Windows 7" => { :major => 6, :minor => 1, :callable => lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } },
- "Windows Server 2008 R2" => { :major => 6, :minor => 1, :callable => lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } },
- "Windows Server 2008" => { :major => 6, :minor => 0, :callable => lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } },
- "Windows Vista" => { :major => 6, :minor => 0, :callable => lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } },
- "Windows Server 2003 R2" => { :major => 5, :minor => 2, :callable => lambda { |product_type, suite_mask| get_system_metrics(SM_SERVERR2) != 0 } },
- "Windows Home Server" => { :major => 5, :minor => 2, :callable => lambda { |product_type, suite_mask| (suite_mask & VER_SUITE_WH_SERVER) == VER_SUITE_WH_SERVER } },
- "Windows Server 2003" => { :major => 5, :minor => 2, :callable => lambda { |product_type, suite_mask| get_system_metrics(SM_SERVERR2) == 0 } },
- "Windows XP" => { :major => 5, :minor => 1 },
- "Windows 2000" => { :major => 5, :minor => 0 },
+ "Windows 10" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } },
+ "Windows Server 2016" => { major: 10, minor: 0, callable: lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } },
+ "Windows 8.1" => { major: 6, minor: 3, callable: lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } },
+ "Windows Server 2012 R2" => { major: 6, minor: 3, callable: lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } },
+ "Windows 8" => { major: 6, minor: 2, callable: lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } },
+ "Windows Server 2012" => { major: 6, minor: 2, callable: lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } },
+ "Windows 7" => { major: 6, minor: 1, callable: lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } },
+ "Windows Server 2008 R2" => { major: 6, minor: 1, callable: lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } },
+ "Windows Server 2008" => { major: 6, minor: 0, callable: lambda { |product_type, suite_mask| product_type != VER_NT_WORKSTATION } },
+ "Windows Vista" => { major: 6, minor: 0, callable: lambda { |product_type, suite_mask| product_type == VER_NT_WORKSTATION } },
+ "Windows Server 2003 R2" => { major: 5, minor: 2, callable: lambda { |product_type, suite_mask| get_system_metrics(SM_SERVERR2) != 0 } },
+ "Windows Home Server" => { major: 5, minor: 2, callable: lambda { |product_type, suite_mask| (suite_mask & VER_SUITE_WH_SERVER) == VER_SUITE_WH_SERVER } },
+ "Windows Server 2003" => { major: 5, minor: 2, callable: lambda { |product_type, suite_mask| get_system_metrics(SM_SERVERR2) == 0 } },
+ "Windows XP" => { major: 5, minor: 1 },
+ "Windows 2000" => { major: 5, minor: 0 },
}
def initialize
diff --git a/spec/functional/audit/rspec_formatter_spec.rb b/spec/functional/audit/rspec_formatter_spec.rb
index 209694ae70..f30f7bbd8a 100644
--- a/spec/functional/audit/rspec_formatter_spec.rb
+++ b/spec/functional/audit/rspec_formatter_spec.rb
@@ -30,7 +30,7 @@ describe Chef::Audit::RspecFormatter do
let(:events) { double("events").as_null_object }
let(:audits) { {} }
- let(:run_context) { instance_double(Chef::RunContext, :events => events, :audits => audits) }
+ let(:run_context) { instance_double(Chef::RunContext, events: events, audits: audits) }
let(:runner) { Chef::Audit::Runner.new(run_context) }
let(:output) { double("output") }
diff --git a/spec/functional/audit/runner_spec.rb b/spec/functional/audit/runner_spec.rb
index 54f014e28f..f80256fa5c 100644
--- a/spec/functional/audit/runner_spec.rb
+++ b/spec/functional/audit/runner_spec.rb
@@ -49,7 +49,7 @@ describe Chef::Audit::Runner do
describe "#run" do
let(:audits) { {} }
- let(:run_context) { instance_double(Chef::RunContext, :events => events, :audits => audits) }
+ let(:run_context) { instance_double(Chef::RunContext, events: events, audits: audits) }
let(:control_group_name) { "control_group_name" }
# Set cookbook path to include our parent, so that it will recognize this
diff --git a/spec/functional/dsl/reboot_pending_spec.rb b/spec/functional/dsl/reboot_pending_spec.rb
index c7a93c6822..ff7fd574b1 100644
--- a/spec/functional/dsl/reboot_pending_spec.rb
+++ b/spec/functional/dsl/reboot_pending_spec.rb
@@ -42,19 +42,19 @@ describe Chef::DSL::RebootPending, :windows_only do
describe 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations' do
let(:reg_key) { 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager' }
- let(:original_set) { registry.value_exists?(reg_key, { :name => "PendingFileRenameOperations" }) }
+ let(:original_set) { registry.value_exists?(reg_key, { name: "PendingFileRenameOperations" }) }
it "returns true if the registry value exists" do
skip "found existing registry key" if original_set
registry.set_value(reg_key,
- { :name => "PendingFileRenameOperations", :type => :multi_string, :data => ['\??\C:\foo.txt|\??\C:\bar.txt'] })
+ { name: "PendingFileRenameOperations", type: :multi_string, data: ['\??\C:\foo.txt|\??\C:\bar.txt'] })
expect(recipe.reboot_pending?).to be_truthy
end
after do
unless original_set
- registry.delete_value(reg_key, { :name => "PendingFileRenameOperations" })
+ registry.delete_value(reg_key, { name: "PendingFileRenameOperations" })
end
end
end
diff --git a/spec/functional/dsl/registry_helper_spec.rb b/spec/functional/dsl/registry_helper_spec.rb
index d90d5090e4..7a56ee11cf 100644
--- a/spec/functional/dsl/registry_helper_spec.rb
+++ b/spec/functional/dsl/registry_helper_spec.rb
@@ -42,7 +42,7 @@ describe Chef::Resource::RegistryKey, :windows_only do
end
it "returns true if registry has specified value" do
values = @resource.registry_get_values("HKCU\\Software\\Root")
- expect(values.include?({ :name => "RootType1", :type => :string, :data => "fibrous" })).to eq(true)
+ expect(values.include?({ name: "RootType1", type: :string, data: "fibrous" })).to eq(true)
end
it "returns true if specified registry_has_subkey" do
expect(@resource.registry_has_subkeys?("HKCU\\Software\\Root")).to eq(true)
@@ -52,10 +52,10 @@ describe Chef::Resource::RegistryKey, :windows_only do
expect(subkeys.include?("Branch")).to eq(true)
end
it "returns true if registry_value_exists" do
- expect(@resource.registry_value_exists?("HKCU\\Software\\Root", { :name => "RootType1", :type => :string, :data => "fibrous" })).to eq(true)
+ expect(@resource.registry_value_exists?("HKCU\\Software\\Root", { name: "RootType1", type: :string, data: "fibrous" })).to eq(true)
end
it "returns true if data_value_exists" do
- expect(@resource.registry_data_exists?("HKCU\\Software\\Root", { :name => "RootType1", :type => :string, :data => "fibrous" })).to eq(true)
+ expect(@resource.registry_data_exists?("HKCU\\Software\\Root", { name: "RootType1", type: :string, data: "fibrous" })).to eq(true)
end
end
end
diff --git a/spec/functional/http/simple_spec.rb b/spec/functional/http/simple_spec.rb
index fcabd3f308..562c037bb0 100644
--- a/spec/functional/http/simple_spec.rb
+++ b/spec/functional/http/simple_spec.rb
@@ -24,7 +24,7 @@ describe Chef::HTTP::Simple do
include ChefHTTPShared
let(:http_client) { described_class.new(source) }
- let(:http_client_disable_gzip) { described_class.new(source, { :disable_gzip => true } ) }
+ let(:http_client_disable_gzip) { described_class.new(source, { disable_gzip: true } ) }
before(:all) do
start_tiny_server(RequestTimeout: 1)
diff --git a/spec/functional/knife/ssh_spec.rb b/spec/functional/knife/ssh_spec.rb
index 3defbe781f..95e7b6454c 100644
--- a/spec/functional/knife/ssh_spec.rb
+++ b/spec/functional/knife/ssh_spec.rb
@@ -301,7 +301,7 @@ describe Chef::Knife::Ssh do
end
it "uses the ssh_gateway_identity file" do
- expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { :keys => File.expand_path("#{ENV['HOME']}/.ssh/aws-gateway.rsa").squeeze("/"), :keys_only => true })
+ expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { keys: File.expand_path("#{ENV['HOME']}/.ssh/aws-gateway.rsa").squeeze("/"), keys_only: true })
@knife.run
expect(@knife.config[:ssh_gateway_identity]).to eq("~/.ssh/aws-gateway.rsa")
end
@@ -315,7 +315,7 @@ describe Chef::Knife::Ssh do
end
it "uses the ssh_gateway_identity file" do
- expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { :keys => File.expand_path("#{ENV['HOME']}/.ssh/aws-gateway.rsa").squeeze("/"), :keys_only => true })
+ expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { keys: File.expand_path("#{ENV['HOME']}/.ssh/aws-gateway.rsa").squeeze("/"), keys_only: true })
@knife.run
expect(@knife.config[:ssh_gateway_identity]).to eq("~/.ssh/aws-gateway.rsa")
end
diff --git a/spec/functional/mixin/shell_out_spec.rb b/spec/functional/mixin/shell_out_spec.rb
index 48a34762c6..b3e9bf796d 100644
--- a/spec/functional/mixin/shell_out_spec.rb
+++ b/spec/functional/mixin/shell_out_spec.rb
@@ -40,9 +40,9 @@ describe Chef::Mixin::ShellOut do
describe "when environment['LC_ALL'] is set" do
it "should use the option's setting" do
cmd = if windows?
- shell_out_with_systems_locale("echo %LC_ALL%", :environment => { "LC_ALL" => "POSIX" })
+ shell_out_with_systems_locale("echo %LC_ALL%", environment: { "LC_ALL" => "POSIX" })
else
- shell_out_with_systems_locale("echo $LC_ALL", :environment => { "LC_ALL" => "POSIX" })
+ shell_out_with_systems_locale("echo $LC_ALL", environment: { "LC_ALL" => "POSIX" })
end
expect(cmd.stdout.chomp).to eq "POSIX"
@@ -66,9 +66,9 @@ describe Chef::Mixin::ShellOut do
describe "when environment['LC_ALL'] is set" do
it "should use the option's setting" do
cmd = if windows?
- shell_out("echo %LC_ALL%", :environment => { "LC_ALL" => "POSIX" }, default_env: false)
+ shell_out("echo %LC_ALL%", environment: { "LC_ALL" => "POSIX" }, default_env: false)
else
- shell_out("echo $LC_ALL", :environment => { "LC_ALL" => "POSIX" }, default_env: false)
+ shell_out("echo $LC_ALL", environment: { "LC_ALL" => "POSIX" }, default_env: false)
end
expect(cmd.stdout.chomp).to eq "POSIX"
diff --git a/spec/functional/rebooter_spec.rb b/spec/functional/rebooter_spec.rb
index 36961593b0..8e5b23f86b 100644
--- a/spec/functional/rebooter_spec.rb
+++ b/spec/functional/rebooter_spec.rb
@@ -22,9 +22,9 @@ describe Chef::Platform::Rebooter do
let(:reboot_info) do
{
- :delay_mins => 5,
- :requested_by => "reboot resource functional test",
- :reason => "rebooter spec test",
+ delay_mins: 5,
+ requested_by: "reboot resource functional test",
+ reason: "rebooter spec test",
}
end
@@ -44,9 +44,9 @@ describe Chef::Platform::Rebooter do
let(:expected) do
{
- :windows => "#{ENV['SYSTEMROOT']}/System32/shutdown.exe /r /t 300 /c \"rebooter spec test\"",
- :linux => 'shutdown -r +5 "rebooter spec test" &',
- :solaris => 'shutdown -i6 -g5 -y "rebooter spec test" &',
+ windows: "#{ENV['SYSTEMROOT']}/System32/shutdown.exe /r /t 300 /c \"rebooter spec test\"",
+ linux: 'shutdown -r +5 "rebooter spec test" &',
+ solaris: 'shutdown -i6 -g5 -y "rebooter spec test" &',
}
end
diff --git a/spec/functional/resource/aixinit_service_spec.rb b/spec/functional/resource/aixinit_service_spec.rb
index bf50046b03..3241a1b3cb 100755
--- a/spec/functional/resource/aixinit_service_spec.rb
+++ b/spec/functional/resource/aixinit_service_spec.rb
@@ -59,7 +59,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
let(:new_resource) do
new_resource = Chef::Resource::Service.new("chefinittest", run_context)
new_resource.provider Chef::Provider::Service::AixInit
- new_resource.supports({ :status => true, :restart => true, :reload => true })
+ new_resource.supports({ status: true, restart: true, reload: true })
new_resource
end
diff --git a/spec/functional/resource/apt_package_spec.rb b/spec/functional/resource/apt_package_spec.rb
index c032bafc92..c1ac51c4b1 100644
--- a/spec/functional/resource/apt_package_spec.rb
+++ b/spec/functional/resource/apt_package_spec.rb
@@ -50,11 +50,11 @@ module AptServer
def apt_server
@apt_server ||= WEBrick::HTTPServer.new(
- :Port => 9000,
- :DocumentRoot => apt_data_dir + "/var/www/apt",
+ Port: 9000,
+ DocumentRoot: apt_data_dir + "/var/www/apt",
# Make WEBrick quiet, comment out for debug.
- :Logger => Logger.new(StringIO.new),
- :AccessLog => [ StringIO.new, WEBrick::AccessLog::COMMON_LOG_FORMAT ]
+ Logger: Logger.new(StringIO.new),
+ AccessLog: [ StringIO.new, WEBrick::AccessLog::COMMON_LOG_FORMAT ]
)
end
@@ -86,10 +86,10 @@ module AptServer
end
end
-metadata = { :unix_only => true,
- :requires_root => true,
- :provider => { :package => Chef::Provider::Package::Apt },
- :arch => "x86_64" # test packages are 64bit
+metadata = { unix_only: true,
+ requires_root: true,
+ provider: { package: Chef::Provider::Package::Apt },
+ arch: "x86_64" # test packages are 64bit
}
describe Chef::Resource::AptPackage, metadata do
@@ -169,13 +169,13 @@ describe Chef::Resource::AptPackage, metadata do
it "does nothing for action :remove" do
package_resource.run_action(:remove)
- shell_out!("dpkg -l chef-integration-test", :returns => [1])
+ shell_out!("dpkg -l chef-integration-test", returns: [1])
expect(package_resource).not_to be_updated_by_last_action
end
it "does nothing for action :purge" do
package_resource.run_action(:purge)
- shell_out!("dpkg -l chef-integration-test", :returns => [1])
+ shell_out!("dpkg -l chef-integration-test", returns: [1])
expect(package_resource).not_to be_updated_by_last_action
end
@@ -275,7 +275,7 @@ describe Chef::Resource::AptPackage, metadata do
r = base_resource
r.cookbook_name = "preseed"
r.response_file("preseed-template-variables.seed")
- r.response_file_variables({ :template_variable => "SUPPORTS VARIABLES" })
+ r.response_file_variables({ template_variable: "SUPPORTS VARIABLES" })
r
end
@@ -300,13 +300,13 @@ describe Chef::Resource::AptPackage, metadata do
it "does nothing for action :install" do
package_resource.run_action(:install)
- shell_out!("dpkg -l chef-integration-test", :returns => [0])
+ shell_out!("dpkg -l chef-integration-test", returns: [0])
expect(package_resource).not_to be_updated_by_last_action
end
it "does nothing for action :upgrade" do
package_resource.run_action(:upgrade)
- shell_out!("dpkg -l chef-integration-test", :returns => [0])
+ shell_out!("dpkg -l chef-integration-test", returns: [0])
expect(package_resource).not_to be_updated_by_last_action
end
@@ -324,7 +324,7 @@ describe Chef::Resource::AptPackage, metadata do
# un chef-integration-test <none> (no description available)
def pkg_should_be_removed
# will raise if exit code != 0,1
- pkg_check = shell_out!("dpkg -l chef-integration-test", :returns => [0, 1])
+ pkg_check = shell_out!("dpkg -l chef-integration-test", returns: [0, 1])
if pkg_check.exitstatus == 0
expect(pkg_check.stdout).to match(/un[\s]+chef-integration-test/)
@@ -353,13 +353,13 @@ describe Chef::Resource::AptPackage, metadata do
it "does nothing for action :install" do
package_resource.run_action(:install)
- shell_out!("dpkg -l chef-integration-test", :returns => [0])
+ shell_out!("dpkg -l chef-integration-test", returns: [0])
expect(package_resource).not_to be_updated_by_last_action
end
it "upgrades the package for action :upgrade" do
package_resource.run_action(:upgrade)
- dpkg_l = shell_out!("dpkg -l chef-integration-test", :returns => [0])
+ dpkg_l = shell_out!("dpkg -l chef-integration-test", returns: [0])
expect(dpkg_l.stdout).to match(/chef\-integration\-test[\s]+1\.1\-1/)
expect(package_resource).to be_updated_by_last_action
end
@@ -373,7 +373,7 @@ describe Chef::Resource::AptPackage, metadata do
it "upgrades the package for action :install" do
package_resource.run_action(:install)
- dpkg_l = shell_out!("dpkg -l chef-integration-test", :returns => [0])
+ dpkg_l = shell_out!("dpkg -l chef-integration-test", returns: [0])
expect(dpkg_l.stdout).to match(/chef\-integration\-test[\s]+1\.1\-1/)
expect(package_resource).to be_updated_by_last_action
end
diff --git a/spec/functional/resource/bff_spec.rb b/spec/functional/resource/bff_spec.rb
index 0b45e097af..9943e821e9 100644
--- a/spec/functional/resource/bff_spec.rb
+++ b/spec/functional/resource/bff_spec.rb
@@ -20,7 +20,7 @@ require "functional/resource/base"
require "chef/mixin/shell_out"
# Run the test only for AIX platform.
-describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform] != "aix" do
+describe Chef::Resource::BffPackage, :requires_root, external: ohai[:platform] != "aix" do
include Chef::Mixin::ShellOut
let(:new_resource) do
diff --git a/spec/functional/resource/cron_spec.rb b/spec/functional/resource/cron_spec.rb
index 1bff8bf874..84fe304585 100644
--- a/spec/functional/resource/cron_spec.rb
+++ b/spec/functional/resource/cron_spec.rb
@@ -105,7 +105,7 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do
end
exclude_solaris = %w{solaris opensolaris solaris2 omnios}.include?(ohai[:platform])
- describe "create action with various attributes", :external => exclude_solaris do
+ describe "create action with various attributes", external: exclude_solaris do
def create_and_validate_with_attribute(resource, attribute, value)
if ohai[:platform] == "aix"
expect { resource.run_action(:create) }.to raise_error(Chef::Exceptions::Cron, /Aix cron entry does not support environment variables. Please set them in script and use script in cron./)
diff --git a/spec/functional/resource/dnf_package_spec.rb b/spec/functional/resource/dnf_package_spec.rb
index 01611ef996..921c48da84 100644
--- a/spec/functional/resource/dnf_package_spec.rb
+++ b/spec/functional/resource/dnf_package_spec.rb
@@ -21,7 +21,7 @@ require "chef/mixin/shell_out"
# run this test only for following platforms.
exclude_test = !(%w{rhel fedora}.include?(ohai[:platform_family]) && File.exist?("/usr/bin/dnf"))
-describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test do
+describe Chef::Resource::RpmPackage, :requires_root, external: exclude_test do
include Chef::Mixin::ShellOut
def flush_cache
diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb
index ce92c468f0..efda46abbe 100644
--- a/spec/functional/resource/dsc_script_spec.rb
+++ b/spec/functional/resource/dsc_script_spec.rb
@@ -234,7 +234,7 @@ EOH
expect(dsc_test_resource.registry_key_exists?(test_registry_key)).to eq(false)
dsc_test_resource.run_action(:run)
expect(dsc_test_resource.registry_key_exists?(test_registry_key)).to eq(true)
- expect(dsc_test_resource.registry_value_exists?(test_registry_key, { :name => test_registry_value, :type => :string, :data => test_registry_data })).to eq(true)
+ expect(dsc_test_resource.registry_value_exists?(test_registry_key, { name: test_registry_value, type: :string, data: test_registry_data })).to eq(true)
end
it_should_behave_like "a dsc_script resource with configuration affected by cwd"
@@ -314,7 +314,7 @@ EOH
expect(dsc_test_resource.registry_key_exists?(test_registry_key)).to eq(false)
dsc_test_resource.run_action(:run)
expect(dsc_test_resource.registry_key_exists?(test_registry_key)).to eq(true)
- expect(dsc_test_resource.registry_value_exists?(test_registry_key, { :name => test_registry_value, :type => :string, :data => test_registry_data })).to eq(true)
+ expect(dsc_test_resource.registry_value_exists?(test_registry_key, { name: test_registry_value, type: :string, data: test_registry_data })).to eq(true)
end
end
end
diff --git a/spec/functional/resource/execute_spec.rb b/spec/functional/resource/execute_spec.rb
index 4dd3110629..3ad8762169 100644
--- a/spec/functional/resource/execute_spec.rb
+++ b/spec/functional/resource/execute_spec.rb
@@ -106,7 +106,7 @@ describe Chef::Resource::Execute do
it "guard adds additional values in its :environment and runs" do
resource.only_if %{ruby -e 'exit 1 if ENV["SGCE_SECRET"] != "regularsecret"'}, {
- :environment => { "SGCE_SECRET" => "regularsecret" },
+ environment: { "SGCE_SECRET" => "regularsecret" },
}
resource.run_action(:run)
expect(resource).to be_updated_by_last_action
@@ -114,7 +114,7 @@ describe Chef::Resource::Execute do
it "guard adds additional values in its :environment and does not run" do
resource.only_if %{ruby -e 'exit 1 if ENV["SGCE_SECRET"] == "regularsecret"'}, {
- :environment => { "SGCE_SECRET" => "regularsecret" },
+ environment: { "SGCE_SECRET" => "regularsecret" },
}
resource.run_action(:run)
expect(resource).not_to be_updated_by_last_action
@@ -122,7 +122,7 @@ describe Chef::Resource::Execute do
it "guard overwrites value with its :environment and runs" do
resource.only_if %{ruby -e 'exit 1 if ENV["SAWS_SECRET"] != "regularsecret"'}, {
- :environment => { "SAWS_SECRET" => "regularsecret" },
+ environment: { "SAWS_SECRET" => "regularsecret" },
}
resource.run_action(:run)
expect(resource).to be_updated_by_last_action
@@ -130,7 +130,7 @@ describe Chef::Resource::Execute do
it "guard overwrites value with its :environment and does not runs" do
resource.only_if %{ruby -e 'exit 1 if ENV["SAWS_SECRET"] == "regularsecret"'}, {
- :environment => { "SAWS_SECRET" => "regularsecret" },
+ environment: { "SAWS_SECRET" => "regularsecret" },
}
resource.run_action(:run)
expect(resource).not_to be_updated_by_last_action
diff --git a/spec/functional/resource/file_spec.rb b/spec/functional/resource/file_spec.rb
index 0fa1317032..291311f3e2 100644
--- a/spec/functional/resource/file_spec.rb
+++ b/spec/functional/resource/file_spec.rb
@@ -51,7 +51,7 @@ describe Chef::Resource::File do
end
let(:resource_with_relative_path) do
- create_resource(:use_relative_path => true)
+ create_resource(use_relative_path: true)
end
let(:unmanaged_content) do
diff --git a/spec/functional/resource/git_spec.rb b/spec/functional/resource/git_spec.rb
index 6808898c29..1fa3f54515 100644
--- a/spec/functional/resource/git_spec.rb
+++ b/spec/functional/resource/git_spec.rb
@@ -22,7 +22,7 @@ require "tmpdir"
require "shellwords"
# Deploy relies heavily on symlinks, so it doesn't work on windows.
-describe Chef::Resource::Git, :requires_git => true do
+describe Chef::Resource::Git, requires_git: true do
include Chef::Mixin::ShellOut
let(:file_cache_path) { Dir.mktmpdir }
# Some versions of git complains when the deploy directory is
@@ -75,7 +75,7 @@ E
before(:each) do
Chef::Log.level = :warn # silence git command live streams
@old_file_cache_path = Chef::Config[:file_cache_path]
- shell_out!("git clone \"#{git_bundle_repo}\" example", :cwd => origin_repo_dir)
+ shell_out!("git clone \"#{git_bundle_repo}\" example", cwd: origin_repo_dir)
File.open("#{origin_repo}/.git/config", "a+") { |f| f.print(git_user_config) }
Chef::Config[:file_cache_path] = file_cache_path
end
@@ -127,10 +127,10 @@ E
it "checks out the revision pointed to by the tag commit, not the tag commit itself" do
basic_git_resource.run_action(:sync)
- head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", cwd: deploy_directory, returns: [0]).stdout.strip
expect(head_rev).to eq(v1_commit)
# also verify the tag commit itself is what we expect as an extra sanity check
- rev = shell_out!("git rev-parse v1.0.0", :cwd => deploy_directory, :returns => [0]).stdout.strip
+ rev = shell_out!("git rev-parse v1.0.0", cwd: deploy_directory, returns: [0]).stdout.strip
expect(rev).to eq(v1_tag)
end
@@ -138,7 +138,7 @@ E
# this used to fail because we didn't resolve the annotated tag
# properly to the pointed to commit.
basic_git_resource.run_action(:sync)
- head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", cwd: deploy_directory, returns: [0]).stdout.strip
expect(head_rev).to eq(v1_commit)
copy_git_resource.run_action(:sync)
@@ -164,14 +164,14 @@ E
it "checks out the expected revision ed18" do
basic_git_resource.revision rev_foo
basic_git_resource.run_action(:sync)
- head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", cwd: deploy_directory, returns: [0]).stdout.strip
expect(head_rev).to eq(rev_foo)
end
it "doesn't update if up-to-date" do
basic_git_resource.revision rev_foo
basic_git_resource.run_action(:sync)
- head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", cwd: deploy_directory, returns: [0]).stdout.strip
expect(head_rev).to eq(rev_foo)
copy_git_resource.revision rev_foo
@@ -182,7 +182,7 @@ E
it "checks out the expected revision 972d" do
basic_git_resource.revision rev_testing
basic_git_resource.run_action(:sync)
- head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", cwd: deploy_directory, returns: [0]).stdout.strip
expect(head_rev).to eq(rev_testing)
end
end
@@ -197,7 +197,7 @@ E
it "checks out the expected revision" do
basic_git_resource.run_action(:sync)
- head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", cwd: deploy_directory, returns: [0]).stdout.strip
expect(head_rev).to eq(rev_head)
end
end
@@ -212,7 +212,7 @@ E
it "checks out HEAD as the default revision" do
basic_git_resource.run_action(:sync)
- head_rev = shell_out!("git rev-parse HEAD", :cwd => deploy_directory, :returns => [0]).stdout.strip
+ head_rev = shell_out!("git rev-parse HEAD", cwd: deploy_directory, returns: [0]).stdout.strip
expect(head_rev).to eq(rev_head)
end
end
@@ -220,7 +220,7 @@ E
context "when dealing with a repo with a degenerate tag named 'HEAD'" do
before do
shell_out!("git tag -m\"degenerate tag\" HEAD ed181b3419b6f489bedab282348162a110d6d3a1",
- :cwd => origin_repo)
+ cwd: origin_repo)
end
let(:basic_git_resource) do
@@ -240,16 +240,16 @@ E
it "checks out the (master) HEAD revision and ignores the tag" do
basic_git_resource.run_action(:sync)
head_rev = shell_out!("git rev-parse HEAD",
- :cwd => deploy_directory,
- :returns => [0]).stdout.strip
+ cwd: deploy_directory,
+ returns: [0]).stdout.strip
expect(head_rev).to eq(rev_head)
end
it "checks out the (master) HEAD revision when no revision is specified (ignores tag)" do
git_resource_default_rev.run_action(:sync)
head_rev = shell_out!("git rev-parse HEAD",
- :cwd => deploy_directory,
- :returns => [0]).stdout.strip
+ cwd: deploy_directory,
+ returns: [0]).stdout.strip
expect(head_rev).to eq(rev_head)
end
diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb
index f32ed069b5..c52a4c0694 100644
--- a/spec/functional/resource/ifconfig_spec.rb
+++ b/spec/functional/resource/ifconfig_spec.rb
@@ -23,7 +23,7 @@ require "chef/mixin/shell_out"
# run this test only for following platforms.
include_flag = !(%w{amazon debian aix}.include?(ohai[:platform_family]) || (ohai[:platform_family] == "rhel" && ohai[:platform_version].to_i < 7))
-describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => include_flag do
+describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, external: include_flag do
# This test does not work in travis because there is no eth0
include Chef::Mixin::ShellOut
@@ -122,7 +122,7 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
end
exclude_test = ohai[:platform] != "ubuntu"
- describe "#action_add", :external => exclude_test do
+ describe "#action_add", external: exclude_test do
after do
new_resource.run_action(:delete)
end
@@ -134,7 +134,7 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
end
end
- describe "#action_enable", :external => exclude_test do
+ describe "#action_enable", external: exclude_test do
after do
new_resource.run_action(:disable)
end
@@ -145,7 +145,7 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
end
end
- describe "#action_disable", :external => exclude_test do
+ describe "#action_disable", external: exclude_test do
before do
setup_enable_interface(new_resource)
new_resource.run_action(:enable)
@@ -157,7 +157,7 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
end
end
- describe "#action_delete", :external => exclude_test do
+ describe "#action_delete", external: exclude_test do
before do
setup_add_interface(new_resource)
new_resource.run_action(:add)
diff --git a/spec/functional/resource/mount_spec.rb b/spec/functional/resource/mount_spec.rb
index c98d6cec25..f4e528c755 100644
--- a/spec/functional/resource/mount_spec.rb
+++ b/spec/functional/resource/mount_spec.rb
@@ -24,7 +24,7 @@ require "tmpdir"
# run this test only for following platforms.
include_flag = !(%w{debian rhel amazon aix solaris2}.include?(ohai[:platform_family]))
-describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => include_flag do
+describe Chef::Resource::Mount, :requires_root, :skip_travis, external: include_flag do
# Disabled in travis because it refuses to let us mount a ramdisk. /dev/ramX does not
# exist even after loading the kernel module
@@ -161,7 +161,7 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => inclu
# don't run the remount tests on solaris2 (tmpfs does not support remount)
# Need to make sure the platforms we've already excluded are considered:
skip_remount = include_flag || (ohai[:platform] == "solaris2")
- describe "when the filesystem should be remounted and the resource supports remounting", :external => skip_remount do
+ describe "when the filesystem should be remounted and the resource supports remounting", external: skip_remount do
it "should remount the filesystem if it is mounted" do
new_resource.run_action(:mount)
mount_should_exist(new_resource.mount_point, new_resource.device)
diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb
index bbd304fd06..4828d0fa79 100644
--- a/spec/functional/resource/powershell_script_spec.rb
+++ b/spec/functional/resource/powershell_script_spec.rb
@@ -474,13 +474,13 @@ configuration LCM
it "evaluates a not_if block using the cwd guard parameter" do
custom_cwd = "#{ENV['SystemRoot']}\\system32\\drivers\\etc"
- resource.not_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", :cwd => custom_cwd
+ resource.not_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", cwd: custom_cwd
expect(resource.should_skip?(:run)).to be_truthy
end
it "evaluates an only_if block using the cwd guard parameter" do
custom_cwd = "#{ENV['SystemRoot']}\\system32\\drivers\\etc"
- resource.only_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", :cwd => custom_cwd
+ resource.only_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", cwd: custom_cwd
expect(resource.should_skip?(:run)).to be_falsey
end
@@ -581,7 +581,7 @@ configuration LCM
end
it "raises an error when a 32-bit guard is used on Windows Nano Server", :windows_nano_only do
- resource.only_if "$true", :architecture => :i386
+ resource.only_if "$true", architecture: :i386
expect { resource.run_action(:run) }.to raise_error(
Chef::Exceptions::Win32ArchitectureIncorrect,
/cannot execute script with requested architecture 'i386' on Windows Nano Server/)
diff --git a/spec/functional/resource/reboot_spec.rb b/spec/functional/resource/reboot_spec.rb
index c264b122a7..3b8e3efe8a 100644
--- a/spec/functional/resource/reboot_spec.rb
+++ b/spec/functional/resource/reboot_spec.rb
@@ -22,9 +22,9 @@ describe Chef::Resource::Reboot do
let(:expected) do
{
- :delay_mins => 5,
- :requested_by => "reboot resource functional test",
- :reason => "reboot resource spec test",
+ delay_mins: 5,
+ requested_by: "reboot resource functional test",
+ reason: "reboot resource spec test",
}
end
diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb
index 7318086034..2a11cdb63f 100644
--- a/spec/functional/resource/registry_spec.rb
+++ b/spec/functional/resource/registry_spec.rb
@@ -34,13 +34,13 @@ describe Chef::Resource::RegistryKey, :unix_only do
context "when load_current_resource is run on a non-windows node" do
it "throws an exception because you don't have a windows registry (derp)" do
@resource.key("HKCU\\Software\\Opscode")
- @resource.values([{ :name => "Color", :type => :string, :data => "Orange" }])
+ @resource.values([{ name: "Color", type: :string, data: "Orange" }])
expect { @resource.run_action(:create) }.to raise_error(Chef::Exceptions::Win32NotWindows)
end
end
end
-describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
+describe Chef::Resource::RegistryKey, :windows_only, broken: true do
# parent and key must be single keys, not paths
let(:parent) { "Opscode" }
@@ -123,7 +123,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
@run_id = @resource_reporter.run_id
@new_resource.cookbook_name = "monkey"
- @cookbook_version = double("Cookbook::Version", :version => "1.2.3")
+ @cookbook_version = double("Cookbook::Version", version: "1.2.3")
@new_resource.cookbook_version(@cookbook_version)
end
@@ -137,110 +137,110 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
end
it "creates registry key, value if the key is missing" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "Color", :type => :string, :data => "Orange" }])
+ @new_resource.values([{ name: "Color", type: :string, data: "Orange" }])
@new_resource.run_action(:create)
expect(@registry.key_exists?(reg_child)).to eq(true)
- expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
+ expect(@registry.data_exists?(reg_child, { name: "Color", type: :string, data: "Orange" })).to eq(true)
end
it "does not create the key if it already exists with same value, type and data" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "Color", :type => :string, :data => "Orange" }])
+ @new_resource.values([{ name: "Color", type: :string, data: "Orange" }])
@new_resource.run_action(:create)
expect(@registry.key_exists?(reg_child)).to eq(true)
- expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
+ expect(@registry.data_exists?(reg_child, { name: "Color", type: :string, data: "Orange" })).to eq(true)
end
it "does not create the key if it already exists with same value and type but datatype of data differs" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "number", :type => :dword, :data => "12345" }])
+ @new_resource.values([{ name: "number", type: :dword, data: "12345" }])
@new_resource.run_action(:create)
expect(@new_resource).not_to be_updated_by_last_action
expect(@registry.key_exists?(reg_child)).to eq(true)
- expect(@registry.data_exists?(reg_child, { :name => "number", :type => :dword, :data => 12344 })).to eq(true)
+ expect(@registry.data_exists?(reg_child, { name: "number", type: :dword, data: 12344 })).to eq(true)
end
it "creates a value if it does not exist" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "Mango", :type => :string, :data => "Yellow" }])
+ @new_resource.values([{ name: "Mango", type: :string, data: "Yellow" }])
@new_resource.run_action(:create)
- expect(@registry.data_exists?(reg_child, { :name => "Mango", :type => :string, :data => "Yellow" })).to eq(true)
+ expect(@registry.data_exists?(reg_child, { name: "Mango", type: :string, data: "Yellow" })).to eq(true)
end
it "modifies the data if the key and value exist and type matches" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "Color", :type => :string, :data => "Not just Orange - OpscodeOrange!" }])
+ @new_resource.values([{ name: "Color", type: :string, data: "Not just Orange - OpscodeOrange!" }])
@new_resource.run_action(:create)
- expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :string, :data => "Not just Orange - OpscodeOrange!" })).to eq(true)
+ expect(@registry.data_exists?(reg_child, { name: "Color", type: :string, data: "Not just Orange - OpscodeOrange!" })).to eq(true)
end
it "modifys the type if the key and value exist and the type does not match" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "Color", :type => :multi_string, :data => ["Not just Orange - OpscodeOrange!"] }])
+ @new_resource.values([{ name: "Color", type: :multi_string, data: ["Not just Orange - OpscodeOrange!"] }])
@new_resource.run_action(:create)
- expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :multi_string, :data => ["Not just Orange - OpscodeOrange!"] })).to eq(true)
+ expect(@registry.data_exists?(reg_child, { name: "Color", type: :multi_string, data: ["Not just Orange - OpscodeOrange!"] })).to eq(true)
end
it "creates subkey if parent exists" do
@new_resource.key(reg_child + '\OpscodeTest')
- @new_resource.values([{ :name => "Chef", :type => :multi_string, :data => %w{OpscodeOrange Rules} }])
+ @new_resource.values([{ name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} }])
@new_resource.recursive(false)
@new_resource.run_action(:create)
expect(@registry.key_exists?(reg_child + '\OpscodeTest')).to eq(true)
- expect(@registry.value_exists?(reg_child + '\OpscodeTest', { :name => "Chef", :type => :multi_string, :data => %w{OpscodeOrange Rules} })).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\OpscodeTest', { name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} })).to eq(true)
end
it "raises an error if action create and parent does not exist and recursive is set to false" do
@new_resource.key(reg_child + '\Missing1\Missing2')
- @new_resource.values([{ :name => "OC", :type => :string, :data => "MissingData" }])
+ @new_resource.values([{ name: "OC", type: :string, data: "MissingData" }])
@new_resource.recursive(false)
expect { @new_resource.run_action(:create) }.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
end
it "raises an error if action create and type key missing in values hash" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "OC", :data => "my_data" }])
+ @new_resource.values([{ name: "OC", data: "my_data" }])
expect { @new_resource.run_action(:create) }.to raise_error(Chef::Exceptions::RegKeyValuesTypeMissing)
end
it "raises an error if action create and data key missing in values hash" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "OC", :type => :string }])
+ @new_resource.values([{ name: "OC", type: :string }])
expect { @new_resource.run_action(:create) }.to raise_error(Chef::Exceptions::RegKeyValuesDataMissing)
end
it "raises an error if action create and only name key present in values hash" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "OC" }])
+ @new_resource.values([{ name: "OC" }])
expect { @new_resource.run_action(:create) }.to raise_error(Chef::Exceptions::RegKeyValuesTypeMissing)
end
it "does not raise an error if action create and all keys are present in values hash" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "OC", :type => :string, :data => "my_data" }])
+ @new_resource.values([{ name: "OC", type: :string, data: "my_data" }])
expect { @new_resource.run_action(:create) }.to_not raise_error
end
it "creates missing keys if action create and parent does not exist and recursive is set to true" do
@new_resource.key(reg_child + '\Missing1\Missing2')
- @new_resource.values([{ :name => "OC", :type => :string, :data => "MissingData" }])
+ @new_resource.values([{ name: "OC", type: :string, data: "MissingData" }])
@new_resource.recursive(true)
@new_resource.run_action(:create)
expect(@registry.key_exists?(reg_child + '\Missing1\Missing2')).to eq(true)
- expect(@registry.value_exists?(reg_child + '\Missing1\Missing2', { :name => "OC", :type => :string, :data => "MissingData" })).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\Missing1\Missing2', { name: "OC", type: :string, data: "MissingData" })).to eq(true)
end
it "creates key with multiple value as specified" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "one", :type => :string, :data => "1" }, { :name => "two", :type => :string, :data => "2" }, { :name => "three", :type => :string, :data => "3" }])
+ @new_resource.values([{ name: "one", type: :string, data: "1" }, { name: "two", type: :string, data: "2" }, { name: "three", type: :string, data: "3" }])
@new_resource.recursive(true)
@new_resource.run_action(:create)
@@ -259,12 +259,12 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
end
it "creates a key in a 32-bit registry that is not viewable in 64-bit" do
@new_resource.key(reg_child + '\Atraxi' )
- @new_resource.values([{ :name => "OC", :type => :string, :data => "Data" }])
+ @new_resource.values([{ name: "OC", type: :string, data: "Data" }])
@new_resource.recursive(true)
@new_resource.architecture(:i386)
@new_resource.run_action(:create)
@registry.architecture = :i386
- expect(@registry.data_exists?(reg_child + '\Atraxi', { :name => "OC", :type => :string, :data => "Data" })).to eq(true)
+ expect(@registry.data_exists?(reg_child + '\Atraxi', { name: "OC", type: :string, data: "Data" })).to eq(true)
@registry.architecture = :x86_64
expect(@registry.key_exists?(reg_child + '\Atraxi')).to eq(false)
end
@@ -272,7 +272,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "prepares the reporting data for action :create" do
@new_resource.key(reg_child + '\Ood')
- @new_resource.values([{ :name => "ReportingVal1", :type => :string, :data => "report1" }, { :name => "ReportingVal2", :type => :string, :data => "report2" }])
+ @new_resource.values([{ name: "ReportingVal1", type: :string, data: "report1" }, { name: "ReportingVal2", type: :string, data: "report2" }])
@new_resource.recursive(true)
@new_resource.run_action(:create)
@report = @resource_reporter.prepare_run_data
@@ -281,8 +281,8 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
expect(@report["resources"][0]["type"]).to eq("registry_key")
expect(@report["resources"][0]["name"]).to eq(resource_name)
expect(@report["resources"][0]["id"]).to eq(reg_child + '\Ood')
- expect(@report["resources"][0]["after"][:values]).to eq([{ :name => "ReportingVal1", :type => :string, :data => "report1" },
- { :name => "ReportingVal2", :type => :string, :data => "report2" }])
+ expect(@report["resources"][0]["after"][:values]).to eq([{ name: "ReportingVal1", type: :string, data: "report1" },
+ { name: "ReportingVal2", type: :string, data: "report2" }])
expect(@report["resources"][0]["before"][:values]).to eq([])
expect(@report["resources"][0]["result"]).to eq("create")
expect(@report["status"]).to eq("success")
@@ -296,7 +296,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "does not raise an exception if the keys do not exist but recursive is set to false" do
@new_resource.key(reg_child + '\Slitheen\Raxicoricofallapatorius')
- @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
+ @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
@@ -305,7 +305,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "does not create key if the action is create" do
@new_resource.key(reg_child + '\Slitheen')
- @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
+ @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create)
expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
@@ -313,28 +313,28 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "does not raise an exception if the action create and type key missing in values hash" do
@new_resource.key(reg_child + '\Slitheen')
- @new_resource.values([{ :name => "BriskWalk", :data => "my_data" }])
+ @new_resource.values([{ name: "BriskWalk", data: "my_data" }])
@new_resource.run_action(:create) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
end
it "does not raise an exception if the action create and data key missing in values hash" do
@new_resource.key(reg_child + '\Slitheen')
- @new_resource.values([{ :name => "BriskWalk", :type => :string }])
+ @new_resource.values([{ name: "BriskWalk", type: :string }])
@new_resource.run_action(:create) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
end
it "does not raise an exception if the action create and only name key present in values hash" do
@new_resource.key(reg_child + '\Slitheen')
- @new_resource.values([{ :name => "BriskWalk" }])
+ @new_resource.values([{ name: "BriskWalk" }])
@new_resource.run_action(:create) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
end
it "does not raise an exception if the action create and all keys are present in values hash" do
@new_resource.key(reg_child + '\Slitheen')
- @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "my_data" }])
+ @new_resource.values([{ name: "BriskWalk", type: :string, data: "my_data" }])
@new_resource.run_action(:create) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Slitheen')).to eq(false)
end
@@ -348,85 +348,85 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "creates registry key, value if the key is missing" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "Color", :type => :string, :data => "Orange" }])
+ @new_resource.values([{ name: "Color", type: :string, data: "Orange" }])
@new_resource.run_action(:create_if_missing)
expect(@registry.key_exists?(reg_parent)).to eq(true)
expect(@registry.key_exists?(reg_child)).to eq(true)
- expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
+ expect(@registry.data_exists?(reg_child, { name: "Color", type: :string, data: "Orange" })).to eq(true)
end
it "does not create the key if it already exists with same value, type and data" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "Color", :type => :string, :data => "Orange" }])
+ @new_resource.values([{ name: "Color", type: :string, data: "Orange" }])
@new_resource.run_action(:create_if_missing)
expect(@registry.key_exists?(reg_child)).to eq(true)
- expect(@registry.data_exists?(reg_child, { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
+ expect(@registry.data_exists?(reg_child, { name: "Color", type: :string, data: "Orange" })).to eq(true)
end
it "creates a value if it does not exist" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "Mango", :type => :string, :data => "Yellow" }])
+ @new_resource.values([{ name: "Mango", type: :string, data: "Yellow" }])
@new_resource.run_action(:create_if_missing)
- expect(@registry.data_exists?(reg_child, { :name => "Mango", :type => :string, :data => "Yellow" })).to eq(true)
+ expect(@registry.data_exists?(reg_child, { name: "Mango", type: :string, data: "Yellow" })).to eq(true)
end
it "creates subkey if parent exists" do
@new_resource.key(reg_child + '\Pyrovile')
- @new_resource.values([{ :name => "Chef", :type => :multi_string, :data => %w{OpscodeOrange Rules} }])
+ @new_resource.values([{ name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} }])
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing)
expect(@registry.key_exists?(reg_child + '\Pyrovile')).to eq(true)
- expect(@registry.value_exists?(reg_child + '\Pyrovile', { :name => "Chef", :type => :multi_string, :data => %w{OpscodeOrange Rules} })).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\Pyrovile', { name: "Chef", type: :multi_string, data: %w{OpscodeOrange Rules} })).to eq(true)
end
it "raises an error if action create and parent does not exist and recursive is set to false" do
@new_resource.key(reg_child + '\Sontaran\Sontar')
- @new_resource.values([{ :name => "OC", :type => :string, :data => "MissingData" }])
+ @new_resource.values([{ name: "OC", type: :string, data: "MissingData" }])
@new_resource.recursive(false)
expect { @new_resource.run_action(:create_if_missing) }.to raise_error(Chef::Exceptions::Win32RegNoRecursive)
end
it "raises an error if action create_if_missing and type key missing in values hash" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "OC", :data => "my_data" }])
+ @new_resource.values([{ name: "OC", data: "my_data" }])
expect { @new_resource.run_action(:create_if_missing) }.to raise_error(Chef::Exceptions::RegKeyValuesTypeMissing)
end
it "raises an error if action create_if_missing and data key missing in values hash" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "OC", :type => :string }])
+ @new_resource.values([{ name: "OC", type: :string }])
expect { @new_resource.run_action(:create_if_missing) }.to raise_error(Chef::Exceptions::RegKeyValuesDataMissing)
end
it "raises an error if action create_if_missing and only name key present in values hash" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "OC" }])
+ @new_resource.values([{ name: "OC" }])
expect { @new_resource.run_action(:create_if_missing) }.to raise_error(Chef::Exceptions::RegKeyValuesTypeMissing)
end
it "does not raise an error if action create_if_missing and all keys are present in values hash" do
@new_resource.key(reg_child)
- @new_resource.values([{ :name => "OC", :type => :string, :data => "my_data" }])
+ @new_resource.values([{ name: "OC", type: :string, data: "my_data" }])
expect { @new_resource.run_action(:create_if_missing) }.to_not raise_error
end
it "creates missing keys if action create and parent does not exist and recursive is set to true" do
@new_resource.key(reg_child + '\Sontaran\Sontar')
- @new_resource.values([{ :name => "OC", :type => :string, :data => "MissingData" }])
+ @new_resource.values([{ name: "OC", type: :string, data: "MissingData" }])
@new_resource.recursive(true)
@new_resource.run_action(:create_if_missing)
expect(@registry.key_exists?(reg_child + '\Sontaran\Sontar')).to eq(true)
- expect(@registry.value_exists?(reg_child + '\Sontaran\Sontar', { :name => "OC", :type => :string, :data => "MissingData" })).to eq(true)
+ expect(@registry.value_exists?(reg_child + '\Sontaran\Sontar', { name: "OC", type: :string, data: "MissingData" })).to eq(true)
end
it "creates key with multiple value as specified" do
@new_resource.key(reg_child + '\Adipose')
- @new_resource.values([{ :name => "one", :type => :string, :data => "1" }, { :name => "two", :type => :string, :data => "2" }, { :name => "three", :type => :string, :data => "3" }])
+ @new_resource.values([{ name: "one", type: :string, data: "1" }, { name: "two", type: :string, data: "2" }, { name: "three", type: :string, data: "3" }])
@new_resource.recursive(true)
@new_resource.run_action(:create_if_missing)
@@ -437,7 +437,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "prepares the reporting data for :create_if_missing" do
@new_resource.key(reg_child + '\Judoon')
- @new_resource.values([{ :name => "ReportingVal3", :type => :string, :data => "report3" }])
+ @new_resource.values([{ name: "ReportingVal3", type: :string, data: "report3" }])
@new_resource.recursive(true)
@new_resource.run_action(:create_if_missing)
@report = @resource_reporter.prepare_run_data
@@ -446,7 +446,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
expect(@report["resources"][0]["type"]).to eq("registry_key")
expect(@report["resources"][0]["name"]).to eq(resource_name)
expect(@report["resources"][0]["id"]).to eq(reg_child + '\Judoon')
- expect(@report["resources"][0]["after"][:values]).to eq([{ :name => "ReportingVal3", :type => :string, :data => "report3" }])
+ expect(@report["resources"][0]["after"][:values]).to eq([{ name: "ReportingVal3", type: :string, data: "report3" }])
expect(@report["resources"][0]["before"][:values]).to eq([])
expect(@report["resources"][0]["result"]).to eq("create_if_missing")
expect(@report["status"]).to eq("success")
@@ -460,7 +460,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "does not raise an exception if the keys do not exist but recursive is set to false" do
@new_resource.key(reg_child + '\Zygons\Zygor')
- @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
+ @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
@@ -469,7 +469,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "does nothing if the action is create_if_missing" do
@new_resource.key(reg_child + '\Zygons')
- @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
+ @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:create_if_missing)
expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
@@ -477,28 +477,28 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "does not raise an exception if the action create_if_missing and type key missing in values hash" do
@new_resource.key(reg_child + '\Zygons')
- @new_resource.values([{ :name => "BriskWalk", :data => "my_data" }])
+ @new_resource.values([{ name: "BriskWalk", data: "my_data" }])
@new_resource.run_action(:create_if_missing) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
end
it "does not raise an exception if the action create_if_missing and data key missing in values hash" do
@new_resource.key(reg_child + '\Zygons')
- @new_resource.values([{ :name => "BriskWalk", :type => :string }])
+ @new_resource.values([{ name: "BriskWalk", type: :string }])
@new_resource.run_action(:create_if_missing) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
end
it "does not raise an exception if the action create_if_missing and only name key present in values hash" do
@new_resource.key(reg_child + '\Zygons')
- @new_resource.values([{ :name => "BriskWalk" }])
+ @new_resource.values([{ name: "BriskWalk" }])
@new_resource.run_action(:create_if_missing) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
end
it "does not raise an exception if the action create_if_missing and all keys are present in values hash" do
@new_resource.key(reg_child + '\Zygons')
- @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "my_data" }])
+ @new_resource.values([{ name: "BriskWalk", type: :string, data: "my_data" }])
@new_resource.run_action(:create_if_missing) # should not raise_error
expect(@registry.key_exists?(reg_child + '\Zygons')).to eq(false)
end
@@ -522,53 +522,53 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
end
it "takes no action if the key exists but the value does not" do
- expect(@registry.data_exists?(reg_parent + '\Opscode', { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
+ expect(@registry.data_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(true)
@new_resource.key(reg_parent + '\Opscode')
- @new_resource.values([{ :name => "LooksLike", :type => :multi_string, :data => %w{SeattleGrey OCOrange} }])
+ @new_resource.values([{ name: "LooksLike", type: :multi_string, data: %w{SeattleGrey OCOrange} }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- expect(@registry.data_exists?(reg_parent + '\Opscode', { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
+ expect(@registry.data_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(true)
end
it "deletes only specified values under a key path" do
@new_resource.key(reg_parent + '\Opscode')
- @new_resource.values([{ :name => "Opscode", :type => :multi_string, :data => %w{Seattle Washington} }, { :name => "AKA", :type => :string, :data => "OC" }])
+ @new_resource.values([{ name: "Opscode", type: :multi_string, data: %w{Seattle Washington} }, { name: "AKA", type: :string, data: "OC" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- expect(@registry.data_exists?(reg_parent + '\Opscode', { :name => "Color", :type => :string, :data => "Orange" })).to eq(true)
- expect(@registry.value_exists?(reg_parent + '\Opscode', { :name => "AKA", :type => :string, :data => "OC" })).to eq(false)
- expect(@registry.value_exists?(reg_parent + '\Opscode', { :name => "Opscode", :type => :multi_string, :data => %w{Seattle Washington} })).to eq(false)
+ expect(@registry.data_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(true)
+ expect(@registry.value_exists?(reg_parent + '\Opscode', { name: "AKA", type: :string, data: "OC" })).to eq(false)
+ expect(@registry.value_exists?(reg_parent + '\Opscode', { name: "Opscode", type: :multi_string, data: %w{Seattle Washington} })).to eq(false)
end
it "it deletes the values with the same name irrespective of it type and data" do
@new_resource.key(reg_parent + '\Opscode')
- @new_resource.values([{ :name => "Color", :type => :multi_string, :data => %w{Black Orange} }])
+ @new_resource.values([{ name: "Color", type: :multi_string, data: %w{Black Orange} }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
- expect(@registry.value_exists?(reg_parent + '\Opscode', { :name => "Color", :type => :string, :data => "Orange" })).to eq(false)
+ expect(@registry.value_exists?(reg_parent + '\Opscode', { name: "Color", type: :string, data: "Orange" })).to eq(false)
end
it "prepares the reporting data for action :delete" do
@new_resource.key(reg_parent + '\ReportKey')
- @new_resource.values([{ :name => "ReportVal4", :type => :string, :data => "report4" }, { :name => "ReportVal5", :type => :string, :data => "report5" }])
+ @new_resource.values([{ name: "ReportVal4", type: :string, data: "report4" }, { name: "ReportVal5", type: :string, data: "report5" }])
@new_resource.recursive(true)
@new_resource.run_action(:delete)
@report = @resource_reporter.prepare_run_data
- expect(@registry.value_exists?(reg_parent + '\ReportKey', [{ :name => "ReportVal4", :type => :string, :data => "report4" }, { :name => "ReportVal5", :type => :string, :data => "report5" }])).to eq(false)
+ expect(@registry.value_exists?(reg_parent + '\ReportKey', [{ name: "ReportVal4", type: :string, data: "report4" }, { name: "ReportVal5", type: :string, data: "report5" }])).to eq(false)
expect(@report["action"]).to eq("end")
expect(@report["resources"].count).to eq(1)
expect(@report["resources"][0]["type"]).to eq("registry_key")
expect(@report["resources"][0]["name"]).to eq(resource_name)
expect(@report["resources"][0]["id"]).to eq(reg_parent + '\ReportKey')
- expect(@report["resources"][0]["before"][:values]).to eq([{ :name => "ReportVal4", :type => :string, :data => "report4" },
- { :name => "ReportVal5", :type => :string, :data => "report5" }])
+ expect(@report["resources"][0]["before"][:values]).to eq([{ name: "ReportVal4", type: :string, data: "report4" },
+ { name: "ReportVal5", type: :string, data: "report5" }])
#Not testing for after values to match since after -> new_resource values.
expect(@report["resources"][0]["result"]).to eq("delete")
expect(@report["status"]).to eq("success")
@@ -581,7 +581,7 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
end
it "does nothing if the action is delete" do
@new_resource.key(reg_parent + '\OpscodeWhyRun')
- @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
+ @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete)
@@ -659,13 +659,13 @@ describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
it "does not throw an exception if the key has subkeys but recursive is set to false" do
@new_resource.key(reg_parent + '\OpscodeWhyRun')
- @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
+ @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete_key)
end
it "does nothing if the action is delete_key" do
@new_resource.key(reg_parent + '\OpscodeWhyRun')
- @new_resource.values([{ :name => "BriskWalk", :type => :string, :data => "is good for health" }])
+ @new_resource.values([{ name: "BriskWalk", type: :string, data: "is good for health" }])
@new_resource.recursive(false)
@new_resource.run_action(:delete_key)
diff --git a/spec/functional/resource/rpm_spec.rb b/spec/functional/resource/rpm_spec.rb
index 17d0bf9e3c..fcaf8817eb 100644
--- a/spec/functional/resource/rpm_spec.rb
+++ b/spec/functional/resource/rpm_spec.rb
@@ -22,7 +22,7 @@ require "chef/mixin/shell_out"
# run this test only for following platforms.
exclude_test = !%w{aix rhel fedora suse}.include?(ohai[:platform_family])
-describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test do
+describe Chef::Resource::RpmPackage, :requires_root, external: exclude_test do
include Chef::Mixin::ShellOut
let(:new_resource) do
diff --git a/spec/functional/resource/template_spec.rb b/spec/functional/resource/template_spec.rb
index b9a39255f4..243b66311b 100644
--- a/spec/functional/resource/template_spec.rb
+++ b/spec/functional/resource/template_spec.rb
@@ -68,7 +68,7 @@ describe Chef::Resource::Template do
context "when the target file does not exist" do
it "creates the template with the rendered content using the variable attribute when the :create action is run" do
resource.source("openldap_variable_stuff.conf.erb")
- resource.variables(:secret => "nutella")
+ resource.variables(secret: "nutella")
resource.run_action(:create)
expect(IO.read(path)).to eq("super secret is nutella")
end
@@ -213,21 +213,21 @@ describe Chef::Resource::Template do
describe "when template variables contain lazy{} calls" do
it "resolves the DelayedEvaluator" do
resource.source("openldap_variable_stuff.conf.erb")
- resource.variables(:secret => Chef::DelayedEvaluator.new { "nutella" })
+ resource.variables(secret: Chef::DelayedEvaluator.new { "nutella" })
resource.run_action(:create)
expect(IO.read(path)).to eq("super secret is nutella")
end
it "does not mutate the resource variables" do
resource.source("openldap_variable_stuff.conf.erb")
- resource.variables(:secret => Chef::DelayedEvaluator.new { "nutella" })
+ resource.variables(secret: Chef::DelayedEvaluator.new { "nutella" })
resource.run_action(:create)
expect(resource.variables[:secret]).to be_a Chef::DelayedEvaluator
end
it "resolves the DelayedEvaluator when deeply nested" do
resource.source("openldap_nested_variable_stuff.erb")
- resource.variables(:secret => [{ "key" => Chef::DelayedEvaluator.new { "nutella" } }])
+ resource.variables(secret: [{ "key" => Chef::DelayedEvaluator.new { "nutella" } }])
resource.run_action(:create)
expect(IO.read(path)).to eq("super secret is nutella")
end
diff --git a/spec/functional/resource/user/dscl_spec.rb b/spec/functional/resource/user/dscl_spec.rb
index ed96e31bac..78d7f2336e 100644
--- a/spec/functional/resource/user/dscl_spec.rb
+++ b/spec/functional/resource/user/dscl_spec.rb
@@ -19,9 +19,9 @@ require "spec_helper"
require "chef/mixin/shell_out"
metadata = {
- :mac_osx_only => true,
- :requires_root => true,
- :not_supported_on_mac_osx_106 => true,
+ mac_osx_only: true,
+ requires_root: true,
+ not_supported_on_mac_osx_106: true,
}
describe "Chef::Resource::User with Chef::Provider::User::Dscl provider", metadata do
diff --git a/spec/functional/resource/windows_service_spec.rb b/spec/functional/resource/windows_service_spec.rb
index 531f9e9250..f422ac21d6 100644
--- a/spec/functional/resource/windows_service_spec.rb
+++ b/spec/functional/resource/windows_service_spec.rb
@@ -18,7 +18,7 @@
require "spec_helper"
-describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_gem_only, :appveyor_only, :broken => true do
+describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_gem_only, :appveyor_only, broken: true do
# Marking as broken. This test is causing appveyor tests to exit with 116.
include_context "using Win32::Service"
diff --git a/spec/functional/resource/yum_package_spec.rb b/spec/functional/resource/yum_package_spec.rb
index 7c45a64ae5..5751e92ce5 100644
--- a/spec/functional/resource/yum_package_spec.rb
+++ b/spec/functional/resource/yum_package_spec.rb
@@ -21,7 +21,7 @@ require "chef/mixin/shell_out"
# run this test only for following platforms.
exclude_test = !(%w{rhel fedora}.include?(ohai[:platform_family]) && !File.exist?("/usr/bin/dnf"))
-describe Chef::Resource::YumPackage, :requires_root, :external => exclude_test do
+describe Chef::Resource::YumPackage, :requires_root, external: exclude_test do
include Chef::Mixin::ShellOut
# NOTE: every single test here either needs to explicitly call flush_cache or needs to explicitly
diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb
index d270803698..c1942cff50 100644
--- a/spec/functional/run_lock_spec.rb
+++ b/spec/functional/run_lock_spec.rb
@@ -21,7 +21,7 @@ require "chef/client"
describe Chef::RunLock do
# This behavior works on windows, but the tests use fork :(
- describe "when locking the chef-client run", :unix_only => true do
+ describe "when locking the chef-client run", unix_only: true do
##
# Lockfile location and helpers
@@ -150,7 +150,7 @@ describe Chef::RunLock do
end
end
- it "sets FD_CLOEXEC on the lockfile", :supports_cloexec => true do
+ it "sets FD_CLOEXEC on the lockfile", supports_cloexec: true do
run_lock = File.open(lockfile)
expect(run_lock.fcntl(Fcntl::F_GETFD, 0) & Fcntl::FD_CLOEXEC).to eq(Fcntl::FD_CLOEXEC)
end
@@ -197,7 +197,7 @@ describe Chef::RunLock do
end
end
- it "sets FD_CLOEXEC on the lockfile", :supports_cloexec => true do
+ it "sets FD_CLOEXEC on the lockfile", supports_cloexec: true do
run_lock = File.open(lockfile)
expect(run_lock.fcntl(Fcntl::F_GETFD, 0) & Fcntl::FD_CLOEXEC).to eq(Fcntl::FD_CLOEXEC)
end
diff --git a/spec/functional/shell_spec.rb b/spec/functional/shell_spec.rb
index 08c791f2d2..3990f1afe0 100644
--- a/spec/functional/shell_spec.rb
+++ b/spec/functional/shell_spec.rb
@@ -26,7 +26,7 @@ describe Shell do
# chef-shell's unit tests are by necessity very mock-heavy, and frequently do
# not catch cases where chef-shell fails to boot because of changes in
# chef/client.rb
- describe "smoke tests", :unix_only => true do
+ describe "smoke tests", unix_only: true do
TIMEOUT = 300
diff --git a/spec/functional/util/powershell/cmdlet_spec.rb b/spec/functional/util/powershell/cmdlet_spec.rb
index 19f5e58a49..4be021a60b 100644
--- a/spec/functional/util/powershell/cmdlet_spec.rb
+++ b/spec/functional/util/powershell/cmdlet_spec.rb
@@ -25,10 +25,10 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
@node.consume_external_attrs(OHAI_SYSTEM.data, {})
end
let(:cmd_output_format) { :text }
- let(:simple_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "get-childitem", cmd_output_format, { :depth => 2 }) }
+ let(:simple_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "get-childitem", cmd_output_format, { depth: 2 }) }
let(:invalid_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "get-idontexist", cmd_output_format) }
- let(:cmdlet_get_item_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "get-item", cmd_output_format, { :depth => 2 }) }
- let(:cmdlet_alias_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "alias", cmd_output_format, { :depth => 2 }) }
+ let(:cmdlet_get_item_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "get-item", cmd_output_format, { depth: 2 }) }
+ let(:cmdlet_alias_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "alias", cmd_output_format, { depth: 2 }) }
let(:etc_directory) { "#{ENV['systemroot']}\\system32\\drivers\\etc" }
let(:architecture_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "$env:PROCESSOR_ARCHITECTURE") }
@@ -58,7 +58,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
end
it "passes command line switches to the command" do
- result = cmdlet_alias_requires_switch_or_argument.run({ :name => "ls" })
+ result = cmdlet_alias_requires_switch_or_argument.run({ name: "ls" })
expect(result.succeeded?).to eq(true)
end
@@ -68,7 +68,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
end
it "passes command line arguments and switches to the command" do
- result = cmdlet_get_item_requires_switch_or_argument.run({ :path => etc_directory }, {}, " | select-object -property fullname | format-table -hidetableheaders")
+ result = cmdlet_get_item_requires_switch_or_argument.run({ path: etc_directory }, {}, " | select-object -property fullname | format-table -hidetableheaders")
expect(result.succeeded?).to eq(true)
returned_directory = result.return_value
returned_directory.strip!
@@ -76,7 +76,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
end
it "passes execution options to the command" do
- result = cmdlet_get_item_requires_switch_or_argument.run({}, { :cwd => etc_directory }, ". | select-object -property fullname | format-table -hidetableheaders")
+ result = cmdlet_get_item_requires_switch_or_argument.run({}, { cwd: etc_directory }, ". | select-object -property fullname | format-table -hidetableheaders")
expect(result.succeeded?).to eq(true)
returned_directory = result.return_value
returned_directory.strip!
@@ -95,7 +95,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
context "when returning Ruby objects" do
let(:cmd_output_format) { :object }
it "returns object format data" do
- result = simple_cmdlet.run({}, { :cwd => etc_directory }, "hosts")
+ result = simple_cmdlet.run({}, { cwd: etc_directory }, "hosts")
expect(result.succeeded?).to eq(true)
data = result.return_value
expect(data["Name"]).to eq("hosts")
diff --git a/spec/functional/version_spec.rb b/spec/functional/version_spec.rb
index a45c25ff8c..dc323e9d3a 100644
--- a/spec/functional/version_spec.rb
+++ b/spec/functional/version_spec.rb
@@ -28,7 +28,7 @@ describe "Chef Versions" do
binaries.each do |binary|
it "#{binary} version should be sane" do
- expect(shell_out!("ruby #{File.join("bin", binary)} -v", :cwd => chef_dir).stdout.chomp).to include("Chef: #{Chef::VERSION}")
+ expect(shell_out!("ruby #{File.join("bin", binary)} -v", cwd: chef_dir).stdout.chomp).to include("Chef: #{Chef::VERSION}")
end
end
diff --git a/spec/functional/win32/registry_spec.rb b/spec/functional/win32/registry_spec.rb
index bcfa0ffd48..c5323d3557 100644
--- a/spec/functional/win32/registry_spec.rb
+++ b/spec/functional/win32/registry_spec.rb
@@ -102,85 +102,85 @@ describe "Chef::Win32::Registry", :windows_only do
describe "value_exists?" do
it "throws an exception if the hive does not exist" do
- expect { @registry.value_exists?("JKLM\\Software\\Branch\\Flower", { :name => "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.value_exists?("JKLM\\Software\\Branch\\Flower", { name: "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- expect { @registry.value_exists?("HKCU\\Software\\Branch\\Flower", { :name => "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.value_exists?("HKCU\\Software\\Branch\\Flower", { name: "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if the value exists" do
- expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals" })).to eq(true)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals" })).to eq(true)
end
it "returns true if the value exists with a case mismatch on the value name" do
- expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "petals" })).to eq(true)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "petals" })).to eq(true)
end
it "returns false if the value does not exist" do
- expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "FOOBAR" })).to eq(false)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "FOOBAR" })).to eq(false)
end
end
describe "value_exists!" do
it "throws an exception if the hive does not exist" do
- expect { @registry.value_exists!("JKLM\\Software\\Branch\\Flower", { :name => "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.value_exists!("JKLM\\Software\\Branch\\Flower", { name: "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- expect { @registry.value_exists!("HKCU\\Software\\Branch\\Flower", { :name => "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.value_exists!("HKCU\\Software\\Branch\\Flower", { name: "Petals" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if the value exists" do
- expect(@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals" })).to eq(true)
+ expect(@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals" })).to eq(true)
end
it "returns true if the value exists with a case mismatch on the value name" do
- expect(@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "petals" })).to eq(true)
+ expect(@registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", { name: "petals" })).to eq(true)
end
it "throws an exception if the value does not exist" do
- expect { @registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "FOOBAR" }) }.to raise_error(Chef::Exceptions::Win32RegValueMissing)
+ expect { @registry.value_exists!("HKCU\\Software\\Root\\Branch\\Flower", { name: "FOOBAR" }) }.to raise_error(Chef::Exceptions::Win32RegValueMissing)
end
end
describe "data_exists?" do
it "throws an exception if the hive does not exist" do
- expect { @registry.data_exists?("JKLM\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.data_exists?("JKLM\\Software\\Branch\\Flower", { name: "Petals", type: :multi_string, data: %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- expect { @registry.data_exists?("HKCU\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.data_exists?("HKCU\\Software\\Branch\\Flower", { name: "Petals", type: :multi_string, data: %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if all the data matches" do
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :multi_string, data: %w{Pink Delicate} })).to eq(true)
end
it "returns true if all the data matches with a case mismatch on the data name" do
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "petals", :type => :multi_string, :data => %w{Pink Delicate} })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "petals", type: :multi_string, data: %w{Pink Delicate} })).to eq(true)
end
it "returns false if the name does not exist" do
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "slateP", :type => :multi_string, :data => %w{Pink Delicate} })).to eq(false)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "slateP", type: :multi_string, data: %w{Pink Delicate} })).to eq(false)
end
it "returns false if the types do not match" do
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :string, :data => "Pink" })).to eq(false)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :string, data: "Pink" })).to eq(false)
end
it "returns false if the data does not match" do
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Mauve Delicate} })).to eq(false)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :multi_string, data: %w{Mauve Delicate} })).to eq(false)
end
end
describe "data_exists!" do
it "throws an exception if the hive does not exist" do
- expect { @registry.data_exists!("JKLM\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.data_exists!("JKLM\\Software\\Branch\\Flower", { name: "Petals", type: :multi_string, data: %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
it "throws an exception if the key does not exist" do
- expect { @registry.data_exists!("HKCU\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.data_exists!("HKCU\\Software\\Branch\\Flower", { name: "Petals", type: :multi_string, data: %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "returns true if all the data matches" do
- expect(@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Pink Delicate} })).to eq(true)
+ expect(@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :multi_string, data: %w{Pink Delicate} })).to eq(true)
end
it "returns true if all the data matches with a case mismatch on the data name" do
- expect(@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "petals", :type => :multi_string, :data => %w{Pink Delicate} })).to eq(true)
+ expect(@registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { name: "petals", type: :multi_string, data: %w{Pink Delicate} })).to eq(true)
end
it "throws an exception if the name does not exist" do
- expect { @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "slateP", :type => :multi_string, :data => %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
+ expect { @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { name: "slateP", type: :multi_string, data: %w{Pink Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
end
it "throws an exception if the types do not match" do
- expect { @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :string, :data => "Pink" }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
+ expect { @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :string, data: "Pink" }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
end
it "throws an exception if the data does not match" do
- expect { @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => %w{Mauve Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
+ expect { @registry.data_exists!("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :multi_string, data: %w{Mauve Delicate} }) }.to raise_error(Chef::Exceptions::Win32RegDataMissing)
end
end
@@ -188,8 +188,8 @@ describe "Chef::Win32::Registry", :windows_only do
it "returns all values for a key if it exists" do
values = @registry.get_values("HKCU\\Software\\Root")
expect(values).to be_an_instance_of Array
- expect(values).to eq([{ :name => "RootType1", :type => :string, :data => "fibrous" },
- { :name => "Roots", :type => :multi_string, :data => ["strong roots", "healthy tree"] }])
+ expect(values).to eq([{ name: "RootType1", type: :string, data: "fibrous" },
+ { name: "Roots", type: :multi_string, data: ["strong roots", "healthy tree"] }])
end
it "throws an exception if the key does not exist" do
@@ -203,70 +203,70 @@ describe "Chef::Win32::Registry", :windows_only do
describe "set_value" do
it "updates a value if the key, value exist and type matches and value different" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :multi_string, data: ["Yellow", "Changed Color"] })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :multi_string, data: ["Yellow", "Changed Color"] })).to eq(true)
end
it "updates a value if the type does match and the values are different" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :string, :data => "Yellow" })).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :string, :data => "Yellow" })).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(false)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :string, data: "Yellow" })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :string, data: "Yellow" })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :multi_string, data: ["Yellow", "Changed Color"] })).to eq(false)
end
it "creates a value if key exists and value does not" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Stamen", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Stamen", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { name: "Stamen", type: :multi_string, data: ["Yellow", "Changed Color"] })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "Stamen", type: :multi_string, data: ["Yellow", "Changed Color"] })).to eq(true)
end
it "does nothing if data,type and name parameters for the value are same" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Stamen", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(false)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "Stamen", :type => :multi_string, :data => ["Yellow", "Changed Color"] })).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { name: "Stamen", type: :multi_string, data: ["Yellow", "Changed Color"] })).to eq(false)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "Stamen", type: :multi_string, data: ["Yellow", "Changed Color"] })).to eq(true)
end
it "throws an exception if the key does not exist" do
- expect { @registry.set_value("HKCU\\Software\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Yellow", "Changed Color"] }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.set_value("HKCU\\Software\\Branch\\Flower", { name: "Petals", type: :multi_string, data: ["Yellow", "Changed Color"] }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- expect { @registry.set_value("JKLM\\Software\\Root\\Branch\\Flower", { :name => "Petals", :type => :multi_string, :data => ["Yellow", "Changed Color"] }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.set_value("JKLM\\Software\\Root\\Branch\\Flower", { name: "Petals", type: :multi_string, data: ["Yellow", "Changed Color"] }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
# we are validating that the data gets .to_i called on it when type is a :dword
it "casts an integer string given as a dword into an integer" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBe32767", :type => :dword, :data => "32767" })).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBe32767", :type => :dword, :data => 32767 })).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { name: "ShouldBe32767", type: :dword, data: "32767" })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "ShouldBe32767", type: :dword, data: 32767 })).to eq(true)
end
it "casts a nonsense string given as a dword into zero" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBeZero", :type => :dword, :data => "whatdoesthisdo" })).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBeZero", :type => :dword, :data => 0 })).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { name: "ShouldBeZero", type: :dword, data: "whatdoesthisdo" })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "ShouldBeZero", type: :dword, data: 0 })).to eq(true)
end
it "throws an exception when trying to cast an array to an int for a dword" do
- expect { @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldThrow", :type => :dword, :data => %w{one two} }) }.to raise_error NoMethodError
+ expect { @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { name: "ShouldThrow", type: :dword, data: %w{one two} }) }.to raise_error NoMethodError
end
# we are validating that the data gets .to_s called on it when type is a :string
it "stores the string representation of an array into a string if you pass it an array" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBePainful", :type => :string, :data => %w{one two} })).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBePainful", :type => :string, :data => '["one", "two"]' })).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { name: "ShouldBePainful", type: :string, data: %w{one two} })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "ShouldBePainful", type: :string, data: '["one", "two"]' })).to eq(true)
end
it "stores the string representation of a number into a string if you pass it an number" do
- expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBe65535", :type => :string, :data => 65535 })).to eq(true)
- expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBe65535", :type => :string, :data => "65535" })).to eq(true)
+ expect(@registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { name: "ShouldBe65535", type: :string, data: 65535 })).to eq(true)
+ expect(@registry.data_exists?("HKCU\\Software\\Root\\Branch\\Flower", { name: "ShouldBe65535", type: :string, data: "65535" })).to eq(true)
end
# we are validating that the data gets .to_a called on it when type is a :multi_string
it "throws an exception when a multi-string is passed a number" do
- expect { @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldThrow", :type => :multi_string, :data => 65535 }) }.to raise_error NoMethodError
+ expect { @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { name: "ShouldThrow", type: :multi_string, data: 65535 }) }.to raise_error NoMethodError
end
it "throws an exception when a multi-string is passed a string" do
- expect { @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { :name => "ShouldBeWat", :type => :multi_string, :data => "foo" }) }.to raise_error NoMethodError
+ expect { @registry.set_value("HKCU\\Software\\Root\\Branch\\Flower", { name: "ShouldBeWat", type: :multi_string, data: "foo" }) }.to raise_error NoMethodError
end
end
@@ -309,21 +309,21 @@ describe "Chef::Win32::Registry", :windows_only do
end
it "deletes values if the value exists" do
- expect(@registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" })).to eq(true)
- expect(@registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" })).to eq(false)
+ expect(@registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { name: "Peter", type: :string, data: "Tiny" })).to eq(true)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { name: "Peter", type: :string, data: "Tiny" })).to eq(false)
end
it "does nothing if value does not exist" do
- expect(@registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" })).to eq(true)
- expect(@registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" })).to eq(false)
+ expect(@registry.delete_value("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { name: "Peter", type: :string, data: "Tiny" })).to eq(true)
+ expect(@registry.value_exists?("HKCU\\Software\\Root\\Trunk\\Peck\\Woodpecker", { name: "Peter", type: :string, data: "Tiny" })).to eq(false)
end
it "throws an exception if the key does not exist?" do
- expect { @registry.delete_value("HKCU\\Software\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.delete_value("HKCU\\Software\\Trunk\\Peck\\Woodpecker", { name: "Peter", type: :string, data: "Tiny" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "throws an exception if the hive does not exist" do
- expect { @registry.delete_value("JKLM\\Software\\Root\\Trunk\\Peck\\Woodpecker", { :name => "Peter", :type => :string, :data => "Tiny" }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
+ expect { @registry.delete_value("JKLM\\Software\\Root\\Trunk\\Peck\\Woodpecker", { name: "Peter", type: :string, data: "Tiny" }) }.to raise_error(Chef::Exceptions::Win32RegHiveMissing)
end
end
@@ -566,38 +566,38 @@ describe "Chef::Win32::Registry", :windows_only do
describe "value_exists?" do
it "does not find 64-bit values in the 32-bit registry" do
@registry.architecture = :i386
- expect { @registry.value_exists?("HKLM\\Software\\Root\\Mauve", { :name => "Alert" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.value_exists?("HKLM\\Software\\Root\\Mauve", { name: "Alert" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "finds 32-bit values in the 32-bit registry" do
@registry.architecture = :i386
- expect(@registry.value_exists?("HKLM\\Software\\Root\\Poosh", { :name => "Status" })).to eq(true)
+ expect(@registry.value_exists?("HKLM\\Software\\Root\\Poosh", { name: "Status" })).to eq(true)
end
it "does not find 32-bit values in the 64-bit registry" do
@registry.architecture = :x86_64
- expect(@registry.value_exists?("HKLM\\Software\\Root\\Mauve", { :name => "Alert" })).to eq(true)
+ expect(@registry.value_exists?("HKLM\\Software\\Root\\Mauve", { name: "Alert" })).to eq(true)
end
it "finds 64-bit values in the 64-bit registry" do
@registry.architecture = :x86_64
- expect { @registry.value_exists?("HKLM\\Software\\Root\\Poosh", { :name => "Status" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.value_exists?("HKLM\\Software\\Root\\Poosh", { name: "Status" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
end
describe "data_exists?" do
it "does not find 64-bit keys in the 32-bit registry" do
@registry.architecture = :i386
- expect { @registry.data_exists?("HKLM\\Software\\Root\\Mauve", { :name => "Alert", :type => :string, :data => "Universal" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.data_exists?("HKLM\\Software\\Root\\Mauve", { name: "Alert", type: :string, data: "Universal" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
it "finds 32-bit keys in the 32-bit registry" do
@registry.architecture = :i386
- expect(@registry.data_exists?("HKLM\\Software\\Root\\Poosh", { :name => "Status", :type => :string, :data => "Lost" })).to eq(true)
+ expect(@registry.data_exists?("HKLM\\Software\\Root\\Poosh", { name: "Status", type: :string, data: "Lost" })).to eq(true)
end
it "does not find 32-bit keys in the 64-bit registry" do
@registry.architecture = :x86_64
- expect(@registry.data_exists?("HKLM\\Software\\Root\\Mauve", { :name => "Alert", :type => :string, :data => "Universal" })).to eq(true)
+ expect(@registry.data_exists?("HKLM\\Software\\Root\\Mauve", { name: "Alert", type: :string, data: "Universal" })).to eq(true)
end
it "finds 64-bit keys in the 64-bit registry" do
@registry.architecture = :x86_64
- expect { @registry.data_exists?("HKLM\\Software\\Root\\Poosh", { :name => "Status", :type => :string, :data => "Lost" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
+ expect { @registry.data_exists?("HKLM\\Software\\Root\\Poosh", { name: "Status", type: :string, data: "Lost" }) }.to raise_error(Chef::Exceptions::Win32RegKeyMissing)
end
end
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 8f2364d99a..3c4d43aac5 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -59,17 +59,17 @@ local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
- shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
end
- it "should complete successfully with no other environment variables", :skip => (Chef::Platform.windows?) do
+ it "should complete successfully with no other environment variables", skip: (Chef::Platform.windows?) do
file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
begin
- result = shell_out("env -i #{critical_env_vars} #{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("env -i #{critical_env_vars} #{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
result.error!
rescue
Chef::Log.info "Bare invocation will have the following load-path."
@@ -84,29 +84,29 @@ local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
- result = shell_out("#{chef_client} --no-listen -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} --no-listen -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
result.error!
end
it "should be able to node.save with bad utf8 characters in the node data" do
file "cookbooks/x/attributes/default.rb", 'default["badutf8"] = "Elan Ruusam\xE4e"'
- result = shell_out("#{chef_client} -z -r 'x::default' --disable-config", :cwd => path_to(""))
+ result = shell_out("#{chef_client} -z -r 'x::default' --disable-config", cwd: path_to(""))
result.error!
end
context "and no config file" do
it "should complete with success when cwd is just above cookbooks and paths are not specified" do
- result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => path_to(""))
+ result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", cwd: path_to(""))
result.error!
end
it "should complete with success when cwd is below cookbooks and paths are not specified" do
- result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => path_to("cookbooks/x"))
+ result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", cwd: path_to("cookbooks/x"))
result.error!
end
it "should fail when cwd is below high above and paths are not specified" do
- result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", :cwd => File.expand_path("..", path_to("")))
+ result = shell_out("#{chef_client} -z -o 'x::default' --disable-config", cwd: File.expand_path("..", path_to("")))
expect(result.exitstatus).to eq(1)
end
end
@@ -115,7 +115,7 @@ EOM
before { file ".chef/knife.rb", "xxx.xxx" }
it "should load .chef/knife.rb when -z is specified" do
- result = shell_out("#{chef_client} -z -o 'x::default'", :cwd => path_to(""))
+ result = shell_out("#{chef_client} -z -o 'x::default'", cwd: path_to(""))
# FATAL: Configuration error NoMethodError: undefined method `xxx' for nil:NilClass
expect(result.stdout).to include("xxx")
end
@@ -128,7 +128,7 @@ local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
result.error!
end
@@ -172,7 +172,7 @@ client_key #{path_to('mykey.pem').inspect}
cookbook_path #{path_to('cookbooks').inspect}
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
result.error!
end
@@ -195,7 +195,7 @@ file #{path_to('tempfile2.txt').inspect} do
end
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" #{path_to('arbitrary.rb')} #{path_to('arbitrary2.rb')}", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" #{path_to('arbitrary.rb')} #{path_to('arbitrary2.rb')}", cwd: chef_dir)
result.error!
expect(IO.read(path_to("tempfile.txt"))).to eq("1")
@@ -215,7 +215,7 @@ file #{path_to('tempfile.txt').inspect} do
end
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" arbitrary.rb", :cwd => path_to(""))
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" arbitrary.rb", cwd: path_to(""))
result.error!
expect(IO.read(path_to("tempfile.txt"))).to eq("1")
@@ -239,7 +239,7 @@ file #{path_to('tempfile.txt').inspect} do
end
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o x::constant_definition arbitrary.rb", :cwd => path_to(""))
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o x::constant_definition arbitrary.rb", cwd: path_to(""))
result.error!
expect(IO.read(path_to("tempfile.txt"))).to eq("1")
@@ -253,7 +253,7 @@ chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir)
result.error!
end
@@ -263,7 +263,7 @@ chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", cwd: chef_dir)
result.error!
end
@@ -273,7 +273,7 @@ chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", cwd: chef_dir)
expect(result.stdout).not_to include("SSL validation of HTTPS requests is disabled.")
result.error!
end
@@ -284,7 +284,7 @@ chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir)
result.error!
end
@@ -294,7 +294,7 @@ chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -r 'x::default' -z -l info", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -r 'x::default' -z -l info", cwd: chef_dir)
expect(result.stdout).not_to include("Overridden Run List")
expect(result.stdout).to include("Run List is [recipe[x::default]]")
result.error!
@@ -305,7 +305,7 @@ EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
- result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z --profile-ruby", :cwd => chef_dir)
+ result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z --profile-ruby", cwd: chef_dir)
result.error!
expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be true
end
@@ -315,7 +315,7 @@ EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
- result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", :cwd => chef_dir)
+ result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir)
result.error!
expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be false
end
@@ -335,7 +335,7 @@ cookbook_path "#{path_to('cookbooks')}"
EOM
end
it "should fail the chef client run" do
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
expect(command.exitstatus).to eql(1)
expect(command.stdout).to match(/Chef::Exceptions::CookbookChefVersionMismatch/)
end
@@ -361,7 +361,7 @@ EOM
end
it "the cheffish DSL is loaded lazily" do
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
expect(command.exitstatus).to eql(0)
end
end
@@ -380,7 +380,7 @@ EOM
it "the cheffish DSL tries to load but fails (because chef-provisioning is not there)" do
# we'd need to have a custom bundle to fix this that omitted chef-provisioning, but that would dig our crazy even deeper, so lets not
skip "but if chef-provisioning is in our bundle or in our gemset then this test, very annoyingly, always fails"
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
expect(command.exitstatus).to eql(1)
expect(command.stdout).to match(/cannot load such file -- chef\/provisioning/)
end
@@ -415,7 +415,7 @@ EOM
ENV.delete("CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS")
- result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
expect(result.error?).to be_falsey
# Search to the end of the client run in the output
@@ -446,7 +446,7 @@ control_group "control group without top level control" do
end
RECIPE
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'audit_test::succeed' -l info", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'audit_test::succeed' -l info", cwd: chef_dir)
expect(result.error?).to be_falsey
expect(result.stdout).to include("Successfully executed all `control_group` blocks and contained examples")
end
@@ -460,7 +460,7 @@ control_group "control group without top level control" do
end
RECIPE
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'audit_test::fail'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'audit_test::fail'", cwd: chef_dir)
expect(result.error?).to be_truthy
expect(result.stdout).to include("Failure/Error: expect(2 - 2).to eq(1)")
end
@@ -487,7 +487,7 @@ no_lazy_load #{lazy}
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
- result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
result.error!
expect(IO.read(path_to("tempfile.txt")).strip).to eq("this is my file")
@@ -522,7 +522,7 @@ EOM
end
it "should run the ohai plugin" do
- result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
result.error!
expect(IO.read(path_to("tempfile.txt"))).to eq("2014")
@@ -545,18 +545,18 @@ EOM
file "config/client.rb", <<EOM
chef_repo_path "#{tmp_dir}"
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", :cwd => tmp_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", cwd: tmp_dir)
result.error!
end
it "should fail when passed --recipe-url and not passed -z" do
- result = shell_out("#{chef_client} --recipe-url=http://localhost:9000/recipes.tgz", :cwd => tmp_dir)
+ result = shell_out("#{chef_client} --recipe-url=http://localhost:9000/recipes.tgz", cwd: tmp_dir)
expect(result.exitstatus).not_to eq(0)
end
it "should fail when passed --recipe-url with a file that doesn't exist" do
broken_path = File.join(CHEF_SPEC_DATA, "recipes_dont_exist.tgz")
- result = shell_out("#{chef_client} --recipe-url=#{broken_path}", :cwd => tmp_dir)
+ result = shell_out("#{chef_client} --recipe-url=#{broken_path}", cwd: tmp_dir)
expect(result.exitstatus).not_to eq(0)
end
end
@@ -583,12 +583,12 @@ EOM
end
it "the chef client run should succeed" do
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
command.error!
end
it "a chef-solo run should succeed" do
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
command.error!
end
end
@@ -607,25 +607,25 @@ EOM
end
it "a chef client run should not log to info by default" do
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
command.error!
expect(command.stdout).not_to include("INFO")
end
it "a chef client run to a pipe should not log to info by default" do
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork | tee #{path_to('chefrun.out')}", :cwd => chef_dir)
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork | tee #{path_to('chefrun.out')}", cwd: chef_dir)
command.error!
expect(command.stdout).not_to include("INFO")
end
it "a chef solo run should not log to info by default" do
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
command.error!
expect(command.stdout).not_to include("INFO")
end
it "a chef solo run to a pipe should not log to info by default" do
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork | tee #{path_to('chefrun.out')}", :cwd => chef_dir)
+ command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork | tee #{path_to('chefrun.out')}", cwd: chef_dir)
command.error!
expect(command.stdout).not_to include("INFO")
end
@@ -643,37 +643,37 @@ EOM
end
it "chef-client runs by default with no supervisor" do
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
command.error!
expect(command.stdout).to include("NOFORK")
end
it "chef-solo runs by default with no supervisor" do
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
command.error!
expect(command.stdout).to include("NOFORK")
end
it "chef-client --no-fork does not fork" do
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
command.error!
expect(command.stdout).to include("NOFORK")
end
it "chef-solo --no-fork does not fork" do
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir)
command.error!
expect(command.stdout).to include("NOFORK")
end
it "chef-client with --fork uses a supervisor" do
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --fork", :cwd => chef_dir)
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --fork", cwd: chef_dir)
command.error!
expect(command.stdout).to include("WITHFORK")
end
it "chef-solo with --fork uses a supervisor" do
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --fork", :cwd => chef_dir)
+ command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --fork", cwd: chef_dir)
command.error!
expect(command.stdout).to include("WITHFORK")
end
@@ -692,13 +692,13 @@ EOM
end
it "chef-client uses a supervisor" do
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
command.error!
expect(command.stdout).to include("WITHFORK")
end
it "chef-solo uses a supervisor" do
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
command.error!
expect(command.stdout).to include("WITHFORK")
end
@@ -717,13 +717,13 @@ EOM
end
it "chef-client uses a supervisor" do
- command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
command.error!
expect(command.stdout).to include("NOFORK")
end
it "chef-solo uses a supervisor" do
- command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", :cwd => chef_dir)
+ command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir)
command.error!
expect(command.stdout).to include("NOFORK")
end
diff --git a/spec/integration/client/exit_code_spec.rb b/spec/integration/client/exit_code_spec.rb
index 4397426723..939f5ad5b7 100644
--- a/spec/integration/client/exit_code_spec.rb
+++ b/spec/integration/client/exit_code_spec.rb
@@ -44,8 +44,8 @@ EOM
def run_chef_client_and_expect_exit_code(exit_code)
shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'",
- :cwd => chef_dir,
- :returns => [exit_code])
+ cwd: chef_dir,
+ returns: [exit_code])
end
context "has a cookbook" do
diff --git a/spec/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb
index 6452db1e39..b6e08e842f 100644
--- a/spec/integration/client/ipv6_spec.rb
+++ b/spec/integration/client/ipv6_spec.rb
@@ -22,7 +22,7 @@ describe "chef-client" do
include IntegrationSupport
include Chef::Mixin::ShellOut
- let(:chef_zero_opts) { { :host => "::1" } }
+ let(:chef_zero_opts) { { host: "::1" } }
let(:validation_pem) do
<<-END_VALIDATION_PEM
@@ -93,7 +93,7 @@ END_CLIENT_RB
end
it "should complete with success" do
- result = shell_out("#{chef_client_cmd} -o 'noop::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client_cmd} -o 'noop::default'", cwd: chef_dir)
result.error!
end
@@ -125,7 +125,7 @@ END_CLIENT_RB
end
it "should complete with success" do
- result = shell_out("#{chef_client_cmd} -o 'api-smoke-test::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client_cmd} -o 'api-smoke-test::default'", cwd: chef_dir)
result.error!
end
diff --git a/spec/integration/knife/chef_fs_data_store_spec.rb b/spec/integration/knife/chef_fs_data_store_spec.rb
index 02508b799d..1e9d1c65b4 100644
--- a/spec/integration/knife/chef_fs_data_store_spec.rb
+++ b/spec/integration/knife/chef_fs_data_store_spec.rb
@@ -190,7 +190,7 @@ EOM
end
it "knife cookbook upload works" do
- knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} x").should_succeed :stderr => <<EOM
+ knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} x").should_succeed stderr: <<EOM
Uploading x [1.0.0]
Uploaded 1 cookbook.
EOM
@@ -218,7 +218,7 @@ EOM
knife("list --local /roles").should_succeed "/roles/x.json\n"
end
- it "After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty", :skip => (RUBY_VERSION < "1.9") do
+ it "After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty", skip: (RUBY_VERSION < "1.9") do
knife("raw -z -i #{path_to('rolestuff.json')} -m PUT /roles/x").should_succeed( /"x"/ )
expect(IO.read(path_to("roles/x.json"))).to eq <<EOM.strip
{
@@ -247,7 +247,7 @@ EOM
end
it "knife cookbook upload works" do
- knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} z").should_succeed :stderr => <<EOM
+ knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} z").should_succeed stderr: <<EOM
Uploading z [1.0.0]
Uploaded 1 cookbook.
EOM
@@ -281,7 +281,7 @@ EOM
knife("list --local /roles").should_succeed "/roles/z.json\n"
end
- it "After knife raw -z -i rolestuff.json -m POST /roles, the output is pretty", :skip => (RUBY_VERSION < "1.9") do
+ it "After knife raw -z -i rolestuff.json -m POST /roles, the output is pretty", skip: (RUBY_VERSION < "1.9") do
knife("raw -z -i #{path_to('rolestuff.json')} -m POST /roles").should_succeed( /uri/ )
expect(IO.read(path_to("roles/x.json"))).to eq <<EOM.strip
{
@@ -489,7 +489,7 @@ EOM
knife("list --local /users").should_succeed "/users/x.json\n"
end
- it "After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty", :skip => (RUBY_VERSION < "1.9") do
+ it "After knife raw -z -i rolestuff.json -m PUT /roles/x, the output is pretty", skip: (RUBY_VERSION < "1.9") do
knife("raw -z -i #{path_to('rolestuff.json')} -m PUT /roles/x").should_succeed( /"x"/ )
expect(IO.read(path_to("roles/x.json"))).to eq <<EOM.strip
{
diff --git a/spec/integration/knife/chef_repo_path_spec.rb b/spec/integration/knife/chef_repo_path_spec.rb
index e609fa60b3..9cb093c178 100644
--- a/spec/integration/knife/chef_repo_path_spec.rb
+++ b/spec/integration/knife/chef_repo_path_spec.rb
@@ -391,7 +391,7 @@ EOM
file "cookbooks2/blah/metadata.rb", ""
end
it "knife list -Rfp cookbooks shows files in blah" do
- knife("list --local -Rfp /cookbooks").should_succeed(<<EOM, :stderr => "WARN: Cookbook 'blah' is empty or entirely chefignored at #{Chef::Config.cookbook_path[0]}/blah\n")
+ knife("list --local -Rfp /cookbooks").should_succeed(<<EOM, stderr: "WARN: Cookbook 'blah' is empty or entirely chefignored at #{Chef::Config.cookbook_path[0]}/blah\n")
/cookbooks/blah/
/cookbooks/blah/metadata.rb
/cookbooks/cookbook1/
@@ -408,7 +408,7 @@ EOM
file "cookbooks2/blah/metadata.rb", ""
end
it "knife list -Rfp cookbooks shows files in the first cookbook and not the second" do
- knife("list --local -Rfp /cookbooks").should_succeed(<<EOM, :stderr => "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.cookbook_path[0]}/blah and #{Chef::Config.cookbook_path[1]}/blah\n")
+ knife("list --local -Rfp /cookbooks").should_succeed(<<EOM, stderr: "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.cookbook_path[0]}/blah and #{Chef::Config.cookbook_path[1]}/blah\n")
/cookbooks/blah/
/cookbooks/blah/metadata.json
/cookbooks/cookbook1/
@@ -442,7 +442,7 @@ EOM
file "data_bags2/blah/item2.json", ""
end
it "knife list -Rfp data_bags shows only items in data_bags1" do
- knife("list --local -Rfp /data_bags").should_succeed(<<EOM, :stderr => "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.data_bag_path[0]}/blah and #{Chef::Config.data_bag_path[1]}/blah\n")
+ knife("list --local -Rfp /data_bags").should_succeed(<<EOM, stderr: "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.data_bag_path[0]}/blah and #{Chef::Config.data_bag_path[1]}/blah\n")
/data_bags/bag/
/data_bags/bag/item.json
/data_bags/bag2/
diff --git a/spec/integration/knife/chef_repository_file_system_spec.rb b/spec/integration/knife/chef_repository_file_system_spec.rb
index 222d3aee8a..c9aa787bbe 100644
--- a/spec/integration/knife/chef_repository_file_system_spec.rb
+++ b/spec/integration/knife/chef_repository_file_system_spec.rb
@@ -53,7 +53,7 @@ EOM
before { directory "cookbooks/cookbook1" }
it "knife list --local -Rfp / does not return it" do
- knife("list --local -Rfp /").should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
+ knife("list --local -Rfp /").should_succeed(<<EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
/cookbooks/
EOM
end
@@ -63,7 +63,7 @@ EOM
before { directory "cookbooks/cookbook1/recipes" }
it "knife list --local -Rfp / does not return it" do
- knife("list --local -Rfp /").should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
+ knife("list --local -Rfp /").should_succeed(<<EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
/cookbooks/
EOM
end
@@ -90,7 +90,7 @@ EOM
before { directory "cookbooks/cookbook1/templates/default" }
it "knife list --local -Rfp / does not return it" do
- knife("list --local -Rfp /").should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
+ knife("list --local -Rfp /").should_succeed(<<EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
/cookbooks/
EOM
end
diff --git a/spec/integration/knife/chefignore_spec.rb b/spec/integration/knife/chefignore_spec.rb
index aa5a3979cc..e3f1e18f7e 100644
--- a/spec/integration/knife/chefignore_spec.rb
+++ b/spec/integration/knife/chefignore_spec.rb
@@ -69,7 +69,7 @@ EOM
end
it "the cookbook is not listed" do
- knife("list --local -Rfp /").should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
+ knife("list --local -Rfp /").should_succeed(<<EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
/cookbooks/
EOM
end
@@ -251,7 +251,7 @@ EOM
end
it "chefignores apply only to the winning cookbook" do
- knife("list --local -Rfp /").should_succeed(<<EOM, :stderr => "WARN: Child with name 'yourcookbook' found in multiple directories: #{Chef::Config.chef_repo_path}/cookbooks1/yourcookbook and #{Chef::Config.chef_repo_path}/cookbooks2/yourcookbook\n")
+ knife("list --local -Rfp /").should_succeed(<<EOM, stderr: "WARN: Child with name 'yourcookbook' found in multiple directories: #{Chef::Config.chef_repo_path}/cookbooks1/yourcookbook and #{Chef::Config.chef_repo_path}/cookbooks2/yourcookbook\n")
/cookbooks/
/cookbooks/mycookbook/
/cookbooks/mycookbook/x.json
diff --git a/spec/integration/knife/common_options_spec.rb b/spec/integration/knife/common_options_spec.rb
index da1409456b..0b090f170e 100644
--- a/spec/integration/knife/common_options_spec.rb
+++ b/spec/integration/knife/common_options_spec.rb
@@ -125,7 +125,7 @@ EOM
context "when the default port (8889) is already bound" do
before :each do
begin
- @server = ChefZero::Server.new(:host => "localhost", :port => 8889)
+ @server = ChefZero::Server.new(host: "localhost", port: 8889)
@server.start_background
rescue Errno::EADDRINUSE
# OK. Don't care who has it in use, as long as *someone* does.
@@ -144,7 +144,7 @@ EOM
context "when port 9999 is already bound" do
before :each do
begin
- @server = ChefZero::Server.new(:host => "localhost", :port => 9999)
+ @server = ChefZero::Server.new(host: "localhost", port: 9999)
@server.start_background
rescue Errno::EADDRINUSE
# OK. Don't care who has it in use, as long as *someone* does.
diff --git a/spec/integration/knife/cookbook_api_ipv6_spec.rb b/spec/integration/knife/cookbook_api_ipv6_spec.rb
index 0a4a6a6e94..434210c01e 100644
--- a/spec/integration/knife/cookbook_api_ipv6_spec.rb
+++ b/spec/integration/knife/cookbook_api_ipv6_spec.rb
@@ -23,7 +23,7 @@ describe "Knife cookbook API integration with IPv6", :workstation, :not_supporte
include Chef::Mixin::ShellOut
when_the_chef_server "is bound to IPv6" do
- let(:chef_zero_opts) { { :host => "::1" } }
+ let(:chef_zero_opts) { { host: "::1" } }
let(:client_key) do
<<-END_VALIDATION_PEM
@@ -89,7 +89,7 @@ END_CLIENT_RB
end
it "successfully uploads a cookbook" do
- shell_out!("#{knife} cookbook upload apache2 #{knife_config_flag}", :cwd => chef_dir)
+ shell_out!("#{knife} cookbook upload apache2 #{knife_config_flag}", cwd: chef_dir)
versions_list_json = Chef::HTTP::Simple.new("http://[::1]:8900").get("/cookbooks/apache2", "accept" => "application/json")
versions_list = Chef::JSONCompat.from_json(versions_list_json)
expect(versions_list["apache2"]["versions"]).not_to be_empty
@@ -97,11 +97,11 @@ END_CLIENT_RB
context "and the cookbook has been uploaded to the server" do
before do
- shell_out!("#{knife} cookbook upload apache2 #{knife_config_flag}", :cwd => chef_dir)
+ shell_out!("#{knife} cookbook upload apache2 #{knife_config_flag}", cwd: chef_dir)
end
it "downloads the cookbook" do
- shell_out!("knife cookbook download apache2 #{knife_config_flag} -d #{cache_path}", :cwd => chef_dir)
+ shell_out!("knife cookbook download apache2 #{knife_config_flag} -d #{cache_path}", cwd: chef_dir)
expect(Dir["#{cache_path}/*"].map { |entry| File.basename(entry) }).to include("apache2-0.0.1")
end
end
diff --git a/spec/integration/knife/delete_spec.rb b/spec/integration/knife/delete_spec.rb
index 1c69fbf9c9..9e0b46fd81 100644
--- a/spec/integration/knife/delete_spec.rb
+++ b/spec/integration/knife/delete_spec.rb
@@ -413,7 +413,7 @@ EOM
end
it "knife delete --both /environments/_default.json fails but still deletes the local copy" do
- knife("delete --both /environments/_default.json").should_fail :stderr => "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n", :stdout => "Deleted /environments/_default.json\n"
+ knife("delete --both /environments/_default.json").should_fail stderr: "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n", stdout: "Deleted /environments/_default.json\n"
knife("list -Rf /").should_succeed server_everything
knife("list -Rf --local /").should_succeed <<EOM
/clients
@@ -600,7 +600,7 @@ EOM
end
it "knife delete --both /environments/_default.json fails" do
- knife("delete --both /environments/_default.json").should_fail "", :stderr => "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n"
+ knife("delete --both /environments/_default.json").should_fail "", stderr: "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n"
knife("list -Rf /").should_succeed server_everything
knife("list -Rf --local /").should_succeed nothing
end
@@ -643,7 +643,7 @@ EOM
context "and cwd is at the top level" do
before { cwd "." }
it "knife delete fails" do
- knife("delete").should_fail "FATAL: You must specify at least one argument. If you want to delete everything in this directory, run \"knife delete --recurse .\"\n", :stdout => /USAGE/
+ knife("delete").should_fail "FATAL: You must specify at least one argument. If you want to delete everything in this directory, run \"knife delete --recurse .\"\n", stdout: /USAGE/
knife("list -Rf /").should_succeed <<EOM
clients
clients/chef-validator.json
@@ -796,7 +796,7 @@ EOM
end
it "knife delete --both /environments/_default.json fails but still deletes the local copy" do
- knife("delete --both /environments/_default.json").should_fail :stderr => "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n", :stdout => "Deleted /environments/_default.json\n"
+ knife("delete --both /environments/_default.json").should_fail stderr: "ERROR: /environments/_default.json (remote) cannot be deleted (default environment cannot be modified).\n", stdout: "Deleted /environments/_default.json\n"
knife("list -Rf /").should_succeed server_nothing
knife("list -Rf --local /").should_succeed <<EOM
/clients
@@ -856,7 +856,7 @@ EOM
context "and cwd is at the top level" do
before { cwd "." }
it "knife delete fails" do
- knife("delete").should_fail "FATAL: You must specify at least one argument. If you want to delete everything in this directory, run \"knife delete --recurse .\"\n", :stdout => /USAGE/
+ knife("delete").should_fail "FATAL: You must specify at least one argument. If you want to delete everything in this directory, run \"knife delete --recurse .\"\n", stdout: /USAGE/
knife("list -Rf /").should_succeed <<EOM
clients
clients/chef-validator.json
@@ -962,7 +962,7 @@ EOM
end
end
- when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
+ when_the_chef_server "is in Enterprise mode", osc_compat: false, single_org: false do
before do
organization "foo" do
container "x", {}
diff --git a/spec/integration/knife/deps_spec.rb b/spec/integration/knife/deps_spec.rb
index 3f200396ba..b8ab6e719c 100644
--- a/spec/integration/knife/deps_spec.rb
+++ b/spec/integration/knife/deps_spec.rb
@@ -252,44 +252,44 @@ EOM
when_the_repository "is empty" do
it "knife deps /blah reports an error" do
knife("deps /blah").should_fail(
- :exit_code => 2,
- :stdout => "/blah\n",
- :stderr => "ERROR: /blah: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/blah\n",
+ stderr: "ERROR: /blah: No such file or directory\n"
)
end
it "knife deps /roles/x.json reports an error" do
knife("deps /roles/x.json").should_fail(
- :exit_code => 2,
- :stdout => "/roles/x.json\n",
- :stderr => "ERROR: /roles/x.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/roles/x.json\n",
+ stderr: "ERROR: /roles/x.json: No such file or directory\n"
)
end
it "knife deps /nodes/x.json reports an error" do
knife("deps /nodes/x.json").should_fail(
- :exit_code => 2,
- :stdout => "/nodes/x.json\n",
- :stderr => "ERROR: /nodes/x.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/nodes/x.json\n",
+ stderr: "ERROR: /nodes/x.json: No such file or directory\n"
)
end
it "knife deps /environments/x.json reports an error" do
knife("deps /environments/x.json").should_fail(
- :exit_code => 2,
- :stdout => "/environments/x.json\n",
- :stderr => "ERROR: /environments/x.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/environments/x.json\n",
+ stderr: "ERROR: /environments/x.json: No such file or directory\n"
)
end
it "knife deps /cookbooks/x reports an error" do
knife("deps /cookbooks/x").should_fail(
- :exit_code => 2,
- :stdout => "/cookbooks/x\n",
- :stderr => "ERROR: /cookbooks/x: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/cookbooks/x\n",
+ stderr: "ERROR: /cookbooks/x: No such file or directory\n"
)
end
it "knife deps /data_bags/bag/item.json reports an error" do
knife("deps /data_bags/bag/item.json").should_fail(
- :exit_code => 2,
- :stdout => "/data_bags/bag/item.json\n",
- :stderr => "ERROR: /data_bags/bag/item.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/data_bags/bag/item.json\n",
+ stderr: "ERROR: /data_bags/bag/item.json: No such file or directory\n"
)
end
end
@@ -299,9 +299,9 @@ EOM
end
it "knife deps reports the cookbook, along with an error" do
knife("deps /roles/starring.json").should_fail(
- :exit_code => 2,
- :stdout => "/cookbooks/quiche\n/roles/starring.json\n",
- :stderr => "ERROR: /cookbooks/quiche: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/cookbooks/quiche\n/roles/starring.json\n",
+ stderr: "ERROR: /cookbooks/quiche: No such file or directory\n"
)
end
end
@@ -311,9 +311,9 @@ EOM
end
it "knife deps reports the environment, along with an error" do
knife("deps /nodes/mort.json").should_fail(
- :exit_code => 2,
- :stdout => "/environments/desert.json\n/nodes/mort.json\n",
- :stderr => "ERROR: /environments/desert.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/environments/desert.json\n/nodes/mort.json\n",
+ stderr: "ERROR: /environments/desert.json: No such file or directory\n"
)
end
end
@@ -323,9 +323,9 @@ EOM
end
it "knife deps reports the role, along with an error" do
knife("deps /roles/starring.json").should_fail(
- :exit_code => 2,
- :stdout => "/roles/minor.json\n/roles/starring.json\n",
- :stderr => "ERROR: /roles/minor.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/roles/minor.json\n/roles/starring.json\n",
+ stderr: "ERROR: /roles/minor.json: No such file or directory\n"
)
end
end
@@ -337,9 +337,9 @@ EOM
end
it "knife deps /roles reports an error" do
knife("deps /roles").should_fail(
- :exit_code => 2,
- :stderr => "ERROR: /roles: No such file or directory\n",
- :stdout => "/roles\n"
+ exit_code: 2,
+ stderr: "ERROR: /roles: No such file or directory\n",
+ stdout: "/roles\n"
)
end
end
@@ -590,44 +590,44 @@ EOM
when_the_chef_server "is empty" do
it "knife deps /blah reports an error" do
knife("deps --remote /blah").should_fail(
- :exit_code => 2,
- :stdout => "/blah\n",
- :stderr => "ERROR: /blah: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/blah\n",
+ stderr: "ERROR: /blah: No such file or directory\n"
)
end
it "knife deps /roles/x.json reports an error" do
knife("deps --remote /roles/x.json").should_fail(
- :exit_code => 2,
- :stdout => "/roles/x.json\n",
- :stderr => "ERROR: /roles/x.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/roles/x.json\n",
+ stderr: "ERROR: /roles/x.json: No such file or directory\n"
)
end
it "knife deps /nodes/x.json reports an error" do
knife("deps --remote /nodes/x.json").should_fail(
- :exit_code => 2,
- :stdout => "/nodes/x.json\n",
- :stderr => "ERROR: /nodes/x.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/nodes/x.json\n",
+ stderr: "ERROR: /nodes/x.json: No such file or directory\n"
)
end
it "knife deps /environments/x.json reports an error" do
knife("deps --remote /environments/x.json").should_fail(
- :exit_code => 2,
- :stdout => "/environments/x.json\n",
- :stderr => "ERROR: /environments/x.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/environments/x.json\n",
+ stderr: "ERROR: /environments/x.json: No such file or directory\n"
)
end
it "knife deps /cookbooks/x reports an error" do
knife("deps --remote /cookbooks/x").should_fail(
- :exit_code => 2,
- :stdout => "/cookbooks/x\n",
- :stderr => "ERROR: /cookbooks/x: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/cookbooks/x\n",
+ stderr: "ERROR: /cookbooks/x: No such file or directory\n"
)
end
it "knife deps /data_bags/bag/item reports an error" do
knife("deps --remote /data_bags/bag/item.json").should_fail(
- :exit_code => 2,
- :stdout => "/data_bags/bag/item.json\n",
- :stderr => "ERROR: /data_bags/bag/item.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/data_bags/bag/item.json\n",
+ stderr: "ERROR: /data_bags/bag/item.json: No such file or directory\n"
)
end
end
@@ -637,9 +637,9 @@ EOM
end
it "knife deps reports the cookbook, along with an error" do
knife("deps --remote /roles/starring.json").should_fail(
- :exit_code => 2,
- :stdout => "/cookbooks/quiche\n/roles/starring.json\n",
- :stderr => "ERROR: /cookbooks/quiche: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/cookbooks/quiche\n/roles/starring.json\n",
+ stderr: "ERROR: /cookbooks/quiche: No such file or directory\n"
)
end
end
@@ -649,9 +649,9 @@ EOM
end
it "knife deps reports the environment, along with an error" do
knife("deps --remote /nodes/mort.json").should_fail(
- :exit_code => 2,
- :stdout => "/environments/desert.json\n/nodes/mort.json\n",
- :stderr => "ERROR: /environments/desert.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/environments/desert.json\n/nodes/mort.json\n",
+ stderr: "ERROR: /environments/desert.json: No such file or directory\n"
)
end
end
@@ -661,9 +661,9 @@ EOM
end
it "knife deps reports the role, along with an error" do
knife("deps --remote /roles/starring.json").should_fail(
- :exit_code => 2,
- :stdout => "/roles/minor.json\n/roles/starring.json\n",
- :stderr => "ERROR: /roles/minor.json: No such file or directory\n"
+ exit_code: 2,
+ stdout: "/roles/minor.json\n/roles/starring.json\n",
+ stderr: "ERROR: /roles/minor.json: No such file or directory\n"
)
end
end
diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb
index b3bd23f48e..839dcafe49 100644
--- a/spec/integration/knife/diff_spec.rb
+++ b/spec/integration/knife/diff_spec.rb
@@ -247,7 +247,7 @@ EOM
end
when_the_chef_server "has an environment with a different value" do
before { environment "x", { "description" => "hi" } }
- it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do
knife("diff /environments/x.json").should_succeed(/
{
- "name": "x",
@@ -277,7 +277,7 @@ EOM
environment "x", {}
end
- it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do
knife("diff /environments/x.json").should_succeed(/
{
- "name": "x"
@@ -291,7 +291,7 @@ EOM
before do
environment "x", { "description" => "lo" }
end
- it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do
knife("diff /environments/x.json").should_succeed(/
{
"name": "x",
@@ -311,7 +311,7 @@ EOM
it "knife diff reports an error and does a textual diff" do
error_text = "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF"
error_match = Regexp.new(Regexp.escape(error_text))
- knife("diff /environments/x.json").should_succeed(/- "name": "x"/, :stderr => error_match)
+ knife("diff /environments/x.json").should_succeed(/- "name": "x"/, stderr: error_match)
end
end
end
@@ -533,7 +533,7 @@ EOM
end
when_the_chef_server "has an environment with a different value" do
before { environment "x", { "description" => "hi" } }
- it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do
knife("diff /environments/x.json").should_succeed(/
{
- "name": "x",
@@ -560,7 +560,7 @@ EOM
end
when_the_chef_server "has an environment with no value" do
before { environment "x", {} }
- it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do
knife("diff /environments/x.json").should_succeed(/
{
- "name": "x"
@@ -574,7 +574,7 @@ EOM
before do
environment "x", { "description" => "lo" }
end
- it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ it "knife diff reports the difference", skip: (RUBY_VERSION < "1.9") do
knife("diff /environments/x.json").should_succeed(/
{
"name": "x",
@@ -594,7 +594,7 @@ EOM
it "knife diff reports an error and does a textual diff" do
error_text = "WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF"
error_match = Regexp.new(Regexp.escape(error_text))
- knife("diff /environments/x.json").should_succeed(/- "name": "x"/, :stderr => error_match)
+ knife("diff /environments/x.json").should_succeed(/- "name": "x"/, stderr: error_match)
end
end
end
diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb
index be0fc9d708..68762ec58e 100644
--- a/spec/integration/knife/download_spec.rb
+++ b/spec/integration/knife/download_spec.rb
@@ -255,7 +255,7 @@ EOM
end
it "knife download with no parameters reports an error" do
- knife("download").should_fail "FATAL: You must specify at least one argument. If you want to download everything in this directory, run \"knife download .\"\n", :stdout => /USAGE/
+ knife("download").should_fail "FATAL: You must specify at least one argument. If you want to download everything in this directory, run \"knife download .\"\n", stdout: /USAGE/
end
end
end
@@ -383,7 +383,7 @@ EOM
cwd "data_bags"
end
it "knife download fails" do
- knife("download").should_fail "FATAL: You must specify at least one argument. If you want to download everything in this directory, run \"knife download .\"\n", :stdout => /USAGE/
+ knife("download").should_fail "FATAL: You must specify at least one argument. If you want to download everything in this directory, run \"knife download .\"\n", stdout: /USAGE/
end
it "knife download --purge . downloads everything" do
knife("download --purge .").should_succeed <<EOM
@@ -545,7 +545,7 @@ EOM
end
it "knife download refuses to change the role" do
- knife("download /roles/x.json").should_succeed "", :stderr => "WARNING: /roles/x.rb cannot be updated (can't safely update ruby files).\n"
+ knife("download /roles/x.json").should_succeed "", stderr: "WARNING: /roles/x.rb cannot be updated (can't safely update ruby files).\n"
knife("diff --name-status /roles/x.json").should_succeed "M\t/roles/x.rb\n"
end
end
@@ -566,7 +566,7 @@ WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error
(right here) ------^
EOH
- knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n", :stderr => warning
+ knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n", stderr: warning
knife("diff --name-status /environments/x.json").should_succeed ""
end
end
@@ -779,7 +779,7 @@ EOM
cwd "."
end
it "knife download with no parameters reports an error" do
- knife("download").should_fail "FATAL: You must specify at least one argument. If you want to download everything in this directory, run \"knife download .\"\n", :stdout => /USAGE/
+ knife("download").should_fail "FATAL: You must specify at least one argument. If you want to download everything in this directory, run \"knife download .\"\n", stdout: /USAGE/
end
end
end
@@ -898,7 +898,7 @@ EOM
cwd "data_bags"
end
it "knife download fails" do
- knife("download").should_fail "FATAL: You must specify at least one argument. If you want to download everything in this directory, run \"knife download .\"\n", :stdout => /USAGE/
+ knife("download").should_fail "FATAL: You must specify at least one argument. If you want to download everything in this directory, run \"knife download .\"\n", stdout: /USAGE/
end
it "knife download --purge . downloads everything" do
knife("download --purge .").should_succeed <<EOM
@@ -1111,7 +1111,7 @@ EOM
end
end
- when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
+ when_the_chef_server "is in Enterprise mode", osc_compat: false, single_org: false do
before do
user "foo", {}
user "bar", {}
diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb
index 4aa74f3f0e..bcafd40e9b 100644
--- a/spec/integration/knife/list_spec.rb
+++ b/spec/integration/knife/list_spec.rb
@@ -466,7 +466,7 @@ EOM
end
end
- when_the_repository "has a cookbooks directory and a symlinked cookbooks directory", :skip => (Chef::Platform.windows?) do
+ when_the_repository "has a cookbooks directory and a symlinked cookbooks directory", skip: (Chef::Platform.windows?) do
before do
directory "cookbooks"
symlink "symlinked", "cookbooks"
@@ -503,7 +503,7 @@ EOM
end
end
- when_the_repository "has a real_cookbooks directory and a cookbooks symlink to it", :skip => (Chef::Platform.windows?) do
+ when_the_repository "has a real_cookbooks directory and a cookbooks symlink to it", skip: (Chef::Platform.windows?) do
before do
directory "real_cookbooks"
symlink "cookbooks", "real_cookbooks"
@@ -638,7 +638,7 @@ EOM
end
end
- when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
+ when_the_chef_server "is in Enterprise mode", osc_compat: false, single_org: false do
before do
organization "foo"
end
diff --git a/spec/integration/knife/raw_spec.rb b/spec/integration/knife/raw_spec.rb
index 5e0d3a3d11..27e425717b 100644
--- a/spec/integration/knife/raw_spec.rb
+++ b/spec/integration/knife/raw_spec.rb
@@ -38,7 +38,7 @@ describe "knife raw", :workstation do
user "x", "{}"
end
- it "knife raw /nodes/x returns the node", :skip => (RUBY_VERSION < "1.9") do
+ it "knife raw /nodes/x returns the node", skip: (RUBY_VERSION < "1.9") do
knife("raw /nodes/x").should_succeed <<EOM
{
"name": "x",
@@ -70,7 +70,7 @@ EOM
knife("raw /blarghle").should_fail(/ERROR: Server responded with error 404 "Not Found\s*"/)
end
- it "knife raw -m DELETE /roles/x succeeds", :skip => (RUBY_VERSION < "1.9") do
+ it "knife raw -m DELETE /roles/x succeeds", skip: (RUBY_VERSION < "1.9") do
knife("raw -m DELETE /roles/x").should_succeed <<EOM
{
"name": "x",
@@ -94,7 +94,7 @@ EOM
knife("show /roles/x.json").should_fail "ERROR: /roles/x.json: No such file or directory\n"
end
- it "knife raw -m PUT -i blah.txt /roles/x succeeds", :skip => (RUBY_VERSION < "1.9") do
+ it "knife raw -m PUT -i blah.txt /roles/x succeeds", skip: (RUBY_VERSION < "1.9") do
Tempfile.open("raw_put_input") do |file|
file.write <<EOM
{
@@ -148,7 +148,7 @@ EOM
end
end
- it "knife raw -m POST -i blah.txt /roles succeeds", :skip => (RUBY_VERSION < "1.9") do
+ it "knife raw -m POST -i blah.txt /roles succeeds", skip: (RUBY_VERSION < "1.9") do
Tempfile.open("raw_put_input") do |file|
file.write <<EOM
{
@@ -198,7 +198,7 @@ EOM
@raw_server_thread.kill if @raw_server_thread
end
- it "knife raw /blah returns the prettified json", :skip => (RUBY_VERSION < "1.9") do
+ it "knife raw /blah returns the prettified json", skip: (RUBY_VERSION < "1.9") do
knife("raw /blah").should_succeed <<EOM
{
"x": "y",
diff --git a/spec/integration/knife/show_spec.rb b/spec/integration/knife/show_spec.rb
index ed4802fef9..3d7dfe68e2 100644
--- a/spec/integration/knife/show_spec.rb
+++ b/spec/integration/knife/show_spec.rb
@@ -76,7 +76,7 @@ EOM
}
EOM
end
- it "knife show /environments/x.json shows the remote version", :skip => (RUBY_VERSION < "1.9") do
+ it "knife show /environments/x.json shows the remote version", skip: (RUBY_VERSION < "1.9") do
knife("show /environments/x.json").should_succeed <<EOM
/environments/x.json:
{
@@ -92,7 +92,7 @@ EOM
}
EOM
end
- it "knife show /roles/x.json shows the remote version", :skip => (RUBY_VERSION < "1.9") do
+ it "knife show /roles/x.json shows the remote version", skip: (RUBY_VERSION < "1.9") do
knife("show /roles/x.json").should_succeed <<EOM
/roles/x.json:
{
@@ -135,7 +135,7 @@ EOM
"name" => "x",
}
end
- it "knife show shows the attributes in a predetermined order", :skip => (RUBY_VERSION < "1.9") do
+ it "knife show shows the attributes in a predetermined order", skip: (RUBY_VERSION < "1.9") do
knife("show /environments/x.json").should_succeed <<EOM
/environments/x.json:
{
diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb
index dc713d02b3..f478e6da01 100644
--- a/spec/integration/knife/upload_spec.rb
+++ b/spec/integration/knife/upload_spec.rb
@@ -68,7 +68,7 @@ EOM
end
it "knife upload --purge deletes everything" do
- knife("upload --purge /").should_succeed(<<EOM, :stderr => "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n")
+ knife("upload --purge /").should_succeed(<<EOM, stderr: "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n")
Deleted extra entry /clients/chef-validator.json (purge is on)
Deleted extra entry /clients/chef-webui.json (purge is on)
Deleted extra entry /clients/x.json (purge is on)
@@ -271,7 +271,7 @@ EOM
end
it "knife upload with no parameters reports an error" do
- knife("upload").should_fail "FATAL: You must specify at least one argument. If you want to upload everything in this directory, run \"knife upload .\"\n", :stdout => /USAGE/
+ knife("upload").should_fail "FATAL: You must specify at least one argument. If you want to upload everything in this directory, run \"knife upload .\"\n", stdout: /USAGE/
end
end
end
@@ -291,7 +291,7 @@ Created /data_bags/x/y.json
EOM
knife("diff --name-status /data_bags").should_succeed <<EOM
EOM
- expect(Chef::JSONCompat.parse(knife("raw /data/x/y").stdout, :create_additions => false).keys.sort).to eq(%w{foo id})
+ expect(Chef::JSONCompat.parse(knife("raw /data/x/y").stdout, create_additions: false).keys.sort).to eq(%w{foo id})
end
it "knife upload /data_bags/x /data_bags/x/y.json uploads x once" do
@@ -314,7 +314,7 @@ Created /data_bags/x
Created /data_bags/x/y.json
EOM
knife("diff --name-status /data_bags").should_succeed ""
- result = Chef::JSONCompat.parse(knife("raw /data/x/y").stdout, :create_additions => false)
+ result = Chef::JSONCompat.parse(knife("raw /data/x/y").stdout, create_additions: false)
expect(result.keys.sort).to eq(%w{chef_type data_bag id})
expect(result["chef_type"]).to eq("aaa")
expect(result["data_bag"]).to eq("bbb")
@@ -419,7 +419,7 @@ EOM
end
it "knife upload fails" do
- knife("upload").should_fail "FATAL: You must specify at least one argument. If you want to upload everything in this directory, run \"knife upload .\"\n", :stdout => /USAGE/
+ knife("upload").should_fail "FATAL: You must specify at least one argument. If you want to upload everything in this directory, run \"knife upload .\"\n", stdout: /USAGE/
end
it "knife upload --purge . uploads everything" do
@@ -525,7 +525,7 @@ EOM
when_the_chef_server "has a frozen cookbook" do
before do
- cookbook "frozencook", "1.0.0", {}, :frozen => true
+ cookbook "frozencook", "1.0.0", {}, frozen: true
end
when_the_repository "has an update to said cookbook" do
@@ -652,7 +652,7 @@ WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error
EOH
knife("upload /environments/x.json").should_fail(error1)
- knife("diff --name-status /environments/x.json").should_succeed("M\t/environments/x.json\n", :stderr => warn)
+ knife("diff --name-status /environments/x.json").should_succeed("M\t/environments/x.json\n", stderr: warn)
end
end
@@ -767,7 +767,7 @@ EOM
end
it "knife upload --purge deletes everything" do
- knife("upload --purge /").should_succeed(<<EOM, :stderr => "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n")
+ knife("upload --purge /").should_succeed(<<EOM, stderr: "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n")
Deleted extra entry /clients/chef-validator.json (purge is on)
Deleted extra entry /clients/chef-webui.json (purge is on)
Deleted extra entry /clients/x.json (purge is on)
@@ -922,7 +922,7 @@ EOM
cwd "."
end
it "knife upload with no parameters reports an error" do
- knife("upload").should_fail "FATAL: You must specify at least one argument. If you want to upload everything in this directory, run \"knife upload .\"\n", :stdout => /USAGE/
+ knife("upload").should_fail "FATAL: You must specify at least one argument. If you want to upload everything in this directory, run \"knife upload .\"\n", stdout: /USAGE/
end
end
end
@@ -1024,7 +1024,7 @@ EOM
cwd "data_bags"
end
it "knife upload fails" do
- knife("upload").should_fail "FATAL: You must specify at least one argument. If you want to upload everything in this directory, run \"knife upload .\"\n", :stdout => /USAGE/
+ knife("upload").should_fail "FATAL: You must specify at least one argument. If you want to upload everything in this directory, run \"knife upload .\"\n", stdout: /USAGE/
end
it "knife upload --purge . uploads everything" do
knife("upload --purge .").should_succeed <<EOM
@@ -1274,7 +1274,7 @@ EOM
end
end
- when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
+ when_the_chef_server "is in Enterprise mode", osc_compat: false, single_org: false do
before do
user "foo", {}
user "bar", {}
@@ -1472,7 +1472,7 @@ EOM
end
it "knife upload / emits a warning for bar and invites foobar" do
- knife("upload /").should_succeed "Updated /invitations.json\n", :stderr => "WARN: Could not invite bar to organization foo: User bar is already in organization foo\n"
+ knife("upload /").should_succeed "Updated /invitations.json\n", stderr: "WARN: Could not invite bar to organization foo: User bar is already in organization foo\n"
expect(api.get("association_requests").map { |a| a["username"] }).to eq(%w{foo foobar})
expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar" ])
end
diff --git a/spec/integration/recipes/accumulator_spec.rb b/spec/integration/recipes/accumulator_spec.rb
index 4a193bd7f0..65a05fcdc5 100644
--- a/spec/integration/recipes/accumulator_spec.rb
+++ b/spec/integration/recipes/accumulator_spec.rb
@@ -119,7 +119,7 @@ describe "Accumulators" do
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
result.error!
# runs only a single template resource (in the outer run context, as a delayed resource)
expect(result.stdout.scan(/template\S+ action create/).size).to eql(1)
@@ -221,7 +221,7 @@ describe "Accumulators" do
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
result.error!
# runs only a single template resource (in the outer run context, as a delayed resource)
expect(result.stdout.scan(/template\S+ action create/).size).to eql(1)
diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb
index 54ce94f263..a9832fe6b0 100644
--- a/spec/integration/recipes/lwrp_inline_resources_spec.rb
+++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb
@@ -151,7 +151,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
actual = result.stdout.lines.map { |l| l.chomp }.join("\n")
expected = <<EOM
* x_my_machine[me] action create
diff --git a/spec/integration/recipes/lwrp_spec.rb b/spec/integration/recipes/lwrp_spec.rb
index 3bc008d4f8..3494924a8f 100644
--- a/spec/integration/recipes/lwrp_spec.rb
+++ b/spec/integration/recipes/lwrp_spec.rb
@@ -44,7 +44,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'l-w-r-p::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'l-w-r-p::default'", cwd: chef_dir)
expect(result.stdout).to match(/\* l_w_r_p_foo\[me\] action create \(up to date\)/)
expect(result.stdout).not_to match(/WARN: You are overriding l_w_r_p_foo/)
result.error!
diff --git a/spec/integration/recipes/notifies_spec.rb b/spec/integration/recipes/notifies_spec.rb
index b008e4ade7..2aa02554b9 100644
--- a/spec/integration/recipes/notifies_spec.rb
+++ b/spec/integration/recipes/notifies_spec.rb
@@ -32,7 +32,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
# our delayed notification should run at the end of the parent run_context after the baz resource
expect(result.stdout).to match(/\* apt_update\[\] action nothing \(skipped due to action :nothing\)\s+\* log\[foo\] action write\s+\* log\[bar\] action write\s+\* apt_update\[\] action nothing \(skipped due to action :nothing\)/)
result.error!
@@ -73,7 +73,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
# our delayed notification should run at the end of the parent run_context after the baz resource
expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[baz\] action write\s+\* log\[foo\] action write/)
result.error!
@@ -116,7 +116,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
# our delayed notification should run at the end of the parent run_context after the baz resource
expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[baz\] action write\s+\* log\[foo\] action write/)
# and only run once
@@ -163,7 +163,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
# the delayed notification from the sub-resource is de-duplicated by the notification already in the parent run_context
expect(result.stdout).to match(/\* log\[quux\] action write\s+\* notifying_test\[whatever\] action run\s+\* log\[bar\] action write\s+\* log\[baz\] action write\s+\* log\[foo\] action write\s+\* log\[baz\] action write/)
# and only run once
@@ -197,7 +197,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
# the delayed notification from the sub-resource is de-duplicated by the notification already in the parent run_context
expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[baz\] action write\s+\* log\[foo\] action write/)
# and only run once
@@ -240,7 +240,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[foo\] action write\s+\* log\[baz\] action write/)
result.error!
end
@@ -280,7 +280,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[foo\] action write\s+\* log\[baz\] action write/)
result.error!
end
@@ -317,7 +317,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
expect(result.stdout).to match(/Chef::Exceptions::ResourceNotFound/)
expect(result.exitstatus).not_to eql(0)
end
@@ -357,7 +357,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
expect(result.stdout).not_to match(/CHEF-3694/)
result.error!
end
@@ -385,7 +385,7 @@ cookbook_path "#{path_to('cookbooks')}"
log_level :warn
EOM
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
expect(result.stdout).to match /\* log\[a, b\] action write/
result.error!
end
diff --git a/spec/integration/recipes/notifying_block_spec.rb b/spec/integration/recipes/notifying_block_spec.rb
index 6a1287c7b1..6c50854038 100644
--- a/spec/integration/recipes/notifying_block_spec.rb
+++ b/spec/integration/recipes/notifying_block_spec.rb
@@ -55,7 +55,7 @@ describe "notifying_block" do
# 2. delayed notifications are de-dup'd in the subcontext
# 3. delayed notifications (to resources inside the subcontext) are run at the end of the subcontext
it "should run alpha, beta, gamma, and delta in that order" do
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
expect(result.stdout).to match(/\* log\[alpha\] action write\s+\* log\[beta\] action write\s+\* log\[gamma\] action write\s+Converging 1 resources\s+\* log\[delta\] action write/)
result.error!
end
@@ -103,7 +103,7 @@ describe "notifying_block" do
# 1. notifying block will correctly update wrapping new_resource updated_by_last_action status
# 2. delayed notifications from a subcontext inside a resource will notify resources in their outer run_context
it "should run foo, quux, bar, and baz in that order" do
- result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", :cwd => chef_dir)
+ result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir)
expect(result.stdout).to match(/\* log\[foo\] action write\s+\* log\[quux\] action write\s+\* log\[bar\] action write\s+\* log\[baz\] action write/)
result.error!
end
diff --git a/spec/integration/recipes/remote_directory.rb b/spec/integration/recipes/remote_directory.rb
index 77fe183136..a0e3e23ef3 100644
--- a/spec/integration/recipes/remote_directory.rb
+++ b/spec/integration/recipes/remote_directory.rb
@@ -50,7 +50,7 @@ describe Chef::Resource::RemoteDirectory do
end
EOM
end
- shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'test::default'", :cwd => chef_dir)
+ shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'test::default'", cwd: chef_dir)
end
def mode_of(path)
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb
index 63525f0081..36fabd232d 100644
--- a/spec/integration/solo/solo_spec.rb
+++ b/spec/integration/solo/solo_spec.rb
@@ -26,7 +26,7 @@ describe "chef-solo" do
file "config/solo.rb", <<EOM
chef_repo_path "#{@repository_dir}"
EOM
- result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -l debug", :cwd => chef_dir)
+ result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -l debug", cwd: chef_dir)
result.error!
end
@@ -78,7 +78,7 @@ EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
- result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
+ result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir)
result.error!
expect(result.stdout).to include("ITWORKS")
end
@@ -93,7 +93,7 @@ EOM
{"run_list":["x::default"]}
E
- result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -j '#{path_to('config/node.json')}' -l debug", :cwd => chef_dir)
+ result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -j '#{path_to('config/node.json')}' -l debug", cwd: chef_dir)
result.error!
expect(result.stdout).to include("ITWORKS")
end
@@ -114,7 +114,7 @@ E
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
- result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
+ result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir)
expect(result.exitstatus).to eq(0) # For CHEF-5120 this becomes 1
expect(result.stdout).to include("WARN: MissingCookbookDependency")
end
@@ -131,7 +131,7 @@ EOM
end
it "should exit with an error" do
- result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
+ result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir)
expect(result.exitstatus).to eq(1)
expect(result.stdout).to include("Chef::Exceptions::CookbookChefVersionMismatch")
end
@@ -148,7 +148,7 @@ EOM
end
it "should exit with an error" do
- result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", :cwd => chef_dir)
+ result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir)
expect(result.exitstatus).to eq(1)
expect(result.stdout).to include("Chef::Exceptions::CookbookOhaiVersionMismatch")
end
@@ -187,13 +187,13 @@ EOM
# Instantiate the first chef-solo run
threads << Thread.new do
- s1 = Process.spawn("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug -L #{path_to('logs/runs.log')}", :chdir => chef_dir)
+ s1 = Process.spawn("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug -L #{path_to('logs/runs.log')}", chdir: chef_dir)
Process.waitpid(s1)
end
# Instantiate the second chef-solo run
threads << Thread.new do
- s2 = Process.spawn("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug -L #{path_to('logs/runs.log')}", :chdir => chef_dir)
+ s2 = Process.spawn("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug -L #{path_to('logs/runs.log')}", chdir: chef_dir)
Process.waitpid(s2)
end
diff --git a/spec/scripts/ssl-serve.rb b/spec/scripts/ssl-serve.rb
index 3f4e343926..5677e94d0a 100644
--- a/spec/scripts/ssl-serve.rb
+++ b/spec/scripts/ssl-serve.rb
@@ -20,26 +20,26 @@ key = OpenSSL::PKey::RSA.new(key_text)
server_opts = {}
if $ssl
- server_opts.merge!( { :SSLEnable => true,
- :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
- :SSLCertificate => cert,
- :SSLPrivateKey => key })
+ server_opts.merge!( { SSLEnable: true,
+ SSLVerifyClient: OpenSSL::SSL::VERIFY_NONE,
+ SSLCertificate: cert,
+ SSLPrivateKey: key })
end
# 5 == debug, 3 == warning
LOGGER = WEBrick::Log.new(STDOUT, 5)
DEFAULT_OPTIONS = {
- :server => "webrick",
- :Port => 9000,
- :Host => "localhost",
- :environment => :none,
- :Logger => LOGGER,
- :DocumentRoot => File.expand_path("#{Dir.tmpdir}/chef-118-sampledata")
+ server: "webrick",
+ Port: 9000,
+ Host: "localhost",
+ environment: :none,
+ Logger: LOGGER,
+ DocumentRoot: File.expand_path("#{Dir.tmpdir}/chef-118-sampledata")
#:AccessLog => [] # Remove this option to enable the access log when debugging.
}
webrick_opts = DEFAULT_OPTIONS.merge(server_opts)
-pp :webrick_opts => webrick_opts
+pp webrick_opts: webrick_opts
server = WEBrick::HTTPServer.new(webrick_opts)
trap("INT") { server.shutdown }
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index b4d337eecd..c9ba059ddb 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -119,8 +119,8 @@ resource_handler_map ||= nil
RSpec.configure do |config|
config.include(Matchers)
config.include(MockShellout::RSpec)
- config.filter_run :focus => true
- config.filter_run_excluding :external => true
+ config.filter_run focus: true
+ config.filter_run_excluding external: true
# Explicitly disable :should syntax
config.expect_with :rspec do |c|
@@ -134,83 +134,83 @@ RSpec.configure do |config|
config.filter_run_excluding :workstation if solaris? || aix?
# Tests that randomly fail, but may have value.
- config.filter_run_excluding :volatile => true
- config.filter_run_excluding :volatile_on_solaris => true if solaris?
- config.filter_run_excluding :volatile_from_verify => false
-
- config.filter_run_excluding :skip_appveyor => true if ENV["APPVEYOR"]
- config.filter_run_excluding :appveyor_only => true unless ENV["APPVEYOR"]
- config.filter_run_excluding :skip_travis => true if ENV["TRAVIS"]
-
- config.filter_run_excluding :windows_only => true unless windows?
- config.filter_run_excluding :not_supported_on_mac_osx_106 => true if mac_osx_106?
- config.filter_run_excluding :not_supported_on_mac_osx => true if mac_osx?
- config.filter_run_excluding :mac_osx_only => true if !mac_osx?
- config.filter_run_excluding :not_supported_on_aix => true if aix?
- config.filter_run_excluding :not_supported_on_solaris => true if solaris?
- config.filter_run_excluding :not_supported_on_gce => true if gce?
- config.filter_run_excluding :not_supported_on_nano => true if windows_nano_server?
- config.filter_run_excluding :win2012r2_only => true unless windows_2012r2?
- config.filter_run_excluding :windows_2008r2_or_later => true unless windows_2008r2_or_later?
- config.filter_run_excluding :windows64_only => true unless windows64?
- config.filter_run_excluding :windows32_only => true unless windows32?
- config.filter_run_excluding :windows_nano_only => true unless windows_nano_server?
- config.filter_run_excluding :windows_gte_10 => true unless windows_gte_10?
- config.filter_run_excluding :windows_lt_10 => true if windows_gte_10?
- config.filter_run_excluding :ruby64_only => true unless ruby_64bit?
- config.filter_run_excluding :ruby32_only => true unless ruby_32bit?
- config.filter_run_excluding :windows_powershell_dsc_only => true unless windows_powershell_dsc?
- config.filter_run_excluding :windows_powershell_no_dsc_only => true unless ! windows_powershell_dsc?
- config.filter_run_excluding :windows_domain_joined_only => true unless windows_domain_joined?
- config.filter_run_excluding :windows_not_domain_joined_only => true if windows_domain_joined?
+ config.filter_run_excluding volatile: true
+ config.filter_run_excluding volatile_on_solaris: true if solaris?
+ config.filter_run_excluding volatile_from_verify: false
+
+ config.filter_run_excluding skip_appveyor: true if ENV["APPVEYOR"]
+ config.filter_run_excluding appveyor_only: true unless ENV["APPVEYOR"]
+ config.filter_run_excluding skip_travis: true if ENV["TRAVIS"]
+
+ config.filter_run_excluding windows_only: true unless windows?
+ config.filter_run_excluding not_supported_on_mac_osx_106: true if mac_osx_106?
+ config.filter_run_excluding not_supported_on_mac_osx: true if mac_osx?
+ config.filter_run_excluding mac_osx_only: true if !mac_osx?
+ config.filter_run_excluding not_supported_on_aix: true if aix?
+ config.filter_run_excluding not_supported_on_solaris: true if solaris?
+ config.filter_run_excluding not_supported_on_gce: true if gce?
+ config.filter_run_excluding not_supported_on_nano: true if windows_nano_server?
+ config.filter_run_excluding win2012r2_only: true unless windows_2012r2?
+ config.filter_run_excluding windows_2008r2_or_later: true unless windows_2008r2_or_later?
+ config.filter_run_excluding windows64_only: true unless windows64?
+ config.filter_run_excluding windows32_only: true unless windows32?
+ config.filter_run_excluding windows_nano_only: true unless windows_nano_server?
+ config.filter_run_excluding windows_gte_10: true unless windows_gte_10?
+ config.filter_run_excluding windows_lt_10: true if windows_gte_10?
+ config.filter_run_excluding ruby64_only: true unless ruby_64bit?
+ config.filter_run_excluding ruby32_only: true unless ruby_32bit?
+ config.filter_run_excluding windows_powershell_dsc_only: true unless windows_powershell_dsc?
+ config.filter_run_excluding windows_powershell_no_dsc_only: true unless ! windows_powershell_dsc?
+ config.filter_run_excluding windows_domain_joined_only: true unless windows_domain_joined?
+ config.filter_run_excluding windows_not_domain_joined_only: true if windows_domain_joined?
# We think this line was causing rspec tests to not run on the Jenkins windows
# testers. If we ever fix it we should restore it.
# config.filter_run_excluding :windows_service_requires_assign_token => true if !STDOUT.isatty && !windows_user_right?("SeAssignPrimaryTokenPrivilege")
- config.filter_run_excluding :windows_service_requires_assign_token => true
- config.filter_run_excluding :solaris_only => true unless solaris?
- config.filter_run_excluding :system_windows_service_gem_only => true unless system_windows_service_gem?
- config.filter_run_excluding :unix_only => true unless unix?
- config.filter_run_excluding :linux_only => true unless linux?
- config.filter_run_excluding :aix_only => true unless aix?
- config.filter_run_excluding :debian_family_only => true unless debian_family?
- config.filter_run_excluding :supports_cloexec => true unless supports_cloexec?
- config.filter_run_excluding :selinux_only => true unless selinux_enabled?
- config.filter_run_excluding :requires_root => true unless root?
- config.filter_run_excluding :requires_root_or_running_windows => true unless root? || windows?
- config.filter_run_excluding :requires_unprivileged_user => true if root?
- config.filter_run_excluding :uses_diff => true unless has_diff?
- config.filter_run_excluding :openssl_gte_101 => true unless openssl_gte_101?
- config.filter_run_excluding :openssl_lt_101 => true unless openssl_lt_101?
- config.filter_run_excluding :aes_256_gcm_only => true unless aes_256_gcm?
- config.filter_run_excluding :broken => true
- config.filter_run_excluding :not_wpar => true unless wpar?
- config.filter_run_excluding :not_supported_under_fips => true if fips?
- config.filter_run_excluding :rhel => true unless rhel?
- config.filter_run_excluding :rhel5 => true unless rhel5?
- config.filter_run_excluding :rhel6 => true unless rhel6?
- config.filter_run_excluding :rhel7 => true unless rhel7?
- config.filter_run_excluding :intel_64bit => true unless intel_64bit?
- config.filter_run_excluding :not_rhel => true if rhel?
- config.filter_run_excluding :not_rhel5 => true if rhel5?
- config.filter_run_excluding :not_rhel6 => true if rhel6?
- config.filter_run_excluding :not_rhel7 => true if rhel7?
- config.filter_run_excluding :not_intel_64bit => true if intel_64bit?
+ config.filter_run_excluding windows_service_requires_assign_token: true
+ config.filter_run_excluding solaris_only: true unless solaris?
+ config.filter_run_excluding system_windows_service_gem_only: true unless system_windows_service_gem?
+ config.filter_run_excluding unix_only: true unless unix?
+ config.filter_run_excluding linux_only: true unless linux?
+ config.filter_run_excluding aix_only: true unless aix?
+ config.filter_run_excluding debian_family_only: true unless debian_family?
+ config.filter_run_excluding supports_cloexec: true unless supports_cloexec?
+ config.filter_run_excluding selinux_only: true unless selinux_enabled?
+ config.filter_run_excluding requires_root: true unless root?
+ config.filter_run_excluding requires_root_or_running_windows: true unless root? || windows?
+ config.filter_run_excluding requires_unprivileged_user: true if root?
+ config.filter_run_excluding uses_diff: true unless has_diff?
+ config.filter_run_excluding openssl_gte_101: true unless openssl_gte_101?
+ config.filter_run_excluding openssl_lt_101: true unless openssl_lt_101?
+ config.filter_run_excluding aes_256_gcm_only: true unless aes_256_gcm?
+ config.filter_run_excluding broken: true
+ config.filter_run_excluding not_wpar: true unless wpar?
+ config.filter_run_excluding not_supported_under_fips: true if fips?
+ config.filter_run_excluding rhel: true unless rhel?
+ config.filter_run_excluding rhel5: true unless rhel5?
+ config.filter_run_excluding rhel6: true unless rhel6?
+ config.filter_run_excluding rhel7: true unless rhel7?
+ config.filter_run_excluding intel_64bit: true unless intel_64bit?
+ config.filter_run_excluding not_rhel: true if rhel?
+ config.filter_run_excluding not_rhel5: true if rhel5?
+ config.filter_run_excluding not_rhel6: true if rhel6?
+ config.filter_run_excluding not_rhel7: true if rhel7?
+ config.filter_run_excluding not_intel_64bit: true if intel_64bit?
# these let us use chef: ">= 13" or ruby: "~> 2.0.0" or any other Gem::Dependency-style constraint
config.filter_run_excluding chef: DependencyProc.with(Chef::VERSION)
config.filter_run_excluding ruby: DependencyProc.with(RUBY_VERSION)
- config.filter_run_excluding :choco_installed => true unless choco_installed?
+ config.filter_run_excluding choco_installed: true unless choco_installed?
running_platform_arch = `uname -m`.strip unless windows?
- config.filter_run_excluding :arch => lambda { |target_arch|
+ config.filter_run_excluding arch: lambda { |target_arch|
running_platform_arch != target_arch
}
# Functional Resource tests that are provider-specific:
# context "on platforms that use useradd", :provider => {:user => Chef::Provider::User::Useradd}} do #...
- config.filter_run_excluding :provider => lambda { |criteria|
+ config.filter_run_excluding provider: lambda { |criteria|
type, target_provider = criteria.first
node = TEST_NODE.dup
diff --git a/spec/stress/win32/file_spec.rb b/spec/stress/win32/file_spec.rb
index f1c81eb9c6..49dd8694f5 100644
--- a/spec/stress/win32/file_spec.rb
+++ b/spec/stress/win32/file_spec.rb
@@ -26,12 +26,12 @@ describe "Chef::ReservedNames::Win32::File", :windows_only do
it "should not leak significant memory", :volatile do
test = lambda { Chef::ReservedNames::Win32::File.symlink?(@path) }
- expect(test).not_to leak_memory(:warmup => 50000, :iterations => 50000)
+ expect(test).not_to leak_memory(warmup: 50000, iterations: 50000)
end
it "should not leak handles", :volatile do
test = lambda { Chef::ReservedNames::Win32::File.symlink?(@path) }
- expect(test).not_to leak_handles(:warmup => 50, :iterations => 100)
+ expect(test).not_to leak_handles(warmup: 50, iterations: 100)
end
end
diff --git a/spec/stress/win32/security_spec.rb b/spec/stress/win32/security_spec.rb
index 3c03a657b2..0280398ad5 100644
--- a/spec/stress/win32/security_spec.rb
+++ b/spec/stress/win32/security_spec.rb
@@ -52,7 +52,7 @@ describe "Chef::ReservedNames::Win32::Security", :windows_only do
expect do
sids = Chef::ReservedNames::Win32::Security::SecurableObject.new(@monkeyfoo).security_descriptor.dacl.select { |ace| ace.sid }
GC.start
- end.not_to leak_memory(:warmup => 50, :iterations => 100)
+ end.not_to leak_memory(warmup: 50, iterations: 100)
end
it "should not leak when creating a new ACL and setting it on a file", :volatile do
@@ -63,7 +63,7 @@ describe "Chef::ReservedNames::Win32::Security", :windows_only do
Chef::ReservedNames::Win32::Security::ACE.access_denied(Chef::ReservedNames::Win32::Security::SID.from_account("Users"), Chef::ReservedNames::Win32::API::Security::GENERIC_ALL),
])
GC.start
- end.not_to leak_memory(:warmup => 50, :iterations => 100)
+ end.not_to leak_memory(warmup: 50, iterations: 100)
end
end
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index 8569523e05..6ae052ba1d 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -202,7 +202,7 @@ def selinux_enabled?
# specs independent of product.
selinuxenabled_path = which("selinuxenabled")
if selinuxenabled_path
- cmd = Mixlib::ShellOut.new(selinuxenabled_path, :returns => [0, 1])
+ cmd = Mixlib::ShellOut.new(selinuxenabled_path, returns: [0, 1])
cmd_result = cmd.run_command
case cmd_result.exitstatus
when 1
diff --git a/spec/support/shared/context/client.rb b/spec/support/shared/context/client.rb
index 4b90fcaedd..6797a4ad22 100644
--- a/spec/support/shared/context/client.rb
+++ b/spec/support/shared/context/client.rb
@@ -11,16 +11,16 @@ shared_context "client" do
let(:ohai_data) do
{
- :fqdn => fqdn,
- :hostname => hostname,
- :machinename => machinename,
- :platform => platform,
- :platform_version => platform_version,
+ fqdn: fqdn,
+ hostname: hostname,
+ machinename: machinename,
+ platform: platform,
+ platform_version: platform_version,
}
end
let(:ohai_system) do
- ohai = instance_double("Ohai::System", :all_plugins => true, :data => ohai_data, logger: logger)
+ ohai = instance_double("Ohai::System", all_plugins: true, data: ohai_data, logger: logger)
allow(ohai).to receive(:[]) do |k|
ohai_data[k]
end
@@ -80,7 +80,7 @@ shared_context "a client run" do
let(:reporting_rest_client) { double("Chef::ServerAPI (reporting client)") }
let(:runner) { instance_double("Chef::Runner") }
- let(:audit_runner) { instance_double("Chef::Audit::Runner", :failed? => false) }
+ let(:audit_runner) { instance_double("Chef::Audit::Runner", failed?: false) }
def stub_for_register
# --Client.register
@@ -136,7 +136,7 @@ shared_context "a client run" do
expect_any_instance_of(Chef::CookbookSynchronizer).to receive(:sync_cookbooks)
expect(Chef::ServerAPI).to receive(:new).with(Chef::Config[:chef_server_url], version_class: Chef::CookbookManifestVersions).and_return(http_cookbook_sync)
expect(http_cookbook_sync).to receive(:post).
- with("environments/_default/cookbook_versions", { :run_list => [] }).
+ with("environments/_default/cookbook_versions", { run_list: [] }).
and_return({})
end
@@ -250,8 +250,8 @@ end
shared_context "audit phase completed with failed controls" do
let(:audit_runner) do
- instance_double("Chef::Audit::Runner", :failed? => true,
- :num_failed => 1, :num_total => 3) end
+ instance_double("Chef::Audit::Runner", failed?: true,
+ num_failed: 1, num_total: 3) end
let(:audit_error) do
err = Chef::Exceptions::AuditsFailed.new(audit_runner.num_failed, audit_runner.num_total)
diff --git a/spec/support/shared/functional/securable_resource.rb b/spec/support/shared/functional/securable_resource.rb
index 65f512b5bf..0df006cccc 100644
--- a/spec/support/shared/functional/securable_resource.rb
+++ b/spec/support/shared/functional/securable_resource.rb
@@ -95,7 +95,7 @@ shared_context "use Windows permissions", :windows_only do
def extract_ace_properties(aces)
hashes = []
aces.each do |ace|
- hashes << { :mask => ace.mask, :type => ace.type, :flags => ace.flags }
+ hashes << { mask: ace.mask, type: ace.type, flags: ace.flags }
end
hashes
end
@@ -103,36 +103,36 @@ shared_context "use Windows permissions", :windows_only do
# Standard expected rights
let(:expected_read_perms) do
{
- :generic => Chef::ReservedNames::Win32::API::Security::GENERIC_READ,
- :specific => Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_READ,
+ generic: Chef::ReservedNames::Win32::API::Security::GENERIC_READ,
+ specific: Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_READ,
}
end
let(:expected_read_execute_perms) do
{
- :generic => Chef::ReservedNames::Win32::API::Security::GENERIC_READ | Chef::ReservedNames::Win32::API::Security::GENERIC_EXECUTE,
- :specific => Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_READ | Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_EXECUTE,
+ generic: Chef::ReservedNames::Win32::API::Security::GENERIC_READ | Chef::ReservedNames::Win32::API::Security::GENERIC_EXECUTE,
+ specific: Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_READ | Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_EXECUTE,
}
end
let(:expected_write_perms) do
{
- :generic => Chef::ReservedNames::Win32::API::Security::GENERIC_WRITE,
- :specific => Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_WRITE,
+ generic: Chef::ReservedNames::Win32::API::Security::GENERIC_WRITE,
+ specific: Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_WRITE,
}
end
let(:expected_modify_perms) do
{
- :generic => Chef::ReservedNames::Win32::API::Security::GENERIC_READ | Chef::ReservedNames::Win32::API::Security::GENERIC_WRITE | Chef::ReservedNames::Win32::API::Security::GENERIC_EXECUTE | Chef::ReservedNames::Win32::API::Security::DELETE,
- :specific => Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_READ | Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_WRITE | Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_EXECUTE | Chef::ReservedNames::Win32::API::Security::DELETE,
+ generic: Chef::ReservedNames::Win32::API::Security::GENERIC_READ | Chef::ReservedNames::Win32::API::Security::GENERIC_WRITE | Chef::ReservedNames::Win32::API::Security::GENERIC_EXECUTE | Chef::ReservedNames::Win32::API::Security::DELETE,
+ specific: Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_READ | Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_WRITE | Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_EXECUTE | Chef::ReservedNames::Win32::API::Security::DELETE,
}
end
let(:expected_full_control_perms) do
{
- :generic => Chef::ReservedNames::Win32::API::Security::GENERIC_ALL,
- :specific => Chef::ReservedNames::Win32::API::Security::FILE_ALL_ACCESS,
+ generic: Chef::ReservedNames::Win32::API::Security::GENERIC_ALL,
+ specific: Chef::ReservedNames::Win32::API::Security::FILE_ALL_ACCESS,
}
end
diff --git a/spec/support/shared/functional/securable_resource_with_reporting.rb b/spec/support/shared/functional/securable_resource_with_reporting.rb
index 0bec29783a..cd2b83fda1 100644
--- a/spec/support/shared/functional/securable_resource_with_reporting.rb
+++ b/spec/support/shared/functional/securable_resource_with_reporting.rb
@@ -36,7 +36,7 @@ shared_examples_for "a securable resource with reporting" do
# umask
# let(:default_mode) { (0666 & ~File.umask).to_s(8) }
- describe "reading file security metadata for reporting on unix", :unix_only => true do
+ describe "reading file security metadata for reporting on unix", unix_only: true do
# According to POSIX standard created files get either the
# effective gid of the process or inherits the gid of the parent
# directory based on file system. Since it's hard to guess what
@@ -70,7 +70,7 @@ shared_examples_for "a securable resource with reporting" do
end
end
- context "and owner is specified with a String (username) in new_resource", :requires_root => true do
+ context "and owner is specified with a String (username) in new_resource", requires_root: true do
# TODO/bug: duplicated from the "securable resource" tests
@@ -91,7 +91,7 @@ shared_examples_for "a securable resource with reporting" do
end
- context "and owner is specified with an Integer (uid) in new_resource", :requires_root => true do
+ context "and owner is specified with an Integer (uid) in new_resource", requires_root: true do
# TODO: duplicated from "securable resource"
if ohai[:platform] == "aix"
@@ -113,7 +113,7 @@ shared_examples_for "a securable resource with reporting" do
end
end
- context "and group is specified with a String (group name)", :requires_root => true do
+ context "and group is specified with a String (group name)", requires_root: true do
let(:expected_group_name) { Etc.getgrent.name }
@@ -128,7 +128,7 @@ shared_examples_for "a securable resource with reporting" do
end
- context "and group is specified with an Integer (gid)", :requires_root => true do
+ context "and group is specified with an Integer (gid)", requires_root: true do
let(:expected_gid) { Etc.getgrent.gid }
before do
diff --git a/spec/support/shared/functional/win32_service.rb b/spec/support/shared/functional/win32_service.rb
index 3199caa34f..a528db4a53 100644
--- a/spec/support/shared/functional/win32_service.rb
+++ b/spec/support/shared/functional/win32_service.rb
@@ -39,11 +39,11 @@ shared_context "using Win32::Service" do
let(:test_service) do
{
- :service_name => "spec-service",
- :service_display_name => "Spec Test Service",
- :service_description => "Service for testing Chef::Application::WindowsServiceManager.",
- :service_file_path => File.expand_path(File.join(File.dirname(__FILE__), "../../platforms/win32/spec_service.rb")),
- :delayed_start => true,
+ service_name: "spec-service",
+ service_display_name: "Spec Test Service",
+ service_description: "Service for testing Chef::Application::WindowsServiceManager.",
+ service_file_path: File.expand_path(File.join(File.dirname(__FILE__), "../../platforms/win32/spec_service.rb")),
+ delayed_start: true,
}
end
diff --git a/spec/support/shared/functional/windows_script.rb b/spec/support/shared/functional/windows_script.rb
index e5ac0741bd..5eb68952d7 100644
--- a/spec/support/shared/functional/windows_script.rb
+++ b/spec/support/shared/functional/windows_script.rb
@@ -93,7 +93,7 @@ shared_context Chef::Resource::WindowsScript do
context "when the guard's architecture is specified as 64-bit" do
let (:guard_architecture) { :x86_64 }
it "executes a 64-bit guard", :windows64_only do
- resource.only_if resource_guard_command, :architecture => guard_architecture
+ resource.only_if resource_guard_command, architecture: guard_architecture
resource.run_action(:run)
expect(get_guard_process_architecture).to eq("amd64")
end
@@ -102,7 +102,7 @@ shared_context Chef::Resource::WindowsScript do
context "when the guard's architecture is specified as 32-bit", :not_supported_on_nano do
let (:guard_architecture) { :i386 }
it "executes a 32-bit guard" do
- resource.only_if resource_guard_command, :architecture => guard_architecture
+ resource.only_if resource_guard_command, architecture: guard_architecture
resource.run_action(:run)
expect(get_guard_process_architecture).to eq("x86")
end
@@ -111,7 +111,7 @@ shared_context Chef::Resource::WindowsScript do
context "when the guard's architecture is specified as 32-bit", :windows_nano_only do
let (:guard_architecture) { :i386 }
it "raises an error" do
- resource.only_if resource_guard_command, :architecture => guard_architecture
+ resource.only_if resource_guard_command, architecture: guard_architecture
expect { resource.run_action(:run) }.to raise_error(
Chef::Exceptions::Win32ArchitectureIncorrect,
/cannot execute script with requested architecture 'i386' on Windows Nano Server/)
diff --git a/spec/support/shared/integration/app_server_support.rb b/spec/support/shared/integration/app_server_support.rb
index e2bb3812ea..c0b24d9443 100644
--- a/spec/support/shared/integration/app_server_support.rb
+++ b/spec/support/shared/integration/app_server_support.rb
@@ -25,9 +25,9 @@ module AppServerSupport
server = nil
thread = Thread.new do
Rack::Handler::WEBrick.run(app,
- :Port => 9018,
- :AccessLog => [],
- :Logger => WEBrick::Log.new(StringIO.new, 7)
+ Port: 9018,
+ AccessLog: [],
+ Logger: WEBrick::Log.new(StringIO.new, 7)
) do |found_server|
server = found_server
end
diff --git a/spec/support/shared/integration/integration_helper.rb b/spec/support/shared/integration/integration_helper.rb
index 29f2eef50f..5fc9de4de7 100644
--- a/spec/support/shared/integration/integration_helper.rb
+++ b/spec/support/shared/integration/integration_helper.rb
@@ -140,12 +140,12 @@ module IntegrationSupport
# Versioned cookbooks
- RSpec.shared_context "with versioned cookbooks", :versioned_cookbooks => true do
+ RSpec.shared_context "with versioned cookbooks", versioned_cookbooks: true do
before(:each) { Chef::Config[:versioned_cookbooks] = true }
after(:each) { Chef::Config.delete(:versioned_cookbooks) }
end
- RSpec.shared_context "without versioned cookbooks", :versioned_cookbooks => false do
+ RSpec.shared_context "without versioned cookbooks", versioned_cookbooks: false do
# Just make sure this goes back to default
before(:each) { Chef::Config[:versioned_cookbooks] = false }
after(:each) { Chef::Config.delete(:versioned_cookbooks) }
diff --git a/spec/support/shared/integration/knife_support.rb b/spec/support/shared/integration/knife_support.rb
index 86764cad66..5058b7b278 100644
--- a/spec/support/shared/integration/knife_support.rb
+++ b/spec/support/shared/integration/knife_support.rb
@@ -40,8 +40,8 @@ module KnifeSupport
# Work on machines where we can't access /var
Dir.mktmpdir("checksums") do |checksums_cache_dir|
Chef::Config[:cache_options] = {
- :path => checksums_cache_dir,
- :skip_expires => true,
+ path: checksums_cache_dir,
+ skip_expires: true,
}
# This is Chef::Knife.run without load_commands--we'll load stuff
diff --git a/spec/support/shared/unit/api_error_inspector.rb b/spec/support/shared/unit/api_error_inspector.rb
index 45bfcc67da..06f2e4bb57 100644
--- a/spec/support/shared/unit/api_error_inspector.rb
+++ b/spec/support/shared/unit/api_error_inspector.rb
@@ -28,11 +28,11 @@ shared_examples_for "an api error inspector" do
before do
@node_name = "test-node.example.com"
@config = {
- :validation_client_name => "testorg-validator",
- :validation_key => "/etc/chef/testorg-validator.pem",
- :chef_server_url => "https://chef-api.example.com",
- :node_name => "testnode-name",
- :client_key => "/etc/chef/client.pem",
+ validation_client_name: "testorg-validator",
+ validation_key: "/etc/chef/testorg-validator.pem",
+ chef_server_url: "https://chef-api.example.com",
+ node_name: "testnode-name",
+ client_key: "/etc/chef/client.pem",
}
@description = Chef::Formatters::ErrorDescription.new("Error registering the node:")
@outputter = Chef::Formatters::IndentableOutputStream.new(StringIO.new, STDERR)
diff --git a/spec/support/shared/unit/api_versioning.rb b/spec/support/shared/unit/api_versioning.rb
index 28141b73b1..9c179efa82 100644
--- a/spec/support/shared/unit/api_versioning.rb
+++ b/spec/support/shared/unit/api_versioning.rb
@@ -19,7 +19,7 @@
require "chef/exceptions"
shared_examples_for "version handling" do
- let(:response_406) { OpenStruct.new(:code => "406") }
+ let(:response_406) { OpenStruct.new(code: "406") }
let(:exception_406) { Net::HTTPServerException.new("406 Not Acceptable", response_406) }
before do
@@ -38,7 +38,7 @@ shared_examples_for "version handling" do
end # version handling
shared_examples_for "user and client reregister" do
- let(:response_406) { OpenStruct.new(:code => "406") }
+ let(:response_406) { OpenStruct.new(code: "406") }
let(:exception_406) { Net::HTTPServerException.new("406 Not Acceptable", response_406) }
let(:generic_exception) { Exception.new }
let(:min_version) { "2" }
diff --git a/spec/support/shared/unit/execute_resource.rb b/spec/support/shared/unit/execute_resource.rb
index c97577107e..05c2fc4a9a 100644
--- a/spec/support/shared/unit/execute_resource.rb
+++ b/spec/support/shared/unit/execute_resource.rb
@@ -57,7 +57,7 @@ shared_examples_for "an execute resource" do
end
it "should accept a hash for the environment" do
- test_hash = { :one => :two }
+ test_hash = { one: :two }
@resource.environment(test_hash)
expect(@resource.environment).to eql(test_hash)
end
@@ -155,7 +155,7 @@ shared_examples_for "an execute resource" do
before do
@resource.command("grep")
@resource.cwd("/tmp/")
- @resource.environment({ :one => :two })
+ @resource.environment({ one: :two })
@resource.group("legos")
@resource.returns(1)
@resource.user("root")
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb
index d508e76b24..a7c7af92f6 100644
--- a/spec/support/shared/unit/provider/file.rb
+++ b/spec/support/shared/unit/provider/file.rb
@@ -258,11 +258,11 @@ shared_examples_for Chef::Provider::File do
allow(ChefConfig).to receive(:windows?).and_return(false)
# mock up the filesystem to behave like unix
setup_normal_file
- stat_struct = double("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
+ stat_struct = double("::File.stat", mode: 0600, uid: 0, gid: 0, mtime: 10000)
resource_real_path = File.realpath(resource.path)
expect(File).to receive(:stat).with(resource_real_path).at_least(:once).and_return(stat_struct)
- allow(Etc).to receive(:getgrgid).with(0).and_return(double("Group Ent", :name => "wheel"))
- allow(Etc).to receive(:getpwuid).with(0).and_return(double("User Ent", :name => "root"))
+ allow(Etc).to receive(:getgrgid).with(0).and_return(double("Group Ent", name: "wheel"))
+ allow(Etc).to receive(:getpwuid).with(0).and_return(double("User Ent", name: "root"))
end
context "when the new_resource does not specify any state" do
@@ -383,11 +383,11 @@ shared_examples_for Chef::Provider::File do
allow(ChefConfig).to receive(:windows?).and_return(false)
# mock up the filesystem to behave like unix
setup_normal_file
- stat_struct = double("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
+ stat_struct = double("::File.stat", mode: 0600, uid: 0, gid: 0, mtime: 10000)
resource_real_path = File.realpath(resource.path)
allow(File).to receive(:stat).with(resource_real_path).and_return(stat_struct)
- allow(Etc).to receive(:getgrgid).with(0).and_return(double("Group Ent", :name => "wheel"))
- allow(Etc).to receive(:getpwuid).with(0).and_return(double("User Ent", :name => "root"))
+ allow(Etc).to receive(:getgrgid).with(0).and_return(double("Group Ent", name: "wheel"))
+ allow(Etc).to receive(:getpwuid).with(0).and_return(double("User Ent", name: "root"))
provider.send(:load_resource_attributes_from_file, resource)
end
@@ -460,7 +460,7 @@ shared_examples_for Chef::Provider::File do
before { setup_normal_file }
let(:tempfile) do
- t = double("Tempfile", :path => "/tmp/foo-bar-baz", :closed? => true)
+ t = double("Tempfile", path: "/tmp/foo-bar-baz", closed?: true)
allow(content).to receive(:tempfile).and_return(t)
t
end
@@ -515,7 +515,7 @@ shared_examples_for Chef::Provider::File do
before do
setup_normal_file
provider.load_current_resource
- tempfile = double("Tempfile", :path => "/tmp/foo-bar-baz")
+ tempfile = double("Tempfile", path: "/tmp/foo-bar-baz")
allow(content).to receive(:tempfile).and_return(tempfile)
expect(File).to receive(:exists?).with("/tmp/foo-bar-baz").and_return(true)
expect(tempfile).to receive(:close).once
@@ -528,8 +528,8 @@ shared_examples_for Chef::Provider::File do
let(:diff_for_reporting) { "+++\n---\n+foo\n-bar\n" }
before do
allow(provider).to receive(:contents_changed?).and_return(true)
- diff = double("Diff", :for_output => ["+++", "---", "+foo", "-bar"],
- :for_reporting => diff_for_reporting )
+ diff = double("Diff", for_output: ["+++", "---", "+foo", "-bar"],
+ for_reporting: diff_for_reporting )
allow(diff).to receive(:diff).with(resource_path, tempfile_path).and_return(true)
expect(provider).to receive(:diff).at_least(:once).and_return(diff)
expect(provider).to receive(:checksum).with(tempfile_path).and_return(tempfile_sha256)
@@ -592,13 +592,13 @@ shared_examples_for Chef::Provider::File do
end
it "raises an exception when the content object returns a tempfile with a nil path" do
- tempfile = double("Tempfile", :path => nil)
+ tempfile = double("Tempfile", path: nil)
expect(provider.send(:content)).to receive(:tempfile).at_least(:once).and_return(tempfile)
expect { provider.send(:do_contents_changes) }.to raise_error(RuntimeError)
end
it "raises an exception when the content object returns a tempfile that does not exist" do
- tempfile = double("Tempfile", :path => "/tmp/foo-bar-baz")
+ tempfile = double("Tempfile", path: "/tmp/foo-bar-baz")
expect(provider.send(:content)).to receive(:tempfile).at_least(:once).and_return(tempfile)
expect(File).to receive(:exists?).with("/tmp/foo-bar-baz").and_return(false)
expect { provider.send(:do_contents_changes) }.to raise_error(RuntimeError)
diff --git a/spec/support/shared/unit/provider/useradd_based_user_provider.rb b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
index caa76e4ad6..a6301f9ae7 100644
--- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb
+++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
@@ -68,8 +68,8 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
end
it "should set the option for #{attribute} if the new resources #{attribute} is not nil, without homedir management" do
- allow(@new_resource).to receive(:supports).and_return({ :manage_home => false,
- :non_unique => false })
+ allow(@new_resource).to receive(:supports).and_return({ manage_home: false,
+ non_unique: false })
allow(@new_resource).to receive(attribute).and_return("hola")
expect(provider.universal_options).to eql([option, "hola"])
end
@@ -257,7 +257,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
describe "when checking the lock" do
# lazy initialize so we can modify stdout and stderr strings
let(:passwd_s_status) do
- double("Mixlib::ShellOut command", :exitstatus => 0, :stdout => @stdout, :stderr => @stderr, :error! => nil)
+ double("Mixlib::ShellOut command", exitstatus: 0, stdout: @stdout, stderr: @stderr, error!: nil)
end
before(:each) do
@@ -273,7 +273,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
it "should return false if status begins with P" do
expect(provider).to receive(:shell_out).
- with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
+ with("passwd", "-S", @new_resource.username, { returns: [0, 1] }).
and_return(passwd_s_status)
expect(provider.check_lock).to eql(false)
end
@@ -281,7 +281,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
it "should return false if status begins with N" do
@stdout = "root N"
expect(provider).to receive(:shell_out).
- with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
+ with("passwd", "-S", @new_resource.username, { returns: [0, 1] }).
and_return(passwd_s_status)
expect(provider.check_lock).to eql(false)
end
@@ -289,7 +289,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
it "should return true if status begins with L" do
@stdout = "root L"
expect(provider).to receive(:shell_out).
- with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
+ with("passwd", "-S", @new_resource.username, { returns: [0, 1] }).
and_return(passwd_s_status)
expect(provider.check_lock).to eql(true)
end
@@ -297,7 +297,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
it "should raise a ShellCommandFailed exception if passwd -S exits with something other than 0 or 1" do
expect(passwd_s_status).to receive(:error!).and_raise(Mixlib::ShellOut::ShellCommandFailed)
expect(provider).to receive(:shell_out).
- with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
+ with("passwd", "-S", @new_resource.username, { returns: [0, 1] }).
and_return(passwd_s_status)
expect { provider.check_lock }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
end
@@ -306,16 +306,16 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
expect(passwd_s_status).to receive(:stdout).and_return("")
expect(passwd_s_status).to receive(:stderr).and_return("")
expect(provider).to receive(:shell_out).
- with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
+ with("passwd", "-S", @new_resource.username, { returns: [0, 1] }).
and_return(passwd_s_status)
expect { provider.check_lock }.to raise_error(Chef::Exceptions::User)
end
context "when in why run mode" do
before do
- passwd_status = double("Mixlib::ShellOut command", :exitstatus => 0, :stdout => "", :stderr => "passwd: user 'chef-test' does not exist\n")
+ passwd_status = double("Mixlib::ShellOut command", exitstatus: 0, stdout: "", stderr: "passwd: user 'chef-test' does not exist\n")
expect(provider).to receive(:shell_out).
- with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
+ with("passwd", "-S", @new_resource.username, { returns: [0, 1] }).
and_return(passwd_status)
# ubuntu returns 252 on user-does-not-exist so will raise if #error! is called or if
# shell_out! is used
diff --git a/spec/support/shared/unit/user_and_client_shared.rb b/spec/support/shared/unit/user_and_client_shared.rb
index 6c31ca22d1..40042933e2 100644
--- a/spec/support/shared/unit/user_and_client_shared.rb
+++ b/spec/support/shared/unit/user_and_client_shared.rb
@@ -27,7 +27,7 @@ shared_examples_for "user or client create" do
it "creates a new object via the API with a public_key when it exists" do
object.public_key "some_public_key"
- expect(rest_v1).to receive(:post).with(url, payload.merge({ :public_key => "some_public_key" })).and_return({})
+ expect(rest_v1).to receive(:post).with(url, payload.merge({ public_key: "some_public_key" })).and_return({})
object.create
end
@@ -49,7 +49,7 @@ shared_examples_for "user or client create" do
end
it "creates a new object via the API with create_key" do
- expect(rest_v1).to receive(:post).with(url, payload.merge({ :create_key => true })).and_return({})
+ expect(rest_v1).to receive(:post).with(url, payload.merge({ create_key: true })).and_return({})
object.create
end
end
@@ -104,7 +104,7 @@ shared_examples_for "user or client create" do
it "creates a new object via the API with a public_key when it exists" do
object.public_key "some_public_key"
- expect(rest_v0).to receive(:post).with(url, payload.merge({ :public_key => "some_public_key" })).and_return({})
+ expect(rest_v0).to receive(:post).with(url, payload.merge({ public_key: "some_public_key" })).and_return({})
object.create
end
diff --git a/spec/tiny_server.rb b/spec/tiny_server.rb
index 83c5bf4a42..c3eab76d8e 100644
--- a/spec/tiny_server.rb
+++ b/spec/tiny_server.rb
@@ -136,8 +136,8 @@ module TinyServer
if response = response_for_request(env)
response.call
else
- debug_info = { :message => "no data matches the request for #{env['REQUEST_URI']}",
- :available_routes => @routes, :request => env }
+ debug_info = { message: "no data matches the request for #{env['REQUEST_URI']}",
+ available_routes: @routes, request: env }
# Uncomment me for glorious debugging
# pp :not_found => debug_info
[404, { "Content-Type" => "application/json" }, [ Chef::JSONCompat.to_json(debug_info) ]]
diff --git a/spec/unit/api_client/registration_spec.rb b/spec/unit/api_client/registration_spec.rb
index 0f036766da..b2b74b1c58 100644
--- a/spec/unit/api_client/registration_spec.rb
+++ b/spec/unit/api_client/registration_spec.rb
@@ -38,11 +38,11 @@ describe Chef::ApiClient::Registration do
let(:http_mock) { double("Chef::ServerAPI mock") }
let(:expected_post_data) do
- { :name => client_name, :admin => false, :public_key => generated_public_key.to_pem }
+ { name: client_name, admin: false, public_key: generated_public_key.to_pem }
end
let(:expected_put_data) do
- { :name => client_name, :admin => false, :public_key => generated_public_key.to_pem }
+ { name: client_name, admin: false, public_key: generated_public_key.to_pem }
end
let(:server_v10_response) do
@@ -148,11 +148,11 @@ describe Chef::ApiClient::Registration do
context "when local key generation is disabled" do
let(:expected_post_data) do
- { :name => client_name, :admin => false }
+ { name: client_name, admin: false }
end
let(:expected_put_data) do
- { :name => client_name, :admin => false, :private_key => true }
+ { name: client_name, admin: false, private_key: true }
end
before do
diff --git a/spec/unit/api_client_spec.rb b/spec/unit/api_client_spec.rb
index a8ac4f747b..c3c674ecf7 100644
--- a/spec/unit/api_client_spec.rb
+++ b/spec/unit/api_client_spec.rb
@@ -303,7 +303,7 @@ describe Chef::ApiClient do
@api_client_with_key.name("lost-my-key")
@api_client_with_key.private_key("the new private key")
expect(@http_client).to receive(:put).
- with("clients/lost-my-key", :name => "lost-my-key", :admin => false, :validator => false, :private_key => true).
+ with("clients/lost-my-key", name: "lost-my-key", admin: false, validator: false, private_key: true).
and_return(@api_client_with_key)
end
@@ -321,7 +321,7 @@ describe Chef::ApiClient do
before do
@api_client_with_key = { "name" => "lost-my-key", "private_key" => "the new private key" }
expect(@http_client).to receive(:put).
- with("clients/lost-my-key", :name => "lost-my-key", :admin => false, :validator => false, :private_key => true).
+ with("clients/lost-my-key", name: "lost-my-key", admin: false, validator: false, private_key: true).
and_return(@api_client_with_key)
end
diff --git a/spec/unit/api_client_v1_spec.rb b/spec/unit/api_client_v1_spec.rb
index 9c643fa492..802384534b 100644
--- a/spec/unit/api_client_v1_spec.rb
+++ b/spec/unit/api_client_v1_spec.rb
@@ -324,13 +324,13 @@ describe Chef::ApiClientV1 do
end
describe "Versioned API Interactions" do
- let(:response_406) { OpenStruct.new(:code => "406") }
+ let(:response_406) { OpenStruct.new(code: "406") }
let(:exception_406) { Net::HTTPServerException.new("406 Not Acceptable", response_406) }
let(:payload) do
{
- :name => "some_name",
- :validator => true,
- :admin => true,
+ name: "some_name",
+ validator: true,
+ admin: true,
}
end
@@ -389,7 +389,7 @@ describe Chef::ApiClientV1 do
end
it "updates the client with only the name" do
- expect(rest). to receive(:put).with("clients/some_name", { :name => "some_name" }).and_return({ :name => "some_name" })
+ expect(rest). to receive(:put).with("clients/some_name", { name: "some_name" }).and_return({ name: "some_name" })
@client.update
end
end
@@ -437,7 +437,7 @@ describe Chef::ApiClientV1 do
describe "reregister" do
context "when server API V0 is valid on the Chef Server receiving the request" do
it "creates a new object via the API" do
- expect(@client.chef_rest_v0).to receive(:put).with("clients/#{@client.name}", payload.merge({ :private_key => true })).and_return({})
+ expect(@client.chef_rest_v0).to receive(:put).with("clients/#{@client.name}", payload.merge({ private_key: true })).and_return({})
@client.reregister
end
end # when server API V0 is valid on the Chef Server receiving the request
diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb
index 0af3916134..b9e474ef08 100644
--- a/spec/unit/application/apply_spec.rb
+++ b/spec/unit/application/apply_spec.rb
@@ -37,7 +37,7 @@ describe Chef::Application::Apply do
before do
@recipe_file_name = "foo.rb"
@recipe_path = File.expand_path(@recipe_file_name)
- @recipe_file = double("Tempfile (mock)", :read => @recipe_text)
+ @recipe_file = double("Tempfile (mock)", read: @recipe_text)
allow(@app).to receive(:open).with(@recipe_path).and_return(@recipe_file)
allow(File).to receive(:exist?).with(@recipe_path).and_return(true)
allow(Chef::Application).to receive(:fatal!).and_return(true)
@@ -96,7 +96,7 @@ describe Chef::Application::Apply do
end
describe "when the json_attribs configuration option is specified" do
let(:json_attribs) { { "a" => "b" } }
- let(:config_fetcher) { double(Chef::ConfigFetcher, :fetch_json => json_attribs) }
+ let(:config_fetcher) { double(Chef::ConfigFetcher, fetch_json: json_attribs) }
let(:json_source) { "https://foo.com/foo.json" }
before do
diff --git a/spec/unit/application/client_spec.rb b/spec/unit/application/client_spec.rb
index de6972b625..a1f96e1d43 100644
--- a/spec/unit/application/client_spec.rb
+++ b/spec/unit/application/client_spec.rb
@@ -121,27 +121,27 @@ describe Chef::Application::Client, "reconfigure" do
describe "--named-run-list" do
it_behaves_like "sets the configuration",
"--named-run-list arglebargle-example",
- :named_run_list => "arglebargle-example"
+ named_run_list: "arglebargle-example"
end
describe "--no-listen" do
- it_behaves_like "sets the configuration", "--no-listen", :listen => false
+ it_behaves_like "sets the configuration", "--no-listen", listen: false
end
describe "--daemonize", :unix_only do
context "with no value" do
it_behaves_like "sets the configuration", "--daemonize",
- :daemonize => true
+ daemonize: true
end
context "with an integer value" do
it_behaves_like "sets the configuration", "--daemonize 5",
- :daemonize => 5
+ daemonize: 5
end
context "with a non-integer value" do
it_behaves_like "sets the configuration", "--daemonize foo",
- :daemonize => true
+ daemonize: true
end
end
@@ -178,17 +178,17 @@ describe Chef::Application::Client, "reconfigure" do
describe "--config-option" do
context "with a single value" do
it_behaves_like "sets the configuration", "--config-option chef_server_url=http://example",
- :chef_server_url => "http://example"
+ chef_server_url: "http://example"
end
context "with two values" do
it_behaves_like "sets the configuration", "--config-option chef_server_url=http://example --config-option policy_name=web",
- :chef_server_url => "http://example", :policy_name => "web"
+ chef_server_url: "http://example", policy_name: "web"
end
context "with a boolean value" do
it_behaves_like "sets the configuration", "--config-option minimal_ohai=true",
- :minimal_ohai => true
+ minimal_ohai: true
end
context "with an empty value" do
@@ -321,7 +321,7 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config
describe "when the json_attribs configuration option is specified" do
let(:json_attribs) { { "a" => "b" } }
- let(:config_fetcher) { double(Chef::ConfigFetcher, :fetch_json => json_attribs) }
+ let(:config_fetcher) { double(Chef::ConfigFetcher, fetch_json: json_attribs) }
let(:json_source) { "https://foo.com/foo.json" }
before do
diff --git a/spec/unit/application/knife_spec.rb b/spec/unit/application/knife_spec.rb
index 90ecde608e..8a574b4d0f 100644
--- a/spec/unit/application/knife_spec.rb
+++ b/spec/unit/application/knife_spec.rb
@@ -24,9 +24,9 @@ describe Chef::Application::Knife do
before(:all) do
class NoopKnifeCommand < Chef::Knife
option :opt_with_default,
- :short => "-D VALUE",
- :long => "-optwithdefault VALUE",
- :default => "default-value"
+ short: "-D VALUE",
+ long: "-optwithdefault VALUE",
+ default: "default-value"
def run
end
diff --git a/spec/unit/application/solo_spec.rb b/spec/unit/application/solo_spec.rb
index 5b9dbeaafd..c4c4c3b252 100644
--- a/spec/unit/application/solo_spec.rb
+++ b/spec/unit/application/solo_spec.rb
@@ -93,7 +93,7 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config
describe "when the json_attribs configuration option is specified" do
let(:json_attribs) { { "a" => "b" } }
- let(:config_fetcher) { double(Chef::ConfigFetcher, :fetch_json => json_attribs) }
+ let(:config_fetcher) { double(Chef::ConfigFetcher, fetch_json: json_attribs) }
let(:json_source) { "https://foo.com/foo.json" }
before do
@@ -130,7 +130,7 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config
it "fetches the recipe_url first when both json_attribs and recipe_url are specified" do
json_attribs = { "a" => "b" }
- config_fetcher = instance_double("Chef::ConfigFetcher", :fetch_json => json_attribs)
+ config_fetcher = instance_double("Chef::ConfigFetcher", fetch_json: json_attribs)
Chef::Config[:json_attribs] = "https://foo.com/foo.json"
Chef::Config[:recipe_url] = "http://icanhas.cheezburger.com/lolcats"
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb
index 76be387c22..8b2d0cb114 100644
--- a/spec/unit/application_spec.rb
+++ b/spec/unit/application_spec.rb
@@ -447,7 +447,7 @@ describe Chef::Application do
ARGV.replace(@original_argv)
end
- let(:fake_config_fetcher) { instance_double(Chef::ConfigFetcher, expanded_path: "/thisbetternotexist", :"config_missing?" => false, read_config: "" ) }
+ let(:fake_config_fetcher) { instance_double(Chef::ConfigFetcher, expanded_path: "/thisbetternotexist", "config_missing?": false, read_config: "" ) }
it "reading a mixlib-config default works" do
@app.parse_options
diff --git a/spec/unit/audit/audit_event_proxy_spec.rb b/spec/unit/audit/audit_event_proxy_spec.rb
index 0e35343352..ec9960aff4 100644
--- a/spec/unit/audit/audit_event_proxy_spec.rb
+++ b/spec/unit/audit/audit_event_proxy_spec.rb
@@ -35,9 +35,9 @@ describe Chef::Audit::AuditEventProxy do
let(:description) { "poots" }
let(:group) do
- double("ExampleGroup", :parent_groups => parents,
- :description => description) end
- let(:notification) { double("Notification", :group => group) }
+ double("ExampleGroup", parent_groups: parents,
+ description: description) end
+ let(:notification) { double("Notification", group: group) }
context "when notified from a top-level example group" do
@@ -66,9 +66,9 @@ describe Chef::Audit::AuditEventProxy do
describe "#stop" do
let(:examples) { [] }
- let(:notification) { double("Notification", :examples => examples) }
+ let(:notification) { double("Notification", examples: examples) }
let(:exception) { nil }
- let(:example) { double("Example", :exception => exception) }
+ let(:example) { double("Example", exception: exception) }
let(:control_group_name) { "audit test" }
let(:control_data) { double("ControlData") }
@@ -122,29 +122,29 @@ describe Chef::Audit::AuditEventProxy do
let(:examples) { [example] }
let(:example) do
- double("Example", :metadata => metadata,
- :description => example_description,
- :full_description => full_description, :exception => nil) end
+ double("Example", metadata: metadata,
+ description: example_description,
+ full_description: full_description, exception: nil) end
let(:metadata) do
{
- :described_class => described_class,
- :example_group => example_group,
- :line_number => line,
+ described_class: described_class,
+ example_group: example_group,
+ line_number: line,
}
end
let(:example_group) do
{
- :description => group_description,
- :parent_example_group => parent_group,
+ description: group_description,
+ parent_example_group: parent_group,
}
end
let(:parent_group) do
{
- :description => control_group_name,
- :parent_example_group => nil,
+ description: control_group_name,
+ parent_example_group: nil,
}
end
@@ -152,12 +152,12 @@ describe Chef::Audit::AuditEventProxy do
let(:control_data) do
{
- :name => example_description,
- :desc => full_description,
- :resource_type => resource_type,
- :resource_name => resource_name,
- :context => context,
- :line_number => line,
+ name: example_description,
+ desc: full_description,
+ resource_type: resource_type,
+ resource_name: resource_name,
+ context: context,
+ line_number: line,
}
end
@@ -227,7 +227,7 @@ describe Chef::Audit::AuditEventProxy do
# Metadata fields
let(:described_class) do
double("Serverspec::Type::Port",
- :class => "Serverspec::Type::Port", :name => resource_name) end
+ class: "Serverspec::Type::Port", name: resource_name) end
# Control data fields
let(:resource_type) { "Port" }
@@ -288,20 +288,20 @@ describe Chef::Audit::AuditEventProxy do
# Metadata parts
let(:described_class) do
double("Serverspec::Type::File",
- :class => "Serverspec::Type::File", :name => resource_name) end
+ class: "Serverspec::Type::File", name: resource_name) end
# Example group parts
let(:parent_group) do
{
- :description => outer_group_description,
- :parent_example_group => control_group,
+ description: outer_group_description,
+ parent_example_group: control_group,
}
end
let(:control_group) do
{
- :description => control_group_name,
- :parent_example_group => nil,
+ description: control_group_name,
+ parent_example_group: nil,
}
end
diff --git a/spec/unit/audit/audit_reporter_spec.rb b/spec/unit/audit/audit_reporter_spec.rb
index 3edee46932..f6707825cf 100644
--- a/spec/unit/audit/audit_reporter_spec.rb
+++ b/spec/unit/audit/audit_reporter_spec.rb
@@ -24,13 +24,13 @@ describe Chef::Audit::AuditReporter do
let(:rest) { double("rest") }
let(:reporter) { described_class.new(rest) }
- let(:node) { double("node", :name => "sofreshsoclean") }
+ let(:node) { double("node", name: "sofreshsoclean") }
let(:run_id) { 0 }
let(:start_time) { Time.new(2014, 12, 3, 9, 31, 05, "-08:00") }
let(:end_time) { Time.new(2014, 12, 3, 9, 36, 14, "-08:00") }
let(:run_status) do
- instance_double(Chef::RunStatus, :node => node, :run_id => run_id,
- :start_time => start_time, :end_time => end_time) end
+ instance_double(Chef::RunStatus, node: node, run_id: run_id,
+ start_time: start_time, end_time: end_time) end
describe "#audit_phase_start" do
@@ -87,9 +87,9 @@ describe Chef::Audit::AuditReporter do
context "when audit phase failed" do
let(:audit_error) do
- double("AuditError", :class => "Chef::Exceptions::AuditError",
- :message => "Audit phase failed with error message: derpderpderp",
- :backtrace => ["/path/recipe.rb:57", "/path/library.rb:106"]) end
+ double("AuditError", class: "Chef::Exceptions::AuditError",
+ message: "Audit phase failed with error message: derpderpderp",
+ backtrace: ["/path/recipe.rb:57", "/path/library.rb:106"]) end
before do
reporter.instance_variable_set(:@audit_phase_error, audit_error)
@@ -123,7 +123,7 @@ EOM
context "the error is an http error" do
- let(:response) { double("response", :code => code) }
+ let(:response) { double("response", code: code) }
before do
expect(Chef::Log).to receive(:trace).with(/Sending audit report/)
@@ -236,14 +236,14 @@ EOM
let(:run_data) { audit_data.to_hash }
let(:audit_error) do
- double("AuditError", :class => "Chef::Exceptions::AuditError",
- :message => "Audit phase failed with error message: derpderpderp",
- :backtrace => ["/path/recipe.rb:57", "/path/library.rb:106"]) end
+ double("AuditError", class: "Chef::Exceptions::AuditError",
+ message: "Audit phase failed with error message: derpderpderp",
+ backtrace: ["/path/recipe.rb:57", "/path/library.rb:106"]) end
let(:run_error) do
- double("RunError", :class => "Chef::Exceptions::RunError",
- :message => "This error shouldn't be reported.",
- :backtrace => ["fix it", "fix it", "fix it"]) end
+ double("RunError", class: "Chef::Exceptions::RunError",
+ message: "This error shouldn't be reported.",
+ backtrace: ["fix it", "fix it", "fix it"]) end
before do
allow(reporter).to receive(:auditing_enabled?).and_return(true)
@@ -282,10 +282,10 @@ EOM
let(:control_group_foo) do
instance_double(Chef::Audit::ControlGroupData,
- :metadata => double("foo metadata")) end
+ metadata: double("foo metadata")) end
let(:control_group_bar) do
instance_double(Chef::Audit::ControlGroupData,
- :metadata => double("bar metadata")) end
+ metadata: double("bar metadata")) end
let(:ordered_control_groups) do
{
@@ -296,11 +296,11 @@ EOM
let(:audit_data) do
instance_double(Chef::Audit::AuditData,
- :add_control_group => true) end
+ add_control_group: true) end
let(:run_context) do
instance_double(Chef::RunContext,
- :audits => ordered_control_groups) end
+ audits: ordered_control_groups) end
before do
allow(reporter).to receive(:ordered_control_groups).and_return(ordered_control_groups)
@@ -350,7 +350,7 @@ EOM
let(:name) { "bat" }
let(:control_group) do
instance_double(Chef::Audit::ControlGroupData,
- :metadata => double("metadata")) end
+ metadata: double("metadata")) end
before do
allow(Chef::Audit::ControlGroupData).to receive(:new).
@@ -397,7 +397,7 @@ EOM
let(:name) { "bar" }
let(:example_data) { double("example data") }
- let(:error) { double("Exception", :message => "oopsie") }
+ let(:error) { double("Exception", message: "oopsie") }
it "notifies the control group the example failed" do
expect(control_group_bar).to receive(:example_failure).
diff --git a/spec/unit/audit/control_group_data_spec.rb b/spec/unit/audit/control_group_data_spec.rb
index ea4ac260f9..c56e824d4c 100644
--- a/spec/unit/audit/control_group_data_spec.rb
+++ b/spec/unit/audit/control_group_data_spec.rb
@@ -72,8 +72,8 @@ describe Chef::Audit::AuditData do
describe ":control_groups" do
- let(:control_hash_1) { { :name => "control group 1" } }
- let(:control_hash_2) { { :name => "control group 2" } }
+ let(:control_hash_1) { { name: "control group 1" } }
+ let(:control_hash_2) { { name: "control group 2" } }
let(:control_groups) { audit_data_hash[:control_groups] }
@@ -174,11 +174,11 @@ describe Chef::Audit::ControlGroupData do
let(:control_data) do
{
- :name => name,
- :resource_type => resource_type,
- :resource_name => resource_name,
- :context => context,
- :line_number => line_number,
+ name: name,
+ resource_type: resource_type,
+ resource_name: resource_name,
+ context: context,
+ line_number: line_number,
}
end
@@ -434,22 +434,22 @@ describe Chef::Audit::ControlGroupData do
context "with multiple controls added" do
- let(:control_hash_1) { { :line_number => 27 } }
- let(:control_hash_2) { { :line_number => 13 } }
- let(:control_hash_3) { { :line_number => 35 } }
+ let(:control_hash_1) { { line_number: 27 } }
+ let(:control_hash_2) { { line_number: 13 } }
+ let(:control_hash_3) { { line_number: 35 } }
let(:control_1) do
double("control 1",
- :line_number => control_hash_1[:line_number],
- :to_hash => control_hash_1) end
+ line_number: control_hash_1[:line_number],
+ to_hash: control_hash_1) end
let(:control_2) do
double("control 2",
- :line_number => control_hash_2[:line_number],
- :to_hash => control_hash_2) end
+ line_number: control_hash_2[:line_number],
+ to_hash: control_hash_2) end
let(:control_3) do
double("control 3",
- :line_number => control_hash_3[:line_number],
- :to_hash => control_hash_3) end
+ line_number: control_hash_3[:line_number],
+ to_hash: control_hash_3) end
let(:control_list) { [control_1, control_2, control_3] }
let(:ordered_control_hashes) { [control_hash_2, control_hash_1, control_hash_3] }
diff --git a/spec/unit/audit/runner_spec.rb b/spec/unit/audit/runner_spec.rb
index 4c03cab1d3..902ede62ed 100644
--- a/spec/unit/audit/runner_spec.rb
+++ b/spec/unit/audit/runner_spec.rb
@@ -28,7 +28,7 @@ describe Chef::Audit::Runner do
include RSpec::Support::InSubProcess
let(:events) { double("events") }
- let(:run_context) { instance_double(Chef::RunContext, :events => events) }
+ let(:run_context) { instance_double(Chef::RunContext, events: events) }
let(:runner) { Chef::Audit::Runner.new(run_context) }
around(:each) do |ex|
@@ -89,7 +89,7 @@ describe Chef::Audit::Runner do
describe "#register_control_groups" do
let(:audits) { [] }
- let(:run_context) { instance_double(Chef::RunContext, :audits => audits) }
+ let(:run_context) { instance_double(Chef::RunContext, audits: audits) }
it "adds the control group aliases" do
runner.send(:register_control_groups)
diff --git a/spec/unit/chef_fs/diff_spec.rb b/spec/unit/chef_fs/diff_spec.rb
index d946fcb9e7..229a48c2db 100644
--- a/spec/unit/chef_fs/diff_spec.rb
+++ b/spec/unit/chef_fs/diff_spec.rb
@@ -28,62 +28,62 @@ def remove_os_differences(diff)
diff.gsub(/^@@ -\d(,\d)? \+\d(,\d)? @@/, "CONTEXT_LINE_NUMBERS")
end
-describe "diff", :uses_diff => true do
+describe "diff", uses_diff: true do
include FileSystemSupport
context "with two filesystems with all types of difference" do
let(:a) do
memory_fs("a", {
- :both_dirs => {
- :sub_both_dirs => { :subsub => nil },
- :sub_both_files => nil,
- :sub_both_files_different => "a\n",
- :sub_both_dirs_empty => {},
- :sub_dirs_empty_in_a_filled_in_b => {},
- :sub_dirs_empty_in_b_filled_in_a => { :subsub => nil },
- :sub_a_only_dir => { :subsub => nil },
- :sub_a_only_file => nil,
- :sub_dir_in_a_file_in_b => {},
- :sub_file_in_a_dir_in_b => nil,
+ both_dirs: {
+ sub_both_dirs: { subsub: nil },
+ sub_both_files: nil,
+ sub_both_files_different: "a\n",
+ sub_both_dirs_empty: {},
+ sub_dirs_empty_in_a_filled_in_b: {},
+ sub_dirs_empty_in_b_filled_in_a: { subsub: nil },
+ sub_a_only_dir: { subsub: nil },
+ sub_a_only_file: nil,
+ sub_dir_in_a_file_in_b: {},
+ sub_file_in_a_dir_in_b: nil,
},
- :both_files => nil,
- :both_files_different => "a\n",
- :both_dirs_empty => {},
- :dirs_empty_in_a_filled_in_b => {},
- :dirs_empty_in_b_filled_in_a => { :subsub => nil },
- :dirs_in_a_cannot_be_in_b => {},
- :file_in_a_cannot_be_in_b => nil,
- :a_only_dir => { :subsub => nil },
- :a_only_file => nil,
- :dir_in_a_file_in_b => {},
- :file_in_a_dir_in_b => nil,
+ both_files: nil,
+ both_files_different: "a\n",
+ both_dirs_empty: {},
+ dirs_empty_in_a_filled_in_b: {},
+ dirs_empty_in_b_filled_in_a: { subsub: nil },
+ dirs_in_a_cannot_be_in_b: {},
+ file_in_a_cannot_be_in_b: nil,
+ a_only_dir: { subsub: nil },
+ a_only_file: nil,
+ dir_in_a_file_in_b: {},
+ file_in_a_dir_in_b: nil,
}, /cannot_be_in_a/)
end
let(:b) do
memory_fs("b", {
- :both_dirs => {
- :sub_both_dirs => { :subsub => nil },
- :sub_both_files => nil,
- :sub_both_files_different => "b\n",
- :sub_both_dirs_empty => {},
- :sub_dirs_empty_in_a_filled_in_b => { :subsub => nil },
- :sub_dirs_empty_in_b_filled_in_a => {},
- :sub_b_only_dir => { :subsub => nil },
- :sub_b_only_file => nil,
- :sub_dir_in_a_file_in_b => nil,
- :sub_file_in_a_dir_in_b => {},
+ both_dirs: {
+ sub_both_dirs: { subsub: nil },
+ sub_both_files: nil,
+ sub_both_files_different: "b\n",
+ sub_both_dirs_empty: {},
+ sub_dirs_empty_in_a_filled_in_b: { subsub: nil },
+ sub_dirs_empty_in_b_filled_in_a: {},
+ sub_b_only_dir: { subsub: nil },
+ sub_b_only_file: nil,
+ sub_dir_in_a_file_in_b: nil,
+ sub_file_in_a_dir_in_b: {},
},
- :both_files => nil,
- :both_files_different => "b\n",
- :both_dirs_empty => {},
- :dirs_empty_in_a_filled_in_b => { :subsub => nil },
- :dirs_empty_in_b_filled_in_a => {},
- :dirs_in_b_cannot_be_in_a => {},
- :file_in_b_cannot_be_in_a => nil,
- :b_only_dir => { :subsub => nil },
- :b_only_file => nil,
- :dir_in_a_file_in_b => nil,
- :file_in_a_dir_in_b => {},
+ both_files: nil,
+ both_files_different: "b\n",
+ both_dirs_empty: {},
+ dirs_empty_in_a_filled_in_b: { subsub: nil },
+ dirs_empty_in_b_filled_in_a: {},
+ dirs_in_b_cannot_be_in_a: {},
+ file_in_b_cannot_be_in_a: nil,
+ b_only_dir: { subsub: nil },
+ b_only_file: nil,
+ dir_in_a_file_in_b: nil,
+ file_in_a_dir_in_b: {},
}, /cannot_be_in_b/)
end
it "Chef::ChefFS::CommandLine.diff_print(/)" do
diff --git a/spec/unit/chef_fs/file_pattern_spec.rb b/spec/unit/chef_fs/file_pattern_spec.rb
index c4d076ef90..58cdbb28c2 100644
--- a/spec/unit/chef_fs/file_pattern_spec.rb
+++ b/spec/unit/chef_fs/file_pattern_spec.rb
@@ -157,7 +157,7 @@ describe Chef::ChefFS::FilePattern do
end
end
- context 'with simple pattern "a\*\b"', :skip => (Chef::Platform.windows?) do
+ context 'with simple pattern "a\*\b"', skip: (Chef::Platform.windows?) do
let(:pattern) { Chef::ChefFS::FilePattern.new('a\*\b') }
it "match?" do
expect(pattern.match?("a*b")).to be_truthy
@@ -264,7 +264,7 @@ describe Chef::ChefFS::FilePattern do
end
end
- context 'with star pattern "/abc/d[a-z][0-9]f/ghi"', :skip => (Chef::Platform.windows?) do
+ context 'with star pattern "/abc/d[a-z][0-9]f/ghi"', skip: (Chef::Platform.windows?) do
let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/d[a-z][0-9]f/ghi") }
it "match?" do
expect(pattern.match?("/abc/de1f/ghi")).to be_truthy
diff --git a/spec/unit/chef_fs/file_system/repository/directory_spec.rb b/spec/unit/chef_fs/file_system/repository/directory_spec.rb
index e44cc15167..efd17204e0 100644
--- a/spec/unit/chef_fs/file_system/repository/directory_spec.rb
+++ b/spec/unit/chef_fs/file_system/repository/directory_spec.rb
@@ -88,7 +88,7 @@ describe Chef::ChefFS::FileSystem::Repository::Directory do
end
it "returns a non existent object otherwise" do
- file_double = instance_double(TestFile, :name_valid? => false)
+ file_double = instance_double(TestFile, name_valid?: false)
expect(TestFile).to receive(:new).with("test_child", test_directory).and_return(file_double)
expect(test_directory.child("test_child")).to be_an_instance_of(Chef::ChefFS::FileSystem::NonexistentFSObject)
end
diff --git a/spec/unit/chef_fs/file_system_spec.rb b/spec/unit/chef_fs/file_system_spec.rb
index c7ed83524b..fed468f2cd 100644
--- a/spec/unit/chef_fs/file_system_spec.rb
+++ b/spec/unit/chef_fs/file_system_spec.rb
@@ -57,17 +57,17 @@ describe Chef::ChefFS::FileSystem do
context "with a populated filesystem" do
let(:fs) do
memory_fs("", {
- :a => {
- :aa => {
- :c => "",
- :zz => "",
+ a: {
+ aa: {
+ c: "",
+ zz: "",
},
- :ab => {
- :c => "",
+ ab: {
+ c: "",
},
},
- :x => "",
- :y => {},
+ x: "",
+ y: {},
})
end
context "list" do
diff --git a/spec/unit/chef_fs/parallelizer.rb b/spec/unit/chef_fs/parallelizer.rb
index 84637f7283..cbfa3402fa 100644
--- a/spec/unit/chef_fs/parallelizer.rb
+++ b/spec/unit/chef_fs/parallelizer.rb
@@ -20,7 +20,7 @@ describe Chef::ChefFS::Parallelizer do
end
def parallelize(inputs, options = {}, &block)
- parallelizer.parallelize(inputs, { :main_thread_processing => false }.merge(options), &block)
+ parallelizer.parallelize(inputs, { main_thread_processing: false }.merge(options), &block)
end
it "parallel_do creates unordered output as soon as it is available" do
@@ -35,14 +35,14 @@ describe Chef::ChefFS::Parallelizer do
context "With :ordered => false (unordered output)" do
it "An empty input produces an empty output" do
- expect(parallelize([], :ordered => false) do
+ expect(parallelize([], ordered: false) do
sleep 10
end.to_a).to eql([])
expect(elapsed_time).to be < 0.1
end
it "10 sleep(0.2)s complete within 0.5 seconds" do
- expect(parallelize(1.upto(10), :ordered => false) do |i|
+ expect(parallelize(1.upto(10), ordered: false) do |i|
sleep 0.2
"x"
end.to_a).to eq(%w{x x x x x x x x x x})
@@ -50,7 +50,7 @@ describe Chef::ChefFS::Parallelizer do
end
it "The output comes as soon as it is available" do
- enum = parallelize([0.5, 0.3, 0.1], :ordered => false) do |val|
+ enum = parallelize([0.5, 0.3, 0.1], ordered: false) do |val|
sleep val
val
end
@@ -64,7 +64,7 @@ describe Chef::ChefFS::Parallelizer do
input = TestEnumerable.new(0.5, 0.3, 0.1) do
raise "hi"
end
- enum = parallelize(input, :ordered => false) { |x| sleep(x); x }
+ enum = parallelize(input, ordered: false) { |x| sleep(x); x }
results = []
expect { enum.each { |value| results << value } }.to raise_error "hi"
expect(results).to eq([ 0.1, 0.3, 0.5 ])
@@ -73,7 +73,7 @@ describe Chef::ChefFS::Parallelizer do
it "Exceptions in output are raised after all processing is done" do
processed = 0
- enum = parallelize([1, 2, "x", 3], :ordered => false) do |x|
+ enum = parallelize([1, 2, "x", 3], ordered: false) do |x|
if x == "x"
sleep 0.1
raise "hi"
@@ -91,7 +91,7 @@ describe Chef::ChefFS::Parallelizer do
it "Exceptions with :stop_on_exception are raised after all processing is done" do
processed = 0
- parallelized = parallelize([0.3, 0.3, "x", 0.3, 0.3, 0.3, 0.3, 0.3], :ordered => false, :stop_on_exception => true) do |x|
+ parallelized = parallelize([0.3, 0.3, "x", 0.3, 0.3, 0.3, 0.3, 0.3], ordered: false, stop_on_exception: true) do |x|
if x == "x"
sleep(0.1)
raise "hi"
@@ -114,7 +114,7 @@ describe Chef::ChefFS::Parallelizer do
end
it "10 sleep(0.2)s complete within 0.5 seconds" do
- expect(parallelize(1.upto(10), :ordered => true) do |i|
+ expect(parallelize(1.upto(10), ordered: true) do |i|
sleep 0.2
"x"
end.to_a).to eq(%w{x x x x x x x x x x})
@@ -163,7 +163,7 @@ describe Chef::ChefFS::Parallelizer do
it "Exceptions with :stop_on_exception are raised after all processing is done" do
processed = 0
- parallelized = parallelize([0.3, 0.3, "x", 0.3, 0.3, 0.3, 0.3, 0.3], :ordered => false, :stop_on_exception => true) do |x|
+ parallelized = parallelize([0.3, 0.3, "x", 0.3, 0.3, 0.3, 0.3, 0.3], ordered: false, stop_on_exception: true) do |x|
if x == "x"
sleep(0.1)
raise "hi"
@@ -205,7 +205,7 @@ describe Chef::ChefFS::Parallelizer do
started = false
@occupying_job_finished = occupying_job_finished = [ false ]
@thread = Thread.new do
- parallelizer.parallelize([0], :main_thread_processing => false) do |x|
+ parallelizer.parallelize([0], main_thread_processing: false) do |x|
started = true
sleep(0.3)
occupying_job_finished[0] = true
@@ -229,7 +229,7 @@ describe Chef::ChefFS::Parallelizer do
end
it "parallelize with :main_thread_processing = false waits for the job to finish" do
- expect(parallelizer.parallelize([1], :main_thread_processing => false) do |x|
+ expect(parallelizer.parallelize([1], main_thread_processing: false) do |x|
sleep(0.1)
x + 1
end.to_a).to eq([ 2 ])
@@ -434,7 +434,7 @@ describe Chef::ChefFS::Parallelizer do
end
it "does not have contention issues with large numbers of inputs with ordering off" do
- expect(parallelizer.parallelize(1.upto(500), :ordered => false) { |x| x + 1 }.to_a.sort).to eq(2.upto(501).to_a)
+ expect(parallelizer.parallelize(1.upto(500), ordered: false) { |x| x + 1 }.to_a.sort).to eq(2.upto(501).to_a)
end
it "does not have contention issues with large numbers of jobs and inputs with ordering off" do
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index 001be10e0b..0e72a285af 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -179,12 +179,12 @@ describe Chef::Client do
context "when an override run list is given" do
it "permits spaces in overriding run list" do
- Chef::Client.new(nil, :override_runlist => "role[a], role[b]")
+ Chef::Client.new(nil, override_runlist: "role[a], role[b]")
end
describe "calling run" do
include_examples "a successful client run" do
- let(:client_opts) { { :override_runlist => "recipe[override_recipe]" } }
+ let(:client_opts) { { override_runlist: "recipe[override_recipe]" } }
def stub_for_sync_cookbooks
# --Client#setup_run_context
@@ -193,7 +193,7 @@ describe Chef::Client do
expect_any_instance_of(Chef::CookbookSynchronizer).to receive(:sync_cookbooks)
expect(Chef::ServerAPI).to receive(:new).with(Chef::Config[:chef_server_url], version_class: Chef::CookbookManifestVersions).and_return(http_cookbook_sync)
expect(http_cookbook_sync).to receive(:post).
- with("environments/_default/cookbook_versions", { :run_list => ["override_recipe"] }).
+ with("environments/_default/cookbook_versions", { run_list: ["override_recipe"] }).
and_return({})
end
@@ -218,7 +218,7 @@ describe Chef::Client do
include_examples "a successful client run" do
let(:new_runlist) { "recipe[new_run_list_recipe]" }
- let(:client_opts) { { :runlist => new_runlist } }
+ let(:client_opts) { { runlist: new_runlist } }
def stub_for_sync_cookbooks
# --Client#setup_run_context
@@ -227,7 +227,7 @@ describe Chef::Client do
expect_any_instance_of(Chef::CookbookSynchronizer).to receive(:sync_cookbooks)
expect(Chef::ServerAPI).to receive(:new).with(Chef::Config[:chef_server_url], version_class: Chef::CookbookManifestVersions).and_return(http_cookbook_sync)
expect(http_cookbook_sync).to receive(:post).
- with("environments/_default/cookbook_versions", { :run_list => ["new_run_list_recipe"] }).
+ with("environments/_default/cookbook_versions", { run_list: ["new_run_list_recipe"] }).
and_return({})
end
@@ -293,7 +293,7 @@ describe Chef::Client do
describe "when handling run failures" do
it "should remove the run_lock on failure of #load_node" do
- @run_lock = double("Chef::RunLock", :acquire => true)
+ @run_lock = double("Chef::RunLock", acquire: true)
allow(Chef::RunLock).to receive(:new).and_return(@run_lock)
@events = double("Chef::EventDispatch::Dispatcher").as_null_object
diff --git a/spec/unit/config_fetcher_spec.rb b/spec/unit/config_fetcher_spec.rb
index a674d4de33..c91b043160 100644
--- a/spec/unit/config_fetcher_spec.rb
+++ b/spec/unit/config_fetcher_spec.rb
@@ -2,7 +2,7 @@ require "spec_helper"
require "chef/config_fetcher"
describe Chef::ConfigFetcher do
- let(:valid_json) { Chef::JSONCompat.to_json({ :a => "b" }) }
+ let(:valid_json) { Chef::JSONCompat.to_json({ a: "b" }) }
let(:invalid_json) { %q[{"syntax-error": "missing quote}] }
let(:http) { double("Chef::HTTP::Simple") }
diff --git a/spec/unit/cookbook/metadata_spec.rb b/spec/unit/cookbook/metadata_spec.rb
index a2cb35e60d..7d7b6137bb 100644
--- a/spec/unit/cookbook/metadata_spec.rb
+++ b/spec/unit/cookbook/metadata_spec.rb
@@ -175,15 +175,15 @@ describe Chef::Cookbook::Metadata do
describe "meta-data attributes" do
params = {
- :maintainer => "Adam Jacob",
- :maintainer_email => "adam@opscode.com",
- :license => "Apache v2.0",
- :description => "Foobar!",
- :long_description => "Much Longer\nSeriously",
- :version => "0.6.0",
- :source_url => "http://example.com",
- :issues_url => "http://example.com/issues",
- :privacy => true,
+ maintainer: "Adam Jacob",
+ maintainer_email: "adam@opscode.com",
+ license: "Apache v2.0",
+ description: "Foobar!",
+ long_description: "Much Longer\nSeriously",
+ version: "0.6.0",
+ source_url: "http://example.com",
+ issues_url: "http://example.com/issues",
+ privacy: true,
}
params.sort_by(&:to_s).each do |field, field_value|
describe field do
@@ -212,8 +212,8 @@ describe Chef::Cookbook::Metadata do
describe "describing dependencies" do
dep_types = {
- :depends => [ :dependencies, "foo::bar", "> 0.2" ],
- :provides => [ :providing, "foo::bar", "<= 0.2" ],
+ depends: [ :dependencies, "foo::bar", "> 0.2" ],
+ provides: [ :providing, "foo::bar", "<= 0.2" ],
}
dep_types.sort_by(&:to_s).each do |dep, dep_args|
check_with = dep_args.shift
@@ -229,8 +229,8 @@ describe Chef::Cookbook::Metadata do
end
dep_types = {
- :depends => [ :dependencies, "foo::bar", ">0.2", "> 0.2" ],
- :provides => [ :providing, "foo::bar", "<=0.2", "<= 0.2" ],
+ depends: [ :dependencies, "foo::bar", ">0.2", "> 0.2" ],
+ provides: [ :providing, "foo::bar", "<=0.2", "<= 0.2" ],
}
dep_types.sort_by(&:to_s).each do |dep, dep_args|
check_with = dep_args.shift
@@ -248,8 +248,8 @@ describe Chef::Cookbook::Metadata do
describe "in the obsoleted format" do
dep_types = {
- :depends => [ "foo::bar", "> 0.2", "< 1.0" ],
- :provides => [ "foo::bar", "> 0.2", "< 1.0" ],
+ depends: [ "foo::bar", "> 0.2", "< 1.0" ],
+ provides: [ "foo::bar", "> 0.2", "< 1.0" ],
}
dep_types.each do |dep, dep_args|
@@ -261,8 +261,8 @@ describe Chef::Cookbook::Metadata do
describe "with obsolete operators" do
dep_types = {
- :depends => [ "foo::bar", ">> 0.2"],
- :provides => [ "foo::bar", ">> 0.2"],
+ depends: [ "foo::bar", ">> 0.2"],
+ provides: [ "foo::bar", ">> 0.2"],
}
dep_types.each do |dep, dep_args|
@@ -435,61 +435,61 @@ describe Chef::Cookbook::Metadata do
it "should not accept anything but a string for display_name" do
expect do
- metadata.attribute("db/mysql/databases", :display_name => "foo")
+ metadata.attribute("db/mysql/databases", display_name: "foo")
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :display_name => Hash.new)
+ metadata.attribute("db/mysql/databases", display_name: Hash.new)
end.to raise_error(ArgumentError)
end
it "should not accept anything but a string for the description" do
expect do
- metadata.attribute("db/mysql/databases", :description => "foo")
+ metadata.attribute("db/mysql/databases", description: "foo")
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :description => Hash.new)
+ metadata.attribute("db/mysql/databases", description: Hash.new)
end.to raise_error(ArgumentError)
end
it "should not accept anything but a string for the source_url" do
expect do
- metadata.attribute("db/mysql/databases", :source_url => "foo")
+ metadata.attribute("db/mysql/databases", source_url: "foo")
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :source_url => Hash.new)
+ metadata.attribute("db/mysql/databases", source_url: Hash.new)
end.to raise_error(ArgumentError)
end
it "should not accept anything but a string for the issues_url" do
expect do
- metadata.attribute("db/mysql/databases", :issues_url => "foo")
+ metadata.attribute("db/mysql/databases", issues_url: "foo")
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :issues_url => Hash.new)
+ metadata.attribute("db/mysql/databases", issues_url: Hash.new)
end.to raise_error(ArgumentError)
end
it "should not accept anything but true or false for the privacy flag" do
expect do
- metadata.attribute("db/mysql/databases", :privacy => true)
+ metadata.attribute("db/mysql/databases", privacy: true)
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :privacy => false)
+ metadata.attribute("db/mysql/databases", privacy: false)
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :privacy => "true")
+ metadata.attribute("db/mysql/databases", privacy: "true")
end.to raise_error(ArgumentError)
end
it "should not accept anything but an array of strings for choice" do
expect do
- metadata.attribute("db/mysql/databases", :choice => %w{dedicated shared})
+ metadata.attribute("db/mysql/databases", choice: %w{dedicated shared})
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :choice => [10, "shared"])
+ metadata.attribute("db/mysql/databases", choice: [10, "shared"])
end.to raise_error(ArgumentError)
expect do
- metadata.attribute("db/mysql/databases", :choice => Hash.new)
+ metadata.attribute("db/mysql/databases", choice: Hash.new)
end.to raise_error(ArgumentError)
end
@@ -500,13 +500,13 @@ describe Chef::Cookbook::Metadata do
it "should let calculated be true or false" do
expect do
- metadata.attribute("db/mysql/databases", :calculated => true)
+ metadata.attribute("db/mysql/databases", calculated: true)
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :calculated => false)
+ metadata.attribute("db/mysql/databases", calculated: false)
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :calculated => Hash.new)
+ metadata.attribute("db/mysql/databases", calculated: Hash.new)
end.to raise_error(ArgumentError)
end
@@ -517,53 +517,53 @@ describe Chef::Cookbook::Metadata do
it "accepts String for the attribute type" do
expect do
- metadata.attribute("db/mysql/databases", :type => "string")
+ metadata.attribute("db/mysql/databases", type: "string")
end.not_to raise_error
end
it "accepts Array for the attribute type" do
expect do
- metadata.attribute("db/mysql/databases", :type => "array")
+ metadata.attribute("db/mysql/databases", type: "array")
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :type => Array.new)
+ metadata.attribute("db/mysql/databases", type: Array.new)
end.to raise_error(ArgumentError)
end
it "accepts symbol for the attribute type" do
expect do
- metadata.attribute("db/mysql/databases", :type => "symbol")
+ metadata.attribute("db/mysql/databases", type: "symbol")
end.not_to raise_error
end
it "should let type be hash (backwards compatibility only)" do
expect do
- metadata.attribute("db/mysql/databases", :type => "hash")
+ metadata.attribute("db/mysql/databases", type: "hash")
end.not_to raise_error
end
it "should let required be required, recommended or optional" do
expect do
- metadata.attribute("db/mysql/databases", :required => "required")
+ metadata.attribute("db/mysql/databases", required: "required")
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :required => "recommended")
+ metadata.attribute("db/mysql/databases", required: "recommended")
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :required => "optional")
+ metadata.attribute("db/mysql/databases", required: "optional")
end.not_to raise_error
end
it "should convert required true to required" do
expect do
- metadata.attribute("db/mysql/databases", :required => true)
+ metadata.attribute("db/mysql/databases", required: true)
end.not_to raise_error
#attrib = metadata.attributes["db/mysql/databases"][:required].should == "required"
end
it "should convert required false to optional" do
expect do
- metadata.attribute("db/mysql/databases", :required => false)
+ metadata.attribute("db/mysql/databases", required: false)
end.not_to raise_error
#attrib = metadata.attributes["db/mysql/databases"][:required].should == "optional"
end
@@ -575,10 +575,10 @@ describe Chef::Cookbook::Metadata do
it "should make sure recipes is an array" do
expect do
- metadata.attribute("db/mysql/databases", :recipes => [])
+ metadata.attribute("db/mysql/databases", recipes: [])
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :required => Hash.new)
+ metadata.attribute("db/mysql/databases", required: Hash.new)
end.to raise_error(ArgumentError)
end
@@ -589,57 +589,57 @@ describe Chef::Cookbook::Metadata do
it "should allow the default value to be a string, array, hash, boolean or numeric" do
expect do
- metadata.attribute("db/mysql/databases", :default => [])
+ metadata.attribute("db/mysql/databases", default: [])
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :default => {})
+ metadata.attribute("db/mysql/databases", default: {})
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :default => "alice in chains")
+ metadata.attribute("db/mysql/databases", default: "alice in chains")
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :default => 1337)
+ metadata.attribute("db/mysql/databases", default: 1337)
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :default => true)
+ metadata.attribute("db/mysql/databases", default: true)
end.not_to raise_error
expect do
- metadata.attribute("db/mysql/databases", :required => :not_gonna_do_it)
+ metadata.attribute("db/mysql/databases", required: :not_gonna_do_it)
end.to raise_error(ArgumentError)
end
it "should limit the types allowed in the choice array" do
options = {
- :type => "string",
- :choice => %w{test1 test2},
- :default => "test1",
+ type: "string",
+ choice: %w{test1 test2},
+ default: "test1",
}
expect do
metadata.attribute("test_cookbook/test", options)
end.not_to raise_error
options = {
- :type => "boolean",
- :choice => [ true, false ],
- :default => true,
+ type: "boolean",
+ choice: [ true, false ],
+ default: true,
}
expect do
metadata.attribute("test_cookbook/test", options)
end.not_to raise_error
options = {
- :type => "numeric",
- :choice => [ 1337, 420 ],
- :default => 1337,
+ type: "numeric",
+ choice: [ 1337, 420 ],
+ default: 1337,
}
expect do
metadata.attribute("test_cookbook/test", options)
end.not_to raise_error
options = {
- :type => "numeric",
- :choice => [ true, "false" ],
- :default => false,
+ type: "numeric",
+ choice: [ true, "false" ],
+ default: false,
}
expect do
metadata.attribute("test_cookbook/test", options)
@@ -649,15 +649,15 @@ describe Chef::Cookbook::Metadata do
it "should error if default used with calculated" do
expect do
attrs = {
- :calculated => true,
- :default => [ "I thought you said calculated" ],
+ calculated: true,
+ default: [ "I thought you said calculated" ],
}
metadata.attribute("db/mysql/databases", attrs)
end.to raise_error(ArgumentError)
expect do
attrs = {
- :calculated => true,
- :default => "I thought you said calculated",
+ calculated: true,
+ default: "I thought you said calculated",
}
metadata.attribute("db/mysql/databases", attrs)
end.to raise_error(ArgumentError)
@@ -666,15 +666,15 @@ describe Chef::Cookbook::Metadata do
it "should allow a default that is a choice" do
expect do
attrs = {
- :choice => %w{a b c},
- :default => "b",
+ choice: %w{a b c},
+ default: "b",
}
metadata.attribute("db/mysql/databases", attrs)
end.not_to raise_error
expect do
attrs = {
- :choice => %w{a b c d e},
- :default => %w{b d},
+ choice: %w{a b c d e},
+ default: %w{b d},
}
metadata.attribute("db/mysql/databases", attrs)
end.not_to raise_error
@@ -683,15 +683,15 @@ describe Chef::Cookbook::Metadata do
it "should error if default is not a choice" do
expect do
attrs = {
- :choice => %w{a b c},
- :default => "d",
+ choice: %w{a b c},
+ default: "d",
}
metadata.attribute("db/mysql/databases", attrs)
end.to raise_error(ArgumentError)
expect do
attrs = {
- :choice => %w{a b c d e},
- :default => %w{b z},
+ choice: %w{a b c d e},
+ default: %w{b z},
}
metadata.attribute("db/mysql/databases", attrs)
end.to raise_error(ArgumentError)
@@ -743,7 +743,7 @@ describe Chef::Cookbook::Metadata do
metadata.provides "foo(:bar, :baz)"
metadata.recipe "test_cookbook::enlighten", "is your buddy"
metadata.attribute "bizspark/has_login",
- :display_name => "You have nothing"
+ display_name: "You have nothing"
metadata.version "1.2.3"
metadata.gem "foo", "~> 1.2"
metadata.gem "bar", ">= 2.2", "< 4.0"
diff --git a/spec/unit/cookbook/synchronizer_spec.rb b/spec/unit/cookbook/synchronizer_spec.rb
index 1e6c9ef48c..cabcb57ea4 100644
--- a/spec/unit/cookbook/synchronizer_spec.rb
+++ b/spec/unit/cookbook/synchronizer_spec.rb
@@ -198,22 +198,22 @@ describe Chef::CookbookSynchronizer do
let(:cookbook_a_default_recipe_tempfile) do
double("Tempfile for cookbook_a default.rb recipe",
- :path => "/tmp/cookbook_a_recipes_default_rb")
+ path: "/tmp/cookbook_a_recipes_default_rb")
end
let(:cookbook_a_default_attribute_tempfile) do
double("Tempfile for cookbook_a default.rb attr file",
- :path => "/tmp/cookbook_a_attributes_default_rb")
+ path: "/tmp/cookbook_a_attributes_default_rb")
end
let(:cookbook_a_file_default_tempfile) do
double("Tempfile for cookbook_a megaman.conf file",
- :path => "/tmp/cookbook_a_file_default_tempfile")
+ path: "/tmp/cookbook_a_file_default_tempfile")
end
let(:cookbook_a_template_default_tempfile) do
double("Tempfile for cookbook_a apache.conf.erb template",
- :path => "/tmp/cookbook_a_template_default_tempfile")
+ path: "/tmp/cookbook_a_template_default_tempfile")
end
def setup_common_files_missing_expectations
diff --git a/spec/unit/cookbook_site_streaming_uploader_spec.rb b/spec/unit/cookbook_site_streaming_uploader_spec.rb
index 0e9c277b11..87ff7abdd7 100644
--- a/spec/unit/cookbook_site_streaming_uploader_spec.rb
+++ b/spec/unit/cookbook_site_streaming_uploader_spec.rb
@@ -102,22 +102,22 @@ describe Chef::CookbookSiteStreamingUploader do
it "should be able to receive files to attach as argument" do
Chef::CookbookSiteStreamingUploader.make_request(:put, @uri, "bill", @secret_filename, {
- :myfile => File.new(File.join(CHEF_SPEC_DATA, "config.rb")), # a dummy file
+ myfile: File.new(File.join(CHEF_SPEC_DATA, "config.rb")), # a dummy file
})
end
it "should be able to receive strings to attach as argument" do
Chef::CookbookSiteStreamingUploader.make_request(:put, @uri, "bill", @secret_filename, {
- :mystring => "Lorem ipsum",
+ mystring: "Lorem ipsum",
})
end
it "should be able to receive strings and files as argument at the same time" do
Chef::CookbookSiteStreamingUploader.make_request(:put, @uri, "bill", @secret_filename, {
- :myfile1 => File.new(File.join(CHEF_SPEC_DATA, "config.rb")),
- :mystring1 => "Lorem ipsum",
- :myfile2 => File.new(File.join(CHEF_SPEC_DATA, "config.rb")),
- :mystring2 => "Dummy text",
+ myfile1: File.new(File.join(CHEF_SPEC_DATA, "config.rb")),
+ mystring1: "Lorem ipsum",
+ myfile2: File.new(File.join(CHEF_SPEC_DATA, "config.rb")),
+ mystring2: "Dummy text",
})
end
diff --git a/spec/unit/cookbook_uploader_spec.rb b/spec/unit/cookbook_uploader_spec.rb
index 2c36c2c9c7..0c4fb6cda7 100644
--- a/spec/unit/cookbook_uploader_spec.rb
+++ b/spec/unit/cookbook_uploader_spec.rb
@@ -86,7 +86,7 @@ describe Chef::CookbookUploader do
def expect_sandbox_create
expect(http_client).to receive(:post).
- with("sandboxes", { :checksums => checksums_set }).
+ with("sandboxes", { checksums: checksums_set }).
and_return(sandbox_response)
end
@@ -111,7 +111,7 @@ describe Chef::CookbookUploader do
end
def expect_sandbox_commit
- expect(http_client).to receive(:put).with(sandbox_commit_uri, { :is_completed => true })
+ expect(http_client).to receive(:put).with(sandbox_commit_uri, { is_completed: true })
end
def expect_cookbook_create
diff --git a/spec/unit/cookbook_version_file_specificity_spec.rb b/spec/unit/cookbook_version_file_specificity_spec.rb
index ba7aaa59f5..b7d5a9b288 100644
--- a/spec/unit/cookbook_version_file_specificity_spec.rb
+++ b/spec/unit/cookbook_version_file_specificity_spec.rb
@@ -27,202 +27,202 @@ describe Chef::CookbookVersion, "file specificity" do
[
# afile.rb
{
- :name => "files/afile.rb",
- :path => "files/host-examplehost.example.org/afile.rb",
- :full_path => "/cookbook-folder/files/host-examplehost.example.org/afile.rb",
- :checksum => "csum-host",
- :specificity => "host-examplehost.example.org",
+ name: "files/afile.rb",
+ path: "files/host-examplehost.example.org/afile.rb",
+ full_path: "/cookbook-folder/files/host-examplehost.example.org/afile.rb",
+ checksum: "csum-host",
+ specificity: "host-examplehost.example.org",
},
{
- :name => "files/afile.rb",
- :path => "files/ubuntu-9.10/afile.rb",
- :full_path => "/cookbook-folder/files/ubuntu-9.10/afile.rb",
- :checksum => "csum-platver-full",
- :specificity => "ubuntu-9.10",
+ name: "files/afile.rb",
+ path: "files/ubuntu-9.10/afile.rb",
+ full_path: "/cookbook-folder/files/ubuntu-9.10/afile.rb",
+ checksum: "csum-platver-full",
+ specificity: "ubuntu-9.10",
},
{
- :name => "files/afile.rb",
- :path => "files/newubuntu-9/afile.rb",
- :full_path => "/cookbook-folder/files/newubuntu-9/afile.rb",
- :checksum => "csum-platver-partial",
- :specificity => "newubuntu-9",
+ name: "files/afile.rb",
+ path: "files/newubuntu-9/afile.rb",
+ full_path: "/cookbook-folder/files/newubuntu-9/afile.rb",
+ checksum: "csum-platver-partial",
+ specificity: "newubuntu-9",
},
{
- :name => "files/afile.rb",
- :path => "files/ubuntu/afile.rb",
- :full_path => "/cookbook-folder/files/ubuntu/afile.rb",
- :checksum => "csum-plat",
- :specificity => "ubuntu",
+ name: "files/afile.rb",
+ path: "files/ubuntu/afile.rb",
+ full_path: "/cookbook-folder/files/ubuntu/afile.rb",
+ checksum: "csum-plat",
+ specificity: "ubuntu",
},
{
- :name => "files/afile.rb",
- :path => "files/default/afile.rb",
- :full_path => "/cookbook-folder/files/default/afile.rb",
- :checksum => "csum-default",
- :specificity => "default",
+ name: "files/afile.rb",
+ path: "files/default/afile.rb",
+ full_path: "/cookbook-folder/files/default/afile.rb",
+ checksum: "csum-default",
+ specificity: "default",
},
# for different/odd platform_versions
{
- :name => "files/bfile.rb",
- :path => "files/fakeos-2.0.rc.1/bfile.rb",
- :full_path => "/cookbook-folder/files/fakeos-2.0.rc.1/bfile.rb",
- :checksum => "csum2-platver-full",
- :specificity => "fakeos-2.0.rc.1",
+ name: "files/bfile.rb",
+ path: "files/fakeos-2.0.rc.1/bfile.rb",
+ full_path: "/cookbook-folder/files/fakeos-2.0.rc.1/bfile.rb",
+ checksum: "csum2-platver-full",
+ specificity: "fakeos-2.0.rc.1",
},
{
- :name => "files/bfile.rb",
- :path => "files/newfakeos-2.0.rc/bfile.rb",
- :full_path => "/cookbook-folder/files/newfakeos-2.0.rc/bfile.rb",
- :checksum => "csum2-platver-partial",
- :specificity => "newfakeos-2.0.rc",
+ name: "files/bfile.rb",
+ path: "files/newfakeos-2.0.rc/bfile.rb",
+ full_path: "/cookbook-folder/files/newfakeos-2.0.rc/bfile.rb",
+ checksum: "csum2-platver-partial",
+ specificity: "newfakeos-2.0.rc",
},
{
- :name => "files/bfile.rb",
- :path => "files/fakeos-maple tree/bfile.rb",
- :full_path => "/cookbook-folder/files/fakeos-maple tree/bfile.rb",
- :checksum => "csum3-platver-full",
- :specificity => "maple tree",
+ name: "files/bfile.rb",
+ path: "files/fakeos-maple tree/bfile.rb",
+ full_path: "/cookbook-folder/files/fakeos-maple tree/bfile.rb",
+ checksum: "csum3-platver-full",
+ specificity: "maple tree",
},
{
- :name => "files/bfile.rb",
- :path => "files/fakeos-1/bfile.rb",
- :full_path => "/cookbook-folder/files/fakeos-1/bfile.rb",
- :checksum => "csum4-platver-full",
- :specificity => "fakeos-1",
+ name: "files/bfile.rb",
+ path: "files/fakeos-1/bfile.rb",
+ full_path: "/cookbook-folder/files/fakeos-1/bfile.rb",
+ checksum: "csum4-platver-full",
+ specificity: "fakeos-1",
},
# directory adirectory
{
- :name => "files/anotherfile1.rb",
- :path => "files/host-examplehost.example.org/adirectory/anotherfile1.rb.host",
- :full_path => "/cookbook-folder/files/host-examplehost.example.org/adirectory/anotherfile1.rb.host",
- :checksum => "csum-host-1",
- :specificity => "host-examplehost.example.org",
+ name: "files/anotherfile1.rb",
+ path: "files/host-examplehost.example.org/adirectory/anotherfile1.rb.host",
+ full_path: "/cookbook-folder/files/host-examplehost.example.org/adirectory/anotherfile1.rb.host",
+ checksum: "csum-host-1",
+ specificity: "host-examplehost.example.org",
},
{
- :name => "files/anotherfile2.rb",
- :path => "files/host-examplehost.example.org/adirectory/anotherfile2.rb.host",
- :full_path => "/cookbook-folder/files/host-examplehost.example.org/adirectory/anotherfile2.rb.host",
- :checksum => "csum-host-2",
- :specificity => "host-examplehost.example.org",
+ name: "files/anotherfile2.rb",
+ path: "files/host-examplehost.example.org/adirectory/anotherfile2.rb.host",
+ full_path: "/cookbook-folder/files/host-examplehost.example.org/adirectory/anotherfile2.rb.host",
+ checksum: "csum-host-2",
+ specificity: "host-examplehost.example.org",
},
{
- :name => "files/anotherfile1.rb",
- :path => "files/ubuntu-9.10/adirectory/anotherfile1.rb.platform-full-version",
- :full_path => "/cookbook-folder/files/ubuntu-9.10/adirectory/anotherfile1.rb.platform-full-version",
- :checksum => "csum-platver-full-1",
- :specificity => "ubuntu-9.10",
+ name: "files/anotherfile1.rb",
+ path: "files/ubuntu-9.10/adirectory/anotherfile1.rb.platform-full-version",
+ full_path: "/cookbook-folder/files/ubuntu-9.10/adirectory/anotherfile1.rb.platform-full-version",
+ checksum: "csum-platver-full-1",
+ specificity: "ubuntu-9.10",
},
{
- :name => "files/anotherfile2.rb",
- :path => "files/ubuntu-9.10/adirectory/anotherfile2.rb.platform-full-version",
- :full_path => "/cookbook-folder/files/ubuntu-9.10/adirectory/anotherfile2.rb.platform-full-version",
- :checksum => "csum-platver-full-2",
- :specificity => "ubuntu-9.10",
+ name: "files/anotherfile2.rb",
+ path: "files/ubuntu-9.10/adirectory/anotherfile2.rb.platform-full-version",
+ full_path: "/cookbook-folder/files/ubuntu-9.10/adirectory/anotherfile2.rb.platform-full-version",
+ checksum: "csum-platver-full-2",
+ specificity: "ubuntu-9.10",
},
{
- :name => "files/anotherfile1.rb",
- :path => "files/newubuntu-9/adirectory/anotherfile1.rb.platform-partial-version",
- :full_path => "/cookbook-folder/files/newubuntu-9/adirectory/anotherfile1.rb.platform-partial-version",
- :checksum => "csum-platver-partial-1",
- :specificity => "newubuntu-9",
+ name: "files/anotherfile1.rb",
+ path: "files/newubuntu-9/adirectory/anotherfile1.rb.platform-partial-version",
+ full_path: "/cookbook-folder/files/newubuntu-9/adirectory/anotherfile1.rb.platform-partial-version",
+ checksum: "csum-platver-partial-1",
+ specificity: "newubuntu-9",
},
{
- :name => "files/anotherfile2.rb",
- :path => "files/newubuntu-9/adirectory/anotherfile2.rb.platform-partial-version",
- :full_path => "/cookbook-folder/files/newubuntu-9/adirectory/anotherfile2.rb.platform-partial-version",
- :checksum => "csum-platver-partial-2",
- :specificity => "nweubuntu-9",
+ name: "files/anotherfile2.rb",
+ path: "files/newubuntu-9/adirectory/anotherfile2.rb.platform-partial-version",
+ full_path: "/cookbook-folder/files/newubuntu-9/adirectory/anotherfile2.rb.platform-partial-version",
+ checksum: "csum-platver-partial-2",
+ specificity: "nweubuntu-9",
},
{
- :name => "files/anotherfile1.rb",
- :path => "files/ubuntu/adirectory/anotherfile1.rb.platform",
- :full_path => "/cookbook-folder/files/ubuntu/adirectory/anotherfile1.rb.platform",
- :checksum => "csum-plat-1",
- :specificity => "ubuntu",
+ name: "files/anotherfile1.rb",
+ path: "files/ubuntu/adirectory/anotherfile1.rb.platform",
+ full_path: "/cookbook-folder/files/ubuntu/adirectory/anotherfile1.rb.platform",
+ checksum: "csum-plat-1",
+ specificity: "ubuntu",
},
{
- :name => "files/anotherfile2.rb",
- :path => "files/ubuntu/adirectory/anotherfile2.rb.platform",
- :full_path => "/cookbook-folder/files/ubuntu/adirectory/anotherfile2.rb.platform",
- :checksum => "csum-plat-2",
- :specificity => "ubuntu",
+ name: "files/anotherfile2.rb",
+ path: "files/ubuntu/adirectory/anotherfile2.rb.platform",
+ full_path: "/cookbook-folder/files/ubuntu/adirectory/anotherfile2.rb.platform",
+ checksum: "csum-plat-2",
+ specificity: "ubuntu",
},
{
- :name => "files/anotherfile1.rb",
- :path => "files/default/adirectory/anotherfile1.rb.default",
- :full_path => "/cookbook-folder/files/default/adirectory/anotherfile1.rb.default",
- :checksum => "csum-default-1",
- :specificity => "default",
+ name: "files/anotherfile1.rb",
+ path: "files/default/adirectory/anotherfile1.rb.default",
+ full_path: "/cookbook-folder/files/default/adirectory/anotherfile1.rb.default",
+ checksum: "csum-default-1",
+ specificity: "default",
},
{
- :name => "files/anotherfile2.rb",
- :path => "files/default/adirectory/anotherfile2.rb.default",
- :full_path => "/cookbook-folder/files/default/adirectory/anotherfile2.rb.default",
- :checksum => "csum-default-2",
- :specificity => "default",
+ name: "files/anotherfile2.rb",
+ path: "files/default/adirectory/anotherfile2.rb.default",
+ full_path: "/cookbook-folder/files/default/adirectory/anotherfile2.rb.default",
+ checksum: "csum-default-2",
+ specificity: "default",
},
# for different/odd platform_versions
{
- :name => "files/anotherfile1.rb",
- :path => "files/fakeos-2.0.rc.1/adirectory/anotherfile1.rb.platform-full-version",
- :full_path => "/cookbook-folder/files/fakeos-2.0.rc.1/adirectory/anotherfile1.rb.platform-full-version",
- :checksum => "csum2-platver-full-1",
- :specificity => "fakeos-2.0.rc.1",
+ name: "files/anotherfile1.rb",
+ path: "files/fakeos-2.0.rc.1/adirectory/anotherfile1.rb.platform-full-version",
+ full_path: "/cookbook-folder/files/fakeos-2.0.rc.1/adirectory/anotherfile1.rb.platform-full-version",
+ checksum: "csum2-platver-full-1",
+ specificity: "fakeos-2.0.rc.1",
},
{
- :name => "files/anotherfile2.rb",
- :path => "files/fakeos-2.0.rc.1/adirectory/anotherfile2.rb.platform-full-version",
- :full_path => "/cookbook-folder/files/fakeos-2.0.rc.1/adirectory/anotherfile2.rb.platform-full-version",
- :checksum => "csum2-platver-full-2",
- :specificity => "fakeos-2.0.rc.1",
+ name: "files/anotherfile2.rb",
+ path: "files/fakeos-2.0.rc.1/adirectory/anotherfile2.rb.platform-full-version",
+ full_path: "/cookbook-folder/files/fakeos-2.0.rc.1/adirectory/anotherfile2.rb.platform-full-version",
+ checksum: "csum2-platver-full-2",
+ specificity: "fakeos-2.0.rc.1",
},
{
- :name => "files/anotherfile1.rb",
- :path => "files/newfakeos-2.0.rc.1/adirectory/anotherfile1.rb.platform-partial-version",
- :full_path => "/cookbook-folder/files/newfakeos-2.0.rc.1/adirectory/anotherfile1.rb.platform-partial-version",
- :checksum => "csum2-platver-partial-1",
- :specificity => "newfakeos-2.0.rc",
+ name: "files/anotherfile1.rb",
+ path: "files/newfakeos-2.0.rc.1/adirectory/anotherfile1.rb.platform-partial-version",
+ full_path: "/cookbook-folder/files/newfakeos-2.0.rc.1/adirectory/anotherfile1.rb.platform-partial-version",
+ checksum: "csum2-platver-partial-1",
+ specificity: "newfakeos-2.0.rc",
},
{
- :name => "files/anotherfile2.rb",
- :path => "files/newfakeos-2.0.rc.1/adirectory/anotherfile2.rb.platform-partial-version",
- :full_path => "/cookbook-folder/files/newfakeos-2.0.rc.1/adirectory/anotherfile2.rb.platform-partial-version",
- :checksum => "csum2-platver-partial-2",
- :specificity => "newfakeos-2.0.rc",
+ name: "files/anotherfile2.rb",
+ path: "files/newfakeos-2.0.rc.1/adirectory/anotherfile2.rb.platform-partial-version",
+ full_path: "/cookbook-folder/files/newfakeos-2.0.rc.1/adirectory/anotherfile2.rb.platform-partial-version",
+ checksum: "csum2-platver-partial-2",
+ specificity: "newfakeos-2.0.rc",
},
{
- :name => "files/anotherfile1.rb",
- :path => "files/fakeos-maple tree/adirectory/anotherfile1.rb.platform-full-version",
- :full_path => "/cookbook-folder/files/fakeos-maple tree/adirectory/anotherfile1.rb.platform-full-version",
- :checksum => "csum3-platver-full-1",
- :specificity => "fakeos-maple tree",
+ name: "files/anotherfile1.rb",
+ path: "files/fakeos-maple tree/adirectory/anotherfile1.rb.platform-full-version",
+ full_path: "/cookbook-folder/files/fakeos-maple tree/adirectory/anotherfile1.rb.platform-full-version",
+ checksum: "csum3-platver-full-1",
+ specificity: "fakeos-maple tree",
},
{
- :name => "files/anotherfile2.rb",
- :path => "files/fakeos-maple tree/adirectory/anotherfile2.rb.platform-full-version",
- :full_path => "/cookbook-folder/files/fakeos-maple tree/adirectory/anotherfile2.rb.platform-full-version",
- :checksum => "csum3-platver-full-2",
- :specificity => "fakeos-maple tree",
+ name: "files/anotherfile2.rb",
+ path: "files/fakeos-maple tree/adirectory/anotherfile2.rb.platform-full-version",
+ full_path: "/cookbook-folder/files/fakeos-maple tree/adirectory/anotherfile2.rb.platform-full-version",
+ checksum: "csum3-platver-full-2",
+ specificity: "fakeos-maple tree",
},
{
- :name => "files/anotherfile1.rb",
- :path => "files/fakeos-1/adirectory/anotherfile1.rb.platform-full-version",
- :full_path => "/cookbook-folder/files/fakeos-1/adirectory/anotherfile1.rb.platform-full-version",
- :checksum => "csum4-platver-full-1",
- :specificity => "fakeos-1",
+ name: "files/anotherfile1.rb",
+ path: "files/fakeos-1/adirectory/anotherfile1.rb.platform-full-version",
+ full_path: "/cookbook-folder/files/fakeos-1/adirectory/anotherfile1.rb.platform-full-version",
+ checksum: "csum4-platver-full-1",
+ specificity: "fakeos-1",
},
{
- :name => "files/anotherfile2.rb",
- :path => "files/fakeos-1/adirectory/anotherfile2.rb.platform-full-version",
- :full_path => "/cookbook-folder/files/fakeos-1/adirectory/anotherfile2.rb.platform-full-version",
- :checksum => "csum4-platver-full-2",
- :specificity => "fakeos-1",
+ name: "files/anotherfile2.rb",
+ path: "files/fakeos-1/adirectory/anotherfile2.rb.platform-full-version",
+ full_path: "/cookbook-folder/files/fakeos-1/adirectory/anotherfile2.rb.platform-full-version",
+ checksum: "csum4-platver-full-2",
+ specificity: "fakeos-1",
},
],
}
diff --git a/spec/unit/daemon_spec.rb b/spec/unit/daemon_spec.rb
index 02736a1daf..ffcdb71259 100644
--- a/spec/unit/daemon_spec.rb
+++ b/spec/unit/daemon_spec.rb
@@ -25,7 +25,7 @@ describe Chef::Daemon do
before do
if windows?
mock_struct = #Struct::Passwd.new(nil, nil, 111, 111)
- mock_struct = OpenStruct.new(:uid => 2342, :gid => 2342)
+ mock_struct = OpenStruct.new(uid: 2342, gid: 2342)
allow(Etc).to receive(:getpwnam).and_return mock_struct
allow(Etc).to receive(:getgrnam).and_return mock_struct
# mock unimplemented methods
@@ -126,8 +126,8 @@ describe Chef::Daemon do
allow(Process::UID).to receive(:change_privilege).and_return(nil)
allow(Process::GID).to receive(:change_privilege).and_return(nil)
- @pw_user = double("Struct::Passwd", :uid => 501)
- @pw_group = double("Struct::Group", :gid => 20)
+ @pw_user = double("Struct::Passwd", uid: 501)
+ @pw_group = double("Struct::Group", gid: 20)
allow(Process).to receive(:initgroups).and_return(true)
diff --git a/spec/unit/data_bag_item_spec.rb b/spec/unit/data_bag_item_spec.rb
index 7094a7b1f7..a32ba147f8 100644
--- a/spec/unit/data_bag_item_spec.rb
+++ b/spec/unit/data_bag_item_spec.rb
@@ -53,7 +53,7 @@ describe Chef::DataBagItem do
end
it "should let you set the raw_data with a hash containing symbols" do
- expect { data_bag_item.raw_data = { :id => "octahedron" } }.not_to raise_error
+ expect { data_bag_item.raw_data = { id: "octahedron" } }.not_to raise_error
end
it "should let you set the raw_data from a mash" do
@@ -297,7 +297,7 @@ describe Chef::DataBagItem do
end
it "should create if the item is not found" do
- exception = double("404 error", :code => "404")
+ exception = double("404 error", code: "404")
expect(server).to receive(:put).and_raise(Net::HTTPServerException.new("foo", exception))
expect(server).to receive(:post).with("data/books", data_bag_item)
data_bag_item.save
diff --git a/spec/unit/data_bag_spec.rb b/spec/unit/data_bag_spec.rb
index cadd60936e..f20148de72 100644
--- a/spec/unit/data_bag_spec.rb
+++ b/spec/unit/data_bag_spec.rb
@@ -88,7 +88,7 @@ describe Chef::DataBag do
end
it "should silently proceed when the data bag already exists" do
- exception = double("409 error", :code => "409")
+ exception = double("409 error", code: "409")
expect(@rest).to receive(:post).and_raise(Net::HTTPServerException.new("foo", exception))
@data_bag.save
end
diff --git a/spec/unit/data_collector/resource_report_spec.rb b/spec/unit/data_collector/resource_report_spec.rb
index 278e94b53b..1a5eab796e 100644
--- a/spec/unit/data_collector/resource_report_spec.rb
+++ b/spec/unit/data_collector/resource_report_spec.rb
@@ -133,7 +133,7 @@ describe Chef::DataCollector::ResourceReport do
}
end
let(:conditional) do
- double("Chef::Resource::Conditional", :to_text => "because")
+ double("Chef::Resource::Conditional", to_text: "because")
end
it "should handle any Exception and throw a helpful message by mocking the identity" do
diff --git a/spec/unit/data_collector_spec.rb b/spec/unit/data_collector_spec.rb
index f8a9e374e5..87729d8652 100644
--- a/spec/unit/data_collector_spec.rb
+++ b/spec/unit/data_collector_spec.rb
@@ -805,14 +805,14 @@ describe Chef::DataCollector::Reporter do
context "when valid output_locations are provided" do
it "does not raise an exception" do
expect(reporter).to receive(:open).with("data_collection.json", "a")
- Chef::Config[:data_collector][:output_locations] = { :urls => ["http://data_collector"], :files => ["data_collection.json"] }
+ Chef::Config[:data_collector][:output_locations] = { urls: ["http://data_collector"], files: ["data_collection.json"] }
expect { reporter.send(:validate_data_collector_output_locations!) }.not_to raise_error(Chef::Exceptions::ConfigurationError)
end
end
context "when output_locations contains an invalid URI" do
it "raises an exception" do
- Chef::Config[:data_collector][:output_locations] = { :urls => ["this is not a url"], :files => ["/tmp/data_collection.json"] }
+ Chef::Config[:data_collector][:output_locations] = { urls: ["this is not a url"], files: ["/tmp/data_collection.json"] }
expect { reporter.send(:validate_data_collector_output_locations!) }.to raise_error(Chef::Exceptions::ConfigurationError)
end
end
diff --git a/spec/unit/dsl/audit_spec.rb b/spec/unit/dsl/audit_spec.rb
index 42e543fdb2..e24fbc4589 100644
--- a/spec/unit/dsl/audit_spec.rb
+++ b/spec/unit/dsl/audit_spec.rb
@@ -12,7 +12,7 @@ end
describe Chef::DSL::Audit do
let(:auditor) { AuditDSLTester.new("cookbook_name", "recipe_name", run_context) }
- let(:run_context) { instance_double(Chef::RunContext, :audits => audits, :cookbook_collection => cookbook_collection) }
+ let(:run_context) { instance_double(Chef::RunContext, audits: audits, cookbook_collection: cookbook_collection) }
let(:audits) { {} }
let(:cookbook_collection) { {} }
diff --git a/spec/unit/dsl/platform_introspection_spec.rb b/spec/unit/dsl/platform_introspection_spec.rb
index fd1f9b23b5..51123ba930 100644
--- a/spec/unit/dsl/platform_introspection_spec.rb
+++ b/spec/unit/dsl/platform_introspection_spec.rb
@@ -39,8 +39,8 @@ end
describe Chef::DSL::PlatformIntrospection::PlatformDependentValue do
before do
platform_hash = {
- :openbsd => { :default => "free, functional, secure" },
- [:redhat, :centos, :fedora, :scientific] => { :default => '"stable"' },
+ :openbsd => { default: "free, functional, secure" },
+ [:redhat, :centos, :fedora, :scientific] => { default: '"stable"' },
:ubuntu => { "10.04" => "using upstart more", :default => "using init more" },
:default => "bork da bork",
}
@@ -48,24 +48,24 @@ describe Chef::DSL::PlatformIntrospection::PlatformDependentValue do
end
it "returns the default value when the platform doesn't match" do
- expect(@platform_specific_value.value_for_node(:platform => :dos)).to eq("bork da bork")
+ expect(@platform_specific_value.value_for_node(platform: :dos)).to eq("bork da bork")
end
it "returns a value for a platform set as a group" do
- expect(@platform_specific_value.value_for_node(:platform => :centos)).to eq('"stable"')
+ expect(@platform_specific_value.value_for_node(platform: :centos)).to eq('"stable"')
end
it "returns a value for the platform when it was set as a symbol but fetched as a string" do
- expect(@platform_specific_value.value_for_node(:platform => "centos")).to eq('"stable"')
+ expect(@platform_specific_value.value_for_node(platform: "centos")).to eq('"stable"')
end
it "returns a value for a specific platform version" do
- node = { :platform => "ubuntu", :platform_version => "10.04" }
+ node = { platform: "ubuntu", platform_version: "10.04" }
expect(@platform_specific_value.value_for_node(node)).to eq("using upstart more")
end
it "returns a platform-default value if the platform version doesn't match an explicit one" do
- node = { :platform => "ubuntu", :platform_version => "9.10" }
+ node = { platform: "ubuntu", platform_version: "9.10" }
expect(@platform_specific_value.value_for_node(node)).to eq("using init more")
end
@@ -73,11 +73,11 @@ describe Chef::DSL::PlatformIntrospection::PlatformDependentValue do
# this matches the behavior in the original implementation.
# whether or not it's correct is another matter.
platform_specific_value = Chef::DSL::PlatformIntrospection::PlatformDependentValue.new({})
- expect(platform_specific_value.value_for_node(:platform => "foo")).to be_nil
+ expect(platform_specific_value.value_for_node(platform: "foo")).to be_nil
end
it "raises an argument error if the platform hash is not correctly structured" do
- bad_hash = { :ubuntu => :foo } # should be :ubuntu => {:default => 'foo'}
+ bad_hash = { ubuntu: :foo } # should be :ubuntu => {:default => 'foo'}
expect { Chef::DSL::PlatformIntrospection::PlatformDependentValue.new(bad_hash) }.to raise_error(ArgumentError)
end
@@ -98,32 +98,32 @@ describe Chef::DSL::PlatformIntrospection::PlatformFamilyDependentValue do
end
it "returns the default value when the platform family doesn't match" do
- expect(@platform_family_value.value_for_node(:platform_family => :os2)).to eq("default value")
+ expect(@platform_family_value.value_for_node(platform_family: :os2)).to eq("default value")
end
it "returns a value for the platform family when it was set as a string but fetched as a symbol" do
- expect(@platform_family_value.value_for_node(:platform_family => :debian)).to eq("debian value")
+ expect(@platform_family_value.value_for_node(platform_family: :debian)).to eq("debian value")
end
it "returns a value for the platform family when it was set as a symbol but fetched as a string" do
- expect(@platform_family_value.value_for_node(:platform_family => "gentoo")).to eq("gentoo value")
+ expect(@platform_family_value.value_for_node(platform_family: "gentoo")).to eq("gentoo value")
end
it "returns an array value stored for a platform family" do
- expect(@platform_family_value.value_for_node(:platform_family => "suse")).to eq(@array_values)
+ expect(@platform_family_value.value_for_node(platform_family: "suse")).to eq(@array_values)
end
it "returns a value for the platform family when it was set within an array hash key as a symbol" do
- expect(@platform_family_value.value_for_node(:platform_family => :rhel)).to eq("redhatty value")
+ expect(@platform_family_value.value_for_node(platform_family: :rhel)).to eq("redhatty value")
end
it "returns a value for the platform family when it was set within an array hash key as a string" do
- expect(@platform_family_value.value_for_node(:platform_family => "fedora")).to eq("redhatty value")
+ expect(@platform_family_value.value_for_node(platform_family: "fedora")).to eq("redhatty value")
end
it "returns nil if there is no default and no platforms match" do
platform_specific_value = Chef::DSL::PlatformIntrospection::PlatformFamilyDependentValue.new({})
- expect(platform_specific_value.value_for_node(:platform_family => "foo")).to be_nil
+ expect(platform_specific_value.value_for_node(platform_family: "foo")).to be_nil
end
end
diff --git a/spec/unit/dsl/reboot_pending_spec.rb b/spec/unit/dsl/reboot_pending_spec.rb
index 2a12e27610..4f9e0b764b 100644
--- a/spec/unit/dsl/reboot_pending_spec.rb
+++ b/spec/unit/dsl/reboot_pending_spec.rb
@@ -36,7 +36,7 @@ describe Chef::DSL::RebootPending do
end
it 'should return true if "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations" exists' do
- allow(recipe).to receive(:registry_value_exists?).with('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { :name => "PendingFileRenameOperations" }).and_return(true)
+ allow(recipe).to receive(:registry_value_exists?).with('HKLM\SYSTEM\CurrentControlSet\Control\Session Manager', { name: "PendingFileRenameOperations" }).and_return(true)
expect(recipe.reboot_pending?).to be_truthy
end
diff --git a/spec/unit/environment_spec.rb b/spec/unit/environment_spec.rb
index c604148ec8..a342d6d7cd 100644
--- a/spec/unit/environment_spec.rb
+++ b/spec/unit/environment_spec.rb
@@ -73,12 +73,12 @@ describe Chef::Environment do
describe "default attributes" do
it "should let you set the attributes hash explicitly" do
- expect(@environment.default_attributes({ :one => "two" })).to eq({ :one => "two" })
+ expect(@environment.default_attributes({ one: "two" })).to eq({ one: "two" })
end
it "should let you return the attributes hash" do
- @environment.default_attributes({ :one => "two" })
- expect(@environment.default_attributes).to eq({ :one => "two" })
+ @environment.default_attributes({ one: "two" })
+ expect(@environment.default_attributes).to eq({ one: "two" })
end
it "should throw an ArgumentError if we aren't a kind of hash" do
@@ -88,12 +88,12 @@ describe Chef::Environment do
describe "override attributes" do
it "should let you set the attributes hash explicitly" do
- expect(@environment.override_attributes({ :one => "two" })).to eq({ :one => "two" })
+ expect(@environment.override_attributes({ one: "two" })).to eq({ one: "two" })
end
it "should let you return the attributes hash" do
- @environment.override_attributes({ :one => "two" })
- expect(@environment.override_attributes).to eq({ :one => "two" })
+ @environment.override_attributes({ one: "two" })
+ expect(@environment.override_attributes).to eq({ one: "two" })
end
it "should throw an ArgumentError if we aren't a kind of hash" do
@@ -167,7 +167,7 @@ describe Chef::Environment do
before(:each) do
@environment.name("spec")
@environment.description("Where we run the spec tests")
- @environment.cookbook_versions({ :apt => "= 1.2.3" })
+ @environment.cookbook_versions({ apt: "= 1.2.3" })
@hash = @environment.to_hash
end
@@ -190,7 +190,7 @@ describe Chef::Environment do
before(:each) do
@environment.name("spec")
@environment.description("Where we run the spec tests")
- @environment.cookbook_versions({ :apt => "= 1.2.3" })
+ @environment.cookbook_versions({ apt: "= 1.2.3" })
@json = @environment.to_json
end
@@ -311,17 +311,17 @@ describe Chef::Environment do
end
it "updates the name from parameters[:name]" do
- @environment.update_from_params(:name => "kurrupt")
+ @environment.update_from_params(name: "kurrupt")
expect(@environment.name).to eq("kurrupt")
end
it "validates the name given in the params" do
- expect(@environment.update_from_params(:name => "@$%^&*()")).to be_falsey
+ expect(@environment.update_from_params(name: "@$%^&*()")).to be_falsey
expect(@environment.invalid_fields[:name]).to eq(%q{Option name's value @$%^&*() does not match regular expression /^[\-[:alnum:]_]+$/})
end
it "updates the description from parameters[:description]" do
- @environment.update_from_params(:description => "wow, writing your own object mapper is kinda painful")
+ @environment.update_from_params(description: "wow, writing your own object mapper is kinda painful")
expect(@environment.description).to eq("wow, writing your own object mapper is kinda painful")
end
@@ -329,13 +329,13 @@ describe Chef::Environment do
# NOTE: I'm only choosing this (admittedly weird) structure for the hash b/c the better more obvious
# one, i.e, {:cookbook_version_constraints => {COOKBOOK_NAME => CONSTRAINT}} is difficult to implement
# the way merb does params
- params = { :name => "superbowl", :cookbook_version => { "0" => "apache2 ~> 1.0.0", "1" => "nginx < 2.0.0" } }
+ params = { name: "superbowl", cookbook_version: { "0" => "apache2 ~> 1.0.0", "1" => "nginx < 2.0.0" } }
@environment.update_from_params(params)
expect(@environment.cookbook_versions).to eq({ "apache2" => "~> 1.0.0", "nginx" => "< 2.0.0" })
end
it "validates the cookbook constraints" do
- params = { :cookbook_version => { "0" => "apache2 >>> 1.0.0" } }
+ params = { cookbook_version: { "0" => "apache2 >>> 1.0.0" } }
expect(@environment.update_from_params(params)).to be_falsey
err_msg = @environment.invalid_fields[:cookbook_version]["0"]
expect(err_msg).to eq("apache2 >>> 1.0.0 is not a valid cookbook constraint")
@@ -352,12 +352,12 @@ describe Chef::Environment do
end
it "updates default attributes from a JSON string in params[:attributes]" do
- @environment.update_from_params(:name => "fuuu", :default_attributes => %q|{"fuuu":"RAGE"}|)
+ @environment.update_from_params(name: "fuuu", default_attributes: %q|{"fuuu":"RAGE"}|)
expect(@environment.default_attributes).to eq({ "fuuu" => "RAGE" })
end
it "updates override attributes from a JSON string in params[:attributes]" do
- @environment.update_from_params(:name => "fuuu", :override_attributes => %q|{"foo":"override"}|)
+ @environment.update_from_params(name: "fuuu", override_attributes: %q|{"foo":"override"}|)
expect(@environment.override_attributes).to eq({ "foo" => "override" })
end
@@ -374,7 +374,7 @@ describe Chef::Environment do
describe "list" do
describe "inflated" do
it "should return a hash of environment names and objects" do
- e1 = double("Chef::Environment", :name => "one")
+ e1 = double("Chef::Environment", name: "one")
expect(@query).to receive(:search).with(:environment).and_yield(e1)
r = Chef::Environment.list(true)
expect(r["one"]).to eq(e1)
diff --git a/spec/unit/file_access_control_spec.rb b/spec/unit/file_access_control_spec.rb
index ee806b5c3a..de23fea1f3 100644
--- a/spec/unit/file_access_control_spec.rb
+++ b/spec/unit/file_access_control_spec.rb
@@ -36,7 +36,7 @@ describe Chef::FileAccessControl do
@run_context = Chef::RunContext.new(@node, {}, @events)
@current_resource = Chef::Resource::File.new("/tmp/different_file.txt")
@provider_requirements = Chef::Provider::ResourceRequirements.new(@resource, @run_context)
- @provider = double("File provider", :requirements => @provider_requirements, :manage_symlink_access? => false)
+ @provider = double("File provider", requirements: @provider_requirements, manage_symlink_access?: false)
@fac = Chef::FileAccessControl.new(@current_resource, @resource, @provider)
end
@@ -61,7 +61,7 @@ describe Chef::FileAccessControl do
end
it "determines the uid of the owner specified by the resource" do
- expect(Etc).to receive(:getpwnam).with("toor").and_return(OpenStruct.new(:uid => 2342))
+ expect(Etc).to receive(:getpwnam).with("toor").and_return(OpenStruct.new(uid: 2342))
expect(@fac.target_uid).to eq(2342)
end
@@ -99,7 +99,7 @@ describe Chef::FileAccessControl do
# uids. So we have to get ruby and negative uids to smoke the peace pipe
# with each other.
@resource.owner("nobody")
- expect(Etc).to receive(:getpwnam).with("nobody").and_return(OpenStruct.new(:uid => (4294967294)))
+ expect(Etc).to receive(:getpwnam).with("nobody").and_return(OpenStruct.new(uid: (4294967294)))
expect(@fac.target_uid).to eq(-2)
end
@@ -107,7 +107,7 @@ describe Chef::FileAccessControl do
# More: when OSX userIDs are created by ActiveDirectory sync, it tends to use huge numbers
# which had been incorrectly wrapped. It does not look like the OSX IDs go below -2
@resource.owner("bigdude")
- expect(Etc).to receive(:getpwnam).with("bigdude").and_return(OpenStruct.new(:uid => (4294967286)))
+ expect(Etc).to receive(:getpwnam).with("bigdude").and_return(OpenStruct.new(uid: (4294967286)))
expect(@fac.target_uid).to eq(4294967286)
end
@@ -153,7 +153,7 @@ describe Chef::FileAccessControl do
end
it "determines the gid of the group specified by the resource" do
- expect(Etc).to receive(:getgrnam).with("wheel").and_return(OpenStruct.new(:gid => 2342))
+ expect(Etc).to receive(:getgrnam).with("wheel").and_return(OpenStruct.new(gid: 2342))
expect(@fac.target_gid).to eq(2342)
end
@@ -294,7 +294,7 @@ describe Chef::FileAccessControl do
end
it "sets all access controls on a file" do
- allow(@fac).to receive(:stat).and_return(OpenStruct.new(:owner => 99, :group => 99, :mode => 0100444))
+ allow(@fac).to receive(:stat).and_return(OpenStruct.new(owner: 99, group: 99, mode: 0100444))
@resource.mode(0400)
@resource.owner(0)
@resource.group(0)
diff --git a/spec/unit/file_content_management/deploy/mv_unix_spec.rb b/spec/unit/file_content_management/deploy/mv_unix_spec.rb
index 569fd898a7..6c8736ae38 100644
--- a/spec/unit/file_content_management/deploy/mv_unix_spec.rb
+++ b/spec/unit/file_content_management/deploy/mv_unix_spec.rb
@@ -38,9 +38,9 @@ describe Chef::FileContentManagement::Deploy::MvUnix do
let(:target_file_mode) { 0644 }
let(:target_file_stat) do
double "File::Stat struct for target file",
- :mode => target_file_mode,
- :uid => target_file_uid,
- :gid => target_file_gid
+ mode: target_file_mode,
+ uid: target_file_uid,
+ gid: target_file_gid
end
before do
diff --git a/spec/unit/file_content_management/deploy/mv_windows_spec.rb b/spec/unit/file_content_management/deploy/mv_windows_spec.rb
index 30a62c4da9..456e7a2e3c 100644
--- a/spec/unit/file_content_management/deploy/mv_windows_spec.rb
+++ b/spec/unit/file_content_management/deploy/mv_windows_spec.rb
@@ -84,8 +84,8 @@ describe Chef::FileContentManagement::Deploy::MvWindows do
let(:target_file_security_descriptor) do
double "security descriptor for target file",
- :group => original_target_file_group,
- :owner => original_target_file_owner
+ group: original_target_file_group,
+ owner: original_target_file_owner
end
let(:updated_target_security_descriptor) do
@@ -171,13 +171,13 @@ describe Chef::FileContentManagement::Deploy::MvWindows do
end
context "and the target has a dacl and sacl" do
- let(:inherited_dacl_ace) { double("Windows dacl ace (inherited)", :inherited? => true) }
- let(:not_inherited_dacl_ace) { double("Windows dacl ace (not inherited)", :inherited? => false) }
+ let(:inherited_dacl_ace) { double("Windows dacl ace (inherited)", inherited?: true) }
+ let(:not_inherited_dacl_ace) { double("Windows dacl ace (not inherited)", inherited?: false) }
let(:original_target_file_dacl) { [inherited_dacl_ace, not_inherited_dacl_ace] }
- let(:inherited_sacl_ace) { double("Windows sacl ace (inherited)", :inherited? => true) }
- let(:not_inherited_sacl_ace) { double("Windows sacl ace (not inherited)", :inherited? => false) }
+ let(:inherited_sacl_ace) { double("Windows sacl ace (inherited)", inherited?: true) }
+ let(:not_inherited_sacl_ace) { double("Windows sacl ace (not inherited)", inherited?: false) }
let(:original_target_file_sacl) { [inherited_sacl_ace, not_inherited_sacl_ace] }
let(:custom_dacl) { double("Windows ACL for non-inherited dacl aces") }
diff --git a/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb
index 3e988c584d..6c03750136 100644
--- a/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb
+++ b/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb
@@ -57,7 +57,7 @@ describe Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector do
allow(@response).to receive(:body).and_return(@response_body)
@exception = Net::HTTPServerException.new("(exception) forbidden", @response)
@inspector = Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector.new(@node, @exception)
- allow(@inspector).to receive(:config).and_return(:node_name => "unit-test.example.com")
+ allow(@inspector).to receive(:config).and_return(node_name: "unit-test.example.com")
@inspector.add_explanation(@description)
end
@@ -76,9 +76,9 @@ describe Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector do
@exception = Net::HTTPServerException.new("(exception) unauthorized", @response)
@inspector = Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector.new(@node, @exception)
- allow(@inspector).to receive(:config).and_return(:node_name => "unit-test.example.com",
- :client_key => "/etc/chef/client.pem",
- :chef_server_url => "http://chef.example.com")
+ allow(@inspector).to receive(:config).and_return(node_name: "unit-test.example.com",
+ client_key: "/etc/chef/client.pem",
+ chef_server_url: "http://chef.example.com")
@inspector.add_explanation(@description)
end
diff --git a/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb b/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb
index 746b343e9c..b2ca8704b0 100644
--- a/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb
+++ b/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb
@@ -106,7 +106,7 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do
end
let(:shell_out) do
- instance_double(Mixlib::ShellOut, :live_stream => true, :run_command => true, :error! => nil)
+ instance_double(Mixlib::ShellOut, live_stream: true, run_command: true, error!: nil)
end
before do
@@ -118,7 +118,7 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do
end
it "merges to :code" do
- expect(command_opts).to receive(:merge).with({ :code => "exit 0" }).and_call_original
+ expect(command_opts).to receive(:merge).with({ code: "exit 0" }).and_call_original
expect(guard_interpreter.evaluate).to eq(true)
end
end
@@ -131,7 +131,7 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do
end
it "merges to :code" do
- expect(command_opts).to receive(:merge).with({ :command => "exit 0" }).and_call_original
+ expect(command_opts).to receive(:merge).with({ command: "exit 0" }).and_call_original
expect(guard_interpreter.evaluate).to eq(true)
end
end
@@ -145,7 +145,7 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do
end
it "merges to :command" do
- expect(command_opts).to receive(:merge).with({ :command => "exit 0" }).and_call_original
+ expect(command_opts).to receive(:merge).with({ command: "exit 0" }).and_call_original
expect(guard_interpreter.evaluate).to eq(true)
end
end
diff --git a/spec/unit/handler/json_file_spec.rb b/spec/unit/handler/json_file_spec.rb
index 4be448690a..f10c6a6701 100644
--- a/spec/unit/handler/json_file_spec.rb
+++ b/spec/unit/handler/json_file_spec.rb
@@ -20,7 +20,7 @@ require "spec_helper"
describe Chef::Handler::JsonFile do
before(:each) do
- @handler = Chef::Handler::JsonFile.new(:the_sun => "will rise", :path => "/tmp/foobarbazqux")
+ @handler = Chef::Handler::JsonFile.new(the_sun: "will rise", path: "/tmp/foobarbazqux")
end
it "accepts arbitrary config options" do
diff --git a/spec/unit/http/api_versions_spec.rb b/spec/unit/http/api_versions_spec.rb
index 2ccb847acc..2b52e87cae 100644
--- a/spec/unit/http/api_versions_spec.rb
+++ b/spec/unit/http/api_versions_spec.rb
@@ -43,7 +43,7 @@ describe Chef::HTTP::APIVersions do
end
let(:response) do
- m = double("HttpResponse", :body => response_body)
+ m = double("HttpResponse", body: response_body)
allow(m).to receive(:key?).with("x-ops-server-api-version").and_return(true)
allow(m).to receive(:code).and_return(return_value)
allow(m).to receive(:[]) do |key|
diff --git a/spec/unit/http/authenticator_spec.rb b/spec/unit/http/authenticator_spec.rb
index 548fc0158c..c50a2c0481 100644
--- a/spec/unit/http/authenticator_spec.rb
+++ b/spec/unit/http/authenticator_spec.rb
@@ -59,7 +59,7 @@ describe Chef::HTTP::Authenticator do
end
context "when api_version is set to something other than the default" do
- let(:class_instance) { Chef::HTTP::Authenticator.new({ :api_version => "-10" }) }
+ let(:class_instance) { Chef::HTTP::Authenticator.new({ api_version: "-10" }) }
it "merges the requested version of X-Ops-Server-API-Version into the headers" do
expect(class_instance.handle_request(method, url, headers, data)[2]).
diff --git a/spec/unit/http/validate_content_length_spec.rb b/spec/unit/http/validate_content_length_spec.rb
index 1f24acb94a..673e03f7f4 100644
--- a/spec/unit/http/validate_content_length_spec.rb
+++ b/spec/unit/http/validate_content_length_spec.rb
@@ -44,7 +44,7 @@ describe Chef::HTTP::ValidateContentLength do
end
let(:response) do
- m = double("HttpResponse", :body => response_body)
+ m = double("HttpResponse", body: response_body)
allow(m).to receive(:[]) do |key|
response_headers[key]
end
@@ -67,7 +67,7 @@ describe Chef::HTTP::ValidateContentLength do
data_length = streaming_length
while data_length > 0
chunk_size = data_length > 10 ? 10 : data_length
- stream_handler.handle_chunk(double("Chunk", :bytesize => chunk_size))
+ stream_handler.handle_chunk(double("Chunk", bytesize: chunk_size))
data_length -= chunk_size
end
diff --git a/spec/unit/knife/bootstrap/client_builder_spec.rb b/spec/unit/knife/bootstrap/client_builder_spec.rb
index 97ba0fc48e..f259002b20 100644
--- a/spec/unit/knife/bootstrap/client_builder_spec.rb
+++ b/spec/unit/knife/bootstrap/client_builder_spec.rb
@@ -41,7 +41,7 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
end
context "#sanity_check!" do
- let(:response_404) { OpenStruct.new(:code => "404") }
+ let(:response_404) { OpenStruct.new(code: "404") }
let(:exception_404) { Net::HTTPServerException.new("404 not found", response_404) }
context "in cases where the prompting fails" do
@@ -180,8 +180,8 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
end
it "builds a node with first_boot_attributes if they're given" do
- knife_config[:first_boot_attributes] = { :baz => :quux }
- expect(node).to receive(:normal_attrs=).with({ :baz => :quux })
+ knife_config[:first_boot_attributes] = { baz: :quux }
+ expect(node).to receive(:normal_attrs=).with({ baz: :quux })
expect(node).to receive(:run_list).with([])
client_builder.run
end
diff --git a/spec/unit/knife/client_bulk_delete_spec.rb b/spec/unit/knife/client_bulk_delete_spec.rb
index 994f4d33a4..feebab4986 100644
--- a/spec/unit/knife/client_bulk_delete_spec.rb
+++ b/spec/unit/knife/client_bulk_delete_spec.rb
@@ -128,7 +128,7 @@ describe Chef::Knife::ClientBulkDelete do
end
describe "with --delete-validators" do
- let(:option_args) { { :delete_validators => true } }
+ let(:option_args) { { delete_validators: true } }
it "should mention that validator clients will be deleted" do
knife.run
diff --git a/spec/unit/knife/client_delete_spec.rb b/spec/unit/knife/client_delete_spec.rb
index b05a487d62..41a83b05e4 100644
--- a/spec/unit/knife/client_delete_spec.rb
+++ b/spec/unit/knife/client_delete_spec.rb
@@ -23,7 +23,7 @@ describe Chef::Knife::ClientDelete do
@knife = Chef::Knife::ClientDelete.new
# defaults
@knife.config = {
- :delete_validators => false,
+ delete_validators: false,
}
@knife.name_args = [ "adam" ]
end
diff --git a/spec/unit/knife/client_reregister_spec.rb b/spec/unit/knife/client_reregister_spec.rb
index 6776cafa0a..6b6519d44f 100644
--- a/spec/unit/knife/client_reregister_spec.rb
+++ b/spec/unit/knife/client_reregister_spec.rb
@@ -22,7 +22,7 @@ describe Chef::Knife::ClientReregister do
before(:each) do
@knife = Chef::Knife::ClientReregister.new
@knife.name_args = [ "adam" ]
- @client_mock = double("client_mock", :private_key => "foo_key")
+ @client_mock = double("client_mock", private_key: "foo_key")
@stdout = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
end
diff --git a/spec/unit/knife/configure_spec.rb b/spec/unit/knife/configure_spec.rb
index 27bb0d9a3f..1cdad0cd0e 100644
--- a/spec/unit/knife/configure_spec.rb
+++ b/spec/unit/knife/configure_spec.rb
@@ -6,7 +6,7 @@ describe Chef::Knife::Configure do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::Configure.new
- @rest_client = double("null rest client", :post => { :result => :true })
+ @rest_client = double("null rest client", post: { result: :true })
allow(@knife).to receive(:rest).and_return(@rest_client)
@out = StringIO.new
diff --git a/spec/unit/knife/cookbook_bulk_delete_spec.rb b/spec/unit/knife/cookbook_bulk_delete_spec.rb
index 62b8c9fe51..c8c1873081 100644
--- a/spec/unit/knife/cookbook_bulk_delete_spec.rb
+++ b/spec/unit/knife/cookbook_bulk_delete_spec.rb
@@ -24,7 +24,7 @@ describe Chef::Knife::CookbookBulkDelete do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::CookbookBulkDelete.new
- @knife.config = { :print_after => nil }
+ @knife.config = { print_after: nil }
@knife.name_args = ["."]
@stdout = StringIO.new
@stderr = StringIO.new
diff --git a/spec/unit/knife/cookbook_download_spec.rb b/spec/unit/knife/cookbook_download_spec.rb
index 1fb995f71d..af0b839cd6 100644
--- a/spec/unit/knife/cookbook_download_spec.rb
+++ b/spec/unit/knife/cookbook_download_spec.rb
@@ -53,7 +53,7 @@ describe Chef::Knife::CookbookDownload do
let(:manifest_data) do
{
- :all_files => [
+ all_files: [
{
"path" => "recipes/foo.rb",
"name" => "recipes/foo.rb",
diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb
index bd952c215f..6642e0690d 100644
--- a/spec/unit/knife/cookbook_show_spec.rb
+++ b/spec/unit/knife/cookbook_show_spec.rb
@@ -49,10 +49,10 @@ describe Chef::Knife::CookbookShow do
{
"all_files" => [
{
- :name => "recipes/default.rb",
- :path => "recipes/default.rb",
- :checksum => "1234",
- :url => "http://example.org/files/default.rb",
+ name: "recipes/default.rb",
+ path: "recipes/default.rb",
+ checksum: "1234",
+ url: "http://example.org/files/default.rb",
},
],
}
@@ -172,32 +172,32 @@ describe Chef::Knife::CookbookShow do
cb.manifest = {
"all_files" => [
{
- :name => "files/afile.rb",
- :path => "files/host-examplehost.example.org/afile.rb",
- :checksum => "1111",
- :specificity => "host-examplehost.example.org",
- :url => "http://example.org/files/1111",
+ name: "files/afile.rb",
+ path: "files/host-examplehost.example.org/afile.rb",
+ checksum: "1111",
+ specificity: "host-examplehost.example.org",
+ url: "http://example.org/files/1111",
},
{
- :name => "files/afile.rb",
- :path => "files/ubuntu-9.10/afile.rb",
- :checksum => "2222",
- :specificity => "ubuntu-9.10",
- :url => "http://example.org/files/2222",
+ name: "files/afile.rb",
+ path: "files/ubuntu-9.10/afile.rb",
+ checksum: "2222",
+ specificity: "ubuntu-9.10",
+ url: "http://example.org/files/2222",
},
{
- :name => "files/afile.rb",
- :path => "files/ubuntu/afile.rb",
- :checksum => "3333",
- :specificity => "ubuntu",
- :url => "http://example.org/files/3333",
+ name: "files/afile.rb",
+ path: "files/ubuntu/afile.rb",
+ checksum: "3333",
+ specificity: "ubuntu",
+ url: "http://example.org/files/3333",
},
{
- :name => "files/afile.rb",
- :path => "files/default/afile.rb",
- :checksum => "4444",
- :specificity => "default",
- :url => "http://example.org/files/4444",
+ name: "files/afile.rb",
+ path: "files/default/afile.rb",
+ checksum: "4444",
+ specificity: "default",
+ url: "http://example.org/files/4444",
},
],
}
diff --git a/spec/unit/knife/cookbook_site_download_spec.rb b/spec/unit/knife/cookbook_site_download_spec.rb
index 0ab6a8a9b4..0e2798f374 100644
--- a/spec/unit/knife/cookbook_site_download_spec.rb
+++ b/spec/unit/knife/cookbook_site_download_spec.rb
@@ -59,7 +59,7 @@ describe Chef::Knife::CookbookSiteDownload do
before do
@cookbook_data = { "version" => @version,
"file" => "http://example.com/apache2_#{@version_us}.tgz" }
- @temp_file = double( :path => "/tmp/apache2_#{@version_us}.tgz" )
+ @temp_file = double( path: "/tmp/apache2_#{@version_us}.tgz" )
@file = File.join(Dir.pwd, "apache2-#{@version}.tar.gz")
end
@@ -124,7 +124,7 @@ describe Chef::Knife::CookbookSiteDownload do
@version_us = @version.tr ".", "_"
@cookbook_data = { "version" => @version,
"file" => "http://example.com/apache2_#{@version_us}.tgz" }
- @temp_file = double(:path => "/tmp/apache2_#{@version_us}.tgz")
+ @temp_file = double(path: "/tmp/apache2_#{@version_us}.tgz")
@file = File.join(Dir.pwd, "apache2-#{@version}.tar.gz")
@knife.name_args << @version
end
diff --git a/spec/unit/knife/cookbook_site_install_spec.rb b/spec/unit/knife/cookbook_site_install_spec.rb
index d93af10761..d5df88c997 100644
--- a/spec/unit/knife/cookbook_site_install_spec.rb
+++ b/spec/unit/knife/cookbook_site_install_spec.rb
@@ -25,9 +25,9 @@ describe Chef::Knife::CookbookSiteInstall do
let(:downloader) { Hash.new }
let(:archive) { double(Mixlib::Archive, extract: true) }
let(:repo) do
- double(:sanity_check => true, :reset_to_default_state => true,
- :prepare_to_import => true, :finalize_updates_to => true,
- :merge_updates_from => true) end
+ double(sanity_check: true, reset_to_default_state: true,
+ prepare_to_import: true, finalize_updates_to: true,
+ merge_updates_from: true) end
let(:install_path) do
if Chef::Platform.windows?
"C:/tmp/chef"
diff --git a/spec/unit/knife/cookbook_site_share_spec.rb b/spec/unit/knife/cookbook_site_share_spec.rb
index 823eff8b04..ac12536d6e 100644
--- a/spec/unit/knife/cookbook_site_share_spec.rb
+++ b/spec/unit/knife/cookbook_site_share_spec.rb
@@ -39,7 +39,7 @@ describe Chef::Knife::CookbookSiteShare do
@noauth_rest = double(Chef::ServerAPI)
allow(@knife).to receive(:noauth_rest).and_return(@noauth_rest)
- @cookbook_uploader = Chef::CookbookUploader.new("herpderp", :rest => "norest")
+ @cookbook_uploader = Chef::CookbookUploader.new("herpderp", rest: "norest")
allow(Chef::CookbookUploader).to receive(:new).and_return(@cookbook_uploader)
allow(@cookbook_uploader).to receive(:validate_cookbooks).and_return(true)
allow(Chef::CookbookSiteStreamingUploader).to receive(:create_build_dir).and_return(Dir.mktmpdir)
@@ -139,14 +139,14 @@ describe Chef::Knife::CookbookSiteShare do
context "when the --dry-run flag is specified" do
before do
allow(Chef::CookbookSiteStreamingUploader).to receive(:create_build_dir).and_return("/var/tmp/dummy")
- @knife.config = { :dry_run => true }
+ @knife.config = { dry_run: true }
allow(@knife).to receive_message_chain(:shell_out!, :stdout).and_return("file")
end
it "should list files in the tarball" do
allow(@knife).to receive(:tar_cmd).and_return("footar")
- expect(@knife).to receive(:shell_out!).with("footar -czf #{@cookbook.name}.tgz #{@cookbook.name}", { :cwd => "/var/tmp/dummy" })
- expect(@knife).to receive(:shell_out!).with("footar -tzf #{@cookbook.name}.tgz", { :cwd => "/var/tmp/dummy" })
+ expect(@knife).to receive(:shell_out!).with("footar -czf #{@cookbook.name}.tgz #{@cookbook.name}", { cwd: "/var/tmp/dummy" })
+ expect(@knife).to receive(:shell_out!).with("footar -tzf #{@cookbook.name}.tgz", { cwd: "/var/tmp/dummy" })
@knife.run
end
@@ -172,7 +172,7 @@ describe Chef::Knife::CookbookSiteShare do
end
it 'should post the cookbook to "https://supermarket.chef.io"' do
- response_text = Chef::JSONCompat.to_json({ :uri => "https://supermarket.chef.io/cookbooks/cookbook_name" })
+ response_text = Chef::JSONCompat.to_json({ uri: "https://supermarket.chef.io/cookbooks/cookbook_name" })
allow(@upload_response).to receive(:body).and_return(response_text)
allow(@upload_response).to receive(:code).and_return(201)
expect(Chef::CookbookSiteStreamingUploader).to receive(:post).with(/supermarket\.chef\.io/, anything(), anything(), anything())
@@ -180,7 +180,7 @@ describe Chef::Knife::CookbookSiteShare do
end
it "should alert the user when a version already exists" do
- response_text = Chef::JSONCompat.to_json({ :error_messages => ["Version already exists"] })
+ response_text = Chef::JSONCompat.to_json({ error_messages: ["Version already exists"] })
allow(@upload_response).to receive(:body).and_return(response_text)
allow(@upload_response).to receive(:code).and_return(409)
expect { @knife.run }.to raise_error(SystemExit)
@@ -188,7 +188,7 @@ describe Chef::Knife::CookbookSiteShare do
end
it "should pass any errors on to the user" do
- response_text = Chef::JSONCompat.to_json({ :error_messages => ["You're holding it wrong"] })
+ response_text = Chef::JSONCompat.to_json({ error_messages: ["You're holding it wrong"] })
allow(@upload_response).to receive(:body).and_return(response_text)
allow(@upload_response).to receive(:code).and_return(403)
expect { @knife.run }.to raise_error(SystemExit)
@@ -196,7 +196,7 @@ describe Chef::Knife::CookbookSiteShare do
end
it "should print the body if no errors are exposed on failure" do
- response_text = Chef::JSONCompat.to_json({ :system_error => "Your call was dropped", :reason => "There's a map for that" })
+ response_text = Chef::JSONCompat.to_json({ system_error: "Your call was dropped", reason: "There's a map for that" })
allow(@upload_response).to receive(:body).and_return(response_text)
allow(@upload_response).to receive(:code).and_return(500)
expect(@knife.ui).to receive(:error).with(/#{Regexp.escape(response_text)}/) #.ordered
diff --git a/spec/unit/knife/cookbook_site_unshare_spec.rb b/spec/unit/knife/cookbook_site_unshare_spec.rb
index 8e4358226d..7797fdb3f8 100644
--- a/spec/unit/knife/cookbook_site_unshare_spec.rb
+++ b/spec/unit/knife/cookbook_site_unshare_spec.rb
@@ -55,14 +55,14 @@ describe Chef::Knife::CookbookSiteUnshare do
end
it "should log an error and exit when forbidden" do
- exception = double('403 "Forbidden"', :code => "403")
+ exception = double('403 "Forbidden"', code: "403")
allow(@rest).to receive(:delete).and_raise(Net::HTTPServerException.new('403 "Forbidden"', exception))
expect(@knife.ui).to receive(:error)
expect { @knife.run }.to raise_error(SystemExit)
end
it "should re-raise any non-forbidden errors on delete" do
- exception = double('500 "Application Error"', :code => "500")
+ exception = double('500 "Application Error"', code: "500")
allow(@rest).to receive(:delete).and_raise(Net::HTTPServerException.new('500 "Application Error"', exception))
expect { @knife.run }.to raise_error(Net::HTTPServerException)
end
diff --git a/spec/unit/knife/cookbook_upload_spec.rb b/spec/unit/knife/cookbook_upload_spec.rb
index 9e07497c57..95ebe95fe7 100644
--- a/spec/unit/knife/cookbook_upload_spec.rb
+++ b/spec/unit/knife/cookbook_upload_spec.rb
@@ -36,7 +36,7 @@ describe Chef::Knife::CookbookUpload do
cookbook_loader
end
- let(:cookbook_uploader) { double(:upload_cookbooks => nil) }
+ let(:cookbook_uploader) { double(upload_cookbooks: nil) }
let(:output) { StringIO.new }
@@ -62,15 +62,15 @@ describe Chef::Knife::CookbookUpload do
allow(cookbook_loader).to receive(:each).and_yield("test_cookbook", test_cookbook)
allow(cookbook_loader).to receive(:cookbook_names).and_return(["test_cookbook"])
expect(Chef::CookbookUploader).to receive(:new).
- with( kind_of(Array), { :force => nil, :concurrency => 3 }).
- and_return(double("Chef::CookbookUploader", :upload_cookbooks => true))
+ with( kind_of(Array), { force: nil, concurrency: 3 }).
+ and_return(double("Chef::CookbookUploader", upload_cookbooks: true))
knife.run
end
end
describe "run" do
before(:each) do
- allow(Chef::CookbookUploader).to receive_messages(:new => cookbook_uploader)
+ allow(Chef::CookbookUploader).to receive_messages(new: cookbook_uploader)
allow(Chef::CookbookVersion).to receive(:list_all_versions).and_return({})
end
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb
index 3a32155063..7ee177a7d1 100644
--- a/spec/unit/knife/core/bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/bootstrap_context_spec.rb
@@ -26,15 +26,15 @@ describe Chef::Knife::Core::BootstrapContext do
Chef::Config[:fips] = false
end
- let(:config) { { :foo => :bar, :color => true } }
+ let(:config) { { foo: :bar, color: true } }
let(:run_list) { Chef::RunList.new("recipe[tmux]", "role[base]") }
let(:chef_config) do
{
- :config_log_level => "info",
- :config_log_location => "/tmp/log",
- :validation_key => File.join(CHEF_SPEC_DATA, "ssl", "private_key.pem"),
- :chef_server_url => "http://chef.example.com:4444",
- :validation_client_name => "chef-validator-testing",
+ config_log_level: "info",
+ config_log_location: "/tmp/log",
+ validation_key: File.join(CHEF_SPEC_DATA, "ssl", "private_key.pem"),
+ chef_server_url: "http://chef.example.com:4444",
+ validation_client_name: "chef-validator-testing",
}
end
@@ -51,14 +51,14 @@ describe Chef::Knife::Core::BootstrapContext do
end
describe "when in verbosity mode" do
- let(:config) { { :verbosity => 2, :color => true } }
+ let(:config) { { verbosity: 2, color: true } }
it "adds '-l debug' when verbosity is >= 2" do
expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json -l debug"
end
end
describe "when no color value has been set in config" do
- let(:config) { { :color => false } }
+ let(:config) { { color: false } }
it "adds '--no-color' when color is false" do
expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json --no-color"
end
@@ -80,14 +80,14 @@ EXPECTED
end
describe "alternate chef-client path" do
- let(:chef_config) { { :chef_client_path => "/usr/local/bin/chef-client" } }
+ let(:chef_config) { { chef_client_path: "/usr/local/bin/chef-client" } }
it "runs chef-client from another path when specified" do
expect(bootstrap_context.start_chef).to eq "/usr/local/bin/chef-client -j /etc/chef/first-boot.json"
end
end
describe "validation key path that contains a ~" do
- let(:chef_config) { { :validation_key => "~/my.key" } }
+ let(:chef_config) { { validation_key: "~/my.key" } }
it "reads the validation key when it contains a ~" do
expect(File).to receive(:exist?).with(File.expand_path("my.key", ENV["HOME"])).and_return(true)
expect(IO).to receive(:read).with(File.expand_path("my.key", ENV["HOME"]))
@@ -96,36 +96,36 @@ EXPECTED
end
describe "when an explicit node name is given" do
- let(:config) { { :chef_node_name => "foobar.example.com" } }
+ let(:config) { { chef_node_name: "foobar.example.com" } }
it "sets the node name in the client.rb" do
expect(bootstrap_context.config_content).to match(/node_name "foobar\.example\.com"/)
end
end
describe "when bootstrapping into a specific environment" do
- let(:config) { { :environment => "prodtastic", :color => true } }
+ let(:config) { { environment: "prodtastic", color: true } }
it "starts chef in the configured environment" do
expect(bootstrap_context.start_chef).to eq("chef-client -j /etc/chef/first-boot.json -E prodtastic")
end
end
describe "when tags are given" do
- let(:config) { { :tags => [ "unicorn" ] } }
+ let(:config) { { tags: [ "unicorn" ] } }
it "adds the attributes to first_boot" do
- expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({ :run_list => run_list, :tags => ["unicorn"] }))
+ expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({ run_list: run_list, tags: ["unicorn"] }))
end
end
describe "when JSON attributes are given" do
- let(:config) { { :first_boot_attributes => { :baz => :quux } } }
+ let(:config) { { first_boot_attributes: { baz: :quux } } }
it "adds the attributes to first_boot" do
- expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({ :baz => :quux, :run_list => run_list }))
+ expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({ baz: :quux, run_list: run_list }))
end
end
describe "when JSON attributes are NOT given" do
it "sets first_boot equal to run_list" do
- expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({ :run_list => run_list }))
+ expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({ run_list: run_list }))
end
end
@@ -159,7 +159,7 @@ EXPECTED
describe "when a bootstrap_version is specified" do
let(:chef_config) do
{
- :knife => { :bootstrap_version => "11.12.4" },
+ knife: { bootstrap_version: "11.12.4" },
}
end
@@ -171,7 +171,7 @@ EXPECTED
describe "when a pre-release bootstrap_version is specified" do
let(:chef_config) do
{
- :knife => { :bootstrap_version => "11.12.4.rc.0" },
+ knife: { bootstrap_version: "11.12.4.rc.0" },
}
end
@@ -195,7 +195,7 @@ EXPECTED
describe "when configured in config" do
let(:chef_config) do
{
- :knife => { :ssl_verify_mode => :verify_peer },
+ knife: { ssl_verify_mode: :verify_peer },
}
end
@@ -204,7 +204,7 @@ EXPECTED
end
describe "when configured via CLI" do
- let(:config) { { :node_ssl_verify_mode => "none" } }
+ let(:config) { { node_ssl_verify_mode: "none" } }
it "uses CLI value" do
expect(bootstrap_context.config_content).to include("ssl_verify_mode :verify_none")
@@ -238,7 +238,7 @@ EXPECTED
describe "when configured in config" do
let(:chef_config) do
{
- :knife => { :verify_api_cert => :false },
+ knife: { verify_api_cert: :false },
}
end
@@ -247,7 +247,7 @@ EXPECTED
end
describe "when configured via CLI" do
- let(:config) { { :node_verify_api_cert => true } }
+ let(:config) { { node_verify_api_cert: true } }
it "uses CLI value" do
expect(bootstrap_context.config_content).to include("verify_api_cert true")
@@ -262,7 +262,7 @@ EXPECTED
end
describe "when configured via cli" do
- let(:config) { { :prerelease => true } }
+ let(:config) { { prerelease: true } }
it "uses CLI value" do
expect(bootstrap_context.latest_current_chef_version_string).to eq("-p")
@@ -272,49 +272,49 @@ EXPECTED
describe "#config_log_location" do
context "when config_log_location is nil" do
- let(:chef_config) { { :config_log_location => nil } }
+ let(:chef_config) { { config_log_location: nil } }
it "sets the default config_log_location in the client.rb" do
expect(bootstrap_context.get_log_location).to eq "STDOUT"
end
end
context "when config_log_location is empty" do
- let(:chef_config) { { :config_log_location => "" } }
+ let(:chef_config) { { config_log_location: "" } }
it "sets the default config_log_location in the client.rb" do
expect(bootstrap_context.get_log_location).to eq "STDOUT"
end
end
context "when config_log_location is :win_evt" do
- let(:chef_config) { { :config_log_location => :win_evt } }
+ let(:chef_config) { { config_log_location: :win_evt } }
it "raise error when config_log_location is :win_evt " do
expect { bootstrap_context.get_log_location }.to raise_error("The value :win_evt is not supported for config_log_location on Linux Platforms \n")
end
end
context "when config_log_location is :syslog" do
- let(:chef_config) { { :config_log_location => :syslog } }
+ let(:chef_config) { { config_log_location: :syslog } }
it "sets the config_log_location value as :syslog in the client.rb" do
expect(bootstrap_context.get_log_location).to eq ":syslog"
end
end
context "When config_log_location is STDOUT" do
- let(:chef_config) { { :config_log_location => STDOUT } }
+ let(:chef_config) { { config_log_location: STDOUT } }
it "Sets the config_log_location value as STDOUT in the client.rb" do
expect(bootstrap_context.get_log_location).to eq "STDOUT"
end
end
context "when config_log_location is STDERR" do
- let(:chef_config) { { :config_log_location => STDERR } }
+ let(:chef_config) { { config_log_location: STDERR } }
it "sets the config_log_location value as STDERR in the client.rb" do
expect(bootstrap_context.get_log_location).to eq "STDERR"
end
end
context "when config_log_location is a path" do
- let(:chef_config) { { :config_log_location => "/tmp/ChefLogFile" } }
+ let(:chef_config) { { config_log_location: "/tmp/ChefLogFile" } }
it "sets the config_log_location path in the client.rb" do
expect(bootstrap_context.get_log_location).to eq "\"/tmp/ChefLogFile\""
end
diff --git a/spec/unit/knife/core/cookbook_scm_repo_spec.rb b/spec/unit/knife/core/cookbook_scm_repo_spec.rb
index 3c16f93533..a530dbcdaa 100644
--- a/spec/unit/knife/core/cookbook_scm_repo_spec.rb
+++ b/spec/unit/knife/core/cookbook_scm_repo_spec.rb
@@ -24,7 +24,7 @@ describe Chef::Knife::CookbookSCMRepo do
@repo_path = File.join(CHEF_SPEC_DATA, "cookbooks")
@stdout, @stderr, @stdin = StringIO.new, StringIO.new, StringIO.new
@ui = Chef::Knife::UI.new(@stdout, @stderr, @stdin, {})
- @cookbook_repo = Chef::Knife::CookbookSCMRepo.new(@repo_path, @ui, :default_branch => "master")
+ @cookbook_repo = Chef::Knife::CookbookSCMRepo.new(@repo_path, @ui, default_branch: "master")
@branch_list = Mixlib::ShellOut.new
@branch_list.stdout.replace(<<-BRANCHES)
@@ -69,7 +69,7 @@ BRANCHES
it "exits when the default branch doesn't exist" do
@nobranches = Mixlib::ShellOut.new.tap { |s| s.stdout.replace "\n" }
- expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", :cwd => @repo_path).and_return(@nobranches)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", cwd: @repo_path).and_return(@nobranches)
expect { @cookbook_repo.sanity_check }.to raise_error(SystemExit)
end
@@ -77,7 +77,7 @@ BRANCHES
before do
@master_branch = Mixlib::ShellOut.new
@master_branch.stdout.replace "* master\n"
- expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", :cwd => @repo_path).and_return(@master_branch)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", cwd: @repo_path).and_return(@master_branch)
end
it "exits when the git repo is dirty" do
@@ -85,14 +85,14 @@ BRANCHES
@dirty_status.stdout.replace(<<-DIRTY)
M chef/lib/chef/knife/cookbook_site_install.rb
DIRTY
- expect(@cookbook_repo).to receive(:shell_out!).with("git status --porcelain", :cwd => @repo_path).and_return(@dirty_status)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git status --porcelain", cwd: @repo_path).and_return(@dirty_status)
expect { @cookbook_repo.sanity_check }.to raise_error(SystemExit)
end
describe "and the repo is clean" do
before do
@clean_status = Mixlib::ShellOut.new.tap { |s| s.stdout.replace("\n") }
- allow(@cookbook_repo).to receive(:shell_out!).with("git status --porcelain", :cwd => @repo_path).and_return(@clean_status)
+ allow(@cookbook_repo).to receive(:shell_out!).with("git status --porcelain", cwd: @repo_path).and_return(@clean_status)
end
it "passes the sanity check" do
@@ -106,35 +106,35 @@ DIRTY
end
it "resets to default state by checking out the default branch" do
- expect(@cookbook_repo).to receive(:shell_out!).with("git checkout master", :cwd => @repo_path)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git checkout master", cwd: @repo_path)
@cookbook_repo.reset_to_default_state
end
it "determines if a the pristine copy branch exists" do
- expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", :cwd => @repo_path).and_return(@branch_list)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", cwd: @repo_path).and_return(@branch_list)
expect(@cookbook_repo.branch_exists?("chef-vendor-apache2")).to be_truthy
- expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", :cwd => @repo_path).and_return(@branch_list)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", cwd: @repo_path).and_return(@branch_list)
expect(@cookbook_repo.branch_exists?("chef-vendor-nginx")).to be_falsey
end
it "determines if a the branch not exists correctly without substring search" do
- expect(@cookbook_repo).to receive(:shell_out!).twice.with("git branch --no-color", :cwd => @repo_path).and_return(@branch_list)
+ expect(@cookbook_repo).to receive(:shell_out!).twice.with("git branch --no-color", cwd: @repo_path).and_return(@branch_list)
expect(@cookbook_repo).not_to be_branch_exists("chef-vendor-absent")
expect(@cookbook_repo).to be_branch_exists("chef-vendor-absent-new")
end
describe "when the pristine copy branch does not exist" do
it "prepares for import by creating the pristine copy branch" do
- expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", :cwd => @repo_path).and_return(@branch_list)
- expect(@cookbook_repo).to receive(:shell_out!).with("git checkout -b chef-vendor-nginx", :cwd => @repo_path)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", cwd: @repo_path).and_return(@branch_list)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git checkout -b chef-vendor-nginx", cwd: @repo_path)
@cookbook_repo.prepare_to_import("nginx")
end
end
describe "when the pristine copy branch does exist" do
it "prepares for import by checking out the pristine copy branch" do
- expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", :cwd => @repo_path).and_return(@branch_list)
- expect(@cookbook_repo).to receive(:shell_out!).with("git checkout chef-vendor-apache2", :cwd => @repo_path)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git branch --no-color", cwd: @repo_path).and_return(@branch_list)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git checkout chef-vendor-apache2", cwd: @repo_path)
@cookbook_repo.prepare_to_import("apache2")
end
end
@@ -143,7 +143,7 @@ DIRTY
before do
@updates = Mixlib::ShellOut.new
@updates.stdout.replace("\n")
- allow(@cookbook_repo).to receive(:shell_out!).with("git status --porcelain -- apache2", :cwd => @repo_path).and_return(@updates)
+ allow(@cookbook_repo).to receive(:shell_out!).with("git status --porcelain -- apache2", cwd: @repo_path).and_return(@updates)
end
it "shows no changes in the pristine copy" do
@@ -159,7 +159,7 @@ DIRTY
before do
@updates = Mixlib::ShellOut.new
@updates.stdout.replace(" M cookbooks/apache2/recipes/default.rb\n")
- allow(@cookbook_repo).to receive(:shell_out!).with("git status --porcelain -- apache2", :cwd => @repo_path).and_return(@updates)
+ allow(@cookbook_repo).to receive(:shell_out!).with("git status --porcelain -- apache2", cwd: @repo_path).and_return(@updates)
end
it "shows changes in the pristine copy" do
@@ -167,20 +167,20 @@ DIRTY
end
it "commits the changes to the repo and tags the commit" do
- expect(@cookbook_repo).to receive(:shell_out!).with("git add apache2", :cwd => @repo_path)
- expect(@cookbook_repo).to receive(:shell_out!).with("git commit -m \"Import apache2 version 1.2.3\" -- apache2", :cwd => @repo_path)
- expect(@cookbook_repo).to receive(:shell_out!).with("git tag -f cookbook-site-imported-apache2-1.2.3", :cwd => @repo_path)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git add apache2", cwd: @repo_path)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git commit -m \"Import apache2 version 1.2.3\" -- apache2", cwd: @repo_path)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git tag -f cookbook-site-imported-apache2-1.2.3", cwd: @repo_path)
expect(@cookbook_repo.finalize_updates_to("apache2", "1.2.3")).to be_truthy
end
end
describe "when a custom default branch is specified" do
before do
- @cookbook_repo = Chef::Knife::CookbookSCMRepo.new(@repo_path, @ui, :default_branch => "develop")
+ @cookbook_repo = Chef::Knife::CookbookSCMRepo.new(@repo_path, @ui, default_branch: "develop")
end
it "resets to default state by checking out the default branch" do
- expect(@cookbook_repo).to receive(:shell_out!).with("git checkout develop", :cwd => @repo_path)
+ expect(@cookbook_repo).to receive(:shell_out!).with("git checkout develop", cwd: @repo_path)
@cookbook_repo.reset_to_default_state
end
end
diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb
index 0b986258b7..c2b87cca38 100644
--- a/spec/unit/knife/core/ui_spec.rb
+++ b/spec/unit/knife/core/ui_spec.rb
@@ -25,10 +25,10 @@ describe Chef::Knife::UI do
before do
@out, @err, @in = StringIO.new, StringIO.new, StringIO.new
@config = {
- :verbosity => 0,
- :yes => nil,
- :format => "summary",
- :field_separator => ".",
+ verbosity: 0,
+ yes: nil,
+ format: "summary",
+ field_separator: ".",
}
@ui = Chef::Knife::UI.new(@out, @err, @in, @config)
end
@@ -171,12 +171,12 @@ describe Chef::Knife::UI do
describe "format_list_for_display" do
it "should print the full hash if --with-uri is true" do
@ui.config[:with_uri] = true
- expect(@ui.format_list_for_display({ :marcy => :playground })).to eq({ :marcy => :playground })
+ expect(@ui.format_list_for_display({ marcy: :playground })).to eq({ marcy: :playground })
end
it "should print only the keys if --with-uri is false" do
@ui.config[:with_uri] = false
- expect(@ui.format_list_for_display({ :marcy => :playground })).to eq([ :marcy ])
+ expect(@ui.format_list_for_display({ marcy: :playground })).to eq([ :marcy ])
end
end
@@ -358,7 +358,7 @@ EOM
describe "format_for_display" do
it "should return the raw data" do
- input = { :gi => :go }
+ input = { gi: :go }
expect(@ui.format_for_display(input)).to eq(input)
end
@@ -480,7 +480,7 @@ EOM
context "when running on Windows" do
before(:each) do
- stdout = double("StringIO", :tty? => true)
+ stdout = double("StringIO", tty?: true)
allow(@ui).to receive(:stdout).and_return(stdout)
allow(ChefConfig).to receive(:windows?) { true }
Chef::Config.reset
@@ -631,7 +631,7 @@ EOM
out = StringIO.new
allow(@ui).to receive(:stdout).and_return(out)
allow(@ui).to receive(:stdin).and_return(StringIO.new(" \n"))
- expect(@ui.ask_question("your chef server URL? ", :default => "http://localhost:4000")).to eq("http://localhost:4000")
+ expect(@ui.ask_question("your chef server URL? ", default: "http://localhost:4000")).to eq("http://localhost:4000")
expect(out.string).to eq("your chef server URL? [http://localhost:4000] ")
end
end
diff --git a/spec/unit/knife/data_bag_create_spec.rb b/spec/unit/knife/data_bag_create_spec.rb
index 169c6e1845..6624fb70ab 100644
--- a/spec/unit/knife/data_bag_create_spec.rb
+++ b/spec/unit/knife/data_bag_create_spec.rb
@@ -60,7 +60,7 @@ describe Chef::Knife::DataBagCreate do
context "when data_bag doesn't exist" do
before do
# Data bag doesn't exist by default so we mock the GET request to return 404
- exception = double("404 error", :code => "404")
+ exception = double("404 error", code: "404")
allow(rest).to receive(:get)
.with("data/#{bag_name}")
.and_raise(Net::HTTPServerException.new("404", exception))
@@ -82,7 +82,7 @@ describe Chef::Knife::DataBagCreate do
context "when part of the name is a reserved name" do
before do
- exception = double("404 error", :code => "404")
+ exception = double("404 error", code: "404")
%w{node role client environment}.each do |name|
allow(rest).to receive(:get)
.with("data/sudoing_#{name}_admins")
diff --git a/spec/unit/knife/data_bag_edit_spec.rb b/spec/unit/knife/data_bag_edit_spec.rb
index 635dc63489..ff131a7d91 100644
--- a/spec/unit/knife/data_bag_edit_spec.rb
+++ b/spec/unit/knife/data_bag_edit_spec.rb
@@ -74,7 +74,7 @@ describe Chef::Knife::DataBagEdit do
end
context "when config[:print_after] is set" do
- let(:config) { { :print_after => true } }
+ let(:config) { { print_after: true } }
before do
expect(knife.ui).to receive(:output).with(raw_edited_hash)
end
diff --git a/spec/unit/knife/data_bag_secret_options_spec.rb b/spec/unit/knife/data_bag_secret_options_spec.rb
index 2f4d8c8a88..5aa34029e9 100644
--- a/spec/unit/knife/data_bag_secret_options_spec.rb
+++ b/spec/unit/knife/data_bag_secret_options_spec.rb
@@ -73,13 +73,13 @@ describe Chef::Knife::DataBagSecretOptions do
it "returns the secret first" do
Chef::Config[:knife][:cl_secret] = secret
- expect(example_db).to receive(:config).and_return({ :secret => secret })
+ expect(example_db).to receive(:config).and_return({ secret: secret })
expect(example_db.read_secret).to eq(secret)
end
it "returns the secret_file only if secret does not exist" do
Chef::Config[:knife][:cl_secret_file] = secret_file.path
- expect(example_db).to receive(:config).and_return({ :secret_file => secret_file.path })
+ expect(example_db).to receive(:config).and_return({ secret_file: secret_file.path })
expect(Chef::EncryptedDataBagItem).to receive(:load_secret).with(secret_file.path).and_return("secret file contents")
expect(example_db.read_secret).to eq("secret file contents")
end
@@ -111,19 +111,19 @@ describe Chef::Knife::DataBagSecretOptions do
end
it "returns true if --encrypt is passed on the CL and :secret is in config" do
- expect(example_db).to receive(:config).and_return({ :encrypt => true })
+ expect(example_db).to receive(:config).and_return({ encrypt: true })
Chef::Config[:knife][:secret] = secret
expect(example_db.encryption_secret_provided?).to eq(true)
end
it "returns true if --encrypt is passed on the CL and :secret_file is in config" do
- expect(example_db).to receive(:config).and_return({ :encrypt => true })
+ expect(example_db).to receive(:config).and_return({ encrypt: true })
Chef::Config[:knife][:secret_file] = secret_file.path
expect(example_db.encryption_secret_provided?).to eq(true)
end
it "throws an error if --encrypt is passed and there is not :secret or :secret_file in the config" do
- expect(example_db).to receive(:config).and_return({ :encrypt => true })
+ expect(example_db).to receive(:config).and_return({ encrypt: true })
expect(example_db).to receive(:exit).with(1)
expect(example_db.ui).to receive(:fatal).with("No secret or secret_file specified in config, unable to encrypt item.")
example_db.encryption_secret_provided?
diff --git a/spec/unit/knife/environment_from_file_spec.rb b/spec/unit/knife/environment_from_file_spec.rb
index 4505da3637..11e05cb922 100644
--- a/spec/unit/knife/environment_from_file_spec.rb
+++ b/spec/unit/knife/environment_from_file_spec.rb
@@ -61,7 +61,7 @@ describe Chef::Knife::EnvironmentFromFile do
allow(File).to receive(:expand_path).with("./environments/").and_return("/tmp/environments")
allow(Dir).to receive(:glob).with("/tmp/environments/*.{json,rb}").and_return(["spec.rb", "apple.rb"])
@knife.name_args = []
- allow(@knife).to receive(:config).and_return({ :all => true })
+ allow(@knife).to receive(:config).and_return({ all: true })
expect(@environment).to receive(:save).twice
@knife.run
end
diff --git a/spec/unit/knife/node_delete_spec.rb b/spec/unit/knife/node_delete_spec.rb
index 1a6b277dbb..cc2e0b23af 100644
--- a/spec/unit/knife/node_delete_spec.rb
+++ b/spec/unit/knife/node_delete_spec.rb
@@ -23,7 +23,7 @@ describe Chef::Knife::NodeDelete do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::NodeDelete.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = %w{ adam ben }
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/node_edit_spec.rb b/spec/unit/knife/node_edit_spec.rb
index e5fa9317b1..dfc0986ebe 100644
--- a/spec/unit/knife/node_edit_spec.rb
+++ b/spec/unit/knife/node_edit_spec.rb
@@ -30,9 +30,9 @@ describe Chef::Knife::NodeEdit do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::NodeEdit.new
@knife.config = {
- :editor => "cat",
- :attribute => nil,
- :print_after => nil,
+ editor: "cat",
+ attribute: nil,
+ print_after: nil,
}
@knife.name_args = [ "adam" ]
@node = Chef::Node.new()
@@ -48,10 +48,10 @@ describe Chef::Knife::NodeEdit do
@knife.config[:all_attributes] = false
allow(@knife).to receive(:node).and_return(@node)
- @node.automatic_attrs = { :go => :away }
- @node.default_attrs = { :hide => :me }
- @node.override_attrs = { :dont => :show }
- @node.normal_attrs = { :do_show => :these }
+ @node.automatic_attrs = { go: :away }
+ @node.default_attrs = { hide: :me }
+ @node.override_attrs = { dont: :show }
+ @node.normal_attrs = { do_show: :these }
@node.chef_environment("prod")
@node.run_list("recipe[foo]")
end
diff --git a/spec/unit/knife/node_from_file_spec.rb b/spec/unit/knife/node_from_file_spec.rb
index 61c63c150e..cf128a80a0 100644
--- a/spec/unit/knife/node_from_file_spec.rb
+++ b/spec/unit/knife/node_from_file_spec.rb
@@ -25,7 +25,7 @@ describe Chef::Knife::NodeFromFile do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::NodeFromFile.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = [ "adam.rb" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/node_run_list_add_spec.rb b/spec/unit/knife/node_run_list_add_spec.rb
index e11bf78029..03c89ff9eb 100644
--- a/spec/unit/knife/node_run_list_add_spec.rb
+++ b/spec/unit/knife/node_run_list_add_spec.rb
@@ -23,7 +23,7 @@ describe Chef::Knife::NodeRunListAdd do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::NodeRunListAdd.new
@knife.config = {
- :after => nil,
+ after: nil,
}
@knife.name_args = [ "adam", "role[monkey]" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/osc_user_edit_spec.rb b/spec/unit/knife/osc_user_edit_spec.rb
index 59fb152b5b..1792e38027 100644
--- a/spec/unit/knife/osc_user_edit_spec.rb
+++ b/spec/unit/knife/osc_user_edit_spec.rb
@@ -37,7 +37,7 @@ describe Chef::Knife::OscUserEdit do
end
it "loads and edits the user" do
- data = { :name => "my_user" }
+ data = { name: "my_user" }
allow(Chef::User).to receive(:load).with("my_user").and_return(data)
expect(@knife).to receive(:edit_hash).with(data).and_return(data)
@knife.run
diff --git a/spec/unit/knife/osc_user_reregister_spec.rb b/spec/unit/knife/osc_user_reregister_spec.rb
index de706dfa42..b0ac92568e 100644
--- a/spec/unit/knife/osc_user_reregister_spec.rb
+++ b/spec/unit/knife/osc_user_reregister_spec.rb
@@ -28,7 +28,7 @@ describe Chef::Knife::OscUserReregister do
Chef::Knife::OscUserReregister.load_deps
@knife = Chef::Knife::OscUserReregister.new
@knife.name_args = [ "a_user" ]
- @user_mock = double("user_mock", :private_key => "private_key")
+ @user_mock = double("user_mock", private_key: "private_key")
allow(Chef::User).to receive(:load).and_return(@user_mock)
@stdout = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
diff --git a/spec/unit/knife/role_bulk_delete_spec.rb b/spec/unit/knife/role_bulk_delete_spec.rb
index e9054c1d00..d49adb9354 100644
--- a/spec/unit/knife/role_bulk_delete_spec.rb
+++ b/spec/unit/knife/role_bulk_delete_spec.rb
@@ -23,7 +23,7 @@ describe Chef::Knife::RoleBulkDelete do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::RoleBulkDelete.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = ["."]
@stdout = StringIO.new
diff --git a/spec/unit/knife/role_create_spec.rb b/spec/unit/knife/role_create_spec.rb
index 9466d9642c..5e2b2caeb5 100644
--- a/spec/unit/knife/role_create_spec.rb
+++ b/spec/unit/knife/role_create_spec.rb
@@ -23,7 +23,7 @@ describe Chef::Knife::RoleCreate do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::RoleCreate.new
@knife.config = {
- :description => nil,
+ description: nil,
}
@knife.name_args = [ "adam" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_delete_spec.rb b/spec/unit/knife/role_delete_spec.rb
index f095e5ba2d..98c0cde9b2 100644
--- a/spec/unit/knife/role_delete_spec.rb
+++ b/spec/unit/knife/role_delete_spec.rb
@@ -23,7 +23,7 @@ describe Chef::Knife::RoleDelete do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::RoleDelete.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = [ "adam" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_env_run_list_add_spec.rb b/spec/unit/knife/role_env_run_list_add_spec.rb
index 4738101f90..e679b88295 100644
--- a/spec/unit/knife/role_env_run_list_add_spec.rb
+++ b/spec/unit/knife/role_env_run_list_add_spec.rb
@@ -25,7 +25,7 @@ describe Chef::Knife::RoleEnvRunListAdd do
# Chef::Config[:env_name] = "QA"
@knife = Chef::Knife::RoleEnvRunListAdd.new
@knife.config = {
- :after => nil,
+ after: nil,
}
@knife.name_args = [ "will", "QA", "role[monkey]" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_env_run_list_clear_spec.rb b/spec/unit/knife/role_env_run_list_clear_spec.rb
index c9c24858c0..7a580ecd4a 100644
--- a/spec/unit/knife/role_env_run_list_clear_spec.rb
+++ b/spec/unit/knife/role_env_run_list_clear_spec.rb
@@ -28,7 +28,7 @@ describe Chef::Knife::RoleEnvRunListClear do
@knife = Chef::Knife::RoleEnvRunListClear.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = %w{will QA}
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_env_run_list_remove_spec.rb b/spec/unit/knife/role_env_run_list_remove_spec.rb
index 8a077f1de3..afbabec528 100644
--- a/spec/unit/knife/role_env_run_list_remove_spec.rb
+++ b/spec/unit/knife/role_env_run_list_remove_spec.rb
@@ -28,7 +28,7 @@ describe Chef::Knife::RoleEnvRunListRemove do
@knife = Chef::Knife::RoleEnvRunListRemove.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = [ "will", "QA", "role[monkey]" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_env_run_list_replace_spec.rb b/spec/unit/knife/role_env_run_list_replace_spec.rb
index 08dcdd90e2..c4d231d638 100644
--- a/spec/unit/knife/role_env_run_list_replace_spec.rb
+++ b/spec/unit/knife/role_env_run_list_replace_spec.rb
@@ -28,7 +28,7 @@ describe Chef::Knife::RoleEnvRunListReplace do
@knife = Chef::Knife::RoleEnvRunListReplace.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = [ "will", "QA", "role[dude]", "role[person]" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_env_run_list_set_spec.rb b/spec/unit/knife/role_env_run_list_set_spec.rb
index aed1c9fe1e..79bd3b152e 100644
--- a/spec/unit/knife/role_env_run_list_set_spec.rb
+++ b/spec/unit/knife/role_env_run_list_set_spec.rb
@@ -28,7 +28,7 @@ describe Chef::Knife::RoleEnvRunListSet do
@knife = Chef::Knife::RoleEnvRunListSet.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = [ "will", "QA", "role[owen]", "role[mauntel]" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_from_file_spec.rb b/spec/unit/knife/role_from_file_spec.rb
index 104894df17..827b8ae04d 100644
--- a/spec/unit/knife/role_from_file_spec.rb
+++ b/spec/unit/knife/role_from_file_spec.rb
@@ -25,7 +25,7 @@ describe Chef::Knife::RoleFromFile do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::RoleFromFile.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = [ "adam.rb" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_run_list_add_spec.rb b/spec/unit/knife/role_run_list_add_spec.rb
index fe7318c040..3358da130c 100644
--- a/spec/unit/knife/role_run_list_add_spec.rb
+++ b/spec/unit/knife/role_run_list_add_spec.rb
@@ -25,7 +25,7 @@ describe Chef::Knife::RoleRunListAdd do
# Chef::Config[:env_name] = "QA"
@knife = Chef::Knife::RoleRunListAdd.new
@knife.config = {
- :after => nil,
+ after: nil,
}
@knife.name_args = [ "will", "role[monkey]" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_run_list_clear_spec.rb b/spec/unit/knife/role_run_list_clear_spec.rb
index 4ed1f312b0..8bbc816d6f 100644
--- a/spec/unit/knife/role_run_list_clear_spec.rb
+++ b/spec/unit/knife/role_run_list_clear_spec.rb
@@ -27,7 +27,7 @@ describe Chef::Knife::RoleRunListClear do
@knife = Chef::Knife::RoleRunListClear.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = [ "will" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_run_list_remove_spec.rb b/spec/unit/knife/role_run_list_remove_spec.rb
index 087bc2c6ee..c18416feca 100644
--- a/spec/unit/knife/role_run_list_remove_spec.rb
+++ b/spec/unit/knife/role_run_list_remove_spec.rb
@@ -27,7 +27,7 @@ describe Chef::Knife::RoleRunListRemove do
@knife = Chef::Knife::RoleRunListRemove.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = [ "will", "role[monkey]" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_run_list_replace_spec.rb b/spec/unit/knife/role_run_list_replace_spec.rb
index 2bc060ae2d..9b212de0ae 100644
--- a/spec/unit/knife/role_run_list_replace_spec.rb
+++ b/spec/unit/knife/role_run_list_replace_spec.rb
@@ -27,7 +27,7 @@ describe Chef::Knife::RoleRunListReplace do
@knife = Chef::Knife::RoleRunListReplace.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = [ "will", "role[dude]", "role[person]" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/role_run_list_set_spec.rb b/spec/unit/knife/role_run_list_set_spec.rb
index 27b4d9fea1..f8e440f524 100644
--- a/spec/unit/knife/role_run_list_set_spec.rb
+++ b/spec/unit/knife/role_run_list_set_spec.rb
@@ -27,7 +27,7 @@ describe Chef::Knife::RoleRunListSet do
@knife = Chef::Knife::RoleRunListSet.new
@knife.config = {
- :print_after => nil,
+ print_after: nil,
}
@knife.name_args = [ "will", "role[owen]", "role[mauntel]" ]
allow(@knife).to receive(:output).and_return(true)
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 9d7fcb6f9e..ec345d5aff 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -224,7 +224,7 @@ describe Chef::Knife::Ssh do
describe "#session_from_list" do
before :each do
@knife.instance_variable_set(:@longest, 0)
- ssh_config = { :timeout => 50, :user => "locutus", :port => 23, :keepalive => true, :keepalive_interval => 60 }
+ ssh_config = { timeout: 50, user: "locutus", port: 23, keepalive: true, keepalive_interval: 60 }
allow(Net::SSH).to receive(:configuration_for).with("the.b.org", true).and_return(ssh_config)
end
@@ -279,20 +279,20 @@ describe Chef::Knife::Ssh do
end
describe "#ssh_command" do
- let(:execution_channel) { double(:execution_channel, :on_data => nil) }
- let(:session_channel) { double(:session_channel, :request_pty => nil) }
+ let(:execution_channel) { double(:execution_channel, on_data: nil) }
+ let(:session_channel) { double(:session_channel, request_pty: nil) }
- let(:execution_channel2) { double(:execution_channel, :on_data => nil) }
- let(:session_channel2) { double(:session_channel, :request_pty => nil) }
+ let(:execution_channel2) { double(:execution_channel, on_data: nil) }
+ let(:session_channel2) { double(:session_channel, request_pty: nil) }
- let(:session) { double(:session, :loop => nil) }
+ let(:session) { double(:session, loop: nil) }
let(:command) { "false" }
before do
expect(execution_channel).
to receive(:on_request).
- and_yield(nil, double(:data_stream, :read_long => exit_status))
+ and_yield(nil, double(:data_stream, read_long: exit_status))
expect(session_channel).
to receive(:exec).
@@ -301,7 +301,7 @@ describe Chef::Knife::Ssh do
expect(execution_channel2).
to receive(:on_request).
- and_yield(nil, double(:data_stream, :read_long => exit_status2))
+ and_yield(nil, double(:data_stream, read_long: exit_status2))
expect(session_channel2).
to receive(:exec).
@@ -344,7 +344,7 @@ describe Chef::Knife::Ssh do
describe "#tmux" do
before do
- ssh_config = { :timeout => 50, :user => "locutus", :port => 23, :keepalive => true, :keepalive_interval => 60 }
+ ssh_config = { timeout: 50, user: "locutus", port: 23, keepalive: true, keepalive_interval: 60 }
allow(Net::SSH).to receive(:configuration_for).with("foo.example.org", true).and_return(ssh_config)
@query = Chef::Search::Query.new
expect(@query).to receive(:search).and_yield(@node_foo)
diff --git a/spec/unit/knife/user_reregister_spec.rb b/spec/unit/knife/user_reregister_spec.rb
index d650ff9fb8..8501347087 100644
--- a/spec/unit/knife/user_reregister_spec.rb
+++ b/spec/unit/knife/user_reregister_spec.rb
@@ -20,7 +20,7 @@ require "spec_helper"
describe Chef::Knife::UserReregister do
let(:knife) { Chef::Knife::UserReregister.new }
- let(:user_mock) { double("user_mock", :private_key => "private_key") }
+ let(:user_mock) { double("user_mock", private_key: "private_key") }
let(:stdout) { StringIO.new }
before do
diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb
index adaab11d55..86fe59ca58 100644
--- a/spec/unit/knife_spec.rb
+++ b/spec/unit/knife_spec.rb
@@ -37,7 +37,7 @@ describe Chef::Knife do
instance_double("WorkstationConfigLoader",
load: nil, no_config_found?: false,
config_location: config_location,
- :chef_config_dir => "/etc/chef")
+ chef_config_dir: "/etc/chef")
end
before(:each) do
@@ -225,10 +225,10 @@ describe Chef::Knife do
it "merges the global knife CLI options" do
extra_opts = {}
- extra_opts[:editor] = { :long => "--editor EDITOR",
- :description => "Set the editor to use for interactive commands",
- :short => "-e EDITOR",
- :default => "/usr/bin/vim" }
+ extra_opts[:editor] = { long: "--editor EDITOR",
+ description: "Set the editor to use for interactive commands",
+ short: "-e EDITOR",
+ default: "/usr/bin/vim" }
# there is special hackery to return the subcommand instance going on here.
command = Chef::Knife.run(%w{test yourself}, extra_opts)
@@ -283,8 +283,8 @@ describe Chef::Knife do
describe "merging configuration options" do
before do
KnifeSpecs::TestYourself.option(:opt_with_default,
- :short => "-D VALUE",
- :default => "default-value")
+ short: "-D VALUE",
+ default: "default-value")
end
it "sets the default log_location to STDERR for Chef::Log warnings" do
@@ -330,7 +330,7 @@ describe Chef::Knife do
before do
knife.config[:verbosity] = 1
knife.config[:config_file] = fake_config
- config_loader = double("Chef::WorkstationConfigLoader", :load => true, :no_config_found? => false, :chef_config_dir => "/etc/chef", :config_location => fake_config)
+ config_loader = double("Chef::WorkstationConfigLoader", load: true, no_config_found?: false, chef_config_dir: "/etc/chef", config_location: fake_config)
allow(config_loader).to receive(:explicit_config_file=).with(fake_config).and_return(fake_config)
allow(config_loader).to receive(:profile=)
allow(Chef::WorkstationConfigLoader).to receive(:new).and_return(config_loader)
@@ -423,7 +423,7 @@ describe Chef::Knife do
it "formats 401s nicely" do
response = Net::HTTPUnauthorized.new("1.1", "401", "Unauthorized")
response.instance_variable_set(:@read, true) # I hate you, net/http.
- allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "y u no syncronize your clock?"))
+ allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(error: "y u no syncronize your clock?"))
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("401 Unauthorized", response))
knife.run_with_pretty_exceptions
expect(stderr.string).to match(/ERROR: Failed to authenticate to/)
@@ -433,7 +433,7 @@ describe Chef::Knife do
it "formats 403s nicely" do
response = Net::HTTPForbidden.new("1.1", "403", "Forbidden")
response.instance_variable_set(:@read, true) # I hate you, net/http.
- allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "y u no administrator"))
+ allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(error: "y u no administrator"))
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("403 Forbidden", response))
allow(knife).to receive(:username).and_return("sadpanda")
knife.run_with_pretty_exceptions
@@ -453,7 +453,7 @@ describe Chef::Knife do
it "formats proxy errors nicely" do
response = Net::HTTPForbidden.new("1.1", "403", "Forbidden")
response.instance_variable_set(:@read, true)
- allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "y u no administrator"))
+ allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(error: "y u no administrator"))
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("403 Forbidden", response))
allow(knife).to receive(:username).and_return("sadpanda")
knife.run_with_pretty_exceptions
@@ -466,7 +466,7 @@ describe Chef::Knife do
it "formats 400s nicely" do
response = Net::HTTPBadRequest.new("1.1", "400", "Bad Request")
response.instance_variable_set(:@read, true) # I hate you, net/http.
- allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "y u search wrong"))
+ allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(error: "y u search wrong"))
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("400 Bad Request", response))
knife.run_with_pretty_exceptions
expect(stderr.string).to match(%r{ERROR: The data in your request was invalid})
@@ -476,7 +476,7 @@ describe Chef::Knife do
it "formats 404s nicely" do
response = Net::HTTPNotFound.new("1.1", "404", "Not Found")
response.instance_variable_set(:@read, true) # I hate you, net/http.
- allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "nothing to see here"))
+ allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(error: "nothing to see here"))
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("404 Not Found", response))
knife.run_with_pretty_exceptions
expect(stderr.string).to match(%r{ERROR: The object you are looking for could not be found})
@@ -488,9 +488,9 @@ describe Chef::Knife do
response.instance_variable_set(:@read, true) # I hate you, net/http.
# set the header
- response["x-ops-server-api-version"] = Chef::JSONCompat.to_json(:min_version => "0", :max_version => "1", :request_version => "10000000")
+ response["x-ops-server-api-version"] = Chef::JSONCompat.to_json(min_version: "0", max_version: "1", request_version: "10000000")
- allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "sad trombone"))
+ allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(error: "sad trombone"))
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("406 Not Acceptable", response))
knife.run_with_pretty_exceptions
@@ -502,7 +502,7 @@ describe Chef::Knife do
it "formats 500s nicely" do
response = Net::HTTPInternalServerError.new("1.1", "500", "Internal Server Error")
response.instance_variable_set(:@read, true) # I hate you, net/http.
- allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "sad trombone"))
+ allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(error: "sad trombone"))
allow(knife).to receive(:run).and_raise(Net::HTTPFatalError.new("500 Internal Server Error", response))
knife.run_with_pretty_exceptions
expect(stderr.string).to match(%r{ERROR: internal server error})
@@ -512,7 +512,7 @@ describe Chef::Knife do
it "formats 502s nicely" do
response = Net::HTTPBadGateway.new("1.1", "502", "Bad Gateway")
response.instance_variable_set(:@read, true) # I hate you, net/http.
- allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "sadder trombone"))
+ allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(error: "sadder trombone"))
allow(knife).to receive(:run).and_raise(Net::HTTPFatalError.new("502 Bad Gateway", response))
knife.run_with_pretty_exceptions
expect(stderr.string).to match(%r{ERROR: bad gateway})
@@ -522,7 +522,7 @@ describe Chef::Knife do
it "formats 503s nicely" do
response = Net::HTTPServiceUnavailable.new("1.1", "503", "Service Unavailable")
response.instance_variable_set(:@read, true) # I hate you, net/http.
- allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "saddest trombone"))
+ allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(error: "saddest trombone"))
allow(knife).to receive(:run).and_raise(Net::HTTPFatalError.new("503 Service Unavailable", response))
knife.run_with_pretty_exceptions
expect(stderr.string).to match(%r{ERROR: Service temporarily unavailable})
@@ -532,7 +532,7 @@ describe Chef::Knife do
it "formats other HTTP errors nicely" do
response = Net::HTTPPaymentRequired.new("1.1", "402", "Payment Required")
response.instance_variable_set(:@read, true) # I hate you, net/http.
- allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(:error => "nobugfixtillyoubuy"))
+ allow(response).to receive(:body).and_return(Chef::JSONCompat.to_json(error: "nobugfixtillyoubuy"))
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("402 Payment Required", response))
knife.run_with_pretty_exceptions
expect(stderr.string).to match(%r{ERROR: Payment Required})
diff --git a/spec/unit/log/syslog_spec.rb b/spec/unit/log/syslog_spec.rb
index 6d56b96575..4586503e88 100644
--- a/spec/unit/log/syslog_spec.rb
+++ b/spec/unit/log/syslog_spec.rb
@@ -18,7 +18,7 @@
require "spec_helper"
-describe "Chef::Log::Syslog", :unix_only => true do
+describe "Chef::Log::Syslog", unix_only: true do
let(:syslog) { Chef::Log::Syslog.new }
before do
diff --git a/spec/unit/lwrp_spec.rb b/spec/unit/lwrp_spec.rb
index b42ac3af1e..3776372965 100644
--- a/spec/unit/lwrp_spec.rb
+++ b/spec/unit/lwrp_spec.rb
@@ -243,8 +243,8 @@ describe "LWRP" do
let(:klass) do
Class.new(Chef::Resource::LWRPBase) do
self.resource_name = :sample_resource
- attribute :food, :default => lazy { "BACON!" * 3 }
- attribute :drink, :default => lazy { |r| "Drink after #{r.food}!" }
+ attribute :food, default: lazy { "BACON!" * 3 }
+ attribute :drink, default: lazy { |r| "Drink after #{r.food}!" }
end
end
diff --git a/spec/unit/mash_spec.rb b/spec/unit/mash_spec.rb
index e58f6b85a1..0797e80f2c 100644
--- a/spec/unit/mash_spec.rb
+++ b/spec/unit/mash_spec.rb
@@ -21,7 +21,7 @@ require "chef/mash"
describe Mash do
it "should duplicate a simple key/value mash to a new mash" do
- data = { :x => "one", :y => "two", :z => "three" }
+ data = { x: "one", y: "two", z: "three" }
@orig = Mash.new(data)
@copy = @orig.dup
expect(@copy.to_hash).to eq(Mash.new(data).to_hash)
@@ -30,7 +30,7 @@ describe Mash do
end
it "should duplicate a mash with an array to a new mash" do
- data = { :x => "one", :y => "two", :z => [1, 2, 3] }
+ data = { x: "one", y: "two", z: [1, 2, 3] }
@orig = Mash.new(data)
@copy = @orig.dup
expect(@copy.to_hash).to eq(Mash.new(data).to_hash)
@@ -39,7 +39,7 @@ describe Mash do
end
it "should duplicate a nested mash to a new mash" do
- data = { :x => "one", :y => "two", :z => Mash.new({ :a => [1, 2, 3] }) }
+ data = { x: "one", y: "two", z: Mash.new({ a: [1, 2, 3] }) }
@orig = Mash.new(data)
@copy = @orig.dup
expect(@copy.to_hash).to eq(Mash.new(data).to_hash)
diff --git a/spec/unit/mixin/api_version_request_handling_spec.rb b/spec/unit/mixin/api_version_request_handling_spec.rb
index 191dee643b..5cbad7efa0 100644
--- a/spec/unit/mixin/api_version_request_handling_spec.rb
+++ b/spec/unit/mixin/api_version_request_handling_spec.rb
@@ -26,7 +26,7 @@ describe Chef::Mixin::ApiVersionRequestHandling do
let(:default_supported_client_versions) { [0, 1, 2] }
context "when the response code is not 406" do
- let(:response) { OpenStruct.new(:code => "405") }
+ let(:response) { OpenStruct.new(code: "405") }
let(:exception) { Net::HTTPServerException.new("405 Something Else", response) }
it "returns nil" do
@@ -37,7 +37,7 @@ describe Chef::Mixin::ApiVersionRequestHandling do
end # when the response code is not 406
context "when the response code is 406" do
- let(:response) { OpenStruct.new(:code => "406") }
+ let(:response) { OpenStruct.new(code: "406") }
let(:exception) { Net::HTTPServerException.new("406 Not Acceptable", response) }
context "when x-ops-server-api-version header does not exist" do
diff --git a/spec/unit/mixin/checksum_spec.rb b/spec/unit/mixin/checksum_spec.rb
index 801c8820d2..873d2a2fc0 100644
--- a/spec/unit/mixin/checksum_spec.rb
+++ b/spec/unit/mixin/checksum_spec.rb
@@ -29,7 +29,7 @@ describe Chef::Mixin::Checksum do
@checksum_user = Chef::CMCCheck.new
@cache = Chef::Digester.instance
@file = CHEF_SPEC_DATA + "/checksum/random.txt"
- @stat = double("File::Stat", { :mtime => Time.at(0) })
+ @stat = double("File::Stat", { mtime: Time.at(0) })
allow(File).to receive(:stat).and_return(@stat)
end
diff --git a/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb b/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
index 248de0ba95..701de06167 100644
--- a/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
+++ b/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
@@ -51,11 +51,11 @@ describe Chef::Mixin::EnforceOwnershipAndPermissions do
allow_any_instance_of(Chef::FileAccessControl).to receive(:define_resource_requirements)
allow_any_instance_of(Chef::FileAccessControl).to receive(:describe_changes)
- passwd_struct = OpenStruct.new(:name => "root", :passwd => "x",
- :uid => 0, :gid => 0, :dir => "/root",
- :shell => "/bin/bash")
+ passwd_struct = OpenStruct.new(name: "root", passwd: "x",
+ uid: 0, gid: 0, dir: "/root",
+ shell: "/bin/bash")
- group_struct = OpenStruct.new(:name => "root", :passwd => "x", :gid => 0)
+ group_struct = OpenStruct.new(name: "root", passwd: "x", gid: 0)
allow(Etc).to receive(:getpwuid).and_return(passwd_struct)
allow(Etc).to receive(:getgrgid).and_return(group_struct)
end
@@ -75,11 +75,11 @@ describe Chef::Mixin::EnforceOwnershipAndPermissions do
allow_any_instance_of(Chef::FileAccessControl).to receive(:uid_from_resource).and_return(0)
allow_any_instance_of(Chef::FileAccessControl).to receive(:describe_changes)
- passwd_struct = OpenStruct.new(:name => "root", :passwd => "x",
- :uid => 0, :gid => 0, :dir => "/root",
- :shell => "/bin/bash")
+ passwd_struct = OpenStruct.new(name: "root", passwd: "x",
+ uid: 0, gid: 0, dir: "/root",
+ shell: "/bin/bash")
- group_struct = OpenStruct.new(:name => "root", :passwd => "x", :gid => 0)
+ group_struct = OpenStruct.new(name: "root", passwd: "x", gid: 0)
allow(Etc).to receive(:getpwuid).and_return(passwd_struct)
allow(Etc).to receive(:getgrgid).and_return(group_struct)
end
diff --git a/spec/unit/mixin/homebrew_user_spec.rb b/spec/unit/mixin/homebrew_user_spec.rb
index 67d79719aa..df89962cce 100644
--- a/spec/unit/mixin/homebrew_user_spec.rb
+++ b/spec/unit/mixin/homebrew_user_spec.rb
@@ -56,7 +56,7 @@ describe Chef::Mixin::HomebrewUser do
context "debug statement prints owner name" do
before do
- expect(Etc).to receive(:getpwuid).with(brew_owner).and_return(OpenStruct.new(:name => "name"))
+ expect(Etc).to receive(:getpwuid).with(brew_owner).and_return(OpenStruct.new(name: "name"))
end
it "returns the owner of the brew executable when it is at a default location" do
diff --git a/spec/unit/mixin/params_validate_spec.rb b/spec/unit/mixin/params_validate_spec.rb
index 7bc8a27398..62d6b3e117 100644
--- a/spec/unit/mixin/params_validate_spec.rb
+++ b/spec/unit/mixin/params_validate_spec.rb
@@ -34,7 +34,7 @@ describe Chef::Mixin::ParamsValidate do
end
it "should allow a hash and a hash as arguments to validate" do
- expect { @vo.validate({ :one => "two" }, {}) }.not_to raise_error
+ expect { @vo.validate({ one: "two" }, {}) }.not_to raise_error
end
it "should raise an argument error if validate is called incorrectly" do
@@ -42,26 +42,26 @@ describe Chef::Mixin::ParamsValidate do
end
it "should require validation map keys to be symbols or strings" do
- expect { @vo.validate({ :one => "two" }, { :one => true }) }.not_to raise_error
- expect { @vo.validate({ :one => "two" }, { "one" => true }) }.not_to raise_error
- expect { @vo.validate({ :one => "two" }, { Hash.new => true }) }.to raise_error(ArgumentError)
+ expect { @vo.validate({ one: "two" }, { one: true }) }.not_to raise_error
+ expect { @vo.validate({ one: "two" }, { "one" => true }) }.not_to raise_error
+ expect { @vo.validate({ one: "two" }, { Hash.new => true }) }.to raise_error(ArgumentError)
end
it "should allow options to be required with true" do
- expect { @vo.validate({ :one => "two" }, { :one => true }) }.not_to raise_error
+ expect { @vo.validate({ one: "two" }, { one: true }) }.not_to raise_error
end
it "should allow options to be optional with false" do
- expect { @vo.validate({}, { :one => false }) }.not_to raise_error
+ expect { @vo.validate({}, { one: false }) }.not_to raise_error
end
it "should allow you to check what kind_of? thing an argument is with kind_of" do
expect do
@vo.validate(
- { :one => "string" },
+ { one: "string" },
{
- :one => {
- :kind_of => String,
+ one: {
+ kind_of: String,
},
}
)
@@ -69,10 +69,10 @@ describe Chef::Mixin::ParamsValidate do
expect do
@vo.validate(
- { :one => "string" },
+ { one: "string" },
{
- :one => {
- :kind_of => Array,
+ one: {
+ kind_of: Array,
},
}
)
@@ -82,10 +82,10 @@ describe Chef::Mixin::ParamsValidate do
it "should allow you to specify an argument is required with required" do
expect do
@vo.validate(
- { :one => "string" },
+ { one: "string" },
{
- :one => {
- :required => true,
+ one: {
+ required: true,
},
}
)
@@ -93,10 +93,10 @@ describe Chef::Mixin::ParamsValidate do
expect do
@vo.validate(
- { :two => "string" },
+ { two: "string" },
{
- :one => {
- :required => true,
+ one: {
+ required: true,
},
}
)
@@ -104,10 +104,10 @@ describe Chef::Mixin::ParamsValidate do
expect do
@vo.validate(
- { :two => "string" },
+ { two: "string" },
{
- :one => {
- :required => false,
+ one: {
+ required: false,
},
}
)
@@ -117,10 +117,10 @@ describe Chef::Mixin::ParamsValidate do
it "should allow you to specify whether an object has a method with respond_to" do
expect do
@vo.validate(
- { :one => @vo },
+ { one: @vo },
{
- :one => {
- :respond_to => "validate",
+ one: {
+ respond_to: "validate",
},
}
)
@@ -128,10 +128,10 @@ describe Chef::Mixin::ParamsValidate do
expect do
@vo.validate(
- { :one => @vo },
+ { one: @vo },
{
- :one => {
- :respond_to => "monkey",
+ one: {
+ respond_to: "monkey",
},
}
)
@@ -141,10 +141,10 @@ describe Chef::Mixin::ParamsValidate do
it "should allow you to specify whether an object has all the given methods with respond_to and an array" do
expect do
@vo.validate(
- { :one => @vo },
+ { one: @vo },
{
- :one => {
- :respond_to => %w{validate music},
+ one: {
+ respond_to: %w{validate music},
},
}
)
@@ -152,10 +152,10 @@ describe Chef::Mixin::ParamsValidate do
expect do
@vo.validate(
- { :one => @vo },
+ { one: @vo },
{
- :one => {
- :respond_to => %w{monkey validate},
+ one: {
+ respond_to: %w{monkey validate},
},
}
)
@@ -165,8 +165,8 @@ describe Chef::Mixin::ParamsValidate do
it "should let you set a default value with default => value" do
arguments = Hash.new
@vo.validate(arguments, {
- :one => {
- :default => "is the loneliest number",
+ one: {
+ default: "is the loneliest number",
},
})
expect(arguments[:one]).to eq("is the loneliest number")
@@ -175,10 +175,10 @@ describe Chef::Mixin::ParamsValidate do
it "should let you check regular expressions" do
expect do
@vo.validate(
- { :one => "is good" },
+ { one: "is good" },
{
- :one => {
- :regex => /^is good$/,
+ one: {
+ regex: /^is good$/,
},
}
)
@@ -186,10 +186,10 @@ describe Chef::Mixin::ParamsValidate do
expect do
@vo.validate(
- { :one => "is good" },
+ { one: "is good" },
{
- :one => {
- :regex => /^is bad$/,
+ one: {
+ regex: /^is bad$/,
},
}
)
@@ -199,10 +199,10 @@ describe Chef::Mixin::ParamsValidate do
it "should let you specify your own callbacks" do
expect do
@vo.validate(
- { :one => "is good" },
+ { one: "is good" },
{
- :one => {
- :callbacks => {
+ one: {
+ callbacks: {
"should be equal to is good" => lambda do |a|
a == "is good"
end,
@@ -214,10 +214,10 @@ describe Chef::Mixin::ParamsValidate do
expect do
@vo.validate(
- { :one => "is bad" },
+ { one: "is bad" },
{
- :one => {
- :callbacks => {
+ one: {
+ callbacks: {
"should be equal to 'is good'" => lambda do |a|
a == "is good"
end,
@@ -229,27 +229,27 @@ describe Chef::Mixin::ParamsValidate do
end
it "should let you combine checks" do
- args = { :one => "is good", :two => "is bad" }
+ args = { one: "is good", two: "is bad" }
expect do
@vo.validate(
args,
{
- :one => {
- :kind_of => String,
- :respond_to => [ :to_s, :upcase ],
- :regex => /^is good/,
- :callbacks => {
+ one: {
+ kind_of: String,
+ respond_to: [ :to_s, :upcase ],
+ regex: /^is good/,
+ callbacks: {
"should be your friend" => lambda do |a|
a == "is good"
end,
},
- :required => true,
+ required: true,
},
- :two => {
- :kind_of => String,
- :required => false,
+ two: {
+ kind_of: String,
+ required: false,
},
- :three => { :default => "neato mosquito" },
+ three: { default: "neato mosquito" },
}
)
end.not_to raise_error
@@ -258,22 +258,22 @@ describe Chef::Mixin::ParamsValidate do
@vo.validate(
args,
{
- :one => {
- :kind_of => String,
- :respond_to => [ :to_s, :upcase ],
- :regex => /^is good/,
- :callbacks => {
+ one: {
+ kind_of: String,
+ respond_to: [ :to_s, :upcase ],
+ regex: /^is good/,
+ callbacks: {
"should be your friend" => lambda do |a|
a == "is good"
end,
},
- :required => true,
+ required: true,
},
- :two => {
- :kind_of => Hash,
- :required => false,
+ two: {
+ kind_of: Hash,
+ required: false,
},
- :three => { :default => "neato mosquito" },
+ three: { default: "neato mosquito" },
}
)
end.to raise_error(ArgumentError)
@@ -282,10 +282,10 @@ describe Chef::Mixin::ParamsValidate do
it "should raise an ArgumentError if the validation map has an unknown check" do
expect do
@vo.validate(
- { :one => "two" },
+ { one: "two" },
{
- :one => {
- :busted => "check",
+ one: {
+ busted: "check",
},
}
)
@@ -294,37 +294,37 @@ describe Chef::Mixin::ParamsValidate do
it "should accept keys that are strings in the options" do
expect do
- @vo.validate({ "one" => "two" }, { :one => { :regex => /^two$/ } })
+ @vo.validate({ "one" => "two" }, { one: { regex: /^two$/ } })
end.not_to raise_error
end
it "should allow an array to kind_of" do
expect do
@vo.validate(
- { :one => "string" },
+ { one: "string" },
{
- :one => {
- :kind_of => [ String, Array ],
+ one: {
+ kind_of: [ String, Array ],
},
}
)
end.not_to raise_error
expect do
@vo.validate(
- { :one => ["string"] },
+ { one: ["string"] },
{
- :one => {
- :kind_of => [ String, Array ],
+ one: {
+ kind_of: [ String, Array ],
},
}
)
end.not_to raise_error
expect do
@vo.validate(
- { :one => Hash.new },
+ { one: Hash.new },
{
- :one => {
- :kind_of => [ String, Array ],
+ one: {
+ kind_of: [ String, Array ],
},
}
)
@@ -333,23 +333,23 @@ describe Chef::Mixin::ParamsValidate do
it "asserts that a value returns false from a predicate method" do
expect do
- @vo.validate({ :not_blank => "should pass" },
- { :not_blank => { :cannot_be => [ :nil, :empty ] } })
+ @vo.validate({ not_blank: "should pass" },
+ { not_blank: { cannot_be: [ :nil, :empty ] } })
end.not_to raise_error
expect do
- @vo.validate({ :not_blank => "" },
- { :not_blank => { :cannot_be => [ :nil, :empty ] } })
+ @vo.validate({ not_blank: "" },
+ { not_blank: { cannot_be: [ :nil, :empty ] } })
end.to raise_error(Chef::Exceptions::ValidationFailed)
end
it "allows a custom validation message" do
expect do
- @vo.validate({ :not_blank => "should pass" },
- { :not_blank => { :cannot_be => [ :nil, :empty ], validation_message: "my validation message" } })
+ @vo.validate({ not_blank: "should pass" },
+ { not_blank: { cannot_be: [ :nil, :empty ], validation_message: "my validation message" } })
end.not_to raise_error
expect do
- @vo.validate({ :not_blank => "" },
- { :not_blank => { :cannot_be => [ :nil, :empty ], validation_message: "my validation message" } })
+ @vo.validate({ not_blank: "" },
+ { not_blank: { cannot_be: [ :nil, :empty ], validation_message: "my validation message" } })
end.to raise_error(Chef::Exceptions::ValidationFailed, "my validation message")
end
@@ -361,38 +361,38 @@ describe Chef::Mixin::ParamsValidate do
it "should set and return a default value when the argument is nil, then return the same value" do
value = "meow"
- expect(@vo.set_or_return(:test, nil, { :default => value }).object_id).to eq(value.object_id)
+ expect(@vo.set_or_return(:test, nil, { default: value }).object_id).to eq(value.object_id)
expect(@vo.set_or_return(:test, nil, {}).object_id).to eq(value.object_id)
end
it "should raise an ArgumentError when argument is nil and required is true" do
expect do
- @vo.set_or_return(:test, nil, { :required => true })
+ @vo.set_or_return(:test, nil, { required: true })
end.to raise_error(ArgumentError)
end
it "should not raise an error when argument is nil and required is false" do
expect do
- @vo.set_or_return(:test, nil, { :required => false })
+ @vo.set_or_return(:test, nil, { required: false })
end.not_to raise_error
end
it "should set and return @name, then return @name for foo when argument is nil" do
value = "meow"
expect(@vo.set_or_return(:name, value, {}).object_id).to eq(value.object_id)
- expect(@vo.set_or_return(:foo, nil, { :name_attribute => true }).object_id).to eq(value.object_id)
+ expect(@vo.set_or_return(:foo, nil, { name_attribute: true }).object_id).to eq(value.object_id)
end
it "should allow DelayedEvaluator instance to be set for value regardless of restriction" do
value = Chef::DelayedEvaluator.new { "test" }
- @vo.set_or_return(:test, value, { :kind_of => Numeric })
+ @vo.set_or_return(:test, value, { kind_of: Numeric })
end
it "should raise an error when delayed evaluated attribute is not valid" do
value = Chef::DelayedEvaluator.new { "test" }
- @vo.set_or_return(:test, value, { :kind_of => Numeric })
+ @vo.set_or_return(:test, value, { kind_of: Numeric })
expect do
- @vo.set_or_return(:test, nil, { :kind_of => Numeric })
+ @vo.set_or_return(:test, nil, { kind_of: Numeric })
end.to raise_error(Chef::Exceptions::ValidationFailed)
end
diff --git a/spec/unit/mixin/securable_spec.rb b/spec/unit/mixin/securable_spec.rb
index 6f50ce853f..7ec39ac63f 100644
--- a/spec/unit/mixin/securable_spec.rb
+++ b/spec/unit/mixin/securable_spec.rb
@@ -258,23 +258,23 @@ describe Chef::Mixin::Securable do
end
it "should allow you to specify whether the permissions applies_to_children with true/false/:containers_only/:objects_only" do
- expect { @securable.rights :read, "The Dude", :applies_to_children => false }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => true }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => :containers_only }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => :objects_only }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => "poop" }.to raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", applies_to_children: false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: :containers_only }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: :objects_only }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: "poop" }.to raise_error(ArgumentError)
end
it "should allow you to specify whether the permissions applies_to_self with true/false" do
- expect { @securable.rights :read, "The Dude", :applies_to_children => true, :applies_to_self => false }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_self => true }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_self => "poop" }.to raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", applies_to_children: true, applies_to_self: false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_self: true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_self: "poop" }.to raise_error(ArgumentError)
end
it "should allow you to specify whether the permissions applies one_level_deep with true/false" do
- expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => false }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => true }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => "poop" }.to raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", applies_to_children: true, one_level_deep: false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: true, one_level_deep: true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: true, one_level_deep: "poop" }.to raise_error(ArgumentError)
end
it "should allow multiple rights and deny_rights declarations" do
@@ -288,21 +288,21 @@ describe Chef::Mixin::Securable do
end
it "should allow you to specify whether the permission applies_to_self only if you specified applies_to_children" do
- expect { @securable.rights :read, "The Dude", :applies_to_children => true, :applies_to_self => true }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => true, :applies_to_self => false }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => false, :applies_to_self => true }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => false, :applies_to_self => false }.to raise_error(ArgumentError)
- expect { @securable.rights :read, "The Dude", :applies_to_self => true }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_self => false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: true, applies_to_self: true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: true, applies_to_self: false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: false, applies_to_self: true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: false, applies_to_self: false }.to raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", applies_to_self: true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_self: false }.not_to raise_error
end
it "should allow you to specify whether the permission applies one_level_deep only if you specified applies_to_children" do
- expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => true }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => false }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => false, :one_level_deep => true }.to raise_error(ArgumentError)
- expect { @securable.rights :read, "The Dude", :applies_to_children => false, :one_level_deep => false }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :one_level_deep => true }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :one_level_deep => false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: true, one_level_deep: true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: true, one_level_deep: false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", applies_to_children: false, one_level_deep: true }.to raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", applies_to_children: false, one_level_deep: false }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", one_level_deep: true }.not_to raise_error
+ expect { @securable.rights :read, "The Dude", one_level_deep: false }.not_to raise_error
end
it "should allow you to specify whether the permissions inherit with true/false" do
diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb
index 2fef051b29..6b0cd659ef 100644
--- a/spec/unit/mixin/shell_out_spec.rb
+++ b/spec/unit/mixin/shell_out_spec.rb
@@ -60,21 +60,21 @@ describe Chef::Mixin::ShellOut do
describe "when the last argument is a Hash" do
describe "and environment is an option" do
it "should not change environment language settings when they are set to nil" do
- options = { :environment => { "LC_ALL" => nil, "LANGUAGE" => nil, "LANG" => nil, env_path => nil } }
+ options = { environment: { "LC_ALL" => nil, "LANGUAGE" => nil, "LANG" => nil, env_path => nil } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(retobj)
shell_out_obj.send(method, cmd, options)
end
it "should not change environment language settings when they are set to non-nil" do
- options = { :environment => { "LC_ALL" => "en_US.UTF-8", "LANGUAGE" => "en_US.UTF-8", "LANG" => "en_US.UTF-8", env_path => "foo:bar:baz" } }
+ options = { environment: { "LC_ALL" => "en_US.UTF-8", "LANGUAGE" => "en_US.UTF-8", "LANG" => "en_US.UTF-8", env_path => "foo:bar:baz" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(retobj)
shell_out_obj.send(method, cmd, options)
end
it "should set environment language settings to the configured internal locale when they are not present" do
- options = { :environment => { "HOME" => "/Users/morty" } }
+ options = { environment: { "HOME" => "/Users/morty" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, {
- :environment => {
+ environment: {
"HOME" => "/Users/morty",
"LC_ALL" => Chef::Config[:internal_locale],
"LANG" => Chef::Config[:internal_locale],
@@ -86,9 +86,9 @@ describe Chef::Mixin::ShellOut do
end
it "should not mutate the options hash when it adds language settings" do
- options = { :environment => { "HOME" => "/Users/morty" } }
+ options = { environment: { "HOME" => "/Users/morty" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, {
- :environment => {
+ environment: {
"HOME" => "/Users/morty",
"LC_ALL" => Chef::Config[:internal_locale],
"LANG" => Chef::Config[:internal_locale],
@@ -103,21 +103,21 @@ describe Chef::Mixin::ShellOut do
describe "and env is an option" do
it "should not change env when langauge options are set to nil" do
- options = { :env => { "LC_ALL" => nil, "LANG" => nil, "LANGUAGE" => nil, env_path => nil } }
+ options = { env: { "LC_ALL" => nil, "LANG" => nil, "LANGUAGE" => nil, env_path => nil } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(retobj)
shell_out_obj.send(method, cmd, options)
end
it "should not change env when language options are set to non-nil" do
- options = { :env => { "LC_ALL" => "de_DE.UTF-8", "LANG" => "de_DE.UTF-8", "LANGUAGE" => "de_DE.UTF-8", env_path => "foo:bar:baz" } }
+ options = { env: { "LC_ALL" => "de_DE.UTF-8", "LANG" => "de_DE.UTF-8", "LANGUAGE" => "de_DE.UTF-8", env_path => "foo:bar:baz" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(retobj)
shell_out_obj.send(method, cmd, options)
end
it "should set environment language settings to the configured internal locale when they are not present" do
- options = { :env => { "HOME" => "/Users/morty" } }
+ options = { env: { "HOME" => "/Users/morty" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, {
- :env => {
+ env: {
"HOME" => "/Users/morty",
"LC_ALL" => Chef::Config[:internal_locale],
"LANG" => Chef::Config[:internal_locale],
@@ -129,9 +129,9 @@ describe Chef::Mixin::ShellOut do
end
it "should not mutate the options hash when it adds language settings" do
- options = { :env => { "HOME" => "/Users/morty" } }
+ options = { env: { "HOME" => "/Users/morty" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, {
- :env => {
+ env: {
"HOME" => "/Users/morty",
"LC_ALL" => Chef::Config[:internal_locale],
"LANG" => Chef::Config[:internal_locale],
@@ -146,10 +146,10 @@ describe Chef::Mixin::ShellOut do
describe "and no env/environment option is present" do
it "should set environment language settings to the configured internal locale" do
- options = { :user => "morty" }
+ options = { user: "morty" }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, {
- :user => "morty",
- :environment => {
+ user: "morty",
+ environment: {
"LC_ALL" => Chef::Config[:internal_locale],
"LANG" => Chef::Config[:internal_locale],
"LANGUAGE" => Chef::Config[:internal_locale],
@@ -164,7 +164,7 @@ describe Chef::Mixin::ShellOut do
describe "when the last argument is not a Hash" do
it "should set environment language settings to the configured internal locale" do
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, {
- :environment => {
+ environment: {
"LC_ALL" => Chef::Config[:internal_locale],
"LANG" => Chef::Config[:internal_locale],
"LANGUAGE" => Chef::Config[:internal_locale],
@@ -185,19 +185,19 @@ describe Chef::Mixin::ShellOut do
describe "when the last argument is a Hash" do
describe "and environment is an option" do
it "should not change environment['LC_ALL'] when set to nil" do
- options = { :environment => { "LC_ALL" => nil } }
+ options = { environment: { "LC_ALL" => nil } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should not change environment['LC_ALL'] when set to non-nil" do
- options = { :environment => { "LC_ALL" => "en_US.UTF-8" } }
+ options = { environment: { "LC_ALL" => "en_US.UTF-8" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should no longer set environment['LC_ALL'] to nil when 'LC_ALL' not present" do
- options = { :environment => { "HOME" => "/Users/morty" } }
+ options = { environment: { "HOME" => "/Users/morty" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
@@ -205,19 +205,19 @@ describe Chef::Mixin::ShellOut do
describe "and env is an option" do
it "should not change env when set to nil" do
- options = { :env => { "LC_ALL" => nil } }
+ options = { env: { "LC_ALL" => nil } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should not change env when set to non-nil" do
- options = { :env => { "LC_ALL" => "en_US.UTF-8" } }
+ options = { env: { "LC_ALL" => "en_US.UTF-8" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should no longer set env['LC_ALL'] to nil when 'LC_ALL' not present" do
- options = { :env => { "HOME" => "/Users/morty" } }
+ options = { env: { "HOME" => "/Users/morty" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
@@ -225,7 +225,7 @@ describe Chef::Mixin::ShellOut do
describe "and no env/environment option is present" do
it "should no longer add environment option and set environment['LC_ALL'] to nil" do
- options = { :user => "morty" }
+ options = { user: "morty" }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
@@ -245,19 +245,19 @@ describe Chef::Mixin::ShellOut do
describe "when the last argument is a Hash" do
describe "and environment is an option" do
it "should not change environment['LC_ALL'] when set to nil" do
- options = { :environment => { "LC_ALL" => nil } }
+ options = { environment: { "LC_ALL" => nil } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(cmd, **options, default_env: false)
end
it "should not change environment['LC_ALL'] when set to non-nil" do
- options = { :environment => { "LC_ALL" => "en_US.UTF-8" } }
+ options = { environment: { "LC_ALL" => "en_US.UTF-8" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(cmd, **options, default_env: false)
end
it "should no longer set environment['LC_ALL'] to nil when 'LC_ALL' not present" do
- options = { :environment => { "HOME" => "/Users/morty" } }
+ options = { environment: { "HOME" => "/Users/morty" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(cmd, **options, default_env: false)
end
@@ -265,19 +265,19 @@ describe Chef::Mixin::ShellOut do
describe "and env is an option" do
it "should not change env when set to nil" do
- options = { :env => { "LC_ALL" => nil } }
+ options = { env: { "LC_ALL" => nil } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(cmd, **options, default_env: false)
end
it "should not change env when set to non-nil" do
- options = { :env => { "LC_ALL" => "en_US.UTF-8" } }
+ options = { env: { "LC_ALL" => "en_US.UTF-8" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(cmd, **options, default_env: false)
end
it "should no longer set env['LC_ALL'] to nil when 'LC_ALL' not present" do
- options = { :env => { "HOME" => "/Users/morty" } }
+ options = { env: { "HOME" => "/Users/morty" } }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(cmd, **options, default_env: false)
end
@@ -285,7 +285,7 @@ describe Chef::Mixin::ShellOut do
describe "and no env/environment option is present" do
it "should no longer add environment option and set environment['LC_ALL'] to nil" do
- options = { :user => "morty" }
+ options = { user: "morty" }
expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(cmd, **options, default_env: false)
end
diff --git a/spec/unit/mixin/user_context_spec.rb b/spec/unit/mixin/user_context_spec.rb
index 3dadf6a2c3..896241f173 100644
--- a/spec/unit/mixin/user_context_spec.rb
+++ b/spec/unit/mixin/user_context_spec.rb
@@ -43,7 +43,7 @@ describe "a class that mixes in user_context" do
allow(::Chef::Util::Windows::LogonSession).to receive(:new).and_return(logon_session)
end
- let(:logon_session) { instance_double("::Chef::Util::Windows::LogonSession", :set_user_context => nil, :open => nil, :close => nil) }
+ let(:logon_session) { instance_double("::Chef::Util::Windows::LogonSession", set_user_context: nil, open: nil, close: nil) }
it "does not raise an exception when the user and all parameters are nil" do
expect { instance_with_user_context.with_context(nil, nil, nil) {} }.not_to raise_error
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb
index 557c469216..618a9bbe0e 100644
--- a/spec/unit/node/attribute_spec.rb
+++ b/spec/unit/node/attribute_spec.rb
@@ -22,8 +22,8 @@ require "chef/node/attribute"
describe Chef::Node::Attribute do
let(:events) { instance_double(Chef::EventDispatch::Dispatcher) }
- let(:run_context) { instance_double(Chef::RunContext, :events => events) }
- let(:node) { instance_double(Chef::Node, :run_context => run_context) }
+ let(:run_context) { instance_double(Chef::RunContext, events: events) }
+ let(:node) { instance_double(Chef::Node, run_context: run_context) }
before(:each) do
allow(events).to receive(:attribute_changed)
@attribute_hash =
@@ -184,7 +184,7 @@ describe Chef::Node::Attribute do
[ :normal, :default, :override, :automatic ].each do |accessor|
it "should set #{accessor}" do
- na = Chef::Node::Attribute.new({ :normal => true }, { :default => true }, { :override => true }, { :automatic => true })
+ na = Chef::Node::Attribute.new({ normal: true }, { default: true }, { override: true }, { automatic: true })
expect(na.send(accessor)).to eq({ accessor.to_s => true })
end
end
diff --git a/spec/unit/node/vivid_mash_spec.rb b/spec/unit/node/vivid_mash_spec.rb
index 4898c22380..e1021ba0c0 100644
--- a/spec/unit/node/vivid_mash_spec.rb
+++ b/spec/unit/node/vivid_mash_spec.rb
@@ -61,7 +61,7 @@ describe Chef::Node::VividMash do
it "deep converts values through arrays" do
expect(root).to receive(:reset_cache).with("foo")
- vivid["foo"] = [ { :bar => true } ]
+ vivid["foo"] = [ { bar: true } ]
expect(vivid["foo"].class).to eql(Chef::Node::AttrArray)
expect(vivid["foo"][0].class).to eql(Chef::Node::VividMash)
expect(vivid["foo"][0]["bar"]).to be true
@@ -69,7 +69,7 @@ describe Chef::Node::VividMash do
it "deep converts values through nested arrays" do
expect(root).to receive(:reset_cache).with("foo")
- vivid["foo"] = [ [ { :bar => true } ] ]
+ vivid["foo"] = [ [ { bar: true } ] ]
expect(vivid["foo"].class).to eql(Chef::Node::AttrArray)
expect(vivid["foo"][0].class).to eql(Chef::Node::AttrArray)
expect(vivid["foo"][0][0].class).to eql(Chef::Node::VividMash)
@@ -78,7 +78,7 @@ describe Chef::Node::VividMash do
it "deep converts values through hashes" do
expect(root).to receive(:reset_cache).with("foo")
- vivid["foo"] = { baz: { :bar => true } }
+ vivid["foo"] = { baz: { bar: true } }
expect(vivid["foo"]).to be_an_instance_of(Chef::Node::VividMash)
expect(vivid["foo"]["baz"]).to be_an_instance_of(Chef::Node::VividMash)
expect(vivid["foo"]["baz"]["bar"]).to be true
diff --git a/spec/unit/node_map_spec.rb b/spec/unit/node_map_spec.rb
index 253486438b..df70ad380a 100644
--- a/spec/unit/node_map_spec.rb
+++ b/spec/unit/node_map_spec.rb
@@ -145,14 +145,14 @@ describe Chef::NodeMap do
describe "deleting classes" do
it "deletes a class and removes the mapping completely" do
node_map.set(:thing, Bar)
- expect( node_map.delete_class(Bar) ).to include({ :thing => [{ :klass => Bar, :cookbook_override => false, :core_override => false }] })
+ expect( node_map.delete_class(Bar) ).to include({ thing: [{ klass: Bar, cookbook_override: false, core_override: false }] })
expect( node_map.get(node, :thing) ).to eql(nil)
end
it "deletes a class and leaves the mapping that still has an entry" do
node_map.set(:thing, Bar)
node_map.set(:thing, Foo)
- expect( node_map.delete_class(Bar) ).to eql({ :thing => [{ :klass => Bar, :cookbook_override => false, :core_override => false }] })
+ expect( node_map.delete_class(Bar) ).to eql({ thing: [{ klass: Bar, cookbook_override: false, core_override: false }] })
expect( node_map.get(node, :thing) ).to eql(Foo)
end
@@ -160,7 +160,7 @@ describe Chef::NodeMap do
node_map.set(:thing1, Bar)
node_map.set(:thing2, Bar)
node_map.set(:thing2, Foo)
- expect( node_map.delete_class(Bar) ).to eql({ :thing1 => [{ :klass => Bar, :cookbook_override => false, :core_override => false }], :thing2 => [{ :klass => Bar, :cookbook_override => false, :core_override => false }] })
+ expect( node_map.delete_class(Bar) ).to eql({ thing1: [{ klass: Bar, cookbook_override: false, core_override: false }], thing2: [{ klass: Bar, cookbook_override: false, core_override: false }] })
expect( node_map.get(node, :thing1) ).to eql(nil)
expect( node_map.get(node, :thing2) ).to eql(Foo)
end
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index 3a43a155d5..ee0f969f6d 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -52,7 +52,7 @@ describe Chef::Node do
describe "when the node does not exist on the server" do
before do
- response = OpenStruct.new(:code => "404")
+ response = OpenStruct.new(code: "404")
exception = Net::HTTPServerException.new("404 not found", response)
allow(Chef::Node).to receive(:load).and_raise(exception)
node.name("created-node")
@@ -852,7 +852,7 @@ describe Chef::Node do
describe "consuming json" do
before do
- @ohai_data = { :platform => "foo", :platform_version => "bar" }
+ @ohai_data = { platform: "foo", platform_version: "bar" }
end
it "consumes the run list portion of a collection of attributes and returns the remainder" do
@@ -944,7 +944,7 @@ describe Chef::Node do
describe "preparing for a chef client run" do
before do
- @ohai_data = { :platform => "foobuntu", :platform_version => "23.42" }
+ @ohai_data = { platform: "foobuntu", platform_version: "23.42" }
end
it "sets its platform according to platform detection" do
@@ -1096,12 +1096,12 @@ describe Chef::Node do
before do
node.chef_environment = "rspec"
@expansion = Chef::RunList::RunListExpansion.new("rspec", [])
- @expansion.default_attrs.replace({ :default => "from role", :d_role => "role only" })
- @expansion.override_attrs.replace({ :override => "from role", :o_role => "role only" })
+ @expansion.default_attrs.replace({ default: "from role", d_role: "role only" })
+ @expansion.override_attrs.replace({ override: "from role", o_role: "role only" })
@environment = Chef::Environment.new
- @environment.default_attributes = { :default => "from env", :d_env => "env only" }
- @environment.override_attributes = { :override => "from env", :o_env => "env only" }
+ @environment.default_attributes = { default: "from env", d_env: "env only" }
+ @environment.override_attributes = { override: "from env", o_env: "env only" }
allow(Chef::Environment).to receive(:load).and_return(@environment)
node.apply_expansion_attributes(@expansion)
end
@@ -1269,7 +1269,7 @@ describe Chef::Node do
end
describe "converting to or from json" do
- it "should serialize itself as json", :json => true do
+ it "should serialize itself as json", json: true do
node.from_file(File.expand_path("nodes/test.example.com.rb", CHEF_SPEC_DATA))
json = Chef::JSONCompat.to_json(node)
expect(json).to match(/json_class/)
@@ -1281,7 +1281,7 @@ describe Chef::Node do
expect(json).to match(/run_list/)
end
- it "should serialize valid json with a run list", :json => true do
+ it "should serialize valid json with a run list", json: true do
#This test came about because activesupport mucks with Chef json serialization
#Test should pass with and without Activesupport
node.run_list << { "type" => "role", "name" => "Cthulu" }
@@ -1290,7 +1290,7 @@ describe Chef::Node do
expect(json).to match(/\"run_list\":\[\"role\[Cthulu\]\",\"role\[Hastur\]\"\]/)
end
- it "should serialize the correct run list", :json => true do
+ it "should serialize the correct run list", json: true do
node.run_list << "role[marxist]"
node.run_list << "role[leninist]"
node.override_runlist << "role[stalinist]"
@@ -1315,7 +1315,7 @@ describe Chef::Node do
expect(node_for_json["default"]["env default"]).to eq("env default")
end
- it "should deserialize itself from json", :json => true do
+ it "should deserialize itself from json", json: true do
node.from_file(File.expand_path("nodes/test.example.com.rb", CHEF_SPEC_DATA))
json = Chef::JSONCompat.to_json(node)
serialized_node = Chef::Node.from_hash(Chef::JSONCompat.parse(json))
@@ -1392,7 +1392,7 @@ describe Chef::Node do
describe "list" do
describe "inflated" do
it "should return a hash of node names and objects" do
- n1 = double("Chef::Node", :name => "one")
+ n1 = double("Chef::Node", name: "one")
allow(n1).to receive(:kind_of?).with(Chef::Node) { true }
expect(@query).to receive(:search).with(:node).and_yield(n1)
r = Chef::Node.list(true)
@@ -1446,7 +1446,7 @@ describe Chef::Node do
it "should create if it cannot update" do
node.name("monkey")
allow(node).to receive(:data_for_save).and_return({})
- exception = double("404 error", :code => "404")
+ exception = double("404 error", code: "404")
expect(@rest).to receive(:put).and_raise(Net::HTTPServerException.new("foo", exception))
expect(@rest).to receive(:post).with("nodes", {})
node.save
diff --git a/spec/unit/org_spec.rb b/spec/unit/org_spec.rb
index 49557417a5..79a29b1fff 100644
--- a/spec/unit/org_spec.rb
+++ b/spec/unit/org_spec.rb
@@ -164,7 +164,7 @@ describe Chef::Org do
describe "create" do
it "creates a new org via the API" do
- expect(rest).to receive(:post).with("organizations", { :name => "foobar", :full_name => "foo bar bat" }).and_return({})
+ expect(rest).to receive(:post).with("organizations", { name: "foobar", full_name: "foo bar bat" }).and_return({})
org.create
end
end
@@ -181,7 +181,7 @@ describe Chef::Org do
describe "update" do
it "updates an existing org on via the API" do
- expect(rest).to receive(:put).with("organizations/foobar", { :name => "foobar", :full_name => "foo bar bat" }).and_return({})
+ expect(rest).to receive(:put).with("organizations/foobar", { name: "foobar", full_name: "foo bar bat" }).and_return({})
org.update
end
end
diff --git a/spec/unit/policy_builder/expand_node_object_spec.rb b/spec/unit/policy_builder/expand_node_object_spec.rb
index a7f4f1fa43..438e0805e7 100644
--- a/spec/unit/policy_builder/expand_node_object_spec.rb
+++ b/spec/unit/policy_builder/expand_node_object_spec.rb
@@ -176,7 +176,7 @@ describe Chef::PolicyBuilder::ExpandNodeObject do
let(:expansion) do
recipe_list = Chef::RunList::VersionedRecipeList.new
recipe_list.add_recipe("recipe[from_role::default", "1.0.2")
- double("RunListExpansion", :recipes => recipe_list)
+ double("RunListExpansion", recipes: recipe_list)
end
let(:node) do
@@ -268,13 +268,13 @@ describe Chef::PolicyBuilder::ExpandNodeObject do
let(:chef_http) { double("Chef::ServerAPI") }
let(:cookbook_resolve_url) { "environments/#{node.chef_environment}/cookbook_versions" }
- let(:cookbook_resolve_post_data) { { :run_list => ["first::default", "second::default"] } }
+ let(:cookbook_resolve_post_data) { { run_list: ["first::default", "second::default"] } }
# cookbook_hash is just a hash, but since we're passing it between mock
# objects, we get a little better test strictness by using a double (which
# will have object equality rather than semantic equality #== semantics).
let(:cookbook_hash) { double("cookbook hash") }
- let(:expanded_cookbook_hash) { double("expanded cookbook hash", :each => nil) }
+ let(:expanded_cookbook_hash) { double("expanded cookbook hash", each: nil) }
let(:cookbook_synchronizer) { double("CookbookSynchronizer") }
diff --git a/spec/unit/policy_builder/policyfile_spec.rb b/spec/unit/policy_builder/policyfile_spec.rb
index 5663cb8b19..260b99c89c 100644
--- a/spec/unit/policy_builder/policyfile_spec.rb
+++ b/spec/unit/policy_builder/policyfile_spec.rb
@@ -393,10 +393,10 @@ describe Chef::PolicyBuilder::Policyfile do
let(:run_list_for_data_collector) do
{
- :id => "_policy_node",
- :run_list => [
- { :type => "recipe", :name => "test::default", :skipped => false, :version => nil },
- { :type => "recipe", :name => "test::other", :skipped => false, :version => nil },
+ id: "_policy_node",
+ run_list: [
+ { type: "recipe", name: "test::default", skipped: false, version: nil },
+ { type: "recipe", name: "test::other", skipped: false, version: nil },
],
}
end
diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb
index 79c4baa89f..463f9469c6 100644
--- a/spec/unit/property_spec.rb
+++ b/spec/unit/property_spec.rb
@@ -1070,13 +1070,13 @@ describe "Chef::Resource.property" do
end
it "raises an error if both name_property and name_attribute are specified" do
- expect { resource_class.property :x, :name_property => false, :name_attribute => 1 }.to raise_error ArgumentError,
+ expect { resource_class.property :x, name_property: false, name_attribute: 1 }.to raise_error ArgumentError,
/name_attribute and name_property are functionally identical and both cannot be specified on a property at once. Use just one on property x of resource chef_resource_property_spec_(\d+)./
- expect { resource_class.property :x, :name_property => false, :name_attribute => nil }.to raise_error ArgumentError,
+ expect { resource_class.property :x, name_property: false, name_attribute: nil }.to raise_error ArgumentError,
/name_attribute and name_property are functionally identical and both cannot be specified on a property at once. Use just one on property x of resource chef_resource_property_spec_(\d+)./
- expect { resource_class.property :x, :name_property => false, :name_attribute => false }.to raise_error ArgumentError,
+ expect { resource_class.property :x, name_property: false, name_attribute: false }.to raise_error ArgumentError,
/name_attribute and name_property are functionally identical and both cannot be specified on a property at once. Use just one on property x of resource chef_resource_property_spec_(\d+)./
- expect { resource_class.property :x, :name_property => true, :name_attribute => true }.to raise_error ArgumentError,
+ expect { resource_class.property :x, name_property: true, name_attribute: true }.to raise_error ArgumentError,
/name_attribute and name_property are functionally identical and both cannot be specified on a property at once. Use just one on property x of resource chef_resource_property_spec_(\d+)./
end
diff --git a/spec/unit/provider/apt_repository_spec.rb b/spec/unit/provider/apt_repository_spec.rb
index d881d01124..54f1f2df66 100644
--- a/spec/unit/provider/apt_repository_spec.rb
+++ b/spec/unit/provider/apt_repository_spec.rb
@@ -67,14 +67,14 @@ describe Chef::Provider::AptRepository do
end
let(:gpg_shell_out_success) do
- double("shell_out", :stdout => "pub 2048R/7BD9BF62 2011-08-19 nginx signing key <signing-key@nginx.com>",
- :exitstatus => 0, :error? => false)
+ double("shell_out", stdout: "pub 2048R/7BD9BF62 2011-08-19 nginx signing key <signing-key@nginx.com>",
+ exitstatus: 0, error?: false)
end
let(:gpg_shell_out_failure) do
- double("shell_out", :stderr => "gpg: no valid OpenPGP data found.\n
+ double("shell_out", stderr: "gpg: no valid OpenPGP data found.\n
gpg: processing message failed: eof",
- :exitstatus => 1, :error? => true)
+ exitstatus: 1, error?: true)
end
let(:apt_fingerprints) do
diff --git a/spec/unit/provider/cookbook_file/content_spec.rb b/spec/unit/provider/cookbook_file/content_spec.rb
index 096ac85b64..4e07915a95 100644
--- a/spec/unit/provider/cookbook_file/content_spec.rb
+++ b/spec/unit/provider/cookbook_file/content_spec.rb
@@ -20,7 +20,7 @@ require "spec_helper"
describe Chef::Provider::CookbookFile::Content do
- let(:new_resource) { double("Chef::Resource::CookbookFile (new)", :cookbook_name => "apache2", :cookbook => "apache2") }
+ let(:new_resource) { double("Chef::Resource::CookbookFile (new)", cookbook_name: "apache2", cookbook: "apache2") }
let(:content) do
@run_context = double("Chef::RunContext")
@current_resource = double("Chef::Resource::CookbookFile (current)")
diff --git a/spec/unit/provider/cookbook_file_spec.rb b/spec/unit/provider/cookbook_file_spec.rb
index f27392de5d..e1ef3c63d8 100644
--- a/spec/unit/provider/cookbook_file_spec.rb
+++ b/spec/unit/provider/cookbook_file_spec.rb
@@ -26,7 +26,7 @@ describe Chef::Provider::CookbookFile do
let(:node) { double("Chef::Node") }
let(:events) { double("Chef::Events").as_null_object } # mock all the methods
let(:logger) { double("Mixlib::Log::Child").as_null_object }
- let(:run_context) { double("Chef::RunContext", :node => node, :events => events, :logger => logger) }
+ let(:run_context) { double("Chef::RunContext", node: node, events: events, logger: logger) }
let(:enclosing_directory) do
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
end
diff --git a/spec/unit/provider/cron/unix_spec.rb b/spec/unit/provider/cron/unix_spec.rb
index 62b941c4aa..843f3f3d8c 100644
--- a/spec/unit/provider/cron/unix_spec.rb
+++ b/spec/unit/provider/cron/unix_spec.rb
@@ -37,9 +37,9 @@ describe Chef::Provider::Cron::Unix do
end
end
- let(:status) { double("Process::Status", :exitstatus => exitstatus) }
+ let(:status) { double("Process::Status", exitstatus: exitstatus) }
let(:exitstatus) { 0 }
- let(:shell_out) { double("Mixlib::ShellOut", :status => status, :stdout => stdout, :stderr => stderr) }
+ let(:shell_out) { double("Mixlib::ShellOut", status: status, stdout: stdout, stderr: stderr) }
let(:logger) { double("Mixlib::Log::Child").as_null_object }
@@ -66,12 +66,12 @@ describe Chef::Provider::Cron::Unix do
before do
allow(logger).to receive(:trace)
allow(shell_out).to receive(:format_for_exception).and_return("formatted command output")
- allow(provider).to receive(:shell_out).with("/usr/bin/crontab -l", :user => username).and_return(shell_out)
+ allow(provider).to receive(:shell_out).with("/usr/bin/crontab -l", user: username).and_return(shell_out)
end
it "should call crontab -l with the user" do
provider.send(:read_crontab)
- expect(provider).to have_received(:shell_out).with("/usr/bin/crontab -l", :user => username)
+ expect(provider).to have_received(:shell_out).with("/usr/bin/crontab -l", user: username)
end
it "should return the contents of the crontab" do
@@ -111,7 +111,7 @@ describe Chef::Provider::Cron::Unix do
describe "write_crontab" do
let(:stdout) { "" }
let(:stderr) { "" }
- let(:tempfile) { double("foo", :path => "/tmp/foo", :close => true) }
+ let(:tempfile) { double("foo", path: "/tmp/foo", close: true) }
before do
expect(Tempfile).to receive(:new).and_return(tempfile)
@@ -119,12 +119,12 @@ describe Chef::Provider::Cron::Unix do
expect(tempfile).to receive(:chmod).with(420)
expect(tempfile).to receive(:close!)
allow(tempfile).to receive(:<<)
- allow(provider).to receive(:shell_out).with("/usr/bin/crontab #{tempfile.path}", :user => username).and_return(shell_out)
+ allow(provider).to receive(:shell_out).with("/usr/bin/crontab #{tempfile.path}", user: username).and_return(shell_out)
end
it "should call crontab for the user" do
provider.send(:write_crontab, "Foo")
- expect(provider).to have_received(:shell_out).with("/usr/bin/crontab #{tempfile.path}", :user => username)
+ expect(provider).to have_received(:shell_out).with("/usr/bin/crontab #{tempfile.path}", user: username)
end
it "should call crontab with a file containing the crontab" do
diff --git a/spec/unit/provider/dsc_resource_spec.rb b/spec/unit/provider/dsc_resource_spec.rb
index 747e37f308..ab675c4ddd 100644
--- a/spec/unit/provider/dsc_resource_spec.rb
+++ b/spec/unit/provider/dsc_resource_spec.rb
@@ -104,7 +104,7 @@ describe Chef::Provider::DscResource do
it "flags the resource as reboot required when required" do
expect(provider).to receive(:test_resource).and_return(false)
expect(provider).to receive(:invoke_resource).
- and_return(double(:stdout => "", :return_value => nil))
+ and_return(double(stdout: "", return_value: nil))
expect(provider).to receive(:add_dsc_verbose_log)
expect(provider).to receive(:return_dsc_resource_result).and_return(true)
expect(provider).to receive(:create_reboot_resource)
@@ -114,7 +114,7 @@ describe Chef::Provider::DscResource do
it "does not flag the resource as reboot required when not required" do
expect(provider).to receive(:test_resource).and_return(false)
expect(provider).to receive(:invoke_resource).
- and_return(double(:stdout => "", :return_value => nil))
+ and_return(double(stdout: "", return_value: nil))
expect(provider).to receive(:add_dsc_verbose_log)
expect(provider).to receive(:return_dsc_resource_result).and_return(false)
expect(provider).to_not receive(:create_reboot_resource)
@@ -293,12 +293,12 @@ describe Chef::Provider::DscResource do
set_node_object
end
- let(:cmdlet) { double(:run! => nil) }
+ let(:cmdlet) { double(run!: nil) }
before(:each) do
allow(provider).to receive(:translate_type).and_return("my_properties")
provider.instance_variable_set(:@new_resource, double(
- :properties => "my_properties", :resource => "my_resource", :timeout => 123
+ properties: "my_properties", resource: "my_resource", timeout: 123
))
end
diff --git a/spec/unit/provider/execute_spec.rb b/spec/unit/provider/execute_spec.rb
index 78534bfb57..48cee78462 100644
--- a/spec/unit/provider/execute_spec.rb
+++ b/spec/unit/provider/execute_spec.rb
@@ -26,7 +26,7 @@ describe Chef::Provider::Execute do
let(:provider) { Chef::Provider::Execute.new(new_resource, run_context) }
let(:current_resource) { Chef::Resource::Ifconfig.new("foo_resource", run_context) }
# You will be the same object, I promise.
- @live_stream = Chef::EventDispatch::EventsOutputStream.new(run_context.events, :name => :execute)
+ @live_stream = Chef::EventDispatch::EventsOutputStream.new(run_context.events, name: :execute)
let(:opts) do
{
diff --git a/spec/unit/provider/file/content_spec.rb b/spec/unit/provider/file/content_spec.rb
index f840d92dbb..e65d094327 100644
--- a/spec/unit/provider/file/content_spec.rb
+++ b/spec/unit/provider/file/content_spec.rb
@@ -36,7 +36,7 @@ describe Chef::Provider::File::Content do
end
let(:new_resource) do
- double("Chef::Provider::File::Resource (new)", :name => "seattle.txt", :path => resource_path)
+ double("Chef::Provider::File::Resource (new)", name: "seattle.txt", path: resource_path)
end
let(:run_context) do
diff --git a/spec/unit/provider/file_spec.rb b/spec/unit/provider/file_spec.rb
index fed9cd5ece..311ef4c55a 100644
--- a/spec/unit/provider/file_spec.rb
+++ b/spec/unit/provider/file_spec.rb
@@ -35,7 +35,7 @@ describe Chef::Provider::File do
let(:node) { double("Chef::Node") }
let(:events) { double("Chef::Events").as_null_object } # mock all the methods
let(:logger) { double("Mixlib::Log::Child").as_null_object }
- let(:run_context) { double("Chef::RunContext", :node => node, :events => events, :logger => logger) }
+ let(:run_context) { double("Chef::RunContext", node: node, events: events, logger: logger) }
let(:enclosing_directory) do
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
end
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb
index a20c7a838c..fafb83f548 100644
--- a/spec/unit/provider/git_spec.rb
+++ b/spec/unit/provider/git_spec.rb
@@ -58,7 +58,7 @@ describe Chef::Provider::Git do
it "determines the current revision when there is one" do
expect(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(true)
@stdout = "9b4d8dc38dd471246e7cfb1c3c1ad14b0f2bee13\n"
- expect(@provider).to receive(:shell_out!).with("git rev-parse HEAD", { :cwd => "/my/deploy/dir", :returns => [0, 128], :log_tag => "git[web2.0 app]" }).and_return(double("ShellOut result", :stdout => @stdout))
+ expect(@provider).to receive(:shell_out!).with("git rev-parse HEAD", { cwd: "/my/deploy/dir", returns: [0, 128], log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout))
expect(@provider.find_current_revision).to eql("9b4d8dc38dd471246e7cfb1c3c1ad14b0f2bee13")
end
@@ -66,7 +66,7 @@ describe Chef::Provider::Git do
expect(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(true)
@stderr = "fatal: Not a git repository (or any of the parent directories): .git"
@stdout = ""
- expect(@provider).to receive(:shell_out!).with("git rev-parse HEAD", :cwd => "/my/deploy/dir", :returns => [0, 128], :log_tag => "git[web2.0 app]" ).and_return(double("ShellOut result", :stdout => "", :stderr => @stderr))
+ expect(@provider).to receive(:shell_out!).with("git rev-parse HEAD", cwd: "/my/deploy/dir", returns: [0, 128], log_tag: "git[web2.0 app]" ).and_return(double("ShellOut result", stdout: "", stderr: @stderr))
expect(@provider.find_current_revision).to be_nil
end
end
@@ -152,7 +152,7 @@ describe Chef::Provider::Git do
@resource.revision "v1.0"
@stdout = ("d03c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha\n" +
"503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/v1.0\n")
- expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", { :log_tag => "git[web2.0 app]" }).and_return(double("ShellOut result", :stdout => @stdout))
+ expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout))
expect(@provider.target_revision).to eql("503c22a5e41f5ae3193460cca044ed1435029f53")
end
@@ -161,7 +161,7 @@ describe Chef::Provider::Git do
@stdout = ("d03c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha\n" +
"503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/v1.0\n" +
"663c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/v1.0^{}\n")
- expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", { :log_tag => "git[web2.0 app]" }).and_return(double("ShellOut result", :stdout => @stdout))
+ expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout))
expect(@provider.target_revision).to eql("663c22a5e41f5ae3193460cca044ed1435029f53")
end
@@ -170,7 +170,7 @@ describe Chef::Provider::Git do
@stdout = ("d03c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha\n" +
"663c22a5e41f5ae3193460cca044ed1435029f53\trefs/tags/releases/v1.0\n" +
"503c22a5e41f5ae3193460cca044ed1435029f53\trefs/tags/v1.0\n")
- expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", { :log_tag => "git[web2.0 app]" }).and_return(double("ShellOut result", :stdout => @stdout))
+ expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout))
expect(@provider.target_revision).to eql("503c22a5e41f5ae3193460cca044ed1435029f53")
end
@@ -179,7 +179,7 @@ describe Chef::Provider::Git do
@stdout = ("d03c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha\n" +
"663c22a5e41f5ae3193460cca044ed1435029f53\trefs/tags/v1.0\n" +
"503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/v1.0\n")
- expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", { :log_tag => "git[web2.0 app]" }).and_return(double("ShellOut result", :stdout => @stdout))
+ expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout))
expect(@provider.target_revision).to eql("663c22a5e41f5ae3193460cca044ed1435029f53")
end
@@ -188,7 +188,7 @@ describe Chef::Provider::Git do
@stdout = ("d03c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha\n" +
"663c22a5e41f5ae3193460cca044ed1435029f53\trefs/tags/v1.1\n" +
"503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/v1.0\n")
- expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", { :log_tag => "git[web2.0 app]" }).and_return(double("ShellOut result", :stdout => @stdout))
+ expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"v1.0*\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout))
expect(@provider.target_revision).to eql("503c22a5e41f5ae3193460cca044ed1435029f53")
end
@@ -198,7 +198,7 @@ describe Chef::Provider::Git do
"663c22a5e41f5ae3193460cca044ed1435029f53\trefs/tags/v1.0\n" +
"805c22a5e41f5ae3193460cca044ed1435029f53\trefs/pulls/v1.0\n" +
"503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/v1.0\n")
- expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"refs/pulls/v1.0*\"", { :log_tag => "git[web2.0 app]" }).and_return(double("ShellOut result", :stdout => @stdout))
+ expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"refs/pulls/v1.0*\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout))
expect(@provider.target_revision).to eql("805c22a5e41f5ae3193460cca044ed1435029f53")
end
@@ -207,7 +207,7 @@ describe Chef::Provider::Git do
@stdout = ("d03c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha\n" +
"663c22a5e41f5ae3193460cca044ed1435029f53\trefs/tags/v1.0\n" +
"503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/v1.0\n")
- expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"refs/heads/v1.0*\"", { :log_tag => "git[web2.0 app]" }).and_return(double("ShellOut result", :stdout => @stdout))
+ expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"refs/heads/v1.0*\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout))
expect(@provider.target_revision).to eql("503c22a5e41f5ae3193460cca044ed1435029f53")
end
@@ -222,21 +222,21 @@ describe Chef::Provider::Git do
it "raises an unresolvable git reference error if the revision can't be resolved to any revision and assertions are run" do
@resource.revision "FAIL, that's the revision I want"
@provider.action = :checkout
- expect(@provider).to receive(:shell_out!).and_return(double("ShellOut result", :stdout => "\n"))
+ expect(@provider).to receive(:shell_out!).and_return(double("ShellOut result", stdout: "\n"))
@provider.define_resource_requirements
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::UnresolvableGitReference)
end
it "does not raise an error if the revision can't be resolved when assertions are not run" do
@resource.revision "FAIL, that's the revision I want"
- expect(@provider).to receive(:shell_out!).and_return(double("ShellOut result", :stdout => "\n"))
+ expect(@provider).to receive(:shell_out!).and_return(double("ShellOut result", stdout: "\n"))
expect(@provider.target_revision).to eq(nil)
end
it "does not raise an error when the revision is valid and assertions are run." do
@resource.revision "0.8-alpha"
@stdout = "503c22a5e41f5ae3193460cca044ed1435029f53\trefs/heads/0.8-alpha\n"
- expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"0.8-alpha*\"", { :log_tag => "git[web2.0 app]" }).and_return(double("ShellOut result", :stdout => @stdout))
+ expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"0.8-alpha*\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout))
@provider.action = :checkout
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
@provider.define_resource_requirements
@@ -261,7 +261,7 @@ b7d19519a1c15f1c1a324e2683bd728b6198ce5a\trefs/tags/0.7.8^{}
ebc1b392fe7e8f0fbabc305c299b4d365d2b4d9b\trefs/tags/chef-server-package
SHAS
@resource.revision ""
- expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"HEAD\"", { :log_tag => "git[web2.0 app]" }).and_return(double("ShellOut result", :stdout => @stdout))
+ expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"HEAD\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout))
expect(@provider.target_revision).to eql("28af684d8460ba4793eda3e7ac238c864a5d029a")
end
end
@@ -276,15 +276,15 @@ SHAS
let(:expected_cmd) { 'git clone "git://github.com/opscode/chef.git" "/my/deploy/dir"' }
let(:default_options) do
{
- :user => deploy_user,
- :environment => { "GIT_SSH" => wrapper, "HOME" => "/home/deployNinja" },
- :log_tag => "git[web2.0 app]",
+ user: deploy_user,
+ environment: { "GIT_SSH" => wrapper, "HOME" => "/home/deployNinja" },
+ log_tag: "git[web2.0 app]",
}
end
before do
@resource.user deploy_user
@resource.ssh_wrapper wrapper
- allow(Etc).to receive(:getpwnam).and_return(double("Struct::Passwd", :name => @resource.user, :dir => "/home/deployNinja"))
+ allow(Etc).to receive(:getpwnam).and_return(double("Struct::Passwd", name: @resource.user, dir: "/home/deployNinja"))
end
context "without a timeout set" do
it "clones a repo with default git options" do
@@ -296,7 +296,7 @@ SHAS
let (:seconds) { 10 }
before { @resource.timeout(seconds) }
it "clones a repo with amended git options" do
- expect(@provider).to receive(:shell_out!).with(expected_cmd, default_options.merge(:timeout => seconds))
+ expect(@provider).to receive(:shell_out!).with(expected_cmd, default_options.merge(timeout: seconds))
@provider.clone
end
end
@@ -306,9 +306,9 @@ SHAS
end
let(:overrided_options) do
{
- :user => deploy_user,
- :environment => { "GIT_SSH" => wrapper, "HOME" => "/home/masterNinja" },
- :log_tag => "git[web2.0 app]",
+ user: deploy_user,
+ environment: { "GIT_SSH" => wrapper, "HOME" => "/home/masterNinja" },
+ log_tag: "git[web2.0 app]",
}
end
before do
@@ -327,14 +327,14 @@ SHAS
let(:expected_cmd) { 'git clone "git://github.com/opscode/chef.git" "/my/deploy/dir"' }
let(:default_options) do
{
- :user => 123,
- :environment => { "HOME" => "/home/deployNinja" },
- :log_tag => "git[web2.0 app]",
+ user: 123,
+ environment: { "HOME" => "/home/deployNinja" },
+ log_tag: "git[web2.0 app]",
}
end
before do
@resource.user deploy_user
- allow(Etc).to receive(:getpwuid).and_return(double("Struct::Passwd", :name => @resource.user, :dir => "/home/deployNinja"))
+ allow(Etc).to receive(:getpwuid).and_return(double("Struct::Passwd", name: @resource.user, dir: "/home/deployNinja"))
end
context "with a specific home" do
let (:override_home) do
@@ -342,9 +342,9 @@ SHAS
end
let(:overrided_options) do
{
- :user => 123,
- :environment => { "HOME" => "/home/masterNinja" },
- :log_tag => "git[web2.0 app]",
+ user: 123,
+ environment: { "HOME" => "/home/masterNinja" },
+ log_tag: "git[web2.0 app]",
}
end
before do
@@ -360,13 +360,13 @@ SHAS
it "runs a clone command with escaped destination" do
@resource.user "deployNinja"
- allow(Etc).to receive(:getpwnam).and_return(double("Struct::Passwd", :name => @resource.user, :dir => "/home/deployNinja"))
+ allow(Etc).to receive(:getpwnam).and_return(double("Struct::Passwd", name: @resource.user, dir: "/home/deployNinja"))
@resource.destination "/Application Support/with/space"
@resource.ssh_wrapper "do_it_this_way.sh"
expected_cmd = "git clone \"git://github.com/opscode/chef.git\" \"/Application Support/with/space\""
- expect(@provider).to receive(:shell_out!).with(expected_cmd, :user => "deployNinja",
- :log_tag => "git[web2.0 app]",
- :environment => { "HOME" => "/home/deployNinja",
+ expect(@provider).to receive(:shell_out!).with(expected_cmd, user: "deployNinja",
+ log_tag: "git[web2.0 app]",
+ environment: { "HOME" => "/home/deployNinja",
"GIT_SSH" => "do_it_this_way.sh" })
@provider.clone
end
@@ -377,8 +377,8 @@ SHAS
version_response = double("shell_out")
allow(version_response).to receive(:stdout) { "git version 1.7.9" }
expect(@provider).to receive(:shell_out!).with("git --version",
- :log_tag => "git[web2.0 app]").and_return(version_response)
- expect(@provider).to receive(:shell_out!).with(expected_cmd, :log_tag => "git[web2.0 app]")
+ log_tag: "git[web2.0 app]").and_return(version_response)
+ expect(@provider).to receive(:shell_out!).with(expected_cmd, log_tag: "git[web2.0 app]")
@provider.clone
end
@@ -388,33 +388,33 @@ SHAS
version_response = double("shell_out")
allow(version_response).to receive(:stdout) { "git version 1.7.10" }
expect(@provider).to receive(:shell_out!).with("git --version",
- :log_tag => "git[web2.0 app]").and_return(version_response)
- expect(@provider).to receive(:shell_out!).with(expected_cmd, :log_tag => "git[web2.0 app]")
+ log_tag: "git[web2.0 app]").and_return(version_response)
+ expect(@provider).to receive(:shell_out!).with(expected_cmd, log_tag: "git[web2.0 app]")
@provider.clone
end
it "compiles a clone command with a remote other than ``origin''" do
@resource.remote "opscode"
expected_cmd = "git clone -o opscode \"git://github.com/opscode/chef.git\" \"/my/deploy/dir\""
- expect(@provider).to receive(:shell_out!).with(expected_cmd, :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(expected_cmd, log_tag: "git[web2.0 app]")
@provider.clone
end
it "runs a checkout command with default options" do
- expect(@provider).to receive(:shell_out!).with("git branch -f deploy d35af14d41ae22b19da05d7d03a0bafc321b244c", :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]").ordered
- expect(@provider).to receive(:shell_out!).with("git checkout deploy", :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]").ordered
+ expect(@provider).to receive(:shell_out!).with("git branch -f deploy d35af14d41ae22b19da05d7d03a0bafc321b244c", cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]").ordered
+ expect(@provider).to receive(:shell_out!).with("git checkout deploy", cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]").ordered
@provider.checkout
end
it "runs an enable_submodule command" do
@resource.enable_submodules true
expected_cmd = "git submodule sync"
- expect(@provider).to receive(:shell_out!).with(expected_cmd, :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(expected_cmd, cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]")
expected_cmd = "git submodule update --init --recursive"
- expect(@provider).to receive(:shell_out!).with(expected_cmd, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(expected_cmd, cwd: "/my/deploy/dir", log_tag: "git[web2.0 app]")
@provider.enable_submodules
end
@@ -426,35 +426,35 @@ SHAS
it "runs a sync command with default options" do
expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository)
expected_cmd1 = "git fetch --prune origin"
- expect(@provider).to receive(:shell_out!).with(expected_cmd1, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(expected_cmd1, cwd: "/my/deploy/dir", log_tag: "git[web2.0 app]")
expected_cmd2 = "git fetch origin --tags"
- expect(@provider).to receive(:shell_out!).with(expected_cmd2, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(expected_cmd2, cwd: "/my/deploy/dir", log_tag: "git[web2.0 app]")
expected_cmd3 = "git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
- expect(@provider).to receive(:shell_out!).with(expected_cmd3, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(expected_cmd3, cwd: "/my/deploy/dir", log_tag: "git[web2.0 app]")
@provider.fetch_updates
end
it "runs a sync command with the user and group specified in the resource" do
@resource.user("whois")
- allow(Etc).to receive(:getpwnam).and_return(double("Struct::Passwd", :name => @resource.user, :dir => "/home/whois"))
+ allow(Etc).to receive(:getpwnam).and_return(double("Struct::Passwd", name: @resource.user, dir: "/home/whois"))
@resource.group("thisis")
expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository)
expected_cmd1 = "git fetch --prune origin"
- expect(@provider).to receive(:shell_out!).with(expected_cmd1, :cwd => "/my/deploy/dir",
- :user => "whois", :group => "thisis",
- :log_tag => "git[web2.0 app]",
- :environment => { "HOME" => "/home/whois" })
+ expect(@provider).to receive(:shell_out!).with(expected_cmd1, cwd: "/my/deploy/dir",
+ user: "whois", group: "thisis",
+ log_tag: "git[web2.0 app]",
+ environment: { "HOME" => "/home/whois" })
expected_cmd2 = "git fetch origin --tags"
- expect(@provider).to receive(:shell_out!).with(expected_cmd2, :cwd => "/my/deploy/dir",
- :user => "whois", :group => "thisis",
- :log_tag => "git[web2.0 app]",
- :environment => { "HOME" => "/home/whois" })
+ expect(@provider).to receive(:shell_out!).with(expected_cmd2, cwd: "/my/deploy/dir",
+ user: "whois", group: "thisis",
+ log_tag: "git[web2.0 app]",
+ environment: { "HOME" => "/home/whois" })
expected_cmd3 = "git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
- expect(@provider).to receive(:shell_out!).with(expected_cmd3, :cwd => "/my/deploy/dir",
- :user => "whois", :group => "thisis",
- :log_tag => "git[web2.0 app]",
- :environment => { "HOME" => "/home/whois" })
+ expect(@provider).to receive(:shell_out!).with(expected_cmd3, cwd: "/my/deploy/dir",
+ user: "whois", group: "thisis",
+ log_tag: "git[web2.0 app]",
+ environment: { "HOME" => "/home/whois" })
@provider.fetch_updates
end
@@ -462,11 +462,11 @@ SHAS
@resource.remote "origin"
expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository)
fetch_command1 = "git fetch --prune origin"
- expect(@provider).to receive(:shell_out!).with(fetch_command1, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(fetch_command1, cwd: "/my/deploy/dir", log_tag: "git[web2.0 app]")
fetch_command2 = "git fetch origin --tags"
- expect(@provider).to receive(:shell_out!).with(fetch_command2, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(fetch_command2, cwd: "/my/deploy/dir", log_tag: "git[web2.0 app]")
fetch_command3 = "git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
- expect(@provider).to receive(:shell_out!).with(fetch_command3, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(fetch_command3, cwd: "/my/deploy/dir", log_tag: "git[web2.0 app]")
@provider.fetch_updates
end
@@ -474,11 +474,11 @@ SHAS
@resource.remote "opscode"
expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository)
fetch_command1 = "git fetch --prune opscode"
- expect(@provider).to receive(:shell_out!).with(fetch_command1, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(fetch_command1, cwd: "/my/deploy/dir", log_tag: "git[web2.0 app]")
fetch_command2 = "git fetch opscode --tags"
- expect(@provider).to receive(:shell_out!).with(fetch_command2, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(fetch_command2, cwd: "/my/deploy/dir", log_tag: "git[web2.0 app]")
fetch_command3 = "git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c"
- expect(@provider).to receive(:shell_out!).with(fetch_command3, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]")
+ expect(@provider).to receive(:shell_out!).with(fetch_command3, cwd: "/my/deploy/dir", log_tag: "git[web2.0 app]")
@provider.fetch_updates
end
@@ -489,37 +489,37 @@ SHAS
allow(command_response).to receive(:exitstatus) { 1 }
expected_command = "git config --get remote.#{@resource.remote}.url"
expect(@provider).to receive(:shell_out!).with(expected_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]",
- :returns => [0, 1, 2]).and_return(command_response)
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]",
+ returns: [0, 1, 2]).and_return(command_response)
add_remote_command = "git remote add #{@resource.remote} #{@resource.repository}"
expect(@provider).to receive(:shell_out!).with(add_remote_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]")
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]")
@provider.setup_remote_tracking_branches(@resource.remote, @resource.repository)
end
it "runs the config with the user and group specified in the resource" do
@resource.user("whois")
@resource.group("thisis")
- allow(Etc).to receive(:getpwnam).and_return(double("Struct::Passwd", :name => @resource.user, :dir => "/home/whois"))
+ allow(Etc).to receive(:getpwnam).and_return(double("Struct::Passwd", name: @resource.user, dir: "/home/whois"))
command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 1 }
expected_command = "git config --get remote.#{@resource.remote}.url"
expect(@provider).to receive(:shell_out!).with(expected_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]",
- :user => "whois",
- :group => "thisis",
- :environment => { "HOME" => "/home/whois" },
- :returns => [0, 1, 2]).and_return(command_response)
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]",
+ user: "whois",
+ group: "thisis",
+ environment: { "HOME" => "/home/whois" },
+ returns: [0, 1, 2]).and_return(command_response)
add_remote_command = "git remote add #{@resource.remote} #{@resource.repository}"
expect(@provider).to receive(:shell_out!).with(add_remote_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]",
- :user => "whois",
- :group => "thisis",
- :environment => { "HOME" => "/home/whois" })
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]",
+ user: "whois",
+ group: "thisis",
+ environment: { "HOME" => "/home/whois" })
@provider.setup_remote_tracking_branches(@resource.remote, @resource.repository)
end
@@ -529,13 +529,13 @@ SHAS
allow(command_response).to receive(:exitstatus) { 1 }
check_remote_command = "git config --get remote.#{@resource.remote}.url"
expect(@provider).to receive(:shell_out!).with(check_remote_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]",
- :returns => [0, 1, 2]).and_return(command_response)
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]",
+ returns: [0, 1, 2]).and_return(command_response)
expected_command = "git remote add #{@resource.remote} #{@resource.repository}"
expect(@provider).to receive(:shell_out!).with(expected_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]")
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]")
@provider.setup_remote_tracking_branches(@resource.remote, @resource.repository)
end
end
@@ -547,13 +547,13 @@ SHAS
allow(command_response).to receive(:stdout) { "some_other_url" }
check_remote_command = "git config --get remote.#{@resource.remote}.url"
expect(@provider).to receive(:shell_out!).with(check_remote_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]",
- :returns => [0, 1, 2]).and_return(command_response)
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]",
+ returns: [0, 1, 2]).and_return(command_response)
expected_command = "git config --replace-all remote.#{@resource.remote}.url \"#{@resource.repository}\""
expect(@provider).to receive(:shell_out!).with(expected_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]")
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]")
@provider.setup_remote_tracking_branches(@resource.remote, @resource.repository)
end
@@ -563,13 +563,13 @@ SHAS
allow(command_response).to receive(:stdout) { @resource.repository }
check_remote_command = "git config --get remote.#{@resource.remote}.url"
expect(@provider).to receive(:shell_out!).with(check_remote_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]",
- :returns => [0, 1, 2]).and_return(command_response)
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]",
+ returns: [0, 1, 2]).and_return(command_response)
unexpected_command = "git config --replace-all remote.#{@resource.remote}.url \"#{@resource.repository}\""
expect(@provider).not_to receive(:shell_out!).with(unexpected_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]")
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]")
@provider.setup_remote_tracking_branches(@resource.remote, @resource.repository)
end
@@ -578,13 +578,13 @@ SHAS
allow(command_response).to receive(:exitstatus) { 2 }
check_remote_command = "git config --get remote.#{@resource.remote}.url"
expect(@provider).to receive(:shell_out!).with(check_remote_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]",
- :returns => [0, 1, 2]).and_return(command_response)
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]",
+ returns: [0, 1, 2]).and_return(command_response)
expected_command = "git config --replace-all remote.#{@resource.remote}.url \"#{@resource.repository}\""
expect(@provider).to receive(:shell_out!).with(expected_command,
- :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]")
+ cwd: "/my/deploy/dir",
+ log_tag: "git[web2.0 app]")
@provider.setup_remote_tracking_branches(@resource.remote, @resource.repository)
end
end
@@ -705,7 +705,7 @@ SHAS
allow(::File).to receive(:directory?).with("/my/deploy/dir").and_return(true)
allow(@provider).to receive(:sync_command).and_return("huzzah!")
expect(@provider).to receive(:action_checkout)
- expect(@provider).not_to receive(:shell_out!).with("huzzah!", :cwd => "/my/deploy/dir")
+ expect(@provider).not_to receive(:shell_out!).with("huzzah!", cwd: "/my/deploy/dir")
@provider.run_action(:sync)
#@resource.should be_updated
end
@@ -719,8 +719,8 @@ SHAS
describe "calling add_remotes" do
it "adds a new remote for each entry in additional remotes hash" do
- @resource.additional_remotes({ :opscode => "opscode_repo_url",
- :another_repo => "some_other_repo_url" })
+ @resource.additional_remotes({ opscode: "opscode_repo_url",
+ another_repo: "some_other_repo_url" })
allow(STDOUT).to receive(:tty?).and_return(false)
command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 0 }
diff --git a/spec/unit/provider/group_spec.rb b/spec/unit/provider/group_spec.rb
index c3e0d4b345..437b8c45ea 100644
--- a/spec/unit/provider/group_spec.rb
+++ b/spec/unit/provider/group_spec.rb
@@ -37,9 +37,9 @@ describe Chef::Provider::User do
@provider.current_resource = @current_resource
@pw_group = double("Struct::Group",
- :name => "wheel",
- :gid => 20,
- :mem => %w{root aj}
+ name: "wheel",
+ gid: 20,
+ mem: %w{root aj}
)
allow(Etc).to receive(:getgrnam).with("wheel").and_return(@pw_group)
end
diff --git a/spec/unit/provider/link_spec.rb b/spec/unit/provider/link_spec.rb
index 10dbdc1766..8f1ec8c3ba 100644
--- a/spec/unit/provider/link_spec.rb
+++ b/spec/unit/provider/link_spec.rb
@@ -46,7 +46,7 @@ describe Chef::Resource::Link do
describe "when the target is a symlink" do
before(:each) do
- lstat = double("stats", :ino => 5)
+ lstat = double("stats", ino: 5)
allow(lstat).to receive(:uid).and_return(501)
allow(lstat).to receive(:gid).and_return(501)
allow(lstat).to receive(:mode).and_return(0777)
@@ -146,7 +146,7 @@ describe Chef::Resource::Link do
describe "when the target is a regular old file" do
before do
- stat = double("stats", :ino => 5)
+ stat = double("stats", ino: 5)
allow(stat).to receive(:uid).and_return(501)
allow(stat).to receive(:gid).and_return(501)
allow(stat).to receive(:mode).and_return(0755)
@@ -178,7 +178,7 @@ describe Chef::Resource::Link do
describe "and the source exists" do
before do
- stat = double("stats", :ino => 6)
+ stat = double("stats", ino: 6)
allow(stat).to receive(:uid).and_return(502)
allow(stat).to receive(:gid).and_return(502)
allow(stat).to receive(:mode).and_return(0644)
@@ -205,7 +205,7 @@ describe Chef::Resource::Link do
describe "and is hardlinked to the source" do
before do
- stat = double("stats", :ino => 5)
+ stat = double("stats", ino: 5)
allow(stat).to receive(:uid).and_return(502)
allow(stat).to receive(:gid).and_return(502)
allow(stat).to receive(:mode).and_return(0644)
@@ -254,7 +254,7 @@ describe Chef::Resource::Link do
describe "action_delete" do
before(:each) do
- stat = double("stats", :ino => 5)
+ stat = double("stats", ino: 5)
allow(stat).to receive(:uid).and_return(501)
allow(stat).to receive(:gid).and_return(501)
allow(stat).to receive(:mode).and_return(0755)
@@ -321,7 +321,7 @@ describe Chef::Resource::Link do
end
before(:each) do
- stat = double("stats", :ino => 5)
+ stat = double("stats", ino: 5)
allow(stat).to receive(:uid).and_return(502)
allow(stat).to receive(:gid).and_return(502)
allow(stat).to receive(:mode).and_return(0644)
diff --git a/spec/unit/provider/mdadm_spec.rb b/spec/unit/provider/mdadm_spec.rb
index 8ef884e131..17824c4fb8 100644
--- a/spec/unit/provider/mdadm_spec.rb
+++ b/spec/unit/provider/mdadm_spec.rb
@@ -32,20 +32,20 @@ describe Chef::Provider::Mdadm do
describe "when determining the current metadevice status" do
it "should set the current resources mount point to the new resources mount point" do
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:status => 0))
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(status: 0))
@provider.load_current_resource
expect(@provider.current_resource.name).to eq("/dev/md1")
expect(@provider.current_resource.raid_device).to eq("/dev/md1")
end
it "determines that the metadevice exists when mdadm exit code is zero" do
- allow(@provider).to receive(:shell_out!).with("mdadm --detail --test /dev/md1", :returns => [0, 4]).and_return(OpenStruct.new(:status => 0))
+ allow(@provider).to receive(:shell_out!).with("mdadm --detail --test /dev/md1", returns: [0, 4]).and_return(OpenStruct.new(status: 0))
@provider.load_current_resource
expect(@provider.current_resource.exists).to be_truthy
end
it "determines that the metadevice does not exist when mdadm exit code is 4" do
- allow(@provider).to receive(:shell_out!).with("mdadm --detail --test /dev/md1", :returns => [0, 4]).and_return(OpenStruct.new(:status => 4))
+ allow(@provider).to receive(:shell_out!).with("mdadm --detail --test /dev/md1", returns: [0, 4]).and_return(OpenStruct.new(status: 4))
@provider.load_current_resource
expect(@provider.current_resource.exists).to be_falsey
end
diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb
index 615f3c3304..d807409d05 100644
--- a/spec/unit/provider/mount/aix_spec.rb
+++ b/spec/unit/provider/mount/aix_spec.rb
@@ -61,7 +61,7 @@ WRONG
@new_resource.device_type :device
@new_resource.fstype "jfs2"
- @new_resource.supports :remount => false
+ @new_resource.supports remount: false
@provider = Chef::Provider::Mount::Aix.new(@new_resource, @run_context)
@@ -70,12 +70,12 @@ WRONG
end
def stub_mounted(provider, mounted_output)
- response = double("Mixlib::ShellOut command", :exitstatus => 0, :stdout => mounted_output, :stderr => "")
+ response = double("Mixlib::ShellOut command", exitstatus: 0, stdout: mounted_output, stderr: "")
expect(provider).to receive(:shell_out!).with("mount").and_return(response)
end
def stub_enabled(provider, enabled_output)
- response = double("Mixlib::ShellOut command", :exitstatus => 0, :stdout => enabled_output, :stderr => "")
+ response = double("Mixlib::ShellOut command", exitstatus: 0, stdout: enabled_output, stderr: "")
expect(provider).to receive(:shell_out).with("lsfs -c #{@new_resource.mount_point}").and_return(response)
end
@@ -179,7 +179,7 @@ WRONG
describe "remount_fs" do
it "should remount resource if it is already mounted and it supports remounting" do
- @new_resource.supports({ :remount => true })
+ @new_resource.supports({ remount: true })
stub_mounted_enabled(@provider, @mounted_output, "")
expect(@provider).to receive(:shell_out!).with("mount -o remount #{@new_resource.device} #{@new_resource.mount_point}")
@@ -188,7 +188,7 @@ WRONG
end
it "should remount with new mount options if it is already mounted and it supports remounting" do
- @new_resource.supports({ :remount => true })
+ @new_resource.supports({ remount: true })
@new_resource.options("nodev,rw")
stub_mounted_enabled(@provider, @mounted_output, "")
diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb
index af7916e5bd..18523e3bc6 100644
--- a/spec/unit/provider/mount/mount_spec.rb
+++ b/spec/unit/provider/mount/mount_spec.rb
@@ -30,7 +30,7 @@ describe Chef::Provider::Mount::Mount do
@new_resource.device_type :device
@new_resource.fstype "ext3"
- @new_resource.supports :remount => false
+ @new_resource.supports remount: false
@provider = Chef::Provider::Mount::Mount.new(@new_resource, @run_context)
@@ -42,7 +42,7 @@ describe Chef::Provider::Mount::Mount do
describe "when discovering the current fs state" do
before do
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => ""))
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: ""))
allow(::File).to receive(:foreach).with("/etc/fstab")
end
@@ -54,10 +54,10 @@ describe Chef::Provider::Mount::Mount do
end
it "should accept device_type :uuid", :not_supported_on_solaris do
- @status = double(:stdout => "/dev/sdz1\n", :exitstatus => 1)
+ @status = double(stdout: "/dev/sdz1\n", exitstatus: 1)
@new_resource.device_type :uuid
@new_resource.device "d21afe51-a0fe-4dc6-9152-ac733763ae0a"
- @stdout_findfs = double("STDOUT", :first => "/dev/sdz1")
+ @stdout_findfs = double("STDOUT", first: "/dev/sdz1")
expect(@provider).to receive(:shell_out).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_return(@status)
@provider.load_current_resource
@provider.mountable?
@@ -73,7 +73,7 @@ describe Chef::Provider::Mount::Mount do
it "should ignore trailing slash and set mounted to true for network mount (#{type})" do
@new_resource.device fs_spec
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "#{fs_spec}/ on /tmp/foo type #{type} (rw)\n"))
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "#{fs_spec}/ on /tmp/foo type #{type} (rw)\n"))
@provider.load_current_resource
expect(@provider.current_resource.mounted).to be_truthy
end
@@ -94,7 +94,7 @@ describe Chef::Provider::Mount::Mount do
end
it "should raise an error if the mount device (uuid) does not exist", :not_supported_on_solaris do
- status = double(:stdout => "", :exitstatus => 1)
+ status = double(stdout: "", exitstatus: 1)
@new_resource.device_type :uuid
@new_resource.device "d21afe51-a0fe-4dc6-9152-ac733763ae0a"
expect(@provider).to receive(:shell_out).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_return(status)
@@ -121,13 +121,13 @@ describe Chef::Provider::Mount::Mount do
end
it "should set mounted true if the mount point is found in the mounts list" do
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "/dev/sdz1 on /tmp/foo type ext3 (rw)\n"))
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "/dev/sdz1 on /tmp/foo type ext3 (rw)\n"))
@provider.load_current_resource()
expect(@provider.current_resource.mounted).to be_truthy
end
it "should set mounted false if another mount point beginning with the same path is found in the mounts list" do
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "/dev/sdz1 on /tmp/foobar type ext3 (rw)\n"))
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "/dev/sdz1 on /tmp/foobar type ext3 (rw)\n"))
@provider.load_current_resource()
expect(@provider.current_resource.mounted).to be_falsey
end
@@ -139,7 +139,7 @@ describe Chef::Provider::Mount::Mount do
allow(::File).to receive(:symlink?).with("#{@new_resource.device}").and_return(true)
allow(::File).to receive(:readlink).with("#{@new_resource.device}").and_return(target)
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "#{target} on /tmp/foo type ext3 (rw)\n"))
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "#{target} on /tmp/foo type ext3 (rw)\n"))
@provider.load_current_resource()
expect(@provider.current_resource.mounted).to be_truthy
end
@@ -153,7 +153,7 @@ describe Chef::Provider::Mount::Mount do
allow(::File).to receive(:symlink?).with("#{@new_resource.device}").and_return(true)
allow(::File).to receive(:readlink).with("#{@new_resource.device}").and_return(target)
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "#{absolute_target} on /tmp/foo type ext3 (rw)\n"))
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "#{absolute_target} on /tmp/foo type ext3 (rw)\n"))
@provider.load_current_resource()
expect(@provider.current_resource.mounted).to be_truthy
end
@@ -162,7 +162,7 @@ describe Chef::Provider::Mount::Mount do
mount = "/dev/sdy1 on #{@new_resource.mount_point} type ext3 (rw)\n"
mount << "#{@new_resource.device} on #{@new_resource.mount_point} type ext3 (rw)\n"
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => mount))
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: mount))
@provider.load_current_resource()
expect(@provider.current_resource.mounted).to be_truthy
end
@@ -171,13 +171,13 @@ describe Chef::Provider::Mount::Mount do
mount = "#{@new_resource.device} on #{@new_resource.mount_point} type ext3 (rw)\n"
mount << "/dev/sdy1 on #{@new_resource.mount_point} type ext3 (rw)\n"
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => mount))
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: mount))
@provider.load_current_resource()
expect(@provider.current_resource.mounted).to be_falsey
end
it "mounted should be false if the mount point is not found in the mounts list" do
- allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "/dev/sdy1 on /tmp/foo type ext3 (rw)\n"))
+ allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "/dev/sdy1 on /tmp/foo type ext3 (rw)\n"))
@provider.load_current_resource()
expect(@provider.current_resource.mounted).to be_falsey
end
@@ -307,7 +307,7 @@ describe Chef::Provider::Mount::Mount do
end
it "should mount the filesystem specified by uuid", :not_supported_on_solaris do
- status = double(:stdout => "/dev/sdz1\n", :exitstatus => 1)
+ status = double(stdout: "/dev/sdz1\n", exitstatus: 1)
@new_resource.device "d21afe51-a0fe-4dc6-9152-ac733763ae0a"
@new_resource.device_type :uuid
allow(@provider).to receive(:shell_out).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_return(status)
@@ -341,14 +341,14 @@ describe Chef::Provider::Mount::Mount do
describe "remount_fs" do
it "should use mount -o remount if remount is supported" do
- @new_resource.supports({ :remount => true })
+ @new_resource.supports({ remount: true })
@current_resource.mounted(true)
expect(@provider).to receive(:shell_out!).with("mount -o remount,defaults #{@new_resource.mount_point}")
@provider.remount_fs
end
it "should use mount -o remount with new mount options if remount is supported" do
- @new_resource.supports({ :remount => true })
+ @new_resource.supports({ remount: true })
options = "rw,noexec,noauto"
@new_resource.options(%w{rw noexec noauto})
@current_resource.mounted(true)
@@ -357,7 +357,7 @@ describe Chef::Provider::Mount::Mount do
end
it "should umount and mount if remount is not supported" do
- @new_resource.supports({ :remount => false })
+ @new_resource.supports({ remount: false })
@current_resource.mounted(true)
expect(@provider).to receive(:umount_fs)
expect(@provider).to receive(:sleep).with(1)
@@ -499,7 +499,7 @@ describe Chef::Provider::Mount::Mount do
context "when the device is described differently", :not_supported_on_solaris do
it "should update the existing line" do
@current_resource.enabled(true)
- status = double(:stdout => "/dev/sdz1\n", :exitstatus => 1)
+ status = double(stdout: "/dev/sdz1\n", exitstatus: 1)
expect(@provider).to receive(:shell_out).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_return(status)
filesystems = [%q{/dev/sdy1 /tmp/foo ext3 defaults 1 2},
diff --git a/spec/unit/provider/mount/solaris_spec.rb b/spec/unit/provider/mount/solaris_spec.rb
index 2ec9feaf3b..e489b9001a 100644
--- a/spec/unit/provider/mount/solaris_spec.rb
+++ b/spec/unit/provider/mount/solaris_spec.rb
@@ -48,7 +48,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
new_resource.fsck_device fsck_device
new_resource.fstype fstype
new_resource.options options
- new_resource.supports :remount => false
+ new_resource.supports remount: false
new_resource
end
@@ -92,7 +92,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
before do
stub_const("Chef::Provider::Mount::Solaris::VFSTAB", vfstab_file.path )
- allow(provider).to receive(:shell_out!).with("mount -v").and_return(OpenStruct.new(:stdout => mount_output))
+ allow(provider).to receive(:shell_out!).with("mount -v").and_return(OpenStruct.new(stdout: mount_output))
allow(File).to receive(:symlink?).with(device).and_return(false)
allow(File).to receive(:exist?).and_call_original # Tempfile.open on ruby 1.8.7 calls File.exist?
allow(File).to receive(:exist?).with(device).and_return(true)
diff --git a/spec/unit/provider/mount/windows_spec.rb b/spec/unit/provider/mount/windows_spec.rb
index fdb44836b5..6d55fb958c 100644
--- a/spec/unit/provider/mount/windows_spec.rb
+++ b/spec/unit/provider/mount/windows_spec.rb
@@ -99,10 +99,10 @@ describe Chef::Provider::Mount::Windows do
end
it "should mount the filesystem if it is not mounted" do
- expect(@vol).to receive(:add).with(:remote => @new_resource.device,
- :username => @new_resource.username,
- :domainname => @new_resource.domain,
- :password => @new_resource.password)
+ expect(@vol).to receive(:add).with(remote: @new_resource.device,
+ username: @new_resource.username,
+ domainname: @new_resource.domain,
+ password: @new_resource.password)
@provider.mount_fs
end
diff --git a/spec/unit/provider/ohai_spec.rb b/spec/unit/provider/ohai_spec.rb
index fad08ba589..518523dca2 100644
--- a/spec/unit/provider/ohai_spec.rb
+++ b/spec/unit/provider/ohai_spec.rb
@@ -29,16 +29,16 @@ describe Chef::Provider::Ohai do
@platform_version = "example-platform"
Chef::Config[:node_name] = @fqdn
mock_ohai = {
- :fqdn => @fqdn,
- :hostname => @hostname,
- :platform => @platform,
- :platform_version => @platform_version,
- :data => {
- :origdata => "somevalue",
+ fqdn: @fqdn,
+ hostname: @hostname,
+ platform: @platform,
+ platform_version: @platform_version,
+ data: {
+ origdata: "somevalue",
},
- :data2 => {
- :origdata => "somevalue",
- :newdata => "somevalue",
+ data2: {
+ origdata: "somevalue",
+ newdata: "somevalue",
},
}
allow(mock_ohai).to receive(:all_plugins).and_return(true)
diff --git a/spec/unit/provider/osx_profile_spec.rb b/spec/unit/provider/osx_profile_spec.rb
index a1dcf3ecd6..dce52fd598 100644
--- a/spec/unit/provider/osx_profile_spec.rb
+++ b/spec/unit/provider/osx_profile_spec.rb
@@ -20,7 +20,7 @@ require "spec_helper"
describe Chef::Provider::OsxProfile do
let(:shell_out_success) do
- double("shell_out", :exitstatus => 0, :error? => false)
+ double("shell_out", exitstatus: 0, error?: false)
end
describe "action_create" do
let(:node) { Chef::Node.new }
diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb
index f15929880d..1047534f98 100644
--- a/spec/unit/provider/package/apt_spec.rb
+++ b/spec/unit/provider/package/apt_spec.rb
@@ -31,7 +31,7 @@ describe Chef::Provider::Package::Apt do
allow(@run_context).to receive(:logger).and_return(logger)
@new_resource = Chef::Resource::AptPackage.new("irssi", @run_context)
- @status = double("Status", :exitstatus => 0)
+ @status = double("Status", exitstatus: 0)
@provider = Chef::Provider::Package::Apt.new(@new_resource, @run_context)
@stdin = StringIO.new
@stdout = <<-PKG_STATUS
@@ -43,7 +43,7 @@ irssi:
500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages
PKG_STATUS
@stderr = ""
- @shell_out = OpenStruct.new(:stdout => @stdout, :stdin => @stdin, :stderr => @stderr, :status => @status, :exitstatus => 0)
+ @shell_out = OpenStruct.new(stdout: @stdout, stdin: @stdin, stderr: @stderr, status: @status, exitstatus: 0)
@timeout = 900
end
@@ -52,8 +52,8 @@ irssi:
it "should create a current resource with the name of the new_resource" do
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-cache", "policy", @new_resource.package_name,
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
).and_return(@shell_out)
@provider.load_current_resource
@@ -89,20 +89,20 @@ sudo:
policy_out = <<-POLICY_STDOUT
N: Unable to locate package conic-smarms
POLICY_STDOUT
- policy = double(:stdout => policy_out, :exitstatus => 0)
+ policy = double(stdout: policy_out, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-cache", "policy", "conic-smarms",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
).and_return(policy)
showpkg_out = <<-SHOWPKG_STDOUT
N: Unable to locate package conic-smarms
SHOWPKG_STDOUT
- showpkg = double(:stdout => showpkg_out, :exitstatus => 0)
+ showpkg = double(stdout: showpkg_out, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-cache", "showpkg", "conic-smarms",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
).and_return(showpkg)
@provider.load_current_resource
end
@@ -117,11 +117,11 @@ libmysqlclient15-dev:
Candidate: (none)
Version table:
VPKG_STDOUT
- virtual_package = double(:stdout => virtual_package_out, :exitstatus => 0)
+ virtual_package = double(stdout: virtual_package_out, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-cache", "policy", "libmysqlclient15-dev",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
).and_return(virtual_package)
showpkg_out = <<-SHOWPKG_STDOUT
Package: libmysqlclient15-dev
@@ -141,11 +141,11 @@ libmysqlclient-dev 5.1.41-3ubuntu12.7
libmysqlclient-dev 5.1.41-3ubuntu12.10
libmysqlclient-dev 5.1.41-3ubuntu12
SHOWPKG_STDOUT
- showpkg = double(:stdout => showpkg_out, :exitstatus => 0)
+ showpkg = double(stdout: showpkg_out, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-cache", "showpkg", "libmysqlclient15-dev",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
).and_return(showpkg)
real_package_out = <<-RPKG_STDOUT
libmysqlclient-dev:
@@ -160,11 +160,11 @@ libmysqlclient-dev:
5.1.41-3ubuntu12 0
500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages
RPKG_STDOUT
- real_package = double(:stdout => real_package_out, :exitstatus => 0)
+ real_package = double(stdout: real_package_out, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-cache", "policy", "libmysqlclient-dev",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
).and_return(real_package)
@provider.load_current_resource
end
@@ -177,11 +177,11 @@ mp3-decoder:
Candidate: (none)
Version table:
VPKG_STDOUT
- virtual_package = double(:stdout => virtual_package_out, :exitstatus => 0)
+ virtual_package = double(stdout: virtual_package_out, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-cache", "policy", "mp3-decoder",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
).and_return(virtual_package)
showpkg_out = <<-SHOWPKG_STDOUT
Package: mp3-decoder
@@ -204,11 +204,11 @@ opencubicplayer 1:0.1.17-2
mpg321 0.2.10.6
mpg123 1.12.1-0ubuntu1
SHOWPKG_STDOUT
- showpkg = double(:stdout => showpkg_out, :exitstatus => 0)
+ showpkg = double(stdout: showpkg_out, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-cache", "showpkg", "mp3-decoder",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
).and_return(showpkg)
expect { @provider.load_current_resource }.to raise_error(Chef::Exceptions::Package)
end
@@ -221,8 +221,8 @@ mpg123 1.12.1-0ubuntu1
@new_resource.provider(nil)
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-cache", "-o", "APT::Default-Release=lenny-backports", "policy", "irssi",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
).and_return(@shell_out)
@provider.load_current_resource
end
@@ -231,8 +231,8 @@ mpg123 1.12.1-0ubuntu1
@new_resource.source "pluto"
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-cache", "policy", @new_resource.package_name,
- :env => { "DEBIAN_FRONTEND" => "noninteractive" } ,
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" } ,
+ timeout: @timeout
).and_return(@shell_out)
expect { @provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
end
@@ -260,8 +260,8 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-get install with the package name and version" do
expect(@provider).to receive(:shell_out_compacted!). with(
"apt-get", "-q", "-y", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "irssi=0.8.12-7",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.install_package(["irssi"], ["0.8.12-7"])
end
@@ -269,8 +269,8 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-get install with the package name and version and options if specified" do
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "--force-yes", "install", "irssi=0.8.12-7",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@new_resource.options("--force-yes")
@provider.install_package(["irssi"], ["0.8.12-7"])
@@ -285,8 +285,8 @@ mpg123 1.12.1-0ubuntu1
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "-o", "APT::Default-Release=lenny-backports", "install", "irssi=0.8.12-7",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.install_package(["irssi"], ["0.8.12-7"])
@@ -295,8 +295,8 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-get install with the package name and quotes options if specified" do
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "--force-yes", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confnew", "install", "irssi=0.8.12-7",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@new_resource.options('--force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew"')
@provider.install_package(["irssi"], ["0.8.12-7"])
@@ -316,8 +316,8 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-get remove with the package name" do
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "remove", "irssi",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.remove_package(["irssi"], ["0.8.12-7"])
end
@@ -325,8 +325,8 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-get remove with the package name and options if specified" do
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "--force-yes", "remove", "irssi",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@new_resource.options("--force-yes")
@@ -339,8 +339,8 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-get purge with the package name" do
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "purge", "irssi",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.purge_package(["irssi"], ["0.8.12-7"])
end
@@ -348,8 +348,8 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-get purge with the package name and options if specified" do
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "--force-yes", "purge", "irssi",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@new_resource.options("--force-yes")
@@ -367,8 +367,8 @@ mpg123 1.12.1-0ubuntu1
expect(@provider).to receive(:shell_out_compacted!).with(
"debconf-set-selections", "/tmp/irssi-0.8.12-7.seed",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.preseed_package(file)
@@ -377,8 +377,8 @@ mpg123 1.12.1-0ubuntu1
it "should run debconf-set-selections on the preseed file if it has changed" do
expect(@provider).to receive(:shell_out_compacted!).with(
"debconf-set-selections", "/tmp/irssi-0.8.12-7.seed",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
file = @provider.get_preseed_file("irssi", "0.8.12-7")
@provider.preseed_package(file)
@@ -398,8 +398,8 @@ mpg123 1.12.1-0ubuntu1
it "should run dpkg-reconfigure package" do
expect(@provider).to receive(:shell_out_compacted!).with(
"dpkg-reconfigure", "irssi",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.reconfig_package("irssi", "0.8.12-7")
end
@@ -409,8 +409,8 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-mark hold package" do
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-mark", "hold", "irssi",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.lock_package("irssi", "0.8.12-7")
end
@@ -430,8 +430,8 @@ mpg123 1.12.1-0ubuntu1
it "should run apt-mark unhold package" do
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-mark", "unhold", "irssi",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.unlock_package("irssi", "0.8.12-7")
end
@@ -452,8 +452,8 @@ mpg123 1.12.1-0ubuntu1
@provider.package_data["libmysqlclient15-dev"][:virtual] = true
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "libmysqlclient15-dev",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.install_package(["libmysqlclient15-dev"], ["not_a_real_version"])
end
@@ -464,8 +464,8 @@ mpg123 1.12.1-0ubuntu1
expect(@provider).to receive(:resolve_virtual_package_name).with("libmysqlclient15-dev").and_return("libmysqlclient-dev")
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "remove", "libmysqlclient-dev",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.remove_package(["libmysqlclient15-dev"], ["not_a_real_version"])
end
@@ -476,8 +476,8 @@ mpg123 1.12.1-0ubuntu1
expect(@provider).to receive(:resolve_virtual_package_name).with("libmysqlclient15-dev").and_return("libmysqlclient-dev")
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "purge", "libmysqlclient-dev",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.purge_package(["libmysqlclient15-dev"], ["not_a_real_version"])
end
@@ -488,8 +488,8 @@ mpg123 1.12.1-0ubuntu1
# https://github.com/chef/chef/issues/2914
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "libmysqlclient15-dev", "irssi=0.8.12-7",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.install_package(["libmysqlclient15-dev", "irssi"], ["not_a_real_version", "0.8.12-7"])
end
@@ -511,8 +511,8 @@ mpg123 1.12.1-0ubuntu1
expect(@provider).to receive(:version_compare).and_return(-1)
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "irssi=0.8.12-7",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.run_action(:upgrade)
end
@@ -523,8 +523,8 @@ mpg123 1.12.1-0ubuntu1
expect(@provider).not_to receive(:version_compare)
expect(@provider).to receive(:shell_out_compacted!).with(
"apt-get", "-q", "-y", "-o", "Dpkg::Options::=--force-confdef", "-o", "Dpkg::Options::=--force-confold", "install", "irssi=0.8.12-7",
- :env => { "DEBIAN_FRONTEND" => "noninteractive" },
- :timeout => @timeout
+ env: { "DEBIAN_FRONTEND" => "noninteractive" },
+ timeout: @timeout
)
@provider.run_action(:upgrade)
end
diff --git a/spec/unit/provider/package/bff_spec.rb b/spec/unit/provider/package/bff_spec.rb
index df407914d3..7606092762 100644
--- a/spec/unit/provider/package/bff_spec.rb
+++ b/spec/unit/provider/package/bff_spec.rb
@@ -38,11 +38,11 @@ describe Chef::Provider::Package::Bff do
@bffinfo = "/usr/lib/objrepos:samba.base:3.3.12.0::COMMITTED:I:Samba for AIX:
/etc/objrepos:samba.base:3.3.12.0::COMMITTED:I:Samba for AIX:"
- @empty_status = double("Status", :stdout => "", :exitstatus => 0)
+ @empty_status = double("Status", stdout: "", exitstatus: 0)
end
it "should create a current resource with the name of new_resource" do
- status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
+ status = double("Status", stdout: @bffinfo, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
expect(@provider).to receive(:shell_out_compacted).with("lslpp", "-lcq", "samba.base", timeout: 900).and_return(@empty_status)
@provider.load_current_resource
@@ -50,7 +50,7 @@ describe Chef::Provider::Package::Bff do
end
it "should set the current resource bff package name to the new resource bff package name" do
- status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
+ status = double("Status", stdout: @bffinfo, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
expect(@provider).to receive(:shell_out_compacted).with("lslpp", "-lcq", "samba.base", timeout: 900).and_return(@empty_status)
@provider.load_current_resource
@@ -66,7 +66,7 @@ describe Chef::Provider::Package::Bff do
end
it "should get the source package version from lslpp if provided" do
- status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
+ status = double("Status", stdout: @bffinfo, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
expect(@provider).to receive(:shell_out_compacted).with("lslpp", "-lcq", "samba.base", timeout: 900).and_return(@empty_status)
@provider.load_current_resource
@@ -78,7 +78,7 @@ describe Chef::Provider::Package::Bff do
it "should warn if the package is not a fileset" do
info = "samba.base:samba.base.samples:3.3.12.0::COMMITTED:I:Samba for AIX:
/etc/objrepos:samba.base:3.3.12.0::COMMITTED:I:Samba for AIX:"
- status = double("Status", :stdout => info, :exitstatus => 0)
+ status = double("Status", stdout: info, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
expect(@provider).to receive(:shell_out_compacted).with("lslpp", "-lcq", "samba.base", timeout: 900).and_return(@empty_status)
expect(logger).to receive(:warn).once.with(%r{bff package by product name})
@@ -89,7 +89,7 @@ describe Chef::Provider::Package::Bff do
end
it "should return the current version installed if found by lslpp" do
- status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
+ status = double("Status", stdout: @bffinfo, exitstatus: 0)
@stdout = StringIO.new(@bffinfo)
@stdin, @stderr = StringIO.new, StringIO.new
expect(@provider).to receive(:shell_out_compacted).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
@@ -99,7 +99,7 @@ describe Chef::Provider::Package::Bff do
end
it "should raise an exception if the source is not set but we are installing" do
- status = double("Status", :stdout => "", :exitstatus => 1, :format_for_exception => "")
+ status = double("Status", stdout: "", exitstatus: 1, format_for_exception: "")
@new_resource = Chef::Resource::Package.new("samba.base")
@provider = Chef::Provider::Package::Bff.new(@new_resource, @run_context)
allow(@provider).to receive(:shell_out_compacted).and_return(status)
@@ -107,13 +107,13 @@ describe Chef::Provider::Package::Bff do
end
it "should raise an exception if installp/lslpp fails to run" do
- status = double(:stdout => "", :exitstatus => -1, :format_for_exception => "")
+ status = double(stdout: "", exitstatus: -1, format_for_exception: "")
allow(@provider).to receive(:shell_out_compacted).and_return(status)
expect { @provider.load_current_resource }.to raise_error(Chef::Exceptions::Package)
end
it "should return a current resource with a nil version if the package is not found" do
- status = double("Status", :stdout => @bffinfo, :exitstatus => 0)
+ status = double("Status", stdout: @bffinfo, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
expect(@provider).to receive(:shell_out_compacted).with("lslpp", "-lcq", "samba.base", timeout: 900).and_return(@empty_status)
@provider.load_current_resource
@@ -123,7 +123,7 @@ describe Chef::Provider::Package::Bff do
it "should raise an exception if the source doesn't provide the requested package" do
wrongbffinfo = "/usr/lib/objrepos:openssl.base:0.9.8.2400::COMMITTED:I:Open Secure Socket Layer:
/etc/objrepos:openssl.base:0.9.8.2400::COMMITTED:I:Open Secure Socket Layer:"
- status = double("Status", :stdout => wrongbffinfo, :exitstatus => 0)
+ status = double("Status", stdout: wrongbffinfo, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).with("installp", "-L", "-d", "/tmp/samba.base", timeout: 900).and_return(status)
expect { @provider.load_current_resource }.to raise_error(Chef::Exceptions::Package)
end
@@ -137,13 +137,13 @@ describe Chef::Provider::Package::Bff do
end
it "should lookup the candidate_version if the variable is not already set" do
- status = double(:stdout => "", :exitstatus => 0)
+ status = double(stdout: "", exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).and_return(status)
@provider.candidate_version
end
it "should throw and exception if the exitstatus is not 0" do
- @status = double(:stdout => "", :exitstatus => 1, :format_for_exception => "")
+ @status = double(stdout: "", exitstatus: 1, format_for_exception: "")
allow(@provider).to receive(:shell_out_compacted).and_return(@status)
expect { @provider.candidate_version }.to raise_error(Chef::Exceptions::Package)
end
diff --git a/spec/unit/provider/package/chocolatey_spec.rb b/spec/unit/provider/package/chocolatey_spec.rb
index a0a73c445a..40fca821d9 100644
--- a/spec/unit/provider/package/chocolatey_spec.rb
+++ b/spec/unit/provider/package/chocolatey_spec.rb
@@ -45,8 +45,8 @@ ConEmu|15.10.25.0
before do
allow(provider).to receive(:choco_install_path).and_return(choco_install_path)
allow(provider).to receive(:choco_exe).and_return(choco_exe)
- local_list_obj = double(:stdout => local_list_stdout)
- allow(provider).to receive(:shell_out_compacted!).with("#{choco_exe} list -l -r", { :returns => [0], :timeout => timeout }).and_return(local_list_obj)
+ local_list_obj = double(stdout: local_list_stdout)
+ allow(provider).to receive(:shell_out_compacted!).with("#{choco_exe} list -l -r", { returns: [0], timeout: timeout }).and_return(local_list_obj)
end
def allow_remote_list(package_names, args = nil)
@@ -60,7 +60,7 @@ munin-node|1.6.1.20130823
EOF
remote_list_obj = double(stdout: remote_list_stdout)
package_names.each do |pkg|
- allow(provider).to receive(:shell_out_compacted!).with("#{choco_exe} list -r #{pkg}#{args}", { :returns => [0], timeout: timeout }).and_return(remote_list_obj)
+ allow(provider).to receive(:shell_out_compacted!).with("#{choco_exe} list -r #{pkg}#{args}", { returns: [0], timeout: timeout }).and_return(remote_list_obj)
end
end
@@ -182,7 +182,7 @@ munin-node|1.6.1.20130823
it "should install a single package" do
allow_remote_list(["git"])
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y git", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y git", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -193,7 +193,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git"])
new_resource.timeout(timeout)
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y git", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y git", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -222,7 +222,7 @@ munin-node|1.6.1.20130823
new_resource.package_name("ConEmu")
new_resource.version("15.10.25.1")
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y --version 15.10.25.1 conemu", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y --version 15.10.25.1 conemu", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -235,7 +235,7 @@ munin-node|1.6.1.20130823
new_resource.package_name(%w{chocolatey ConEmu})
new_resource.version([nil, "15.10.25.1"])
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y --version 15.10.25.1 conemu", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y --version 15.10.25.1 conemu", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -245,7 +245,7 @@ munin-node|1.6.1.20130823
new_resource.package_name("conemu")
new_resource.version("15.10.25.1")
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y --version 15.10.25.1 conemu", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y --version 15.10.25.1 conemu", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -255,8 +255,8 @@ munin-node|1.6.1.20130823
new_resource.package_name(%w{ConEmu git})
new_resource.version(["15.10.25.1", nil])
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y --version 15.10.25.1 conemu", { :returns => [0], :timeout => timeout }).and_return(double)
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y git", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y --version 15.10.25.1 conemu", { returns: [0], timeout: timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y git", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -265,7 +265,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git", "munin-node"])
new_resource.package_name(["git", "munin-node"])
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y git munin-node", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y git munin-node", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -275,7 +275,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git"], " -source localpackages")
new_resource.source("localpackages")
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y -source localpackages git", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y -source localpackages git", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -285,7 +285,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git"])
new_resource.options("-force")
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y -force git", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} install -y -force git", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -319,7 +319,7 @@ munin-node|1.6.1.20130823
it "should install a package that is not installed" do
allow_remote_list(["git"])
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y git", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y git", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:upgrade)
expect(new_resource).to be_updated_by_last_action
end
@@ -328,7 +328,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["ConEmu"])
new_resource.package_name("ConEmu")
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y conemu", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y conemu", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:upgrade)
expect(new_resource).to be_updated_by_last_action
end
@@ -337,7 +337,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["conemu"])
new_resource.package_name("conemu")
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y conemu", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y conemu", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:upgrade)
expect(new_resource).to be_updated_by_last_action
end
@@ -346,7 +346,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["chocolatey"])
new_resource.package_name("chocolatey")
provider.load_current_resource
- expect(provider).not_to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y chocolatey", { :returns => [0], :timeout => timeout })
+ expect(provider).not_to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y chocolatey", { returns: [0], timeout: timeout })
provider.run_action(:upgrade)
expect(new_resource).not_to be_updated_by_last_action
end
@@ -355,7 +355,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["git"])
new_resource.version("2.6.2")
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y --version 2.6.2 git", { :returns => [0], :timeout => timeout })
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y --version 2.6.2 git", { returns: [0], timeout: timeout })
provider.run_action(:upgrade)
expect(new_resource).to be_updated_by_last_action
end
@@ -363,7 +363,7 @@ munin-node|1.6.1.20130823
it "upgrading multiple packages uses a single command" do
allow_remote_list(%w{conemu git})
new_resource.package_name(%w{conemu git})
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y conemu git", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} upgrade -y conemu git", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:upgrade)
expect(new_resource).to be_updated_by_last_action
end
@@ -415,7 +415,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["ConEmu"])
new_resource.package_name("ConEmu")
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} uninstall -y ConEmu", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} uninstall -y ConEmu", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
@@ -424,7 +424,7 @@ munin-node|1.6.1.20130823
allow_remote_list(["conemu"])
new_resource.package_name("conemu")
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} uninstall -y conemu", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} uninstall -y conemu", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
@@ -434,7 +434,7 @@ munin-node|1.6.1.20130823
allow_remote_list(%w{git conemu})
new_resource.package_name(%w{git conemu})
provider.load_current_resource
- expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} uninstall -y conemu", { :returns => [0], :timeout => timeout }).and_return(double)
+ expect(provider).to receive(:shell_out_compacted!).with("#{choco_exe} uninstall -y conemu", { returns: [0], timeout: timeout }).and_return(double)
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
@@ -457,7 +457,7 @@ describe "behavior when Chocolatey is not installed" do
provider.instance_variable_set("@choco_install_path", nil)
# we don't care what this returns, but we have to let it be called.
- allow(provider).to receive(:shell_out_compacted!).and_return(double(:stdout => ""))
+ allow(provider).to receive(:shell_out_compacted!).and_return(double(stdout: ""))
end
let(:error_regex) do
diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb
index c99e91dd46..cf8f5097f0 100644
--- a/spec/unit/provider/package/dpkg_spec.rb
+++ b/spec/unit/provider/package/dpkg_spec.rb
@@ -31,7 +31,7 @@ describe Chef::Provider::Package::Dpkg do
let(:provider) { Chef::Provider::Package::Dpkg.new(new_resource, run_context) }
let(:dpkg_deb_version) { "1.11.4" }
- let(:dpkg_deb_status) { status = double(:stdout => "#{package}\t#{dpkg_deb_version}", :exitstatus => 0) }
+ let(:dpkg_deb_status) { status = double(stdout: "#{package}\t#{dpkg_deb_version}", exitstatus: 0) }
let(:dpkg_s_version) { "1.11.4-1ubuntu1" }
let(:dpkg_s_status) do
stdout = <<-DPKG_S
@@ -47,7 +47,7 @@ Config-Version: #{dpkg_s_version}
Depends: libc6 (>= 2.8~20080505), libssl0.9.8 (>= 0.9.8f-5)
Conflicts: wget-ssl
DPKG_S
- status = double(:stdout => stdout, :exitstatus => 1)
+ status = double(stdout: stdout, exitstatus: 1)
end
before(:each) do
@@ -112,7 +112,7 @@ Conflicts: wget-ssl
describe "gets the source package version from dpkg-deb" do
def check_version(version)
- status = double(:stdout => "wget\t#{version}", :exitstatus => 0)
+ status = double(stdout: "wget\t#{version}", exitstatus: 0)
expect(provider).to receive(:shell_out_compacted!).with("dpkg-deb", "-W", source, timeout: 900).and_return(status)
provider.load_current_resource
expect(provider.current_resource.package_name).to eq(["wget"])
@@ -206,7 +206,7 @@ Section: ruby
end
it "should raise an exception if dpkg-deb -W fails to run" do
- status = double(:stdout => "", :exitstatus => -1)
+ status = double(stdout: "", exitstatus: -1)
expect(provider).to receive(:shell_out_compacted!).with("dpkg-deb", "-W", "/tmp/wget_1.11.4-1ubuntu1_amd64.deb", timeout: 900).and_raise(Mixlib::ShellOut::ShellCommandFailed)
expect { provider.load_current_resource }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
end
diff --git a/spec/unit/provider/package/freebsd/pkg_spec.rb b/spec/unit/provider/package/freebsd/pkg_spec.rb
index 259bd7a4c4..6ad6813503 100644
--- a/spec/unit/provider/package/freebsd/pkg_spec.rb
+++ b/spec/unit/provider/package/freebsd/pkg_spec.rb
@@ -78,21 +78,21 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
end
it "should return the version number when it is installed" do
- pkg_info = OpenStruct.new(:stdout => "zsh-4.3.6_7")
+ pkg_info = OpenStruct.new(stdout: "zsh-4.3.6_7")
expect(@provider).to receive(:shell_out_compacted!).with("pkg_info", "-E", "zsh*", env: nil, returns: [0, 1], timeout: 900).and_return(pkg_info)
allow(@provider).to receive(:package_name).and_return("zsh")
expect(@provider.current_installed_version).to eq("4.3.6_7")
end
it "does not set the current version number when the package is not installed" do
- pkg_info = OpenStruct.new(:stdout => "")
+ pkg_info = OpenStruct.new(stdout: "")
expect(@provider).to receive(:shell_out_compacted!).with("pkg_info", "-E", "zsh*", env: nil, returns: [0, 1], timeout: 900).and_return(pkg_info)
allow(@provider).to receive(:package_name).and_return("zsh")
expect(@provider.current_installed_version).to be_nil
end
it "should return the port path for a valid port name" do
- whereis = OpenStruct.new(:stdout => "zsh: /usr/ports/shells/zsh")
+ whereis = OpenStruct.new(stdout: "zsh: /usr/ports/shells/zsh")
expect(@provider).to receive(:shell_out_compacted!).with("whereis", "-s", "zsh", env: nil, timeout: 900).and_return(whereis)
allow(@provider).to receive(:port_name).and_return("zsh")
expect(@provider.port_path).to eq("/usr/ports/shells/zsh")
@@ -101,7 +101,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
# Not happy with the form of these tests as they are far too closely tied to the implementation and so very fragile.
it "should return the ports candidate version when given a valid port path" do
allow(@provider).to receive(:port_path).and_return("/usr/ports/shells/zsh")
- make_v = OpenStruct.new(:stdout => "4.3.6\n", :exitstatus => 0)
+ make_v = OpenStruct.new(stdout: "4.3.6\n", exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted!).with("make", "-V", "PORTVERSION", { cwd: "/usr/ports/shells/zsh", returns: [0, 1], env: nil, timeout: 900 }).and_return(make_v)
expect(@provider.ports_candidate_version).to eq("4.3.6")
end
@@ -109,7 +109,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
it "should figure out the package name when we have ports" do
allow(::File).to receive(:exist?).with("/usr/ports/Makefile").and_return(true)
allow(@provider).to receive(:port_path).and_return("/usr/ports/shells/zsh")
- make_v = OpenStruct.new(:stdout => "zsh-4.3.6_7\n", :exitstatus => 0)
+ make_v = OpenStruct.new(stdout: "zsh-4.3.6_7\n", exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted!).with("make", "-V", "PKGNAME", { cwd: "/usr/ports/shells/zsh", env: nil, returns: [0, 1], timeout: 900 }).and_return(make_v)
#@provider.should_receive(:ports_makefile_variable_value).with("PKGNAME").and_return("zsh-4.3.6_7")
expect(@provider.package_name).to eq("zsh")
@@ -118,7 +118,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
describe Chef::Provider::Package::Freebsd::Pkg, "install_package" do
before(:each) do
- @cmd_result = OpenStruct.new(:status => true)
+ @cmd_result = OpenStruct.new(status: true)
@provider.current_resource = @current_resource
allow(@provider).to receive(:package_name).and_return("zsh")
@@ -141,7 +141,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
end
it "should figure out the port path from the package_name using whereis" do
- whereis = OpenStruct.new(:stdout => "zsh: /usr/ports/shells/zsh")
+ whereis = OpenStruct.new(stdout: "zsh: /usr/ports/shells/zsh")
expect(@provider).to receive(:shell_out_compacted!).with("whereis", "-s", "zsh", env: nil, timeout: 900).and_return(whereis)
expect(@provider.port_path).to eq("/usr/ports/shells/zsh")
end
@@ -174,7 +174,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
allow(@provider).to receive(:package_name).and_return("ruby18-iconv")
allow(@provider).to receive(:latest_link_name).and_return("ruby18-iconv")
- @install_result = OpenStruct.new(:status => true)
+ @install_result = OpenStruct.new(status: true)
end
it "should run pkg_add -r with the package name" do
@@ -185,7 +185,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
describe Chef::Provider::Package::Freebsd::Pkg, "remove_package" do
before(:each) do
- @pkg_delete = OpenStruct.new(:status => true)
+ @pkg_delete = OpenStruct.new(status: true)
@new_resource.version "4.3.6_7"
@current_resource.version "4.3.6_7"
@provider.current_resource = @current_resource
@@ -212,14 +212,14 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
end
it "should return the port path for a valid port name" do
- whereis = OpenStruct.new(:stdout => "bonnie++: /usr/ports/benchmarks/bonnie++")
+ whereis = OpenStruct.new(stdout: "bonnie++: /usr/ports/benchmarks/bonnie++")
expect(@provider).to receive(:shell_out_compacted!).with("whereis", "-s", "bonnie++", env: nil, timeout: 900).and_return(whereis)
allow(@provider).to receive(:port_name).and_return("bonnie++")
expect(@provider.port_path).to eq("/usr/ports/benchmarks/bonnie++")
end
it "should return the version number when it is installed" do
- pkg_info = OpenStruct.new(:stdout => "bonnie++-1.96")
+ pkg_info = OpenStruct.new(stdout: "bonnie++-1.96")
expect(@provider).to receive(:shell_out_compacted!).with("pkg_info", "-E", "bonnie++*", env: nil, returns: [0, 1], timeout: 900).and_return(pkg_info)
allow(@provider).to receive(:package_name).and_return("bonnie++")
expect(@provider.current_installed_version).to eq("1.96")
@@ -252,7 +252,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
allow(@provider).to receive(:package_name).and_return("perl")
allow(@provider).to receive(:latest_link_name).and_return("perl")
- cmd = OpenStruct.new(:status => true)
+ cmd = OpenStruct.new(status: true)
expect(@provider).to receive(:shell_out_compacted!).with("pkg_add", "-r", "perl", env: nil, timeout: 900).and_return(cmd)
@provider.install_package("perl5.8", "5.8.8_1")
end
@@ -266,7 +266,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
allow(@provider).to receive(:package_name).and_return("mysql-server")
allow(@provider).to receive(:latest_link_name).and_return("mysql50-server")
- cmd = OpenStruct.new(:status => true)
+ cmd = OpenStruct.new(status: true)
expect(@provider).to receive(:shell_out_compacted!).with("pkg_add", "-r", "mysql50-server", env: nil, timeout: 900).and_return(cmd)
@provider.install_package("mysql50-server", "5.0.45_1")
end
diff --git a/spec/unit/provider/package/freebsd/pkgng_spec.rb b/spec/unit/provider/package/freebsd/pkgng_spec.rb
index 2fdcb87758..a4da5bb235 100644
--- a/spec/unit/provider/package/freebsd/pkgng_spec.rb
+++ b/spec/unit/provider/package/freebsd/pkgng_spec.rb
@@ -63,7 +63,7 @@ describe Chef::Provider::Package::Freebsd::Port do
describe "determining current installed version" do
before(:each) do
allow(@provider).to receive(:supports_pkgng?)
- @pkg_info = OpenStruct.new(:stdout => "zsh-3.1.7\nVersion : 3.1.7\n")
+ @pkg_info = OpenStruct.new(stdout: "zsh-3.1.7\nVersion : 3.1.7\n")
end
it "should query pkg database" do
@@ -74,14 +74,14 @@ describe Chef::Provider::Package::Freebsd::Port do
describe "determining candidate version" do
it "should query repository" do
- pkg_query = OpenStruct.new(:stdout => "5.0.5\n", :exitstatus => 0)
+ pkg_query = OpenStruct.new(stdout: "5.0.5\n", exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted!).with("pkg", "rquery", "%v", "zsh", env: nil, timeout: 900).and_return(pkg_query)
expect(@provider.candidate_version).to eq("5.0.5")
end
it "should query specified repository when given option" do
@provider.new_resource.options("-r LocalMirror") # This requires LocalMirror repo configuration.
- pkg_query = OpenStruct.new(:stdout => "5.0.3\n", :exitstatus => 0)
+ pkg_query = OpenStruct.new(stdout: "5.0.3\n", exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted!).with("pkg", "rquery", "-r", "LocalMirror", "%v", "zsh", env: nil, timeout: 900).and_return(pkg_query)
expect(@provider.candidate_version).to eq("5.0.3")
end
@@ -94,7 +94,7 @@ describe Chef::Provider::Package::Freebsd::Port do
describe "installing a binary package" do
before(:each) do
- @install_result = OpenStruct.new(:status => true)
+ @install_result = OpenStruct.new(status: true)
end
it "should handle package source from file" do
@@ -129,7 +129,7 @@ describe Chef::Provider::Package::Freebsd::Port do
describe "removing a binary package" do
before(:each) do
- @install_result = OpenStruct.new(:status => true)
+ @install_result = OpenStruct.new(status: true)
end
it "should call pkg delete" do
diff --git a/spec/unit/provider/package/freebsd/port_spec.rb b/spec/unit/provider/package/freebsd/port_spec.rb
index 26a960dedc..1406235725 100644
--- a/spec/unit/provider/package/freebsd/port_spec.rb
+++ b/spec/unit/provider/package/freebsd/port_spec.rb
@@ -62,7 +62,7 @@ describe Chef::Provider::Package::Freebsd::Port do
describe "determining current installed version" do
before(:each) do
- @pkg_info = OpenStruct.new(:stdout => "zsh-3.1.7\n")
+ @pkg_info = OpenStruct.new(stdout: "zsh-3.1.7\n")
end
it "should check 'pkg_info' if system uses pkg_* tools" do
@@ -73,7 +73,7 @@ describe Chef::Provider::Package::Freebsd::Port do
end
it "should check 'pkg info' if make supports WITH_PKGNG if freebsd version is < 1000017" do
- pkg_enabled = OpenStruct.new(:stdout => "yes\n")
+ pkg_enabled = OpenStruct.new(stdout: "yes\n")
[1000016, 1000000, 901503, 902506, 802511].each do |freebsd_version|
@node.automatic_attrs[:os_version] = freebsd_version
expect(@new_resource).to receive(:shell_out_compacted!).with("make", "-V", "WITH_PKGNG", env: nil).and_return(pkg_enabled)
@@ -92,7 +92,7 @@ describe Chef::Provider::Package::Freebsd::Port do
describe "determining candidate version" do
before(:each) do
- @port_version = OpenStruct.new(:stdout => "5.0.5\n", :exitstatus => 0)
+ @port_version = OpenStruct.new(stdout: "5.0.5\n", exitstatus: 0)
end
it "should return candidate version if port exists" do
@@ -121,13 +121,13 @@ describe Chef::Provider::Package::Freebsd::Port do
end
it "should query system for path given just a name" do
- whereis = OpenStruct.new(:stdout => "zsh: /usr/ports/shells/zsh\n")
+ whereis = OpenStruct.new(stdout: "zsh: /usr/ports/shells/zsh\n")
expect(@provider).to receive(:shell_out_compacted!).with("whereis", "-s", "zsh", env: nil, timeout: 900).and_return(whereis)
expect(@provider.port_dir).to eq("/usr/ports/shells/zsh")
end
it "should raise exception if not found" do
- whereis = OpenStruct.new(:stdout => "zsh:\n")
+ whereis = OpenStruct.new(stdout: "zsh:\n")
expect(@provider).to receive(:shell_out_compacted!).with("whereis", "-s", "zsh", env: nil, timeout: 900).and_return(whereis)
expect { @provider.port_dir }.to raise_error(Chef::Exceptions::Package, "Could not find port with the name zsh")
end
@@ -135,13 +135,13 @@ describe Chef::Provider::Package::Freebsd::Port do
describe "building a binary package" do
before(:each) do
- @install_result = OpenStruct.new(:status => true)
+ @install_result = OpenStruct.new(status: true)
end
it "should run make install in port directory" do
allow(@provider).to receive(:port_dir).and_return("/usr/ports/shells/zsh")
expect(@provider).to receive(:shell_out_compacted!).
- with("make", "-DBATCH", "install", "clean", :timeout => 1800, :cwd => "/usr/ports/shells/zsh", :env => nil).
+ with("make", "-DBATCH", "install", "clean", timeout: 1800, cwd: "/usr/ports/shells/zsh", env: nil).
and_return(@install_result)
@provider.install_package("zsh", "5.0.5")
end
@@ -149,13 +149,13 @@ describe Chef::Provider::Package::Freebsd::Port do
describe "removing a binary package" do
before(:each) do
- @install_result = OpenStruct.new(:status => true)
+ @install_result = OpenStruct.new(status: true)
end
it "should run make deinstall in port directory" do
allow(@provider).to receive(:port_dir).and_return("/usr/ports/shells/zsh")
expect(@provider).to receive(:shell_out_compacted!).
- with("make", "deinstall", :timeout => 300, :cwd => "/usr/ports/shells/zsh", :env => nil).
+ with("make", "deinstall", timeout: 300, cwd: "/usr/ports/shells/zsh", env: nil).
and_return(@install_result)
@provider.remove_package("zsh", "5.0.5")
end
diff --git a/spec/unit/provider/package/homebrew_spec.rb b/spec/unit/provider/package/homebrew_spec.rb
index 833fa7bd3e..903aebc93e 100644
--- a/spec/unit/provider/package/homebrew_spec.rb
+++ b/spec/unit/provider/package/homebrew_spec.rb
@@ -173,16 +173,16 @@ describe Chef::Provider::Package::Homebrew do
describe "brew" do
before do
expect(provider).to receive(:find_homebrew_uid).and_return(homebrew_uid)
- expect(Etc).to receive(:getpwuid).with(homebrew_uid).and_return(OpenStruct.new(:name => "name", :dir => "/"))
+ expect(Etc).to receive(:getpwuid).with(homebrew_uid).and_return(OpenStruct.new(name: "name", dir: "/"))
end
it "passes a single to the brew command and return stdout" do
- allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "zombo"))
+ allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "zombo"))
expect(provider.brew).to eql("zombo")
end
it "takes multiple arguments as an array" do
- allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "homestarrunner"))
+ allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "homestarrunner"))
expect(provider.brew("info", "opts", "bananas")).to eql("homestarrunner")
end
@@ -190,7 +190,7 @@ describe Chef::Provider::Package::Homebrew do
let(:new_resource) { Chef::Resource::Package.new("emacs") }
it "does not try to read homebrew_user from Package, which does not have it" do
- allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "zombo"))
+ allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "zombo"))
expect(provider.brew).to eql("zombo")
end
end
diff --git a/spec/unit/provider/package/ips_spec.rb b/spec/unit/provider/package/ips_spec.rb
index eac0fd90f3..46f0c72399 100644
--- a/spec/unit/provider/package/ips_spec.rb
+++ b/spec/unit/provider/package/ips_spec.rb
@@ -41,7 +41,7 @@ installed on the system. Try specifying -r to query remotely:
crypto/gnupg
PKG_STATUS
- OpenStruct.new(:stdout => stdout, :stdin => stdin, :stderr => stderr, :status => @status, :exitstatus => 1)
+ OpenStruct.new(stdout: stdout, stdin: stdin, stderr: stderr, status: @status, exitstatus: 1)
end
def remote_output
@@ -59,7 +59,7 @@ Packaging Date: April 1, 2012 05:55:52 PM
PKG_STATUS
stdin = StringIO.new
stderr = ""
- OpenStruct.new(:stdout => stdout, :stdin => stdin, :stderr => stderr, :status => @status, :exitstatus => 0)
+ OpenStruct.new(stdout: stdout, stdin: stdin, stderr: stderr, status: @status, exitstatus: 0)
end
context "when loading current resource" do
diff --git a/spec/unit/provider/package/macports_spec.rb b/spec/unit/provider/package/macports_spec.rb
index 04e0a9177e..54c5340d72 100644
--- a/spec/unit/provider/package/macports_spec.rb
+++ b/spec/unit/provider/package/macports_spec.rb
@@ -75,13 +75,13 @@ The following ports are currently installed:
openssl @0.9.8k_0 (active)
EOF
- status = double(:stdout => stdout, :exitstatus => 0)
+ status = double(stdout: stdout, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).and_return(status)
expect(@provider.current_installed_version).to eq("0.9.8k_0")
end
it "should return nil if a package is not currently installed" do
- status = double(:stdout => " \n", :exitstatus => 0)
+ status = double(stdout: " \n", exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).and_return(status)
expect(@provider.current_installed_version).to be_nil
end
@@ -89,13 +89,13 @@ EOF
describe "macports_candidate_version" do
it "should return the latest available version of a given package" do
- status = double(:stdout => "version: 4.2.7\n", :exitstatus => 0)
+ status = double(stdout: "version: 4.2.7\n", exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).and_return(status)
expect(@provider.macports_candidate_version).to eq("4.2.7")
end
it "should return nil if there is no version for a given package" do
- status = double(:stdout => "Error: port fadsfadsfads not found\n", :exitstatus => 0)
+ status = double(stdout: "Error: port fadsfadsfads not found\n", exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).and_return(status)
expect(@provider.macports_candidate_version).to be_nil
end
diff --git a/spec/unit/provider/package/openbsd_spec.rb b/spec/unit/provider/package/openbsd_spec.rb
index 07950acf6e..01d6571f65 100644
--- a/spec/unit/provider/package/openbsd_spec.rb
+++ b/spec/unit/provider/package/openbsd_spec.rb
@@ -45,7 +45,7 @@ describe Chef::Provider::Package::Openbsd do
context "when not already installed" do
before do
- allow(provider).to receive(:shell_out_compacted!).with("pkg_info", "-e", "#{name}->0", anything()).and_return(instance_double("shellout", :stdout => ""))
+ allow(provider).to receive(:shell_out_compacted!).with("pkg_info", "-e", "#{name}->0", anything()).and_return(instance_double("shellout", stdout: ""))
end
context "when there is a single candidate" do
@@ -53,11 +53,11 @@ describe Chef::Provider::Package::Openbsd do
context "when source is not provided" do
it "should run the installation command" do
expect(provider).to receive(:shell_out_compacted!).with("pkg_info", "-I", name, anything()).and_return(
- instance_double("shellout", :stdout => "#{name}-#{version}\n"))
+ instance_double("shellout", stdout: "#{name}-#{version}\n"))
expect(provider).to receive(:shell_out_compacted!).with(
"pkg_add", "-r", "#{name}-#{version}",
- { :env => { "PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/" }, timeout: 900 }
- ) { OpenStruct.new :status => true }
+ { env: { "PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/" }, timeout: 900 }
+ ) { OpenStruct.new status: true }
provider.run_action(:install)
end
end
@@ -70,7 +70,7 @@ describe Chef::Provider::Package::Openbsd do
context "if no version is specified" do
it "should raise an exception" do
expect(provider).to receive(:shell_out_compacted!).with("pkg_info", "-I", name, anything()).and_return(
- instance_double("shellout", :stdout => "#{name}-#{version}-#{flavor_a}\n#{name}-#{version}-#{flavor_b}\n"))
+ instance_double("shellout", stdout: "#{name}-#{version}-#{flavor_a}\n#{name}-#{version}-#{flavor_b}\n"))
expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package, /multiple matching candidates/)
end
end
@@ -83,13 +83,13 @@ describe Chef::Provider::Package::Openbsd do
context "if no version is specified" do
it "should run the installation command" do
- expect(provider).to receive(:shell_out_compacted!).with("pkg_info", "-e", "#{package_name}->0", anything()).and_return(instance_double("shellout", :stdout => ""))
+ expect(provider).to receive(:shell_out_compacted!).with("pkg_info", "-e", "#{package_name}->0", anything()).and_return(instance_double("shellout", stdout: ""))
expect(provider).to receive(:shell_out_compacted!).with("pkg_info", "-I", name, anything()).and_return(
- instance_double("shellout", :stdout => "#{name}-#{version}-#{flavor}\n"))
+ instance_double("shellout", stdout: "#{name}-#{version}-#{flavor}\n"))
expect(provider).to receive(:shell_out_compacted!).with(
"pkg_add", "-r", "#{name}-#{version}-#{flavor}",
{ env: { "PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/" }, timeout: 900 }
- ) { OpenStruct.new :status => true }
+ ) { OpenStruct.new status: true }
provider.run_action(:install)
end
end
@@ -99,13 +99,13 @@ describe Chef::Provider::Package::Openbsd do
context "if a version is specified" do
it "should use the flavor from the version" do
expect(provider).to receive(:shell_out_compacted!).with("pkg_info", "-I", "#{name}-#{version}-#{flavor_b}", anything()).and_return(
- instance_double("shellout", :stdout => "#{name}-#{version}-#{flavor_a}\n"))
+ instance_double("shellout", stdout: "#{name}-#{version}-#{flavor_a}\n"))
new_resource.version("#{version}-#{flavor_b}")
expect(provider).to receive(:shell_out_compacted!).with(
"pkg_add", "-r", "#{name}-#{version}-#{flavor_b}",
{ env: { "PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/" }, timeout: 900 }
- ) { OpenStruct.new :status => true }
+ ) { OpenStruct.new status: true }
provider.run_action(:install)
end
end
@@ -124,7 +124,7 @@ describe Chef::Provider::Package::Openbsd do
it "should run the command to delete the installed package" do
expect(@provider).to receive(:shell_out_compacted!).with(
"pkg_delete", @name, env: nil, timeout: 900
- ) { OpenStruct.new :status => true }
+ ) { OpenStruct.new status: true }
@provider.remove_package(@name, nil)
end
end
diff --git a/spec/unit/provider/package/pacman_spec.rb b/spec/unit/provider/package/pacman_spec.rb
index d41df8c24b..9fbba202f5 100644
--- a/spec/unit/provider/package/pacman_spec.rb
+++ b/spec/unit/provider/package/pacman_spec.rb
@@ -26,7 +26,7 @@ describe Chef::Provider::Package::Pacman do
@new_resource = Chef::Resource::Package.new("nano")
@current_resource = Chef::Resource::Package.new("nano")
- @status = double(:stdout => "", :exitstatus => 0)
+ @status = double(stdout: "", exitstatus: 0)
@provider = Chef::Provider::Package::Pacman.new(@new_resource, @run_context)
allow(Chef::Resource::Package).to receive(:new).and_return(@current_resource)
@@ -88,14 +88,14 @@ Install Script : Yes
Description : Pico editor clone with enhancements
PACMAN
- status = double(:stdout => stdout, :exitstatus => 0)
+ status = double(stdout: stdout, exitstatus: 0)
allow(@provider).to receive(:shell_out_compacted).and_return(status)
@provider.load_current_resource
expect(@current_resource.version).to eq("2.2.2-1")
end
it "should set the candidate version if pacman has one" do
- status = double(:stdout => "core nano 2.2.3-1", :exitstatus => 0)
+ status = double(stdout: "core nano 2.2.3-1", exitstatus: 0)
allow(@provider).to receive(:shell_out_compacted).and_return(status)
@provider.load_current_resource
expect(@provider.candidate_version).to eql("2.2.3-1")
@@ -120,7 +120,7 @@ Include = /etc/pacman.d/mirrorlist
Include = /etc/pacman.d/mirrorlist
PACMAN_CONF
- status = double(:stdout => "customrepo nano 1.2.3-4", :exitstatus => 0)
+ status = double(stdout: "customrepo nano 1.2.3-4", exitstatus: 0)
allow(::File).to receive(:exist?).with("/etc/pacman.conf").and_return(true)
allow(::File).to receive(:read).with("/etc/pacman.conf").and_return(@pacman_conf)
allow(@provider).to receive(:shell_out_compacted).and_return(status)
diff --git a/spec/unit/provider/package/paludis_spec.rb b/spec/unit/provider/package/paludis_spec.rb
index 5481a33c0d..a9ae5bf9d3 100644
--- a/spec/unit/provider/package/paludis_spec.rb
+++ b/spec/unit/provider/package/paludis_spec.rb
@@ -42,7 +42,7 @@ user/ntp 0 installed-accounts
net/ntp 4.2.6_p5-r1 installed
PKG_STATUS
@pid = 12345
- @shell_out = OpenStruct.new(:stdout => @stdout, :stdin => @stdin, :stderr => @stderr, :status => @status, :exitstatus => 0)
+ @shell_out = OpenStruct.new(stdout: @stdout, stdin: @stdin, stderr: @stderr, status: @status, exitstatus: 0)
end
context "when loading current resource" do
@@ -86,12 +86,12 @@ INSTALLED
context "when installing a package" do
it "should run pkg install with the package name and version" do
- expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "=net/ntp-4.2.6_p5-r2", { :timeout => @new_resource.timeout || 900 })
+ expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "=net/ntp-4.2.6_p5-r2", { timeout: @new_resource.timeout || 900 })
@provider.install_package("net/ntp", "4.2.6_p5-r2")
end
it "should run pkg install with the package name and version and options if specified" do
- expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "--preserve-world", "=net/ntp-4.2.6_p5-r2", { :timeout => @new_resource.timeout || 900 })
+ expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "--preserve-world", "=net/ntp-4.2.6_p5-r2", { timeout: @new_resource.timeout || 900 })
@new_resource.options "--preserve-world"
@provider.install_package("net/ntp", "4.2.6_p5-r2")
end
@@ -101,7 +101,7 @@ INSTALLED
sys-process/lsof 4.87 arbor
sys-process/lsof 4.87 x86_64
PKG_STATUS
- expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "=sys-process/lsof-4.87", { :timeout => @new_resource.timeout || 900 })
+ expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "=sys-process/lsof-4.87", { timeout: @new_resource.timeout || 900 })
@provider.install_package("sys-process/lsof", "4.87")
end
@@ -119,7 +119,7 @@ PKG_STATUS
context "when upgrading a package" do
it "should run pkg install with the package name and version" do
- expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "=net/ntp-4.2.6_p5-r2", { :timeout => @new_resource.timeout || 900 })
+ expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "=net/ntp-4.2.6_p5-r2", { timeout: @new_resource.timeout || 900 })
@provider.upgrade_package("net/ntp", "4.2.6_p5-r2")
end
end
diff --git a/spec/unit/provider/package/portage_spec.rb b/spec/unit/provider/package/portage_spec.rb
index 7bf8e7f2e8..889053e826 100644
--- a/spec/unit/provider/package/portage_spec.rb
+++ b/spec/unit/provider/package/portage_spec.rb
@@ -113,19 +113,19 @@ describe Chef::Provider::Package::Portage, "load_current_resource" do
end
it "should throw an exception if the exitstatus is not 0" do
- status = double(:stdout => "", :stderr => "", :exitstatus => 1)
+ status = double(stdout: "", stderr: "", exitstatus: 1)
allow(@provider).to receive(:shell_out_compacted).and_return(status)
expect { @provider.candidate_version }.to raise_error(Chef::Exceptions::Package)
end
it "should find the candidate_version if a category is specifed and there are no duplicates" do
- status = double(:stdout => "dev-vcs/git-2.16.2", :exitstatus => 0)
+ status = double(stdout: "dev-vcs/git-2.16.2", exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).and_return(status)
expect(@provider.candidate_version).to eq("2.16.2")
end
it "should find the candidate_version if a category is not specifed and there are no duplicates" do
- status = double(:stdout => "dev-vcs/git-2.16.2", :exitstatus => 0)
+ status = double(stdout: "dev-vcs/git-2.16.2", exitstatus: 0)
@provider = Chef::Provider::Package::Portage.new(@new_resource_without_category, @run_context)
expect(@provider).to receive(:shell_out_compacted).and_return(status)
expect(@provider.candidate_version).to eq("2.16.2")
@@ -139,7 +139,7 @@ You specified an unqualified atom that matched multiple packages:
Please use a more specific atom.
EOF
- status = double(:stdout => "", :stderr => stderr_output, :exitstatus => 1)
+ status = double(stdout: "", stderr: stderr_output, exitstatus: 1)
@provider = Chef::Provider::Package::Portage.new(@new_resource_without_category, @run_context)
expect(@provider).to receive(:shell_out_compacted).and_return(status)
expect { @provider.candidate_version }.to raise_error(Chef::Exceptions::Package)
diff --git a/spec/unit/provider/package/powershell_spec.rb b/spec/unit/provider/package/powershell_spec.rb
index 63f611ac23..c7a16acaa2 100644
--- a/spec/unit/provider/package/powershell_spec.rb
+++ b/spec/unit/provider/package/powershell_spec.rb
@@ -34,63 +34,63 @@ describe Chef::Provider::Package::Powershell do
end
let(:package_xcertificate_installed) do
- double("powershell_out", :stdout => "2.1.0.0\r\n")
+ double("powershell_out", stdout: "2.1.0.0\r\n")
end
let(:package_xcertificate_installed_2_0_0_0) do
- double("powershell_out", :stdout => "2.0.0.0\r\n")
+ double("powershell_out", stdout: "2.0.0.0\r\n")
end
let(:package_xcertificate_available) do
- double("powershell_out", :stdout => "2.1.0.0\r\n")
+ double("powershell_out", stdout: "2.1.0.0\r\n")
end
let(:package_xcertificate_available_2_0_0_0) do
- double("powershell_out", :stdout => "2.0.0.0\r\n")
+ double("powershell_out", stdout: "2.0.0.0\r\n")
end
let(:package_xcertificate_not_installed) do
- double("powershell_out", :stdout => "")
+ double("powershell_out", stdout: "")
end
let(:package_xcertificate_not_available) do
- double("powershell_out", :stdout => "")
+ double("powershell_out", stdout: "")
end
let(:package_xnetworking_installed) do
- double("powershell_out", :stdout => "2.12.0.0\r\n")
+ double("powershell_out", stdout: "2.12.0.0\r\n")
end
let(:package_xnetworking_installed_2_11_0_0) do
- double("powershell_out", :stdout => "2.11.0.0\r\n")
+ double("powershell_out", stdout: "2.11.0.0\r\n")
end
let(:package_xnetworking_available) do
- double("powershell_out", :stdout => "2.12.0.0\r\n")
+ double("powershell_out", stdout: "2.12.0.0\r\n")
end
let(:package_xnetworking_available_2_11_0_0) do
- double("powershell_out", :stdout => "2.11.0.0\r\n")
+ double("powershell_out", stdout: "2.11.0.0\r\n")
end
let(:package_xnetworking_not_installed) do
- double("powershell_out", :stdout => "")
+ double("powershell_out", stdout: "")
end
let(:package_xnetworking_not_available) do
- double("powershell_out", :stdout => "")
+ double("powershell_out", stdout: "")
end
let(:package_7zip_available) do
- double("powershell_out", :stdout => "16.02\r\n")
+ double("powershell_out", stdout: "16.02\r\n")
end
let(:package_7zip_not_installed) do
- double("powershell_out", :stdout => "")
+ double("powershell_out", stdout: "")
end
let(:powershell_installed_version) do
- double("powershell_out", :stdout => "5")
+ double("powershell_out", stdout: "5")
end
let(:generated_command) { "( Get-Package posh-git -Force -ForceBootstrap ).Version" }
@@ -116,14 +116,14 @@ describe Chef::Provider::Package::Powershell do
describe "#candidate_version" do
it "should set the candidate_version to the latest version when not pinning" do
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
new_resource.package_name(["xNetworking"])
new_resource.version(nil)
expect(provider.candidate_version).to eql(["2.12.0.0"])
end
it "should use the candidate_version from the correct source" do
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -Source MyGallery ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
new_resource.package_name(["xNetworking"])
new_resource.version(nil)
new_resource.source("MyGallery")
@@ -131,60 +131,60 @@ describe Chef::Provider::Package::Powershell do
end
it "should set the candidate_version to the latest version when not pinning and package name is space seperated" do
- allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_7zip_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_available)
new_resource.package_name(["7-Zip 16.02 (x64)"])
new_resource.version(nil)
expect(provider.candidate_version).to eql(["16.02"])
end
it "should set the candidate_version to pinned version if available" do
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.0.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available_2_0_0_0)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.0.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available_2_0_0_0)
new_resource.package_name(["xCertificate"])
new_resource.version(["2.0.0.0"])
expect(provider.candidate_version).to eql(["2.0.0.0"])
end
it "should set the candidate_version to nil if there is no candidate" do
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
new_resource.package_name(["xCertificate"])
expect(provider.candidate_version).to eql([nil])
end
it "should set the candidate_version correctly when there are two packages to install" do
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
new_resource.package_name(%w{xCertificate xNetworking})
new_resource.version(nil)
expect(provider.candidate_version).to eql(["2.1.0.0", "2.12.0.0"])
end
it "should set the candidate_version correctly when only the first is installable" do
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
new_resource.package_name(%w{xCertificate xNetworking})
new_resource.version(nil)
expect(provider.candidate_version).to eql(["2.1.0.0", nil])
end
it "should set the candidate_version correctly when only the last is installable" do
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
new_resource.package_name(%w{xCertificate xNetworking})
new_resource.version(nil)
expect(provider.candidate_version).to eql([nil, "2.12.0.0"])
end
it "should set the candidate_version correctly when neither are is installable and version is passed as nil array" do
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
new_resource.package_name(%w{xNetworking xCertificate})
new_resource.version([nil, nil])
expect(provider.candidate_version).to eql([nil, nil])
end
it "should set the candidate_version correctly when neither are is installable and version is not passed" do
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
new_resource.package_name(%w{xNetworking xCertificate})
new_resource.version(nil)
expect(provider.candidate_version).to eql([nil, nil])
@@ -283,10 +283,10 @@ describe Chef::Provider::Package::Powershell do
provider.load_current_resource
new_resource.package_name(["xCertificate"])
new_resource.version(nil)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -296,10 +296,10 @@ describe Chef::Provider::Package::Powershell do
new_resource.package_name(["xCertificate"])
new_resource.version(nil)
new_resource.source("MyGallery")
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -Source MyGallery ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -Source MyGallery ).Version", { :timeout => new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -309,10 +309,10 @@ describe Chef::Provider::Package::Powershell do
new_resource.package_name(["xCertificate"])
new_resource.version(nil)
new_resource.skip_publisher_check(true)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -SkipPublisherCheck ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -SkipPublisherCheck ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -SkipPublisherCheck ).Version", { :timeout => new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -SkipPublisherCheck ).Version", { timeout: new_resource.timeout })
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -321,10 +321,10 @@ describe Chef::Provider::Package::Powershell do
provider.load_current_resource
new_resource.package_name(["7-Zip 16.02 (x64)"])
new_resource.version(nil)
- allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_7zip_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_7zip_not_installed)
+ allow(provider).to receive(:powershell_out).with("( Find-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_7zip_not_installed)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
- expect(provider).to receive(:powershell_out).with("( Install-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap -RequiredVersion 16.02 ).Version", { :timeout => new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package '7-Zip 16.02 (x64)' -Force -ForceBootstrap -RequiredVersion 16.02 ).Version", { timeout: new_resource.timeout })
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -336,10 +336,10 @@ describe Chef::Provider::Package::Powershell do
provider.load_current_resource
new_resource.package_name(["xCertificate"])
new_resource.version(nil)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
end
@@ -348,8 +348,8 @@ describe Chef::Provider::Package::Powershell do
it "should not install packages that are up-to-date" do
new_resource.package_name(["xCertificate"])
new_resource.version(nil)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
provider.load_current_resource
expect(provider).not_to receive(:install_package)
@@ -360,8 +360,8 @@ describe Chef::Provider::Package::Powershell do
it "should not install packages that are up-to-date" do
new_resource.package_name(["xNetworking"])
new_resource.version(["2.11.0.0"])
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
provider.load_current_resource
expect(provider).not_to receive(:install_package)
@@ -374,13 +374,13 @@ describe Chef::Provider::Package::Powershell do
# new_version.resource[0]
new_resource.package_name(%w{xCertificate xNetworking})
new_resource.version([nil, "2.11.0.0"])
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available_2_11_0_0)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout })
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { :timeout => new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.11.0.0 ).Version", { timeout: new_resource.timeout })
provider.load_current_resource
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
@@ -389,13 +389,13 @@ describe Chef::Provider::Package::Powershell do
it "should split up commands when given two packages, one with a version pin" do
new_resource.package_name(%w{xCertificate xNetworking})
new_resource.version(["2.1.0.0", nil])
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout })
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.12.0.0 ).Version", { :timeout => new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.12.0.0 ).Version", { timeout: new_resource.timeout })
provider.load_current_resource
provider.run_action(:install)
@@ -405,13 +405,13 @@ describe Chef::Provider::Package::Powershell do
it "should do multipackage installs when given two packages without constraints" do
new_resource.package_name(%w{xCertificate xNetworking})
new_resource.version(nil)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout })
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.12.0.0 ).Version", { :timeout => new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.12.0.0 ).Version", { timeout: new_resource.timeout })
provider.load_current_resource
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
@@ -421,13 +421,13 @@ describe Chef::Provider::Package::Powershell do
new_resource.package_name(%w{xCertificate xNetworking})
new_resource.version(nil)
new_resource.source("MyGallery")
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -Source MyGallery ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -Source MyGallery ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap -Source MyGallery ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -Source MyGallery ).Version", { :timeout => new_resource.timeout })
- expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.12.0.0 -Source MyGallery ).Version", { :timeout => new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Install-Package 'xNetworking' -Force -ForceBootstrap -RequiredVersion 2.12.0.0 -Source MyGallery ).Version", { timeout: new_resource.timeout })
provider.load_current_resource
provider.run_action(:install)
expect(new_resource).to be_updated_by_last_action
@@ -439,8 +439,8 @@ describe Chef::Provider::Package::Powershell do
provider.load_current_resource
new_resource.package_name(["xCertificate"])
new_resource.version(["2.1.0.0"])
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
expect(provider).not_to receive(:remove_package)
provider.run_action(:remove)
@@ -451,11 +451,11 @@ describe Chef::Provider::Package::Powershell do
new_resource.package_name(["xCertificate"])
new_resource.version(["2.1.0.0"])
new_resource.source("MyGallery")
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -Source MyGallery).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 -Source MyGallery).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
provider.load_current_resource
- expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
@@ -463,10 +463,10 @@ describe Chef::Provider::Package::Powershell do
it "does nothing when all the packages are already removed" do
new_resource.package_name(%w{xCertificate xNetworking})
new_resource.version(nil)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xnetworking_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xNetworking' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xnetworking_not_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
provider.load_current_resource
expect(provider).not_to receive(:remove_package)
@@ -477,11 +477,11 @@ describe Chef::Provider::Package::Powershell do
it "removes a package when version is specified" do
new_resource.package_name(["xCertificate"])
new_resource.version(["2.1.0.0"])
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
provider.load_current_resource
- expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { :timeout => new_resource.timeout })
+ expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap -RequiredVersion 2.1.0.0 ).Version", { timeout: new_resource.timeout })
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
@@ -489,11 +489,11 @@ describe Chef::Provider::Package::Powershell do
it "removes a package when version is not specified" do
new_resource.package_name(["xCertificate"])
new_resource.version(nil)
- allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
- allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Find-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
+ allow(provider).to receive(:powershell_out).with("( Get-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_available)
allow(provider).to receive(:powershell_out).with("$PSVersionTable.PSVersion.Major").and_return(powershell_installed_version)
provider.load_current_resource
- expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap ).Version", { :timeout => new_resource.timeout }).and_return(package_xcertificate_not_available)
+ expect(provider).to receive(:powershell_out).with("( Uninstall-Package 'xCertificate' -Force -ForceBootstrap ).Version", { timeout: new_resource.timeout }).and_return(package_xcertificate_not_available)
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
diff --git a/spec/unit/provider/package/smartos_spec.rb b/spec/unit/provider/package/smartos_spec.rb
index cb5e987a85..172bfbac84 100644
--- a/spec/unit/provider/package/smartos_spec.rb
+++ b/spec/unit/provider/package/smartos_spec.rb
@@ -28,14 +28,14 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
@new_resource = Chef::Resource::Package.new("varnish")
@current_resource = Chef::Resource::Package.new("varnish")
- @status = double("Status", :exitstatus => 0)
+ @status = double("Status", exitstatus: 0)
@provider = Chef::Provider::Package::SmartOS.new(@new_resource, @run_context)
allow(Chef::Resource::Package).to receive(:new).and_return(@current_resource)
@stdin = StringIO.new
@stdout = "varnish-2.1.5nb2\n"
@stderr = StringIO.new
@pid = 10
- @shell_out = OpenStruct.new(:stdout => @stdout, :stdin => @stdin, :stderr => @stderr, :status => @status, :exitstatus => 0)
+ @shell_out = OpenStruct.new(stdout: @stdout, stdin: @stdin, stderr: @stderr, status: @status, exitstatus: 0)
end
describe "when loading current resource" do
@@ -59,7 +59,7 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
end
it "should set the installed version to nil if it's not installed" do
- out = OpenStruct.new(:stdout => nil)
+ out = OpenStruct.new(stdout: nil)
expect(@provider).to receive(:shell_out_compacted!).and_return(out)
@provider.load_current_resource
expect(@current_resource.version).to eq(nil)
@@ -79,8 +79,8 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
expect(search).to receive(:each_line).
and_yield("something-varnish-1.1.1 something varnish like\n").
and_yield("varnish-2.3.4 actual varnish\n")
- @shell_out = double("shell_out!", :stdout => search)
- expect(@provider).to receive(:shell_out_compacted!).with("/opt/local/bin/pkgin", "se", "varnish", :env => nil, :returns => [0, 1], :timeout => 900).and_return(@shell_out)
+ @shell_out = double("shell_out!", stdout: search)
+ expect(@provider).to receive(:shell_out_compacted!).with("/opt/local/bin/pkgin", "se", "varnish", env: nil, returns: [0, 1], timeout: 900).and_return(@shell_out)
expect(@provider.candidate_version).to eq("2.3.4")
end
@@ -89,8 +89,8 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
expect(search).to receive(:each_line).
and_yield("something-varnish-1.1.1;;something varnish like\n").
and_yield("varnish-2.3.4;;actual varnish\n")
- @shell_out = double("shell_out!", :stdout => search)
- expect(@provider).to receive(:shell_out_compacted!).with("/opt/local/bin/pkgin", "se", "varnish", :env => nil, :returns => [0, 1], :timeout => 900).and_return(@shell_out)
+ @shell_out = double("shell_out!", stdout: search)
+ expect(@provider).to receive(:shell_out_compacted!).with("/opt/local/bin/pkgin", "se", "varnish", env: nil, returns: [0, 1], timeout: 900).and_return(@shell_out)
expect(@provider.candidate_version).to eq("2.3.4")
end
end
@@ -98,9 +98,9 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
describe "when manipulating a resource" do
it "run pkgin and install the package" do
- out = OpenStruct.new(:stdout => nil)
- expect(@provider).to receive(:shell_out_compacted!).with("/opt/local/sbin/pkg_info", "-E", "varnish*", { :env => nil, :returns => [0, 1], :timeout => 900 }).and_return(@shell_out)
- expect(@provider).to receive(:shell_out_compacted!).with("/opt/local/bin/pkgin", "-y", "install", "varnish-2.1.5nb2", { :env => nil, :timeout => 900 }).and_return(out)
+ out = OpenStruct.new(stdout: nil)
+ expect(@provider).to receive(:shell_out_compacted!).with("/opt/local/sbin/pkg_info", "-E", "varnish*", { env: nil, returns: [0, 1], timeout: 900 }).and_return(@shell_out)
+ expect(@provider).to receive(:shell_out_compacted!).with("/opt/local/bin/pkgin", "-y", "install", "varnish-2.1.5nb2", { env: nil, timeout: 900 }).and_return(out)
@provider.load_current_resource
@provider.install_package("varnish", "2.1.5nb2")
end
diff --git a/spec/unit/provider/package/solaris_spec.rb b/spec/unit/provider/package/solaris_spec.rb
index 57a0288f58..2ebf8fe4be 100644
--- a/spec/unit/provider/package/solaris_spec.rb
+++ b/spec/unit/provider/package/solaris_spec.rb
@@ -46,7 +46,7 @@ INSTDATE: Nov 04 2009 01:02
HOTLINE: Please contact your local service provider
PKGINFO
- @status = double("Status", :stdout => "", :exitstatus => 0)
+ @status = double("Status", stdout: "", exitstatus: 0)
end
it "should create a current resource with the name of new_resource" do
@@ -70,7 +70,7 @@ PKGINFO
end
it "should get the source package version from pkginfo if provided" do
- status = double(:stdout => @pkginfo, :exitstatus => 0)
+ status = double(stdout: @pkginfo, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).with("pkginfo", "-l", "-d", "/tmp/bash.pkg", "SUNWbash", { timeout: 900 }).and_return(status)
expect(@provider).to receive(:shell_out_compacted).with("pkginfo", "-l", "SUNWbash", { timeout: 900 }).and_return(@status)
@provider.load_current_resource
@@ -80,7 +80,7 @@ PKGINFO
end
it "should return the current version installed if found by pkginfo" do
- status = double(:stdout => @pkginfo, :exitstatus => 0)
+ status = double(stdout: @pkginfo, exitstatus: 0)
expect(@provider).to receive(:shell_out_compacted).with("pkginfo", "-l", "-d", "/tmp/bash.pkg", "SUNWbash", { timeout: 900 }).and_return(@status)
expect(@provider).to receive(:shell_out_compacted).with("pkginfo", "-l", "SUNWbash", { timeout: 900 }).and_return(status)
@provider.load_current_resource
@@ -95,7 +95,7 @@ PKGINFO
end
it "should raise an exception if pkginfo fails to run" do
- status = double(:stdout => "", :exitstatus => -1)
+ status = double(stdout: "", exitstatus: -1)
allow(@provider).to receive(:shell_out_compacted).and_return(status)
expect { @provider.load_current_resource }.to raise_error(Chef::Exceptions::Package)
end
@@ -116,14 +116,14 @@ PKGINFO
end
it "should lookup the candidate_version if the variable is not already set" do
- status = double(:stdout => "", :exitstatus => 0)
+ status = double(stdout: "", exitstatus: 0)
allow(@provider).to receive(:shell_out_compacted).and_return(status)
expect(@provider).to receive(:shell_out_compacted)
@provider.candidate_version
end
it "should throw and exception if the exitstatus is not 0" do
- status = double(:stdout => "", :exitstatus => 1)
+ status = double(stdout: "", exitstatus: 1)
allow(@provider).to receive(:shell_out_compacted).and_return(status)
expect { @provider.candidate_version }.to raise_error(Chef::Exceptions::Package)
end
diff --git a/spec/unit/provider/package/windows/exe_spec.rb b/spec/unit/provider/package/windows/exe_spec.rb
index f18cbf3dca..f8c4e83fc5 100644
--- a/spec/unit/provider/package/windows/exe_spec.rb
+++ b/spec/unit/provider/package/windows/exe_spec.rb
@@ -126,7 +126,7 @@ describe Chef::Provider::Package::Windows::Exe do
it "removes installed package and quotes uninstall string" do
new_resource.timeout = 300
allow(::File).to receive(:exist?).with("uninst_dir/uninst_file").and_return(true)
- expect(provider).to receive(:shell_out!).with(/start \"\" \/wait \"uninst_dir\/uninst_file\" \/S \/NCRC & exit %%%%ERRORLEVEL%%%%/, :timeout => 300, :returns => [0])
+ expect(provider).to receive(:shell_out!).with(/start \"\" \/wait \"uninst_dir\/uninst_file\" \/S \/NCRC & exit %%%%ERRORLEVEL%%%%/, timeout: 300, returns: [0])
provider.remove_package
end
end
diff --git a/spec/unit/provider/package/windows/msi_spec.rb b/spec/unit/provider/package/windows/msi_spec.rb
index aa528ab90e..0e939610db 100644
--- a/spec/unit/provider/package/windows/msi_spec.rb
+++ b/spec/unit/provider/package/windows/msi_spec.rb
@@ -22,7 +22,7 @@ require "chef/provider/package/windows/msi"
describe Chef::Provider::Package::Windows::MSI do
let(:node) { double("Chef::Node") }
let(:events) { double("Chef::Events").as_null_object } # mock all the methods
- let(:run_context) { double("Chef::RunContext", :node => node, :events => events) }
+ let(:run_context) { double("Chef::RunContext", node: node, events: events) }
let(:package_name) { "calculator" }
let(:resource_source) { "calculator.msi" }
let(:resource_version) { nil }
diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb
index aed0ca88be..3030b7f04a 100644
--- a/spec/unit/provider/package/windows_spec.rb
+++ b/spec/unit/provider/package/windows_spec.rb
@@ -50,7 +50,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
before(:each) do
allow(Chef::Util::PathHelper).to receive(:validate_path)
allow(provider).to receive(:package_provider).and_return(double("package_provider",
- :installed_version => "1.0", :package_version => "2.0"))
+ installed_version: "1.0", package_version: "2.0"))
end
it "creates a current resource with the name of the new resource" do
diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb
index 4ba8ac36ac..6795f9e051 100644
--- a/spec/unit/provider/package/zypper_spec.rb
+++ b/spec/unit/provider/package/zypper_spec.rb
@@ -30,7 +30,7 @@ describe Chef::Provider::Package::Zypper do
Chef::Provider::Package::Zypper.new(new_resource, run_context)
end
- let(:status) { double(:stdout => "\n", :exitstatus => 0) }
+ let(:status) { double(stdout: "\n", exitstatus: 0) }
before(:each) do
allow(Chef::Resource::Package).to receive(:new).and_return(current_resource)
@@ -73,7 +73,7 @@ describe Chef::Provider::Package::Zypper do
end
it "should set the installed version if zypper info has one (zypper version < 1.13.0)" do
- status = double(:stdout => "Version: 1.0\nInstalled: Yes\n", :exitstatus => 0)
+ status = double(stdout: "Version: 1.0\nInstalled: Yes\n", exitstatus: 0)
allow(provider).to receive(:shell_out_compacted!).and_return(status)
expect(current_resource).to receive(:version).with(["1.0"]).and_return(true)
@@ -81,7 +81,7 @@ describe Chef::Provider::Package::Zypper do
end
it "should set the installed version if zypper info has one (zypper version >= 1.13.0)" do
- status = double(:stdout => "Version : 1.0 \nInstalled : Yes \n", :exitstatus => 0)
+ status = double(stdout: "Version : 1.0 \nInstalled : Yes \n", exitstatus: 0)
allow(provider).to receive(:shell_out_compacted!).and_return(status)
expect(current_resource).to receive(:version).with(["1.0"]).and_return(true)
@@ -89,7 +89,7 @@ describe Chef::Provider::Package::Zypper do
end
it "should set the installed version if zypper info has one (zypper version >= 1.13.17)" do
- status = double(:stdout => "Version : 1.0\nInstalled : Yes (automatically)\n", :exitstatus => 0)
+ status = double(stdout: "Version : 1.0\nInstalled : Yes (automatically)\n", exitstatus: 0)
allow(provider).to receive(:shell_out_compacted!).and_return(status)
expect(current_resource).to receive(:version).with(["1.0"]).and_return(true)
@@ -97,7 +97,7 @@ describe Chef::Provider::Package::Zypper do
end
it "should set the candidate version if zypper info has one (zypper version < 1.13.0)" do
- status = double(:stdout => "Version: 1.0\nInstalled: No\nStatus: out-of-date (version 0.9 installed)", :exitstatus => 0)
+ status = double(stdout: "Version: 1.0\nInstalled: No\nStatus: out-of-date (version 0.9 installed)", exitstatus: 0)
allow(provider).to receive(:shell_out_compacted!).and_return(status)
provider.load_current_resource
@@ -105,7 +105,7 @@ describe Chef::Provider::Package::Zypper do
end
it "should set the candidate version if zypper info has one (zypper version >= 1.13.0)" do
- status = double(:stdout => "Version : 1.0 \nInstalled : No \nStatus : out-of-date (version 0.9 installed)", :exitstatus => 0)
+ status = double(stdout: "Version : 1.0 \nInstalled : No \nStatus : out-of-date (version 0.9 installed)", exitstatus: 0)
allow(provider).to receive(:shell_out_compacted!).and_return(status)
provider.load_current_resource
diff --git a/spec/unit/provider/powershell_script_spec.rb b/spec/unit/provider/powershell_script_spec.rb
index f4663861c6..79d84e61dc 100644
--- a/spec/unit/provider/powershell_script_spec.rb
+++ b/spec/unit/provider/powershell_script_spec.rb
@@ -25,7 +25,7 @@ describe Chef::Provider::PowershellScript, "action_run" do
node.default["kernel"] = Hash.new
node.default["kernel"][:machine] = :x86_64.to_s
if ! powershell_version.nil?
- node.default[:languages] = { :powershell => { :version => powershell_version } }
+ node.default[:languages] = { powershell: { version: powershell_version } }
end
node
end
diff --git a/spec/unit/provider/registry_key_spec.rb b/spec/unit/provider/registry_key_spec.rb
index 096fe9b9ed..3563af4dc4 100644
--- a/spec/unit/provider/registry_key_spec.rb
+++ b/spec/unit/provider/registry_key_spec.rb
@@ -275,20 +275,20 @@ describe Chef::Provider::RegistryKey do
context "when the key data is safe" do
let(:keyname) { 'HKLM\Software\Opscode\Testing\Safe' }
- let(:testval1) { { :name => "one", :type => :string, :data => "1" } }
- let(:testval1_wrong_type) { { :name => "one", :type => :multi_string, :data => "1" } }
- let(:testval1_wrong_data) { { :name => "one", :type => :string, :data => "2" } }
- let(:testval2) { { :name => "two", :type => :string, :data => "2" } }
+ let(:testval1) { { name: "one", type: :string, data: "1" } }
+ let(:testval1_wrong_type) { { name: "one", type: :multi_string, data: "1" } }
+ let(:testval1_wrong_data) { { name: "one", type: :string, data: "2" } }
+ let(:testval2) { { name: "two", type: :string, data: "2" } }
it_should_behave_like "a registry key"
end
context "when the key data is unsafe" do
let(:keyname) { 'HKLM\Software\Opscode\Testing\Unsafe' }
- let(:testval1) { { :name => "one", :type => :binary, :data => 255.chr * 1 } }
- let(:testval1_wrong_type) { { :name => "one", :type => :string, :data => 255.chr * 1 } }
- let(:testval1_wrong_data) { { :name => "one", :type => :binary, :data => 254.chr * 1 } }
- let(:testval2) { { :name => "two", :type => :binary, :data => 0.chr * 1 } }
+ let(:testval1) { { name: "one", type: :binary, data: 255.chr * 1 } }
+ let(:testval1_wrong_type) { { name: "one", type: :string, data: 255.chr * 1 } }
+ let(:testval1_wrong_data) { { name: "one", type: :binary, data: 254.chr * 1 } }
+ let(:testval2) { { name: "two", type: :binary, data: 0.chr * 1 } }
it_should_behave_like "a registry key"
end
@@ -296,8 +296,8 @@ describe Chef::Provider::RegistryKey do
describe "action_create" do
context "when key exists and type matches" do
let(:keyname) { 'hklm\\software\\opscode\\testing\\dword' }
- let(:dword_passed_as_integer) { { :name => "one", :type => :dword, :data => 12345 } }
- let(:testval1) { { :name => "one", :type => :dword, :data => "12345" } }
+ let(:dword_passed_as_integer) { { name: "one", type: :dword, data: 12345 } }
+ let(:testval1) { { name: "one", type: :dword, data: "12345" } }
before do
expect(@double_registry).to receive(:key_exists?).twice.with(keyname).and_return(true)
end
@@ -321,33 +321,33 @@ describe Chef::Provider::RegistryKey, "key_missing?" do
let(:provider) { Chef::Provider::RegistryKey.new(new_resource, run_context) }
let(:all_keys_present_in_all_hash) do
- [ { :name => "input1_value1", :type => :string, :data => "my_value1" },
- { :name => "input1_value2", :type => :string, :data => "my_value2" },
+ [ { name: "input1_value1", type: :string, data: "my_value1" },
+ { name: "input1_value2", type: :string, data: "my_value2" },
]
end
let(:type_key_not_present_in_any_hash) do
- [ { :name => "input2_value1", :data => "my_value1" },
- { :name => "input2_value2", :data => "my_value2" },
+ [ { name: "input2_value1", data: "my_value1" },
+ { name: "input2_value2", data: "my_value2" },
]
end
let(:type_key_not_present_in_some_hash) do
- [ { :name => "input3_value1", :data => "my_value1" },
- { :name => "input3_value2", :type => :string, :data => "my_value2" },
+ [ { name: "input3_value1", data: "my_value1" },
+ { name: "input3_value2", type: :string, data: "my_value2" },
]
end
let(:data_key_not_present_in_any_hash) do
- [ { :name => "input4_value1", :type => :string },
- { :name => "input4_value2", :type => :string },
+ [ { name: "input4_value1", type: :string },
+ { name: "input4_value2", type: :string },
]
end
let(:data_key_not_present_in_some_hash) do
- [ { :name => "input5_value1", :type => :string, :data => "my_value1" },
- { :name => "input5_value2", :type => :string },
+ [ { name: "input5_value1", type: :string, data: "my_value1" },
+ { name: "input5_value2", type: :string },
]
end
let(:only_name_key_present_in_all_hash) do
- [ { :name => "input6_value1" },
- { :name => "input6_value2" },
+ [ { name: "input6_value1" },
+ { name: "input6_value2" },
]
end
diff --git a/spec/unit/provider/remote_file/content_spec.rb b/spec/unit/provider/remote_file/content_spec.rb
index 307eb98187..1afc95fa48 100644
--- a/spec/unit/provider/remote_file/content_spec.rb
+++ b/spec/unit/provider/remote_file/content_spec.rb
@@ -84,7 +84,7 @@ describe Chef::Provider::RemoteFile::Content do
describe "when the fetcher returns nil for the tempfile" do
before do
- http_fetcher = double("Chef::Provider::RemoteFile::HTTP", :fetch => nil)
+ http_fetcher = double("Chef::Provider::RemoteFile::HTTP", fetch: nil)
expect(Chef::Provider::RemoteFile::Fetcher).to receive(:for_resource).with(@uri, new_resource, current_resource).and_return(http_fetcher)
end
@@ -97,7 +97,7 @@ describe Chef::Provider::RemoteFile::Content do
let(:mtime) { Time.now }
let(:tempfile) { double("Tempfile") }
- let(:http_fetcher) { double("Chef::Provider::RemoteFile::HTTP", :fetch => tempfile) }
+ let(:http_fetcher) { double("Chef::Provider::RemoteFile::HTTP", fetch: tempfile) }
before do
expect(Chef::Provider::RemoteFile::Fetcher).to receive(:for_resource).with(@uri, new_resource, current_resource).and_return(http_fetcher)
@@ -199,7 +199,7 @@ describe Chef::Provider::RemoteFile::Content do
before do
@tempfile = double("Tempfile")
mtime = Time.now
- http_fetcher_works = double("Chef::Provider::RemoteFile::HTTP", :fetch => @tempfile)
+ http_fetcher_works = double("Chef::Provider::RemoteFile::HTTP", fetch: @tempfile)
expect(Chef::Provider::RemoteFile::Fetcher).to receive(:for_resource).with(@uri1, new_resource, current_resource).and_return(http_fetcher_works)
end
@@ -236,7 +236,7 @@ describe Chef::Provider::RemoteFile::Content do
expect(URI).not_to receive(:parse).with(new_resource.source[1])
@tempfile = double("Tempfile")
mtime = Time.now
- http_fetcher_works = double("Chef::Provider::RemoteFile::HTTP", :fetch => @tempfile)
+ http_fetcher_works = double("Chef::Provider::RemoteFile::HTTP", fetch: @tempfile)
expect(Chef::Provider::RemoteFile::Fetcher).to receive(:for_resource).with(@uri0, new_resource, current_resource).and_return(http_fetcher_works)
end
diff --git a/spec/unit/provider/remote_file/fetcher_spec.rb b/spec/unit/provider/remote_file/fetcher_spec.rb
index f5b32800f2..b110e2c03a 100644
--- a/spec/unit/provider/remote_file/fetcher_spec.rb
+++ b/spec/unit/provider/remote_file/fetcher_spec.rb
@@ -46,7 +46,7 @@ describe Chef::Provider::RemoteFile::Fetcher do
end
describe "when passed an http url" do
- let(:uri) { double("uri", :scheme => "http" ) }
+ let(:uri) { double("uri", scheme: "http" ) }
before do
expect(Chef::Provider::RemoteFile::HTTP).to receive(:new).and_return(fetcher_instance)
end
@@ -56,7 +56,7 @@ describe Chef::Provider::RemoteFile::Fetcher do
end
describe "when passed an https url" do
- let(:uri) { double("uri", :scheme => "https" ) }
+ let(:uri) { double("uri", scheme: "https" ) }
before do
expect(Chef::Provider::RemoteFile::HTTP).to receive(:new).and_return(fetcher_instance)
end
@@ -66,7 +66,7 @@ describe Chef::Provider::RemoteFile::Fetcher do
end
describe "when passed an ftp url" do
- let(:uri) { double("uri", :scheme => "ftp" ) }
+ let(:uri) { double("uri", scheme: "ftp" ) }
before do
expect(Chef::Provider::RemoteFile::FTP).to receive(:new).and_return(fetcher_instance)
end
@@ -76,7 +76,7 @@ describe Chef::Provider::RemoteFile::Fetcher do
end
describe "when passed a file url" do
- let(:uri) { double("uri", :scheme => "file" ) }
+ let(:uri) { double("uri", scheme: "file" ) }
before do
expect(Chef::Provider::RemoteFile::LocalFile).to receive(:new).and_return(fetcher_instance)
end
@@ -86,7 +86,7 @@ describe Chef::Provider::RemoteFile::Fetcher do
end
describe "when passed a url we do not recognize" do
- let(:uri) { double("uri", :scheme => "xyzzy" ) }
+ let(:uri) { double("uri", scheme: "xyzzy" ) }
it "throws an ArgumentError exception" do
expect { described_class.for_resource(uri, new_resource, current_resource) }.to raise_error(ArgumentError)
end
diff --git a/spec/unit/provider/remote_file/http_spec.rb b/spec/unit/provider/remote_file/http_spec.rb
index e1f74bd35a..8ece1a854b 100644
--- a/spec/unit/provider/remote_file/http_spec.rb
+++ b/spec/unit/provider/remote_file/http_spec.rb
@@ -292,7 +292,7 @@ describe Chef::Provider::RemoteFile::HTTP do
context "and the target file is a tarball [CHEF-3140]" do
let(:uri) { URI.parse("http://opscode.com/tarball.tgz") }
- let(:expected_http_opts) { { :disable_gzip => true } }
+ let(:expected_http_opts) { { disable_gzip: true } }
# CHEF-3140
# Some servers return tarballs as content type tar and encoding gzip, which
diff --git a/spec/unit/provider/remote_file/local_file_spec.rb b/spec/unit/provider/remote_file/local_file_spec.rb
index 6f345cadd1..6dad6a57f2 100644
--- a/spec/unit/provider/remote_file/local_file_spec.rb
+++ b/spec/unit/provider/remote_file/local_file_spec.rb
@@ -84,8 +84,8 @@ describe Chef::Provider::RemoteFile::LocalFile do
describe "when fetching the object" do
- let(:tempfile) { double("Tempfile", :path => "/tmp/foo/bar/nyan.png", :close => nil) }
- let(:chef_tempfile) { double("Chef::FileContentManagement::Tempfile", :tempfile => tempfile) }
+ let(:tempfile) { double("Tempfile", path: "/tmp/foo/bar/nyan.png", close: nil) }
+ let(:chef_tempfile) { double("Chef::FileContentManagement::Tempfile", tempfile: tempfile) }
before do
current_resource.source("file:///nyan_cat.png")
diff --git a/spec/unit/provider/remote_file/network_file_spec.rb b/spec/unit/provider/remote_file/network_file_spec.rb
index ecb326fc64..1c2bcc5911 100644
--- a/spec/unit/provider/remote_file/network_file_spec.rb
+++ b/spec/unit/provider/remote_file/network_file_spec.rb
@@ -28,9 +28,9 @@ describe Chef::Provider::RemoteFile::NetworkFile do
describe "when fetching the object" do
- let(:tempfile) { double("Tempfile", :path => "/tmp/foo/bar/Foo.tar.gz", :close => nil) }
- let(:chef_tempfile) { double("Chef::FileContentManagement::Tempfile", :tempfile => tempfile) }
- let(:source_file) { double("::File", :read => nil) }
+ let(:tempfile) { double("Tempfile", path: "/tmp/foo/bar/Foo.tar.gz", close: nil) }
+ let(:chef_tempfile) { double("Chef::FileContentManagement::Tempfile", tempfile: tempfile) }
+ let(:source_file) { double("::File", read: nil) }
before do
allow(Chef::Platform).to receive(:windows?).and_return(true)
diff --git a/spec/unit/provider/remote_file/sftp_spec.rb b/spec/unit/provider/remote_file/sftp_spec.rb
index ddab1605f0..d8fff87dec 100644
--- a/spec/unit/provider/remote_file/sftp_spec.rb
+++ b/spec/unit/provider/remote_file/sftp_spec.rb
@@ -120,7 +120,7 @@ describe Chef::Provider::RemoteFile::SFTP do
let(:uri) { URI.parse("sftp://conan:cthu1hu@opscode.com:8021/seattle.txt") }
it "should connect on an alternate port when one is provided" do
- expect(Net::SFTP).to receive(:start).with("opscode.com:8021", "conan", :password => "cthu1hu")
+ expect(Net::SFTP).to receive(:start).with("opscode.com:8021", "conan", password: "cthu1hu")
fetcher.fetch
end
diff --git a/spec/unit/provider/remote_file_spec.rb b/spec/unit/provider/remote_file_spec.rb
index 3f91377c60..07b854da6b 100644
--- a/spec/unit/provider/remote_file_spec.rb
+++ b/spec/unit/provider/remote_file_spec.rb
@@ -37,7 +37,7 @@ describe Chef::Provider::RemoteFile do
let(:node) { double("Chef::Node") }
let(:events) { double("Chef::Events").as_null_object } # mock all the methods
let(:logger) { double("Mixlib::Log::Child").as_null_object }
- let(:run_context) { double("Chef::RunContext", :node => node, :events => events, :logger => logger) }
+ let(:run_context) { double("Chef::RunContext", node: node, events: events, logger: logger) }
let(:enclosing_directory) do
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
end
diff --git a/spec/unit/provider/script_spec.rb b/spec/unit/provider/script_spec.rb
index 651e5130e0..08b19730a7 100644
--- a/spec/unit/provider/script_spec.rb
+++ b/spec/unit/provider/script_spec.rb
@@ -93,7 +93,7 @@ describe Chef::Provider::Script, "action_run" do
end
context "when an alternate user is specified" do
- let(:security_descriptor) { instance_double("Chef::ReservedNames::Win32::Security::SecurityDescriptor", :dacl => []) }
+ let(:security_descriptor) { instance_double("Chef::ReservedNames::Win32::Security::SecurityDescriptor", dacl: []) }
let(:securable_object) { instance_double("Chef::ReservedNames::Win32::Security::SecurableObject", :security_descriptor => security_descriptor, :dacl= => nil) }
it "sets the script file's security descriptor" do
new_resource.user("toor")
diff --git a/spec/unit/provider/service/aix_service_spec.rb b/spec/unit/provider/service/aix_service_spec.rb
index 802ccee2c7..cf6309e82a 100644
--- a/spec/unit/provider/service/aix_service_spec.rb
+++ b/spec/unit/provider/service/aix_service_spec.rb
@@ -33,7 +33,7 @@ describe Chef::Provider::Service::Aix do
describe "load current resource" do
it "should create a current resource with the name of the new resource and determine the status" do
- @status = double("Status", :exitstatus => 0, :stdout => @stdout)
+ @status = double("Status", exitstatus: 0, stdout: @stdout)
allow(@provider).to receive(:shell_out!).and_return(@status)
expect(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
@@ -47,7 +47,7 @@ describe Chef::Provider::Service::Aix do
describe "determine current status" do
context "when the service is active" do
before do
- @status = double("Status", :exitstatus => 0, :stdout => "chef chef 12345 active\n")
+ @status = double("Status", exitstatus: 0, stdout: "chef chef 12345 active\n")
end
it "current resource is running" do
@@ -61,7 +61,7 @@ describe Chef::Provider::Service::Aix do
context "when the service is inoperative" do
before do
- @status = double("Status", :exitstatus => 0, :stdout => "chef chef inoperative\n")
+ @status = double("Status", exitstatus: 0, stdout: "chef chef inoperative\n")
end
it "current resource is not running" do
@@ -75,7 +75,7 @@ describe Chef::Provider::Service::Aix do
context "when there is no such service" do
before do
- @status = double("Status", :exitstatus => 1, :stdout => "0513-085 The chef Subsystem is not on file.\n")
+ @status = double("Status", exitstatus: 1, stdout: "0513-085 The chef Subsystem is not on file.\n")
end
it "current resource is not running" do
expect(@provider).to receive(:shell_out!).with("lssrc -s chef").and_return(@status)
@@ -90,7 +90,7 @@ describe Chef::Provider::Service::Aix do
describe "is resource group" do
context "when there are multiple subsystems associated with group" do
before do
- @status = double("Status", :exitstatus => 0, :stdout => "chef1 chef 12345 active\nchef2 chef 12334 active\nchef3 chef inoperative")
+ @status = double("Status", exitstatus: 0, stdout: "chef1 chef 12345 active\nchef2 chef 12334 active\nchef3 chef inoperative")
end
it "service is a group" do
@@ -102,7 +102,7 @@ describe Chef::Provider::Service::Aix do
context "when there is a single subsystem in the group" do
before do
- @status = double("Status", :exitstatus => 0, :stdout => "chef1 chef inoperative\n")
+ @status = double("Status", exitstatus: 0, stdout: "chef1 chef inoperative\n")
end
it "service is a group" do
@@ -114,8 +114,8 @@ describe Chef::Provider::Service::Aix do
context "when the service is a subsystem" do
before do
- @group_status = double("Status", :exitstatus => 1, :stdout => "0513-086 The chef Group is not on file.\n")
- @service_status = double("Status", :exitstatus => 0, :stdout => "chef chef inoperative\n")
+ @group_status = double("Status", exitstatus: 1, stdout: "0513-086 The chef Group is not on file.\n")
+ @service_status = double("Status", exitstatus: 0, stdout: "chef chef inoperative\n")
end
it "service is a subsystem" do
diff --git a/spec/unit/provider/service/aixinit_service_spec.rb b/spec/unit/provider/service/aixinit_service_spec.rb
index 09c177903b..725d6e210c 100644
--- a/spec/unit/provider/service/aixinit_service_spec.rb
+++ b/spec/unit/provider/service/aixinit_service_spec.rb
@@ -21,7 +21,7 @@ require "spec_helper"
describe Chef::Provider::Service::AixInit do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = { :ps => "fuuuu" }
+ @node.automatic_attrs[:command] = { ps: "fuuuu" }
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb
index 2139e31818..818c2ccb27 100644
--- a/spec/unit/provider/service/arch_service_spec.rb
+++ b/spec/unit/provider/service/arch_service_spec.rb
@@ -26,14 +26,14 @@ require "ostruct"
describe Chef::Provider::Service::Arch, "load_current_resource" do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = { :ps => "ps -ef" }
+ @node.automatic_attrs[:command] = { ps: "ps -ef" }
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@new_resource = Chef::Resource::Service.new("chef")
@new_resource.pattern("chef")
- @new_resource.supports({ :status => false })
+ @new_resource.supports({ status: false })
@provider = Chef::Provider::Service::Arch.new(@new_resource, @run_context)
@@ -43,7 +43,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
describe "when first created" do
it "should set the current resources service name to the new resources service name" do
- allow(@provider).to receive(:shell_out).and_return(OpenStruct.new(:exitstatus => 0, :stdout => ""))
+ allow(@provider).to receive(:shell_out).and_return(OpenStruct.new(exitstatus: 0, stdout: ""))
@provider.load_current_resource
expect(@provider.current_resource.service_name).to eq("chef")
end
@@ -51,22 +51,22 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
describe "when the service supports status" do
before do
- @new_resource.supports({ :status => true })
+ @new_resource.supports({ status: true })
end
it "should run '/etc/rc.d/service_name status'" do
- expect(@provider).to receive(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(:exitstatus => 0))
+ expect(@provider).to receive(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(exitstatus: 0))
@provider.load_current_resource
end
it "should set running to true if the status command returns 0" do
- allow(@provider).to receive(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(:exitstatus => 0))
+ allow(@provider).to receive(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(exitstatus: 0))
@provider.load_current_resource
expect(@provider.current_resource.running).to be_truthy
end
it "should set running to false if the status command returns anything except 0" do
- allow(@provider).to receive(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(:exitstatus => 1))
+ allow(@provider).to receive(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(exitstatus: 1))
@provider.load_current_resource
expect(@provider.current_resource.running).to be_falsey
end
@@ -85,21 +85,21 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do
end
it "should run the services status command if one has been specified" do
- expect(@provider).to receive(:shell_out).with("/etc/rc.d/chefhasmonkeypants status").and_return(OpenStruct.new(:exitstatus => 0))
+ expect(@provider).to receive(:shell_out).with("/etc/rc.d/chefhasmonkeypants status").and_return(OpenStruct.new(exitstatus: 0))
@provider.load_current_resource
end
end
it "should raise error if the node has a nil ps attribute and no other means to get status" do
- @node.automatic_attrs[:command] = { :ps => nil }
+ @node.automatic_attrs[:command] = { ps: nil }
@provider.define_resource_requirements
@provider.action = :start
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
end
it "should raise error if the node has an empty ps attribute and no other means to get status" do
- @node.automatic_attrs[:command] = { :ps => "" }
+ @node.automatic_attrs[:command] = { ps: "" }
@provider.define_resource_requirements
@provider.action = :start
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
@@ -122,10 +122,10 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb
aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash
aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb
DEFAULT_PS
- @status = double("Status", :exitstatus => 0, :stdout => @stdout)
+ @status = double("Status", exitstatus: 0, stdout: @stdout)
allow(@provider).to receive(:shell_out!).and_return(@status)
- @node.automatic_attrs[:command] = { :ps => "ps -ef" }
+ @node.automatic_attrs[:command] = { ps: "ps -ef" }
end
it "determines the service is running when it appears in ps" do
@@ -274,7 +274,7 @@ RUNNING_PS
# end
it "should call 'restart' on the service_name if the resource supports it" do
- @new_resource.supports({ :restart => true })
+ @new_resource.supports({ restart: true })
expect(@provider).to receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} restart", default_env: false)
@provider.restart_service()
end
@@ -309,7 +309,7 @@ RUNNING_PS
# end
it "should call 'reload' on the service if it supports it" do
- @new_resource.supports({ :reload => true })
+ @new_resource.supports({ reload: true })
expect(@provider).to receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} reload", default_env: false)
@provider.reload_service()
end
diff --git a/spec/unit/provider/service/debian_service_spec.rb b/spec/unit/provider/service/debian_service_spec.rb
index 25e7c9acc2..173f5e9b61 100644
--- a/spec/unit/provider/service/debian_service_spec.rb
+++ b/spec/unit/provider/service/debian_service_spec.rb
@@ -21,7 +21,7 @@ require "spec_helper"
describe Chef::Provider::Service::Debian do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = { :ps => "fuuuu" }
+ @node.automatic_attrs[:command] = { ps: "fuuuu" }
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
diff --git a/spec/unit/provider/service/freebsd_service_spec.rb b/spec/unit/provider/service/freebsd_service_spec.rb
index 511962f432..11a02c3421 100644
--- a/spec/unit/provider/service/freebsd_service_spec.rb
+++ b/spec/unit/provider/service/freebsd_service_spec.rb
@@ -27,14 +27,14 @@ end
describe Chef::Provider::Service::Freebsd do
let(:node) do
node = Chef::Node.new
- node.automatic_attrs[:command] = { :ps => "ps -ax" }
+ node.automatic_attrs[:command] = { ps: "ps -ax" }
node
end
let(:new_resource) do
new_resource = Chef::Resource::Service.new("apache22")
new_resource.pattern("httpd")
- new_resource.supports({ :status => false })
+ new_resource.supports({ status: false })
new_resource
end
@@ -99,7 +99,7 @@ describe Chef::Provider::Service::Freebsd do
end
context "when a status command has been specified" do
- let(:status) { double(:stdout => "", :exitstatus => 0) }
+ let(:status) { double(stdout: "", exitstatus: 0) }
before do
new_resource.status_command("/bin/chefhasmonkeypants status")
@@ -112,10 +112,10 @@ describe Chef::Provider::Service::Freebsd do
end
context "when the service supports status" do
- let(:status) { double(:stdout => "", :exitstatus => 0) }
+ let(:status) { double(stdout: "", exitstatus: 0) }
before do
- new_resource.supports({ :status => true })
+ new_resource.supports({ status: true })
end
it "should run '/etc/init.d/service_name status'" do
@@ -144,10 +144,10 @@ describe Chef::Provider::Service::Freebsd do
545 ?? Ss 0:17.53 sendmail: accepting connections (sendmail)
PS_SAMPLE
end
- let(:status) { double(:stdout => stdout, :exitstatus => 0) }
+ let(:status) { double(stdout: stdout, exitstatus: 0) }
before do
- node.automatic_attrs[:command] = { :ps => "ps -ax" }
+ node.automatic_attrs[:command] = { ps: "ps -ax" }
end
it "should shell_out! the node's ps command" do
@@ -191,7 +191,7 @@ PS_SAMPLE
context "when ps is empty string" do
before do
- node.automatic_attrs[:command] = { :ps => "" }
+ node.automatic_attrs[:command] = { ps: "" }
end
it "should set running to nil" do
@@ -369,7 +369,7 @@ EOF
end
before do
- status = double(:stdout => rcvar_stdout, :exitstatus => 0)
+ status = double(stdout: rcvar_stdout, exitstatus: 0)
allow(provider).to receive(:shell_out!).with("/usr/local/etc/rc.d/#{new_resource.service_name} rcvar").and_return(status)
end
@@ -469,7 +469,7 @@ EOF
describe Chef::Provider::Service::Freebsd, "restart_service" do
it "should call 'restart' on the service_name if the resource supports it" do
- new_resource.supports({ :restart => true })
+ new_resource.supports({ restart: true })
expect(provider).to receive(:shell_out!).with("/usr/local/etc/rc.d/#{new_resource.service_name} fastrestart", default_env: false)
provider.restart_service()
end
diff --git a/spec/unit/provider/service/gentoo_service_spec.rb b/spec/unit/provider/service/gentoo_service_spec.rb
index a00ca7aadd..6a928d849b 100644
--- a/spec/unit/provider/service/gentoo_service_spec.rb
+++ b/spec/unit/provider/service/gentoo_service_spec.rb
@@ -30,7 +30,7 @@ describe Chef::Provider::Service::Gentoo do
@provider = Chef::Provider::Service::Gentoo.new(@new_resource, @run_context)
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
- @status = double("Status", :exitstatus => 0, :stdout => @stdout)
+ @status = double("Status", exitstatus: 0, stdout: @stdout)
allow(@provider).to receive(:shell_out).and_return(@status)
allow(File).to receive(:exists?).with("/etc/init.d/chef").and_return(true)
allow(File).to receive(:exists?).with("/sbin/rc-update").and_return(true)
diff --git a/spec/unit/provider/service/init_service_spec.rb b/spec/unit/provider/service/init_service_spec.rb
index ff7fae767a..5d403c6898 100644
--- a/spec/unit/provider/service/init_service_spec.rb
+++ b/spec/unit/provider/service/init_service_spec.rb
@@ -21,7 +21,7 @@ require "spec_helper"
describe Chef::Provider::Service::Init, "load_current_resource" do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = { :ps => "ps -ef" }
+ @node.automatic_attrs[:command] = { ps: "ps -ef" }
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@@ -37,7 +37,7 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb
aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash
aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb
PS
- @status = double("Status", :exitstatus => 0, :stdout => @stdout)
+ @status = double("Status", exitstatus: 0, stdout: @stdout)
allow(@provider).to receive(:shell_out!).and_return(@status)
end
@@ -53,7 +53,7 @@ PS
describe "when the service supports status" do
before do
- @new_resource.supports({ :status => true })
+ @new_resource.supports({ status: true })
end
it "should run '/etc/init.d/service_name status'" do
@@ -109,7 +109,7 @@ PS
describe "when the node has not specified a ps command" do
it "should raise an error if the node has a nil ps attribute" do
- @node.automatic_attrs[:command] = { :ps => nil }
+ @node.automatic_attrs[:command] = { ps: nil }
@provider.load_current_resource
@provider.action = :start
@provider.define_resource_requirements
@@ -117,7 +117,7 @@ PS
end
it "should raise an error if the node has an empty ps attribute" do
- @node.automatic_attrs[:command] = { :ps => "" }
+ @node.automatic_attrs[:command] = { ps: "" }
@provider.load_current_resource
@provider.action = :start
@provider.define_resource_requirements
@@ -189,7 +189,7 @@ RUNNING_PS
describe "when restarting a service" do
it "should call 'restart' on the service_name if the resource supports it" do
- @new_resource.supports({ :restart => true })
+ @new_resource.supports({ restart: true })
expect(@provider).to receive(:shell_out!).with("/etc/init.d/#{@new_resource.service_name} restart", default_env: false)
@provider.restart_service()
end
@@ -210,7 +210,7 @@ RUNNING_PS
describe "when reloading a service" do
it "should call 'reload' on the service if it supports it" do
- @new_resource.supports({ :reload => true })
+ @new_resource.supports({ reload: true })
expect(@provider).to receive(:shell_out!).with("/etc/init.d/chef reload", default_env: false)
@provider.reload_service()
end
diff --git a/spec/unit/provider/service/insserv_service_spec.rb b/spec/unit/provider/service/insserv_service_spec.rb
index 3b2b19c432..f2fe19db59 100644
--- a/spec/unit/provider/service/insserv_service_spec.rb
+++ b/spec/unit/provider/service/insserv_service_spec.rb
@@ -23,13 +23,13 @@ describe Chef::Provider::Service::Insserv do
@node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @node.automatic_attrs[:command] = { :ps => "ps -ax" }
+ @node.automatic_attrs[:command] = { ps: "ps -ax" }
@new_resource = Chef::Resource::Service.new("initgrediant")
@current_resource = Chef::Resource::Service.new("initgrediant")
@provider = Chef::Provider::Service::Insserv.new(@new_resource, @run_context)
- @status = double("Process::Status mock", :exitstatus => 0, :stdout => "")
+ @status = double("Process::Status mock", exitstatus: 0, stdout: "")
allow(@provider).to receive(:shell_out!).and_return(@status)
end
diff --git a/spec/unit/provider/service/invokercd_service_spec.rb b/spec/unit/provider/service/invokercd_service_spec.rb
index e70ba7e094..a63e3e1afb 100644
--- a/spec/unit/provider/service/invokercd_service_spec.rb
+++ b/spec/unit/provider/service/invokercd_service_spec.rb
@@ -21,7 +21,7 @@ require "spec_helper"
describe Chef::Provider::Service::Invokercd, "load_current_resource" do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = { :ps => "ps -ef" }
+ @node.automatic_attrs[:command] = { ps: "ps -ef" }
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@@ -37,7 +37,7 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb
aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash
aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb
PS
- @status = double("Status", :exitstatus => 0, :stdout => @stdout)
+ @status = double("Status", exitstatus: 0, stdout: @stdout)
allow(@provider).to receive(:shell_out!).and_return(@status)
end
@@ -53,7 +53,7 @@ PS
describe "when the service supports status" do
before do
- @new_resource.supports({ :status => true })
+ @new_resource.supports({ status: true })
end
it "should run '/usr/sbin/invoke-rc.d service_name status'" do
@@ -95,14 +95,14 @@ PS
describe "when the node has not specified a ps command" do
it "should raise error if the node has a nil ps attribute and no other means to get status" do
- @node.automatic_attrs[:command] = { :ps => nil }
+ @node.automatic_attrs[:command] = { ps: nil }
@provider.action = :start
@provider.define_resource_requirements
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
end
it "should raise error if the node has an empty ps attribute and no other means to get status" do
- @node.automatic_attrs[:command] = { :ps => "" }
+ @node.automatic_attrs[:command] = { ps: "" }
@provider.action = :start
@provider.define_resource_requirements
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
@@ -112,7 +112,7 @@ PS
describe "when we have a 'ps' attribute" do
it "should shell_out! the node's ps command" do
- @status = double("Status", :exitstatus => 0, :stdout => @stdout)
+ @status = double("Status", exitstatus: 0, stdout: @stdout)
expect(@provider).to receive(:shell_out!).with(@node[:command][:ps]).and_return(@status)
@provider.load_current_resource
end
@@ -122,14 +122,14 @@ PS
aj 7842 5057 0 21:26 pts/2 00:00:06 chef
aj 7842 5057 0 21:26 pts/2 00:00:06 poos
RUNNING_PS
- @status = double("Status", :exitstatus => 0, :stdout => @stdout)
+ @status = double("Status", exitstatus: 0, stdout: @stdout)
expect(@provider).to receive(:shell_out!).and_return(@status)
@provider.load_current_resource
expect(@current_resource.running).to be_truthy
end
it "should set running to false if the regex doesn't match" do
- @status = double("Status", :exitstatus => 0, :stdout => @stdout)
+ @status = double("Status", exitstatus: 0, stdout: @stdout)
expect(@provider).to receive(:shell_out!).and_return(@status)
@provider.load_current_resource
expect(@current_resource.running).to be_falsey
@@ -176,7 +176,7 @@ RUNNING_PS
describe "when restarting a service" do
it "should call 'restart' on the service_name if the resource supports it" do
- @new_resource.supports({ :restart => true })
+ @new_resource.supports({ restart: true })
expect(@provider).to receive(:shell_out!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} restart", default_env: false)
@provider.restart_service()
end
@@ -197,7 +197,7 @@ RUNNING_PS
describe "when reloading a service" do
it "should call 'reload' on the service if it supports it" do
- @new_resource.supports({ :reload => true })
+ @new_resource.supports({ reload: true })
expect(@provider).to receive(:shell_out!).with("/usr/sbin/invoke-rc.d chef reload", default_env: false)
@provider.reload_service()
end
diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb
index 283512108a..5ca06d9ec8 100644
--- a/spec/unit/provider/service/macosx_spec.rb
+++ b/spec/unit/provider/service/macosx_spec.rb
@@ -76,20 +76,20 @@ XML
before do
allow(run_context).to receive(:logger).and_return(logger)
allow(Dir).to receive(:glob).and_return([plist], [])
- @stat = double("File::Stat", { :uid => 501 })
+ @stat = double("File::Stat", { uid: 501 })
allow(File).to receive(:stat).and_return(@stat)
- @getpwuid = double("Etc::Passwd", { :name => "mikedodge04" })
+ @getpwuid = double("Etc::Passwd", { name: "mikedodge04" })
allow(Etc).to receive(:getpwuid).and_return(@getpwuid)
allow(node).to receive(:[]).with("platform_version").and_return(platform_version)
cmd = "launchctl list #{service_label}"
allow(provider).to receive(:shell_out).
with(/(#{su_cmd} '#{cmd}'|#{cmd})/, default_env: false).
and_return(double("Status",
- :stdout => launchctl_stdout, :exitstatus => 0))
+ stdout: launchctl_stdout, exitstatus: 0))
allow(File).to receive(:exists?).and_return([true], [])
allow(provider).to receive(:shell_out!).
with(/plutil -convert xml1 -o/, default_env: false).
- and_return(double("Status", :stdout => plutil_stdout))
+ and_return(double("Status", stdout: plutil_stdout))
end
context "#{service_name} that is a #{service_type} running Osx #{platform_version}" do
diff --git a/spec/unit/provider/service/openbsd_service_spec.rb b/spec/unit/provider/service/openbsd_service_spec.rb
index b990532aaf..38283f609d 100644
--- a/spec/unit/provider/service/openbsd_service_spec.rb
+++ b/spec/unit/provider/service/openbsd_service_spec.rb
@@ -31,11 +31,11 @@ end
describe Chef::Provider::Service::Openbsd do
let(:node) do
node = Chef::Node.new
- node.automatic_attrs[:command] = { :ps => "ps -ax" }
+ node.automatic_attrs[:command] = { ps: "ps -ax" }
node
end
- let(:supports) { { :status => false } }
+ let(:supports) { { status: false } }
let(:new_resource) do
new_resource = Chef::Resource::Service.new("sndiod")
@@ -93,7 +93,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "when a status command has been specified" do
- let(:status) { double(:stdout => "", :exitstatus => 0) }
+ let(:status) { double(stdout: "", exitstatus: 0) }
before do
new_resource.status_command("/bin/chefhasmonkeypants status")
@@ -106,9 +106,9 @@ describe Chef::Provider::Service::Openbsd do
end
context "when the service supports status" do
- let(:status) { double(:stdout => "", :exitstatus => 0) }
+ let(:status) { double(stdout: "", exitstatus: 0) }
- let(:supports) { { :status => true } }
+ let(:supports) { { status: true } }
it "should run '/etc/rc.d/service_name status'" do
expect(provider).to receive(:shell_out).with("/etc/rc.d/#{new_resource.service_name} check").and_return(status)
diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb
index 40f9bc3a91..b965183d14 100644
--- a/spec/unit/provider/service/redhat_spec.rb
+++ b/spec/unit/provider/service/redhat_spec.rb
@@ -23,17 +23,17 @@ shared_examples_for "define_resource_requirements_common" do
it "should raise an error if /sbin/chkconfig does not exist" do
allow(File).to receive(:exists?).with("/sbin/chkconfig").and_return(false)
allow(@provider).to receive(:shell_out).with("/sbin/service chef status").and_raise(Errno::ENOENT)
- allow(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0, 1]).and_raise(Errno::ENOENT)
+ allow(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_raise(Errno::ENOENT)
@provider.load_current_resource
@provider.define_resource_requirements
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
end
it "should not raise an error if the service exists but is not added to any runlevels" do
- status = double("Status", :exitstatus => 0, :stdout => "" , :stderr => "")
+ status = double("Status", exitstatus: 0, stdout: "" , stderr: "")
expect(@provider).to receive(:shell_out).with("/sbin/service chef status").and_return(status)
- chkconfig = double("Chkconfig", :exitstatus => 0, :stdout => "", :stderr => "service chef supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add chef')")
- expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0, 1]).and_return(chkconfig)
+ chkconfig = double("Chkconfig", exitstatus: 0, stdout: "", stderr: "service chef supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add chef')")
+ expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
@provider.load_current_resource
@provider.define_resource_requirements
expect { @provider.process_resource_requirements }.not_to raise_error
@@ -44,7 +44,7 @@ describe "Chef::Provider::Service::Redhat" do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = { :ps => "foo" }
+ @node.automatic_attrs[:command] = { ps: "foo" }
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@@ -65,13 +65,13 @@ describe "Chef::Provider::Service::Redhat" do
describe "load current resource" do
before do
- status = double("Status", :exitstatus => 0, :stdout => "" , :stderr => "")
+ status = double("Status", exitstatus: 0, stdout: "" , stderr: "")
allow(@provider).to receive(:shell_out).with("/sbin/service chef status").and_return(status)
end
it "sets supports[:status] to true by default" do
- chkconfig = double("Chkconfig", :exitstatus => 0, :stdout => "chef 0:off 1:off 2:off 3:off 4:off 5:on 6:off", :stderr => "")
- expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0, 1]).and_return(chkconfig)
+ chkconfig = double("Chkconfig", exitstatus: 0, stdout: "chef 0:off 1:off 2:off 3:off 4:off 5:on 6:off", stderr: "")
+ expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
expect(@provider.service_missing).to be false
@provider.load_current_resource
expect(@provider.supports[:status]).to be true
@@ -80,9 +80,9 @@ describe "Chef::Provider::Service::Redhat" do
it "lets the user override supports[:status] in the new_resource" do
@new_resource.supports( { status: false } )
@new_resource.pattern "myservice"
- chkconfig = double("Chkconfig", :exitstatus => 0, :stdout => "chef 0:off 1:off 2:off 3:off 4:off 5:on 6:off", :stderr => "")
- expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0, 1]).and_return(chkconfig)
- foo_out = double("ps_command", :exitstatus => 0, :stdout => "a line that matches myservice", :stderr => "")
+ chkconfig = double("Chkconfig", exitstatus: 0, stdout: "chef 0:off 1:off 2:off 3:off 4:off 5:on 6:off", stderr: "")
+ expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
+ foo_out = double("ps_command", exitstatus: 0, stdout: "a line that matches myservice", stderr: "")
expect(@provider).to receive(:shell_out!).with("foo").and_return(foo_out)
expect(@provider.service_missing).to be false
expect(@provider).not_to receive(:shell_out).with("/sbin/service chef status")
@@ -91,16 +91,16 @@ describe "Chef::Provider::Service::Redhat" do
end
it "sets the current enabled status to true if the service is enabled for any run level" do
- chkconfig = double("Chkconfig", :exitstatus => 0, :stdout => "chef 0:off 1:off 2:off 3:off 4:off 5:on 6:off", :stderr => "")
- expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0, 1]).and_return(chkconfig)
+ chkconfig = double("Chkconfig", exitstatus: 0, stdout: "chef 0:off 1:off 2:off 3:off 4:off 5:on 6:off", stderr: "")
+ expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
expect(@provider.service_missing).to be false
@provider.load_current_resource
expect(@current_resource.enabled).to be true
end
it "sets the current enabled status to false if the regex does not match" do
- chkconfig = double("Chkconfig", :exitstatus => 0, :stdout => "chef 0:off 1:off 2:off 3:off 4:off 5:off 6:off", :stderr => "")
- expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0, 1]).and_return(chkconfig)
+ chkconfig = double("Chkconfig", exitstatus: 0, stdout: "chef 0:off 1:off 2:off 3:off 4:off 5:off 6:off", stderr: "")
+ expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
expect(@provider.service_missing).to be false
expect(@provider.load_current_resource).to eql(@current_resource)
expect(@current_resource.enabled).to be false
@@ -108,8 +108,8 @@ describe "Chef::Provider::Service::Redhat" do
it "sets the current enabled status to true if the service is enabled at specified run levels" do
@new_resource.run_levels([1, 2])
- chkconfig = double("Chkconfig", :exitstatus => 0, :stdout => "chef 0:off 1:on 2:on 3:off 4:off 5:off 6:off", :stderr => "")
- expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0, 1]).and_return(chkconfig)
+ chkconfig = double("Chkconfig", exitstatus: 0, stdout: "chef 0:off 1:on 2:on 3:off 4:off 5:off 6:off", stderr: "")
+ expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
expect(@provider.service_missing).to be false
@provider.load_current_resource
expect(@current_resource.enabled).to be true
@@ -118,8 +118,8 @@ describe "Chef::Provider::Service::Redhat" do
it "sets the current enabled status to false if the service is enabled at a run level it should not" do
@new_resource.run_levels([1, 2])
- chkconfig = double("Chkconfig", :exitstatus => 0, :stdout => "chef 0:off 1:on 2:on 3:on 4:off 5:off 6:off", :stderr => "")
- expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0, 1]).and_return(chkconfig)
+ chkconfig = double("Chkconfig", exitstatus: 0, stdout: "chef 0:off 1:on 2:on 3:on 4:off 5:off 6:off", stderr: "")
+ expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
expect(@provider.service_missing).to be false
@provider.load_current_resource
expect(@current_resource.enabled).to be false
@@ -128,8 +128,8 @@ describe "Chef::Provider::Service::Redhat" do
it "sets the current enabled status to false if the service is not enabled at specified run levels" do
@new_resource.run_levels([ 2 ])
- chkconfig = double("Chkconfig", :exitstatus => 0, :stdout => "chef 0:off 1:on 2:off 3:off 4:off 5:off 6:off", :stderr => "")
- expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0, 1]).and_return(chkconfig)
+ chkconfig = double("Chkconfig", exitstatus: 0, stdout: "chef 0:off 1:on 2:off 3:off 4:off 5:off 6:off", stderr: "")
+ expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
expect(@provider.service_missing).to be false
@provider.load_current_resource
expect(@current_resource.enabled).to be false
@@ -142,10 +142,10 @@ describe "Chef::Provider::Service::Redhat" do
context "when the service does not exist" do
before do
- status = double("Status", :exitstatus => 1, :stdout => "", :stderr => "chef: unrecognized service")
+ status = double("Status", exitstatus: 1, stdout: "", stderr: "chef: unrecognized service")
expect(@provider).to receive(:shell_out).with("/sbin/service chef status").and_return(status)
- chkconfig = double("Chkconfig", :existatus => 1, :stdout => "", :stderr => "error reading information on service chef: No such file or directory")
- expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0, 1]).and_return(chkconfig)
+ chkconfig = double("Chkconfig", existatus: 1, stdout: "", stderr: "error reading information on service chef: No such file or directory")
+ expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
@provider.load_current_resource
@provider.define_resource_requirements
end
@@ -194,10 +194,10 @@ describe "Chef::Provider::Service::Redhat" do
it_should_behave_like "define_resource_requirements_common"
it "should not raise an error if the service does not exist" do
- status = double("Status", :exitstatus => 1, :stdout => "", :stderr => "chef: unrecognized service")
+ status = double("Status", exitstatus: 1, stdout: "", stderr: "chef: unrecognized service")
expect(@provider).to receive(:shell_out).with("/sbin/service chef status").and_return(status)
- chkconfig = double("Chkconfig", :existatus => 1, :stdout => "", :stderr => "error reading information on service chef: No such file or directory")
- expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", :returns => [0, 1]).and_return(chkconfig)
+ chkconfig = double("Chkconfig", existatus: 1, stdout: "", stderr: "error reading information on service chef: No such file or directory")
+ expect(@provider).to receive(:shell_out!).with("/sbin/chkconfig --list chef", returns: [0, 1]).and_return(chkconfig)
@provider.load_current_resource
@provider.define_resource_requirements
expect { @provider.process_resource_requirements }.not_to raise_error
diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb
index 8a03c0552d..e9fe1b0482 100644
--- a/spec/unit/provider/service/simple_service_spec.rb
+++ b/spec/unit/provider/service/simple_service_spec.rb
@@ -21,7 +21,7 @@ require "spec_helper"
describe Chef::Provider::Service::Simple, "load_current_resource" do
before(:each) do
@node = Chef::Node.new
- @node.automatic_attrs[:command] = { :ps => "ps -ef" }
+ @node.automatic_attrs[:command] = { ps: "ps -ef" }
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@@ -36,7 +36,7 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb
aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash
aj 8119 6041 0 21:34 pts/3 00:00:03 vi simple_service_spec.rb
NOMOCKINGSTRINGSPLZ
- @status = double("Status", :exitstatus => 0, :stdout => @stdout)
+ @status = double("Status", exitstatus: 0, stdout: @stdout)
allow(@provider).to receive(:shell_out!).and_return(@status)
end
@@ -51,13 +51,13 @@ NOMOCKINGSTRINGSPLZ
end
it "should raise error if the node has a nil ps attribute and no other means to get status" do
- @node.automatic_attrs[:command] = { :ps => nil }
+ @node.automatic_attrs[:command] = { ps: nil }
@provider.define_resource_requirements
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
end
it "should raise error if the node has an empty ps attribute and no other means to get status" do
- @node.automatic_attrs[:command] = { :ps => "" }
+ @node.automatic_attrs[:command] = { ps: "" }
@provider.define_resource_requirements
expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::Service)
end
@@ -79,7 +79,7 @@ NOMOCKINGSTRINGSPLZ
aj 7842 5057 0 21:26 pts/2 00:00:06 chef
aj 7842 5057 0 21:26 pts/2 00:00:06 poos
NOMOCKINGSTRINGSPLZ
- @status = double("Status", :exitstatus => 0, :stdout => @stdout)
+ @status = double("Status", exitstatus: 0, stdout: @stdout)
allow(@provider).to receive(:shell_out!).and_return(@status)
@provider.load_current_resource
expect(@current_resource.running).to be_truthy
diff --git a/spec/unit/provider/service/solaris_smf_service_spec.rb b/spec/unit/provider/service/solaris_smf_service_spec.rb
index a5148c236a..7b8bd950d2 100644
--- a/spec/unit/provider/service/solaris_smf_service_spec.rb
+++ b/spec/unit/provider/service/solaris_smf_service_spec.rb
@@ -74,19 +74,19 @@ describe Chef::Provider::Service::Solaris do
].join("\n")
# shell_out! return value for a service that is running
- @enabled_svc_status = double("Status", :exitstatus => 0, :stdout => enabled_svc_stdout, :stdin => "", :stderr => "")
+ @enabled_svc_status = double("Status", exitstatus: 0, stdout: enabled_svc_stdout, stdin: "", stderr: "")
# shell_out! return value for a service that is disabled
- @disabled_svc_status = double("Status", :exitstatus => 0, :stdout => disabled_svc_stdout, :stdin => "", :stderr => "")
+ @disabled_svc_status = double("Status", exitstatus: 0, stdout: disabled_svc_stdout, stdin: "", stderr: "")
# shell_out! return value for a service that is in maintenance mode
- @maintenance_svc_status = double("Status", :exitstatus => 0, :stdout => maintenance_svc_stdout, :stdin => "", :stderr => "")
+ @maintenance_svc_status = double("Status", exitstatus: 0, stdout: maintenance_svc_stdout, stdin: "", stderr: "")
# shell_out! return value for a service that does not exist
- @no_svc_status = double("Status", :exitstatus => 1, :stdout => "", :stdin => "", :stderr => "svcs: Pattern 'chef' doesn't match any instances\n")
+ @no_svc_status = double("Status", exitstatus: 1, stdout: "", stdin: "", stderr: "svcs: Pattern 'chef' doesn't match any instances\n")
# shell_out! return value for a successful execution
- @success = double("clear", :exitstatus => 0, :stdout => "", :stdin => "", :stderr => "")
+ @success = double("clear", exitstatus: 0, stdout: "", stdin: "", stderr: "")
end
it "should raise an error if /bin/svcs and /usr/sbin/svcadm are not executable" do
@@ -116,19 +116,19 @@ describe Chef::Provider::Service::Solaris do
describe "when discovering the current service state" do
it "should create a current resource with the name of the new resource" do
- expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@enabled_svc_status)
+ expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@enabled_svc_status)
expect(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
expect(@provider.maintenance).to be_falsey
@provider.load_current_resource
end
it "should return the current resource" do
- expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@enabled_svc_status)
+ expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@enabled_svc_status)
expect(@provider.load_current_resource).to eql(@current_resource)
end
it "should call '/bin/svcs -l service_name'" do
- expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@enabled_svc_status)
+ expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@enabled_svc_status)
@provider.load_current_resource
end
@@ -163,7 +163,7 @@ describe Chef::Provider::Service::Solaris do
end
it "should call svcadm enable -s chef" do
- expect(@provider).to receive(:shell_out!).twice.with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@enabled_svc_status)
+ expect(@provider).to receive(:shell_out!).twice.with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@enabled_svc_status)
expect(@provider).not_to receive(:shell_out!).with("/usr/sbin/svcadm", "clear", @current_resource.service_name)
expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm", "enable", "-s", @current_resource.service_name).and_return(@success)
@provider.load_current_resource
@@ -173,7 +173,7 @@ describe Chef::Provider::Service::Solaris do
end
it "should call svcadm enable -s chef for start_service" do
- expect(@provider).to receive(:shell_out!).twice.with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@enabled_svc_status)
+ expect(@provider).to receive(:shell_out!).twice.with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@enabled_svc_status)
expect(@provider).not_to receive(:shell_out!).with("/usr/sbin/svcadm", "clear", @current_resource.service_name)
expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm", "enable", "-s", @current_resource.service_name).and_return(@success)
@provider.load_current_resource
@@ -183,7 +183,7 @@ describe Chef::Provider::Service::Solaris do
it "should call svcadm clear chef for start_service when state maintenance" do
# we are in maint mode
- expect(@provider).to receive(:shell_out!).twice.with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@maintenance_svc_status)
+ expect(@provider).to receive(:shell_out!).twice.with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@maintenance_svc_status)
expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm", "clear", @current_resource.service_name).and_return(@success)
expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm", "enable", "-s", @current_resource.service_name).and_return(@success)
@@ -192,7 +192,7 @@ describe Chef::Provider::Service::Solaris do
expect(@provider.enable_service).to be_truthy
# now we are enabled
- expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@enabled_svc_status)
+ expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@enabled_svc_status)
@provider.load_current_resource
expect(@current_resource.enabled).to be_truthy
@@ -206,7 +206,7 @@ describe Chef::Provider::Service::Solaris do
it "should call svcadm enable -s -r chef" do
@new_resource.options("-r")
- expect(@provider).to receive(:shell_out!).twice.with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@enabled_svc_status)
+ expect(@provider).to receive(:shell_out!).twice.with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@enabled_svc_status)
expect(@provider).not_to receive(:shell_out!).with("/usr/sbin/svcadm", "clear", @current_resource.service_name)
expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm", "enable", "-s", "-r", @current_resource.service_name).and_return(@success)
@provider.load_current_resource
@@ -216,7 +216,7 @@ describe Chef::Provider::Service::Solaris do
it "should call svcadm enable -s -r -t chef when passed an array of options" do
@new_resource.options(["-r", "-t"])
- expect(@provider).to receive(:shell_out!).twice.with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@enabled_svc_status)
+ expect(@provider).to receive(:shell_out!).twice.with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@enabled_svc_status)
expect(@provider).not_to receive(:shell_out!).with("/usr/sbin/svcadm", "clear", @current_resource.service_name)
expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm", "enable", "-s", "-r", "-t", @current_resource.service_name).and_return(@success)
@provider.load_current_resource
@@ -232,7 +232,7 @@ describe Chef::Provider::Service::Solaris do
end
it "should call svcadm disable -s chef" do
- expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@disabled_svc_status)
+ expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@disabled_svc_status)
expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm", "disable", "-s", "chef").and_return(@success)
@provider.load_current_resource
expect(@provider.disable_service).to be_truthy
@@ -240,7 +240,7 @@ describe Chef::Provider::Service::Solaris do
end
it "should call svcadm disable -s chef for stop_service" do
- expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@disabled_svc_status)
+ expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@disabled_svc_status)
expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm", "disable", "-s", "chef").and_return(@success)
@provider.load_current_resource
expect(@provider.disable_service).to be_truthy
@@ -249,7 +249,7 @@ describe Chef::Provider::Service::Solaris do
it "should call svcadm disable chef with options" do
@new_resource.options("-t")
- expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@disabled_svc_status)
+ expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@disabled_svc_status)
expect(@provider).to receive(:shell_out!).with("/usr/sbin/svcadm", "disable", "-s", "-t", "chef").and_return(@success)
@provider.load_current_resource
expect(@provider.disable_service).to be_truthy
@@ -261,7 +261,7 @@ describe Chef::Provider::Service::Solaris do
describe "when reloading the service" do
before(:each) do
@provider.current_resource = @current_resource
- allow(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@enabled_svc_status)
+ allow(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@enabled_svc_status)
end
it "should call svcadm refresh chef" do
@@ -274,7 +274,7 @@ describe Chef::Provider::Service::Solaris do
describe "when the service doesn't exist" do
before(:each) do
@provider.current_resource = @current_resource
- expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { :returns => [0, 1] }).and_return(@no_svc_status)
+ expect(@provider).to receive(:shell_out!).with("/bin/svcs", "-l", "chef", { returns: [0, 1] }).and_return(@no_svc_status)
end
it "should be marked not running" do
diff --git a/spec/unit/provider/service/systemd_service_spec.rb b/spec/unit/provider/service/systemd_service_spec.rb
index 1082bdfdc4..ccd814a3a9 100644
--- a/spec/unit/provider/service/systemd_service_spec.rb
+++ b/spec/unit/provider/service/systemd_service_spec.rb
@@ -36,11 +36,11 @@ describe Chef::Provider::Service::Systemd do
let(:provider) { Chef::Provider::Service::Systemd.new(new_resource, run_context) }
let(:shell_out_success) do
- double("shell_out", :exitstatus => 0, :error? => false)
+ double("shell_out", exitstatus: 0, error?: false)
end
let(:shell_out_failure) do
- double("shell_out", :exitstatus => 1, :error? => true)
+ double("shell_out", exitstatus: 1, error?: true)
end
let(:current_resource) { Chef::Resource::Service.new(service_name) }
@@ -190,14 +190,14 @@ describe Chef::Provider::Service::Systemd do
context "when a user is specified" do
it "should call '#{systemctl_path} --user start service_name' if no start command is specified" do
current_resource.user("joe")
- expect(provider).to receive(:shell_out!).with("#{systemctl_path} --user start #{service_name_escaped}", { :environment => { "DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/10000/bus" }, :user => "joe", default_env: false }).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out!).with("#{systemctl_path} --user start #{service_name_escaped}", { environment: { "DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/10000/bus" }, user: "joe", default_env: false }).and_return(shell_out_success)
provider.start_service
end
it "should not call '#{systemctl_path} --user start service_name' if it is already running" do
current_resource.running(true)
current_resource.user("joe")
- expect(provider).not_to receive(:shell_out!).with("#{systemctl_path} --user start #{service_name_escaped}", { :environment => { "DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/10000/bus" }, :user => "joe" })
+ expect(provider).not_to receive(:shell_out!).with("#{systemctl_path} --user start #{service_name_escaped}", { environment: { "DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/10000/bus" }, user: "joe" })
provider.start_service
end
end
@@ -340,22 +340,22 @@ describe Chef::Provider::Service::Systemd do
end
it "should return true if '#{systemctl_path} --system is-enabled service_name' returns 'masked' and returns anything except 0" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "masked", :exitstatus => shell_out_failure))
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(stdout: "masked", exitstatus: shell_out_failure))
expect(provider.is_masked?).to be true
end
it "should return true if '#{systemctl_path} --system is-enabled service_name' outputs 'masked-runtime' and returns anything except 0" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "masked-runtime", :exitstatus => shell_out_failure))
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(stdout: "masked-runtime", exitstatus: shell_out_failure))
expect(provider.is_masked?).to be true
end
it "should return false if '#{systemctl_path} --system is-enabled service_name' returns 0" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "enabled", :exitstatus => shell_out_success))
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(stdout: "enabled", exitstatus: shell_out_success))
expect(provider.is_masked?).to be false
end
it "should return false if '#{systemctl_path} --system is-enabled service_name' returns anything except 0 and outputs an error'" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "Failed to get unit file state for #{service_name}: No such file or directory", :exitstatus => shell_out_failure))
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(stdout: "Failed to get unit file state for #{service_name}: No such file or directory", exitstatus: shell_out_failure))
expect(provider.is_masked?).to be false
end
end
diff --git a/spec/unit/provider/service/upstart_service_spec.rb b/spec/unit/provider/service/upstart_service_spec.rb
index a95f9c494e..ae94e49835 100644
--- a/spec/unit/provider/service/upstart_service_spec.rb
+++ b/spec/unit/provider/service/upstart_service_spec.rb
@@ -20,7 +20,7 @@ require "spec_helper"
describe Chef::Provider::Service::Upstart do
let(:shell_out_success) do
- double("shell_out", :exitstatus => 0, :error? => false)
+ double("shell_out", exitstatus: 0, error?: false)
end
before(:each) do
@@ -66,7 +66,7 @@ describe Chef::Provider::Service::Upstart do
describe "load_current_resource" do
before(:each) do
- @node.automatic_attrs[:command] = { :ps => "ps -ax" }
+ @node.automatic_attrs[:command] = { ps: "ps -ax" }
@current_resource = Chef::Resource::Service.new("rsyslog")
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
@@ -167,14 +167,14 @@ describe Chef::Provider::Service::Upstart do
end
it "should set enabled to true when it finds 'starts on'" do
- @lines = double("start on filesystem", :gets => "start on filesystem")
+ @lines = double("start on filesystem", gets: "start on filesystem")
allow(::File).to receive(:open).and_yield(@lines)
expect(@current_resource).to receive(:running).with(false)
@provider.load_current_resource
end
it "should set enabled to false when it finds '#starts on'" do
- @lines = double("start on filesystem", :gets => "#start on filesystem")
+ @lines = double("start on filesystem", gets: "#start on filesystem")
allow(::File).to receive(:open).and_yield(@lines)
expect(@current_resource).to receive(:running).with(false)
@provider.load_current_resource
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 18ea004795..978d180026 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -98,7 +98,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
Win32::Service::DISABLED = 0x00000004
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "running"))
+ double("StatusStruct", current_state: "running"))
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name)
.and_return(chef_service_config_info)
@@ -502,8 +502,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
describe Chef::Provider::Service::Windows, "start_service" do
before(:each) do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "stopped"),
- double("StatusStruct", :current_state => "running"))
+ double("StatusStruct", current_state: "stopped"),
+ double("StatusStruct", current_state: "running"))
end
it "calls the start command if one is specified" do
@@ -528,7 +528,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "does nothing if the service is running" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "running"))
+ double("StatusStruct", current_state: "running"))
provider.load_current_resource
expect(Win32::Service).not_to receive(:start).with(new_resource.service_name)
provider.start_service
@@ -537,7 +537,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "raises an error if the service is paused" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "paused"))
+ double("StatusStruct", current_state: "paused"))
provider.load_current_resource
expect(Win32::Service).not_to receive(:start).with(new_resource.service_name)
expect { provider.start_service }.to raise_error( Chef::Exceptions::Service )
@@ -546,9 +546,9 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "waits and continues if the service is in start_pending" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "start pending"),
- double("StatusStruct", :current_state => "start pending"),
- double("StatusStruct", :current_state => "running"))
+ double("StatusStruct", current_state: "start pending"),
+ double("StatusStruct", current_state: "start pending"),
+ double("StatusStruct", current_state: "running"))
provider.load_current_resource
expect(Win32::Service).not_to receive(:start).with(new_resource.service_name)
provider.start_service
@@ -557,7 +557,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "fails if the service is in stop_pending" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "stop pending"))
+ double("StatusStruct", current_state: "stop pending"))
provider.load_current_resource
expect(Win32::Service).not_to receive(:start).with(new_resource.service_name)
expect { provider.start_service }.to raise_error( Chef::Exceptions::Service )
@@ -597,8 +597,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
before(:each) do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "running"),
- double("StatusStruct", :current_state => "stopped"))
+ double("StatusStruct", current_state: "running"),
+ double("StatusStruct", current_state: "stopped"))
end
it "calls the stop command if one is specified" do
@@ -623,7 +623,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "does nothing if the service is stopped" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "stopped"))
+ double("StatusStruct", current_state: "stopped"))
provider.load_current_resource
expect(Win32::Service).not_to receive(:stop).with(new_resource.service_name)
provider.stop_service
@@ -632,7 +632,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "raises an error if the service is paused" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "paused"))
+ double("StatusStruct", current_state: "paused"))
provider.load_current_resource
expect(Win32::Service).not_to receive(:start).with(new_resource.service_name)
expect { provider.stop_service }.to raise_error( Chef::Exceptions::Service )
@@ -641,9 +641,9 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "waits and continue if the service is in stop_pending" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "stop pending"),
- double("StatusStruct", :current_state => "stop pending"),
- double("StatusStruct", :current_state => "stopped"))
+ double("StatusStruct", current_state: "stop pending"),
+ double("StatusStruct", current_state: "stop pending"),
+ double("StatusStruct", current_state: "stopped"))
provider.load_current_resource
expect(Win32::Service).not_to receive(:stop).with(new_resource.service_name)
provider.stop_service
@@ -652,7 +652,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "fails if the service is in start_pending" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "start pending"))
+ double("StatusStruct", current_state: "start pending"))
provider.load_current_resource
expect(Win32::Service).not_to receive(:stop).with(new_resource.service_name)
expect { provider.stop_service }.to raise_error( Chef::Exceptions::Service )
@@ -661,7 +661,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "passes custom timeout to the stop command if provided" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "running"))
+ double("StatusStruct", current_state: "running"))
new_resource.timeout 1
expect(Win32::Service).to receive(:stop).with(new_resource.service_name)
Timeout.timeout(2) do
@@ -683,10 +683,10 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "stops then starts the service if it is running" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "running"),
- double("StatusStruct", :current_state => "stopped"),
- double("StatusStruct", :current_state => "stopped"),
- double("StatusStruct", :current_state => "running"))
+ double("StatusStruct", current_state: "running"),
+ double("StatusStruct", current_state: "stopped"),
+ double("StatusStruct", current_state: "stopped"),
+ double("StatusStruct", current_state: "running"))
expect(Win32::Service).to receive(:stop).with(new_resource.service_name)
expect(Win32::Service).to receive(:start).with(new_resource.service_name)
provider.restart_service
@@ -695,9 +695,9 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "just starts the service if it is stopped" do
allow(Win32::Service).to receive(:status).with(new_resource.service_name).and_return(
- double("StatusStruct", :current_state => "stopped"),
- double("StatusStruct", :current_state => "stopped"),
- double("StatusStruct", :current_state => "running"))
+ double("StatusStruct", current_state: "stopped"),
+ double("StatusStruct", current_state: "stopped"),
+ double("StatusStruct", current_state: "running"))
expect(Win32::Service).to receive(:start).with(new_resource.service_name)
provider.restart_service
expect(new_resource.updated_by_last_action?).to be_truthy
@@ -716,11 +716,11 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
describe Chef::Provider::Service::Windows, "enable_service" do
before(:each) do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", :start_type => "disabled"))
+ double("ConfigStruct", start_type: "disabled"))
end
it "enables service" do
- expect(Win32::Service).to receive(:configure).with(:service_name => new_resource.service_name, :start_type => Win32::Service::AUTO_START)
+ expect(Win32::Service).to receive(:configure).with(service_name: new_resource.service_name, start_type: Win32::Service::AUTO_START)
provider.enable_service
expect(new_resource.updated_by_last_action?).to be_truthy
end
@@ -736,14 +736,14 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
describe Chef::Provider::Service::Windows, "action_enable" do
it "does nothing if the service is enabled" do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", :start_type => "auto start"))
+ double("ConfigStruct", start_type: "auto start"))
expect(provider).not_to receive(:enable_service)
provider.action_enable
end
it "enables the service if it is not set to automatic start" do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", :start_type => "disabled"))
+ double("ConfigStruct", start_type: "disabled"))
expect(provider).to receive(:enable_service)
provider.action_enable
end
@@ -752,14 +752,14 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
describe Chef::Provider::Service::Windows, "action_disable" do
it "does nothing if the service is disabled" do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", :start_type => "disabled"))
+ double("ConfigStruct", start_type: "disabled"))
expect(provider).not_to receive(:disable_service)
provider.action_disable
end
it "disables the service if it is not set to disabled" do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", :start_type => "auto start"))
+ double("ConfigStruct", start_type: "auto start"))
expect(provider).to receive(:disable_service)
provider.action_disable
end
@@ -768,7 +768,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
describe Chef::Provider::Service::Windows, "disable_service" do
before(:each) do
allow(Win32::Service).to receive(:config_info).with(new_resource.service_name).and_return(
- double("ConfigStruct", :start_type => "auto start"))
+ double("ConfigStruct", start_type: "auto start"))
end
it "disables service" do
@@ -810,17 +810,17 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
describe Chef::Provider::Service::Windows, "set_start_type" do
it "when called with :automatic it calls Win32::Service#configure with Win32::Service::AUTO_START" do
- expect(Win32::Service).to receive(:configure).with(:service_name => new_resource.service_name, :start_type => Win32::Service::AUTO_START)
+ expect(Win32::Service).to receive(:configure).with(service_name: new_resource.service_name, start_type: Win32::Service::AUTO_START)
provider.send(:set_startup_type, :automatic)
end
it "when called with :manual it calls Win32::Service#configure with Win32::Service::DEMAND_START" do
- expect(Win32::Service).to receive(:configure).with(:service_name => new_resource.service_name, :start_type => Win32::Service::DEMAND_START)
+ expect(Win32::Service).to receive(:configure).with(service_name: new_resource.service_name, start_type: Win32::Service::DEMAND_START)
provider.send(:set_startup_type, :manual)
end
it "when called with :disabled it calls Win32::Service#configure with Win32::Service::DISABLED" do
- expect(Win32::Service).to receive(:configure).with(:service_name => new_resource.service_name, :start_type => Win32::Service::DISABLED)
+ expect(Win32::Service).to receive(:configure).with(service_name: new_resource.service_name, start_type: Win32::Service::DISABLED)
provider.send(:set_startup_type, :disabled)
end
diff --git a/spec/unit/provider/service_spec.rb b/spec/unit/provider/service_spec.rb
index c788cb223e..f3e725abb6 100644
--- a/spec/unit/provider/service_spec.rb
+++ b/spec/unit/provider/service_spec.rb
@@ -99,7 +99,7 @@ describe Chef::Provider::Service do
describe "action_restart" do
before do
- @current_resource.supports(:restart => true)
+ @current_resource.supports(restart: true)
end
it "should restart the service if it's supported and set the resource as updated" do
@@ -118,11 +118,11 @@ describe Chef::Provider::Service do
describe "action_reload" do
before do
- @new_resource.supports(:reload => true)
+ @new_resource.supports(reload: true)
end
it "should raise an exception if reload isn't supported" do
- @new_resource.supports(:reload => false)
+ @new_resource.supports(reload: false)
@new_resource.reload_command(false)
expect { @provider.run_action(:reload) }.to raise_error(Chef::Exceptions::UnsupportedAction)
end
diff --git a/spec/unit/provider/subversion_spec.rb b/spec/unit/provider/subversion_spec.rb
index 55d6dc5d24..8f364aa8c8 100644
--- a/spec/unit/provider/subversion_spec.rb
+++ b/spec/unit/provider/subversion_spec.rb
@@ -46,7 +46,7 @@ describe Chef::Provider::Subversion do
it "converts resource attributes to options for shell_out" do
expect(@provider.run_options).to eq({})
@resource.user "deployninja"
- expect(@provider.run_options).to eq({ :user => "deployninja" })
+ expect(@provider.run_options).to eq({ user: "deployninja" })
end
context "determining the revision of the currently deployed code" do
@@ -73,18 +73,18 @@ describe Chef::Provider::Subversion do
"Last Changed Rev: 11410\n" + # Last Changed Rev is preferred to Revision
"Last Changed Date: 2009-03-25 06:09:56 -0600 (Wed, 25 Mar 2009)\n\n"
expect(::File).to receive(:exist?).at_least(1).times.with("/my/deploy/dir/.svn").and_return(true)
- expected_command = ["svn info", { :cwd => "/my/deploy/dir", :returns => [0, 1] }]
+ expected_command = ["svn info", { cwd: "/my/deploy/dir", returns: [0, 1] }]
expect(@provider).to receive(:shell_out!).with(*expected_command).
- and_return(double("ShellOut result", :stdout => example_svn_info, :stderr => ""))
+ and_return(double("ShellOut result", stdout: example_svn_info, stderr: ""))
expect(@provider.find_current_revision).to eql("11410")
end
it "gives nil as the current revision if the deploy dir isn't a SVN working copy" do
example_svn_info = "svn: '/tmp/deploydir' is not a working copy\n"
expect(::File).to receive(:exist?).with("/my/deploy/dir/.svn").and_return(true)
- expected_command = ["svn info", { :cwd => "/my/deploy/dir", :returns => [0, 1] }]
+ expected_command = ["svn info", { cwd: "/my/deploy/dir", returns: [0, 1] }]
expect(@provider).to receive(:shell_out!).with(*expected_command).
- and_return(double("ShellOut result", :stdout => example_svn_info, :stderr => ""))
+ and_return(double("ShellOut result", stdout: example_svn_info, stderr: ""))
expect(@provider.find_current_revision).to be_nil
end
@@ -128,18 +128,18 @@ describe Chef::Provider::Subversion do
"Last Changed Rev: 11410\n" + # Last Changed Rev is preferred to Revision
"Last Changed Date: 2009-03-25 06:09:56 -0600 (Wed, 25 Mar 2009)\n\n"
@resource.revision "HEAD"
- expected_command = ["svn info http://svn.example.org/trunk/ --no-auth-cache -rHEAD", { :cwd => "/my/deploy/dir", :returns => [0, 1] }]
+ expected_command = ["svn info http://svn.example.org/trunk/ --no-auth-cache -rHEAD", { cwd: "/my/deploy/dir", returns: [0, 1] }]
expect(@provider).to receive(:shell_out!).with(*expected_command).
- and_return(double("ShellOut result", :stdout => example_svn_info, :stderr => ""))
+ and_return(double("ShellOut result", stdout: example_svn_info, stderr: ""))
expect(@provider.revision_int).to eql("11410")
end
it "returns a helpful message if data from `svn info` can't be parsed" do
example_svn_info = "some random text from an error message\n"
@resource.revision "HEAD"
- expected_command = ["svn info http://svn.example.org/trunk/ --no-auth-cache -rHEAD", { :cwd => "/my/deploy/dir", :returns => [0, 1] }]
+ expected_command = ["svn info http://svn.example.org/trunk/ --no-auth-cache -rHEAD", { cwd: "/my/deploy/dir", returns: [0, 1] }]
expect(@provider).to receive(:shell_out!).with(*expected_command).
- and_return(double("ShellOut result", :stdout => example_svn_info, :stderr => ""))
+ and_return(double("ShellOut result", stdout: example_svn_info, stderr: ""))
expect { @provider.revision_int }.to raise_error(RuntimeError, "Could not parse `svn info` data: some random text from an error message\n")
end
diff --git a/spec/unit/provider/systemd_unit_spec.rb b/spec/unit/provider/systemd_unit_spec.rb
index 5e57cbb840..8c42c41420 100644
--- a/spec/unit/provider/systemd_unit_spec.rb
+++ b/spec/unit/provider/systemd_unit_spec.rb
@@ -50,27 +50,27 @@ describe Chef::Provider::SystemdUnit do
let(:user_cmd_opts) do
{
- :user => "joe",
- :environment => {
+ user: "joe",
+ environment: {
"DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/1000/bus",
},
}
end
let(:shell_out_success) do
- double("shell_out", :exitstatus => 0, :error? => false)
+ double("shell_out", exitstatus: 0, error?: false)
end
let(:shell_out_failure) do
- double("shell_out", :exitstatus => 1, :error? => true)
+ double("shell_out", exitstatus: 1, error?: true)
end
let(:shell_out_masked) do
- double("shell_out", :exit_status => 0, :error? => false, :stdout => "masked")
+ double("shell_out", exit_status: 0, error?: false, stdout: "masked")
end
let(:shell_out_static) do
- double("shell_out", :exit_status => 0, :error? => false, :stdout => "static")
+ double("shell_out", exit_status: 0, error?: false, stdout: "static")
end
before(:each) do
diff --git a/spec/unit/provider/template/content_spec.rb b/spec/unit/provider/template/content_spec.rb
index 8f30d8f868..fb5d127d57 100644
--- a/spec/unit/provider/template/content_spec.rb
+++ b/spec/unit/provider/template/content_spec.rb
@@ -30,20 +30,20 @@ describe Chef::Provider::Template::Content do
let(:new_resource) do
double("Chef::Resource::Template (new)",
- :cookbook_name => "openldap",
- :recipe_name => "default",
- :source_line => "/Users/lamont/solo/cookbooks/openldap/recipes/default.rb:2:in `from_file'",
- :source_line_file => "/Users/lamont/solo/cookbooks/openldap/recipes/default.rb",
- :source_line_number => "2",
- :source => "openldap_stuff.conf.erb",
- :name => "openldap_stuff.conf",
- :path => resource_path,
- :local => false,
- :cookbook => nil,
- :variables => {},
- :inline_helper_blocks => {},
- :inline_helper_modules => [],
- :helper_modules => [])
+ cookbook_name: "openldap",
+ recipe_name: "default",
+ source_line: "/Users/lamont/solo/cookbooks/openldap/recipes/default.rb:2:in `from_file'",
+ source_line_file: "/Users/lamont/solo/cookbooks/openldap/recipes/default.rb",
+ source_line_number: "2",
+ source: "openldap_stuff.conf.erb",
+ name: "openldap_stuff.conf",
+ path: resource_path,
+ local: false,
+ cookbook: nil,
+ variables: {},
+ inline_helper_blocks: {},
+ inline_helper_modules: [],
+ helper_modules: [])
end
let(:rendered_file_locations) do
@@ -58,7 +58,7 @@ describe Chef::Provider::Template::Content do
cl.load_cookbooks
cookbook_collection = Chef::CookbookCollection.new(cl)
node = Chef::Node.new
- double("Chef::Resource::RunContext", :node => node, :cookbook_collection => cookbook_collection)
+ double("Chef::Resource::RunContext", node: node, cookbook_collection: cookbook_collection)
end
let(:content) do
@@ -130,20 +130,20 @@ describe Chef::Provider::Template::Content do
describe "when using location helpers" do
let(:new_resource) do
double("Chef::Resource::Template (new)",
- :cookbook_name => "openldap",
- :recipe_name => "default",
- :source_line => CHEF_SPEC_DATA + "/cookbooks/openldap/recipes/default.rb:2:in `from_file'",
- :source_line_file => CHEF_SPEC_DATA + "/cookbooks/openldap/recipes/default.rb",
- :source_line_number => "2",
- :source => "helpers.erb",
- :name => "helpers.erb",
- :path => CHEF_SPEC_DATA + "/cookbooks/openldap/templates/default/helpers.erb",
- :local => false,
- :cookbook => nil,
- :variables => {},
- :inline_helper_blocks => {},
- :inline_helper_modules => [],
- :helper_modules => [])
+ cookbook_name: "openldap",
+ recipe_name: "default",
+ source_line: CHEF_SPEC_DATA + "/cookbooks/openldap/recipes/default.rb:2:in `from_file'",
+ source_line_file: CHEF_SPEC_DATA + "/cookbooks/openldap/recipes/default.rb",
+ source_line_number: "2",
+ source: "helpers.erb",
+ name: "helpers.erb",
+ path: CHEF_SPEC_DATA + "/cookbooks/openldap/templates/default/helpers.erb",
+ local: false,
+ cookbook: nil,
+ variables: {},
+ inline_helper_blocks: {},
+ inline_helper_modules: [],
+ helper_modules: [])
end
it "creates the template with the rendered content" do
diff --git a/spec/unit/provider/template_spec.rb b/spec/unit/provider/template_spec.rb
index 9f69772bc8..a65846ecb2 100644
--- a/spec/unit/provider/template_spec.rb
+++ b/spec/unit/provider/template_spec.rb
@@ -27,7 +27,7 @@ describe Chef::Provider::Template do
let(:node) { double("Chef::Node") }
let(:events) { double("Chef::Events").as_null_object } # mock all the methods
let(:logger) { double("Mixlib::Log::Child").as_null_object }
- let(:run_context) { double("Chef::RunContext", :node => node, :events => events, :logger => logger) }
+ let(:run_context) { double("Chef::RunContext", node: node, events: events, logger: logger) }
let(:enclosing_directory) do
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
end
@@ -50,7 +50,7 @@ describe Chef::Provider::Template do
end
let(:content) do
- content = double("Chef::Provider::File::Content::Template", :template_location => "/foo/bar/baz")
+ content = double("Chef::Provider::File::Content::Template", template_location: "/foo/bar/baz")
allow(File).to receive(:exists?).with("/foo/bar/baz").and_return(true)
content
end
diff --git a/spec/unit/provider/user/pw_spec.rb b/spec/unit/provider/user/pw_spec.rb
index 8cc69f88af..7c6948bf84 100644
--- a/spec/unit/provider/user/pw_spec.rb
+++ b/spec/unit/provider/user/pw_spec.rb
@@ -202,7 +202,7 @@ describe Chef::Provider::User::Pw do
end
it "should run pw usermod with the username and the option -H 0" do
- expect(@provider).to receive(:shell_out_compacted!).with( "pw usermod adam -H 0", { :input => "abracadabra" }).and_return(@status)
+ expect(@provider).to receive(:shell_out_compacted!).with( "pw usermod adam -H 0", { input: "abracadabra" }).and_return(@status)
@provider.modify_password
end
diff --git a/spec/unit/provider/windows_task_spec.rb b/spec/unit/provider/windows_task_spec.rb
index 66bd6854b6..39f39b37fe 100644
--- a/spec/unit/provider/windows_task_spec.rb
+++ b/spec/unit/provider/windows_task_spec.rb
@@ -70,20 +70,20 @@ describe Chef::Provider::WindowsTask, :windows_only do
new_resource.frequency_modifier 15
new_resource.random_delay 60
result = {
- :start_year => 2017,
- :start_month => 12,
- :start_day => 2,
- :start_hour => 17,
- :start_minute => 30,
- :end_month => 0,
- :end_day => 0,
- :end_year => 0,
- :trigger_type => 1,
- :type => { :once => nil },
- :random_minutes_interval => 60,
- :minutes_interval => 15,
- :run_on_last_day_of_month => false,
- :run_on_last_week_of_month => false
+ start_year: 2017,
+ start_month: 12,
+ start_day: 2,
+ start_hour: 17,
+ start_minute: 30,
+ end_month: 0,
+ end_day: 0,
+ end_year: 0,
+ trigger_type: 1,
+ type: { once: nil },
+ random_minutes_interval: 60,
+ minutes_interval: 15,
+ run_on_last_day_of_month: false,
+ run_on_last_week_of_month: false
}
expect(provider.send(:trigger)).to eq(result)
@@ -145,7 +145,7 @@ describe Chef::Provider::WindowsTask, :windows_only do
new_resource.frequency_modifier 2
result = provider.send(:type)
expect(result).to include(:once)
- expect(result).to eq({ :once => nil })
+ expect(result).to eq({ once: nil })
end
it "returns type hash when frequency :daily" do
diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb
index 93d03756a7..3b16edaa4a 100644
--- a/spec/unit/recipe_spec.rb
+++ b/spec/unit/recipe_spec.rb
@@ -110,7 +110,7 @@ describe Chef::Recipe do
it "locate resource for particular platform" do
ShaunTheSheep = Class.new(Chef::Resource)
ShaunTheSheep.resource_name :shaun_the_sheep
- ShaunTheSheep.provides :laughter, :platform => ["television"]
+ ShaunTheSheep.provides :laughter, platform: ["television"]
node.automatic[:platform] = "television"
node.automatic[:platform_version] = "123"
res = recipe.laughter "timmy"
@@ -183,7 +183,7 @@ describe Chef::Recipe do
it "does not add the resource to the resource collection" do
zm_resource # force let binding evaluation
- expect { run_context.resource_collection.resources(:zen_master => "klopp") }.to raise_error(Chef::Exceptions::ResourceNotFound)
+ expect { run_context.resource_collection.resources(zen_master: "klopp") }.to raise_error(Chef::Exceptions::ResourceNotFound)
end
end
@@ -238,7 +238,7 @@ describe Chef::Recipe do
it "adds the resource to the resource collection" do
zm_resource # force let binding evaluation
- expect(run_context.resource_collection.resources(:zen_master => "klopp")).to eq(zm_resource)
+ expect(run_context.resource_collection.resources(zen_master: "klopp")).to eq(zm_resource)
end
it "will insert another resource if create_if_missing is not set (cloned resource as of Chef-12)" do
@@ -339,7 +339,7 @@ describe Chef::Recipe do
describe "resource definitions" do
it "should execute defined resources" do
crow_define = Chef::ResourceDefinition.new
- crow_define.define :crow, :peace => false, :something => true do
+ crow_define.define :crow, peace: false, something: true do
zen_master "lao tzu" do
peace params[:peace]
something params[:something]
@@ -349,13 +349,13 @@ describe Chef::Recipe do
recipe.crow "mine" do
peace true
end
- expect(run_context.resource_collection.resources(:zen_master => "lao tzu").name).to eql("lao tzu")
- expect(run_context.resource_collection.resources(:zen_master => "lao tzu").something).to eql(true)
+ expect(run_context.resource_collection.resources(zen_master: "lao tzu").name).to eql("lao tzu")
+ expect(run_context.resource_collection.resources(zen_master: "lao tzu").something).to eql(true)
end
it "should set the node on defined resources" do
crow_define = Chef::ResourceDefinition.new
- crow_define.define :crow, :peace => false, :something => true do
+ crow_define.define :crow, peace: false, something: true do
zen_master "lao tzu" do
peace params[:peace]
something params[:something]
@@ -366,12 +366,12 @@ describe Chef::Recipe do
recipe.crow "mine" do
something node[:foo]
end
- expect(recipe.resources(:zen_master => "lao tzu").something).to eql(false)
+ expect(recipe.resources(zen_master: "lao tzu").something).to eql(false)
end
it "should return the last statement in the definition as the retval" do
crow_define = Chef::ResourceDefinition.new
- crow_define.define :crow, :peace => false, :something => true do
+ crow_define.define :crow, peace: false, something: true do
"the return val"
end
run_context.definitions[:crow] = crow_define
@@ -392,7 +392,7 @@ describe Chef::Recipe do
end
CODE
expect { recipe.instance_eval(code) }.not_to raise_error
- expect(recipe.resources(:zen_master => "gnome").name).to eql("gnome")
+ expect(recipe.resources(zen_master: "gnome").name).to eql("gnome")
end
end
@@ -408,7 +408,7 @@ describe Chef::Recipe do
describe "from_file" do
it "should load a resource from a ruby file" do
recipe.from_file(File.join(CHEF_SPEC_DATA, "recipes", "test.rb"))
- res = recipe.resources(:file => "/etc/nsswitch.conf")
+ res = recipe.resources(file: "/etc/nsswitch.conf")
expect(res.name).to eql("/etc/nsswitch.conf")
expect(res.action).to eql([:create])
expect(res.owner).to eql("root")
@@ -426,7 +426,7 @@ describe Chef::Recipe do
expect(node).to receive(:loaded_recipe).with(:openldap, "gigantor")
allow(run_context).to receive(:unreachable_cookbook?).with(:openldap).and_return(false)
run_context.include_recipe "openldap::gigantor"
- res = run_context.resource_collection.resources(:cat => "blanket")
+ res = run_context.resource_collection.resources(cat: "blanket")
expect(res.name).to eql("blanket")
expect(res.pretty_kitty).to eql(false)
end
@@ -435,7 +435,7 @@ describe Chef::Recipe do
expect(node).to receive(:loaded_recipe).with(:openldap, "default")
allow(run_context).to receive(:unreachable_cookbook?).with(:openldap).and_return(false)
run_context.include_recipe "openldap"
- res = run_context.resource_collection.resources(:cat => "blanket")
+ res = run_context.resource_collection.resources(cat: "blanket")
expect(res.name).to eql("blanket")
expect(res.pretty_kitty).to eql(true)
end
diff --git a/spec/unit/resource/conditional_spec.rb b/spec/unit/resource/conditional_spec.rb
index c38ebbdd46..2a2e166e6c 100644
--- a/spec/unit/resource/conditional_spec.rb
+++ b/spec/unit/resource/conditional_spec.rb
@@ -22,7 +22,7 @@ require "ostruct"
describe Chef::Resource::Conditional do
before do
allow_any_instance_of(Mixlib::ShellOut).to receive(:run_command).and_return(nil)
- @status = OpenStruct.new(:success? => true)
+ @status = OpenStruct.new(success?: true)
allow_any_instance_of(Mixlib::ShellOut).to receive(:status).and_return(@status)
@parent_resource = Chef::Resource.new("", Chef::Node.new)
end
diff --git a/spec/unit/resource/cookbook_file_spec.rb b/spec/unit/resource/cookbook_file_spec.rb
index 734fc152c1..c670d2f543 100644
--- a/spec/unit/resource/cookbook_file_spec.rb
+++ b/spec/unit/resource/cookbook_file_spec.rb
@@ -72,8 +72,8 @@ describe Chef::Resource::CookbookFile do
state = resource.state_for_resource_reporter
if Chef::Platform.windows?
puts state
- expect(state[:rights]).to eq([{ :permissions => :read, :principals => "Everyone" }])
- expect(state[:deny_rights]).to eq([{ :permissions => :full_control, :principals => "Clumsy_Sam" }])
+ expect(state[:rights]).to eq([{ permissions: :read, principals: "Everyone" }])
+ expect(state[:deny_rights]).to eq([{ permissions: :full_control, principals: "Clumsy_Sam" }])
else
expect(state[:group]).to eq("wheel")
expect(state[:mode]).to eq("0664")
diff --git a/spec/unit/resource/dnf_package_spec.rb b/spec/unit/resource/dnf_package_spec.rb
index 1b90fd3a0d..f4262a0396 100644
--- a/spec/unit/resource/dnf_package_spec.rb
+++ b/spec/unit/resource/dnf_package_spec.rb
@@ -59,19 +59,19 @@ describe Chef::Resource::DnfPackage, "flush_cache" do
let(:resource) { Chef::Resource::DnfPackage.new("foo") }
it "defaults the flush timing to false" do
- flush_hash = { :before => false, :after => false }
+ flush_hash = { before: false, after: false }
expect(resource.flush_cache).to eq(flush_hash)
end
it "allows you to set the flush timing with an array" do
flush_array = [ :before, :after ]
- flush_hash = { :before => true, :after => true }
+ flush_hash = { before: true, after: true }
resource.flush_cache(flush_array)
expect(resource.flush_cache).to eq(flush_hash)
end
it "allows you to set the flush timing with a hash" do
- flush_hash = { :before => true, :after => true }
+ flush_hash = { before: true, after: true }
resource.flush_cache(flush_hash)
expect(resource.flush_cache).to eq(flush_hash)
end
diff --git a/spec/unit/resource/execute_spec.rb b/spec/unit/resource/execute_spec.rb
index 947f6c608e..9bd434b74a 100644
--- a/spec/unit/resource/execute_spec.rb
+++ b/spec/unit/resource/execute_spec.rb
@@ -109,7 +109,7 @@ describe Chef::Resource::Execute do
shared_examples_for "a consumer of the Execute resource" do
context "when running on Windows" do
before do
- allow(resource).to receive(:node).and_return({ :platform_family => "windows" })
+ allow(resource).to receive(:node).and_return({ platform_family: "windows" })
end
context "when no user, domain, or password is specified" do
@@ -211,7 +211,7 @@ describe Chef::Resource::Execute do
context "when not running on Windows" do
before do
- allow(resource).to receive(:node).and_return({ :platform_family => "ubuntu" })
+ allow(resource).to receive(:node).and_return({ platform_family: "ubuntu" })
end
context "when no user, domain, or password is specified" do
diff --git a/spec/unit/resource/file/verification/systemd_unit_spec.rb b/spec/unit/resource/file/verification/systemd_unit_spec.rb
index 8a3d849582..b1f9239442 100644
--- a/spec/unit/resource/file/verification/systemd_unit_spec.rb
+++ b/spec/unit/resource/file/verification/systemd_unit_spec.rb
@@ -20,7 +20,7 @@ require "spec_helper"
describe Chef::Resource::File::Verification::SystemdUnit do
let(:command) { "#{systemd_analyze_path} verify %{path}" }
- let(:opts) { { :future => true } }
+ let(:opts) { { future: true } }
let(:parent_resource) { Chef::Resource.new("llama") }
let(:systemd_analyze_path) { "/usr/bin/systemd-analyze" }
let(:systemd_dir) { "/etc/systemd/system" }
diff --git a/spec/unit/resource/file/verification_spec.rb b/spec/unit/resource/file/verification_spec.rb
index e46040268a..f0ec999019 100644
--- a/spec/unit/resource/file/verification_spec.rb
+++ b/spec/unit/resource/file/verification_spec.rb
@@ -48,7 +48,7 @@ describe Chef::Resource::File::Verification do
it "accepts an options hash" do
v = Chef::Resource::File::Verification.new(parent_resource, nil, {}) {}
- expect { v.verify("/foo/bar", { :future => true }) }.to_not raise_error
+ expect { v.verify("/foo/bar", { future: true }) }.to_not raise_error
end
context "with a verification block" do
diff --git a/spec/unit/resource/file_spec.rb b/spec/unit/resource/file_spec.rb
index 7e9b96616a..5e649da1a9 100644
--- a/spec/unit/resource/file_spec.rb
+++ b/spec/unit/resource/file_spec.rb
@@ -113,15 +113,15 @@ describe Chef::Resource::File do
end
- describe "when access controls are set on windows", :windows_only => true do
+ describe "when access controls are set on windows", windows_only: true do
before do
resource.rights :read, "Everyone"
resource.rights :full_control, "DOMAIN\User"
end
it "describes its state including windows ACL attributes" do
state = resource.state_for_resource_reporter
- expect(state[:rights]).to eq([ { :permissions => :read, :principals => "Everyone" },
- { :permissions => :full_control, :principals => "DOMAIN\User" } ])
+ expect(state[:rights]).to eq([ { permissions: :read, principals: "Everyone" },
+ { permissions: :full_control, principals: "DOMAIN\User" } ])
end
end
end
diff --git a/spec/unit/resource/freebsd_package_spec.rb b/spec/unit/resource/freebsd_package_spec.rb
index 9747c41a88..154bd09616 100644
--- a/spec/unit/resource/freebsd_package_spec.rb
+++ b/spec/unit/resource/freebsd_package_spec.rb
@@ -79,8 +79,8 @@ describe Chef::Resource::FreebsdPackage do
describe "if pkgng enabled" do
it "is Freebsd::Pkgng" do
- pkg_enabled = OpenStruct.new(:stdout => "yes\n")
- allow(resource).to receive(:shell_out!).with("make", "-V", "WITH_PKGNG", :env => nil).and_return(pkg_enabled)
+ pkg_enabled = OpenStruct.new(stdout: "yes\n")
+ allow(resource).to receive(:shell_out!).with("make", "-V", "WITH_PKGNG", env: nil).and_return(pkg_enabled)
resource.after_created
expect(resource.provider).to eq(Chef::Provider::Package::Freebsd::Pkgng)
end
@@ -88,8 +88,8 @@ describe Chef::Resource::FreebsdPackage do
describe "if freebsd_version is less than 1000017 and pkgng not enabled" do
it "is Freebsd::Pkg" do
- pkg_enabled = OpenStruct.new(:stdout => "\n")
- allow(resource).to receive(:shell_out!).with("make", "-V", "WITH_PKGNG", :env => nil).and_return(pkg_enabled)
+ pkg_enabled = OpenStruct.new(stdout: "\n")
+ allow(resource).to receive(:shell_out!).with("make", "-V", "WITH_PKGNG", env: nil).and_return(pkg_enabled)
[1000016, 1000000, 901503, 902506, 802511].each do |freebsd_version|
node.automatic_attrs[:os_version] = freebsd_version
diff --git a/spec/unit/resource/group_spec.rb b/spec/unit/resource/group_spec.rb
index 638d8718c7..10bef38410 100644
--- a/spec/unit/resource/group_spec.rb
+++ b/spec/unit/resource/group_spec.rb
@@ -72,7 +72,7 @@ describe Chef::Resource::Group, "group_name" do
end
it "does not allow a hash" do
- expect { resource.send(:group_name, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
+ expect { resource.send(:group_name, { aj: "is freakin awesome" }) }.to raise_error(ArgumentError)
end
end
@@ -85,7 +85,7 @@ describe Chef::Resource::Group, "gid" do
end
it "does not allow a hash" do
- expect { resource.send(:gid, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
+ expect { resource.send(:gid, { aj: "is freakin awesome" }) }.to raise_error(ArgumentError)
end
end
@@ -109,7 +109,7 @@ describe Chef::Resource::Group, "members" do
end
it "(#{method}) does not allow a hash" do
- expect { resource.send(method, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
+ expect { resource.send(method, { aj: "is freakin awesome" }) }.to raise_error(ArgumentError)
end
end
end
@@ -127,7 +127,7 @@ describe Chef::Resource::Group, "append" do
end
it "does not allow a hash" do
- expect { resource.send(:gid, { :aj => "is freakin awesome" }) }.to raise_error(ArgumentError)
+ expect { resource.send(:gid, { aj: "is freakin awesome" }) }.to raise_error(ArgumentError)
end
describe "when it has members" do
diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb
index 721f30cf09..ec6fb1232a 100644
--- a/spec/unit/resource/mount_spec.rb
+++ b/spec/unit/resource/mount_spec.rb
@@ -144,19 +144,19 @@ describe Chef::Resource::Mount do
end
it "defaults all feature support to false" do
- support_hash = { :remount => false }
+ support_hash = { remount: false }
expect(resource.supports).to eq(support_hash)
end
it "allows you to set feature support as an array" do
support_array = [ :remount ]
- support_hash = { :remount => true }
+ support_hash = { remount: true }
resource.supports(support_array)
expect(resource.supports).to eq(support_hash)
end
it "allows you to set feature support as a hash" do
- support_hash = { :remount => true }
+ support_hash = { remount: true }
resource.supports(support_hash)
expect(resource.supports).to eq(support_hash)
end
diff --git a/spec/unit/resource/package_spec.rb b/spec/unit/resource/package_spec.rb
index 79a714edfc..b0e1304775 100644
--- a/spec/unit/resource/package_spec.rb
+++ b/spec/unit/resource/package_spec.rb
@@ -56,8 +56,8 @@ describe Chef::Resource::Package do
end
it "accepts a hash for response file template variables" do
- resource.response_file_variables({ :variables => true })
- expect(resource.response_file_variables).to eql({ :variables => true })
+ resource.response_file_variables({ variables: true })
+ expect(resource.response_file_variables).to eql({ variables: true })
end
it "accepts a string for the source" do
diff --git a/spec/unit/resource/powershell_package_source_spec.rb b/spec/unit/resource/powershell_package_source_spec.rb
index d8cb8a09a0..4033f4515f 100644
--- a/spec/unit/resource/powershell_package_source_spec.rb
+++ b/spec/unit/resource/powershell_package_source_spec.rb
@@ -205,13 +205,13 @@ describe Chef::Resource::PowershellPackageSource do
describe "#package_source_exists?" do
it "returns true if it exists" do
- allow(provider).to receive(:powershell_out!).with("(Get-PackageSource -Name 'MyGallery').Name").and_return(double("powershell_out!", :stdout => "MyGallery\r\n"))
+ allow(provider).to receive(:powershell_out!).with("(Get-PackageSource -Name 'MyGallery').Name").and_return(double("powershell_out!", stdout: "MyGallery\r\n"))
resource.source_name("MyGallery")
expect(provider.package_source_exists?).to eql(true)
end
it "returns false if it doesn't exist" do
- allow(provider).to receive(:powershell_out!).with("(Get-PackageSource -Name 'MyGallery').Name").and_return(double("powershell_out!", :stdout => ""))
+ allow(provider).to receive(:powershell_out!).with("(Get-PackageSource -Name 'MyGallery').Name").and_return(double("powershell_out!", stdout: ""))
resource.source_name("MyGallery")
expect(provider.package_source_exists?).to eql(false)
end
diff --git a/spec/unit/resource/powershell_script_spec.rb b/spec/unit/resource/powershell_script_spec.rb
index 9cdb6fdbee..9afd202f91 100644
--- a/spec/unit/resource/powershell_script_spec.rb
+++ b/spec/unit/resource/powershell_script_spec.rb
@@ -87,7 +87,7 @@ describe Chef::Resource::PowershellScript do
it "enables convert_boolean_return by default for guards in the context of powershell_script when no guard params are specified" do
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:evaluate_action).and_return(true)
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with(
- { :convert_boolean_return => true, :code => "$true" }).and_return(Proc.new {})
+ { convert_boolean_return: true, code: "$true" }).and_return(Proc.new {})
resource.only_if("$true")
end
@@ -98,27 +98,27 @@ describe Chef::Resource::PowershellScript do
file_resource.guard_interpreter :powershell_script
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with(
- { :convert_boolean_return => true, :code => "$true" }).and_return(Proc.new {})
+ { convert_boolean_return: true, code: "$true" }).and_return(Proc.new {})
resource.only_if("$true")
end
it "enables convert_boolean_return by default for guards in the context of powershell_script when guard params are specified" do
- guard_parameters = { :cwd => "/etc/chef", :architecture => :x86_64 }
+ guard_parameters = { cwd: "/etc/chef", architecture: :x86_64 }
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with(
- { :convert_boolean_return => true, :code => "$true" }.merge(guard_parameters)).and_return(Proc.new {})
+ { convert_boolean_return: true, code: "$true" }.merge(guard_parameters)).and_return(Proc.new {})
resource.only_if("$true", guard_parameters)
end
it "passes convert_boolean_return as true if it was specified as true in a guard parameter" do
- guard_parameters = { :cwd => "/etc/chef", :convert_boolean_return => true, :architecture => :x86_64 }
+ guard_parameters = { cwd: "/etc/chef", convert_boolean_return: true, architecture: :x86_64 }
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with(
- { :convert_boolean_return => true, :code => "$true" }.merge(guard_parameters)).and_return(Proc.new {})
+ { convert_boolean_return: true, code: "$true" }.merge(guard_parameters)).and_return(Proc.new {})
resource.only_if("$true", guard_parameters)
end
it "passes convert_boolean_return as false if it was specified as true in a guard parameter" do
- other_guard_parameters = { :cwd => "/etc/chef", :architecture => :x86_64 }
- parameters_with_boolean_disabled = other_guard_parameters.merge({ :convert_boolean_return => false, :code => "$true" })
+ other_guard_parameters = { cwd: "/etc/chef", architecture: :x86_64 }
+ parameters_with_boolean_disabled = other_guard_parameters.merge({ convert_boolean_return: false, code: "$true" })
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with(
parameters_with_boolean_disabled).and_return(Proc.new {})
resource.only_if("$true", parameters_with_boolean_disabled)
diff --git a/spec/unit/resource/registry_key_spec.rb b/spec/unit/resource/registry_key_spec.rb
index c7e95c37be..147bc8492c 100644
--- a/spec/unit/resource/registry_key_spec.rb
+++ b/spec/unit/resource/registry_key_spec.rb
@@ -72,7 +72,7 @@ describe Chef::Resource::RegistryKey, "key" do
end
it "does not allow a hash" do
- expect { resource.send(:key, { :sonic => "screwdriver" }) }.to raise_error(ArgumentError)
+ expect { resource.send(:key, { sonic: "screwdriver" }) }.to raise_error(ArgumentError)
end
end
@@ -80,26 +80,26 @@ describe Chef::Resource::RegistryKey, "values" do
let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
it "allows a single proper hash of registry values" do
- resource.values( { :name => "poosh", :type => :string, :data => "carmen" } )
- expect(resource.values).to eql([ { :name => "poosh", :type => :string, :data => "carmen" } ])
+ resource.values( { name: "poosh", type: :string, data: "carmen" } )
+ expect(resource.values).to eql([ { name: "poosh", type: :string, data: "carmen" } ])
end
it "allows an array of proper hashes of registry values" do
- resource.values [ { :name => "poosh", :type => :string, :data => "carmen" } ]
- expect(resource.values).to eql([ { :name => "poosh", :type => :string, :data => "carmen" } ])
+ resource.values [ { name: "poosh", type: :string, data: "carmen" } ]
+ expect(resource.values).to eql([ { name: "poosh", type: :string, data: "carmen" } ])
end
it "returns checksummed data if the type is unsafe" do
- resource.values( { :name => "poosh", :type => :binary, :data => 255.chr * 1 })
- expect(resource.values).to eql([ { :name => "poosh", :type => :binary, :data => "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89" } ])
+ resource.values( { name: "poosh", type: :binary, data: 255.chr * 1 })
+ expect(resource.values).to eql([ { name: "poosh", type: :binary, data: "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89" } ])
end
it "raises an exception if the name field is missing" do
- expect { resource.values [ { :type => :string, :data => "carmen" } ] }.to raise_error(ArgumentError)
+ expect { resource.values [ { type: :string, data: "carmen" } ] }.to raise_error(ArgumentError)
end
it "raises an exception if extra fields are present" do
- expect { resource.values [ { :name => "poosh", :type => :string, :data => "carmen", :screwdriver => "sonic" } ] }.to raise_error(ArgumentError)
+ expect { resource.values [ { name: "poosh", type: :string, data: "carmen", screwdriver: "sonic" } ] }.to raise_error(ArgumentError)
end
it "does not allow a string" do
@@ -111,26 +111,26 @@ describe Chef::Resource::RegistryKey, "values" do
end
it "raises an exception if type of name is not string" do
- expect { resource.values([ { :name => 123, :type => :string, :data => "carmen" } ]) }.to raise_error(ArgumentError)
+ expect { resource.values([ { name: 123, type: :string, data: "carmen" } ]) }.to raise_error(ArgumentError)
end
it "does not raise an exception if type of name is string" do
- expect { resource.values([ { :name => "123", :type => :string, :data => "carmen" } ]) }.to_not raise_error
+ expect { resource.values([ { name: "123", type: :string, data: "carmen" } ]) }.to_not raise_error
end
context "type key not given" do
it "does not raise an exception" do
- expect { resource.values([ { :name => "123", :data => "carmen" } ]) }.to_not raise_error
+ expect { resource.values([ { name: "123", data: "carmen" } ]) }.to_not raise_error
end
end
context "type key given" do
it "raises an exception if type of type is not symbol" do
- expect { resource.values([ { :name => "123", :type => "string", :data => "carmen" } ]) }.to raise_error(ArgumentError)
+ expect { resource.values([ { name: "123", type: "string", data: "carmen" } ]) }.to raise_error(ArgumentError)
end
it "does not raise an exception if type of type is symbol" do
- expect { resource.values([ { :name => "123", :type => :string, :data => "carmen" } ]) }.to_not raise_error
+ expect { resource.values([ { name: "123", type: :string, data: "carmen" } ]) }.to_not raise_error
end
end
end
@@ -144,7 +144,7 @@ describe Chef::Resource::RegistryKey, "recursive" do
end
it "does not allow a hash" do
- expect { resource.recursive({ :sonic => :screwdriver }) }.to raise_error(ArgumentError)
+ expect { resource.recursive({ sonic: :screwdriver }) }.to raise_error(ArgumentError)
end
it "does not allow an array" do
@@ -175,7 +175,7 @@ describe Chef::Resource::RegistryKey, "architecture" do
end
it "does not allow a hash" do
- expect { resource.architecture({ :sonic => :screwdriver }) }.to raise_error(ArgumentError)
+ expect { resource.architecture({ sonic: :screwdriver }) }.to raise_error(ArgumentError)
end
it "does not allow an array" do
@@ -195,7 +195,7 @@ describe Chef::Resource::RegistryKey, ":unscrubbed_values" do
let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
it "returns unsafe data as-is" do
- key_values = [ { :name => "poosh", :type => :binary, :data => 255.chr * 1 } ]
+ key_values = [ { name: "poosh", type: :binary, data: 255.chr * 1 } ]
resource.values(key_values)
expect(resource.unscrubbed_values).to eql(key_values)
end
@@ -205,7 +205,7 @@ describe Chef::Resource::RegistryKey, "state" do
let(:resource) { Chef::Resource::RegistryKey.new('HKCU\Software\Raxicoricofallapatorius') }
it "returns scrubbed values" do
- resource.values([ { :name => "poosh", :type => :binary, :data => 255.chr * 1 } ])
- expect(resource.state_for_resource_reporter[:values]).to eql( [{ :name => "poosh", :type => :binary, :data => "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89" }] )
+ resource.values([ { name: "poosh", type: :binary, data: 255.chr * 1 } ])
+ expect(resource.state_for_resource_reporter[:values]).to eql( [{ name: "poosh", type: :binary, data: "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89" }] )
end
end
diff --git a/spec/unit/resource/remote_file_spec.rb b/spec/unit/resource/remote_file_spec.rb
index 581b2dbf6e..39d34d9a96 100644
--- a/spec/unit/resource/remote_file_spec.rb
+++ b/spec/unit/resource/remote_file_spec.rb
@@ -199,8 +199,8 @@ describe Chef::Resource::RemoteFile do
state = resource.state_for_resource_reporter
if Chef::Platform.windows?
puts state
- expect(state[:rights]).to eq([{ :permissions => :read, :principals => "Everyone" }])
- expect(state[:deny_rights]).to eq([{ :permissions => :full_control, :principals => "Clumsy_Sam" }])
+ expect(state[:rights]).to eq([{ permissions: :read, principals: "Everyone" }])
+ expect(state[:deny_rights]).to eq([{ permissions: :full_control, principals: "Clumsy_Sam" }])
else
expect(state[:group]).to eq("pokemon")
expect(state[:mode]).to eq("0664")
diff --git a/spec/unit/resource/resource_notification_spec.rb b/spec/unit/resource/resource_notification_spec.rb
index e141e01fcf..07fd63bb2b 100644
--- a/spec/unit/resource/resource_notification_spec.rb
+++ b/spec/unit/resource/resource_notification_spec.rb
@@ -65,7 +65,7 @@ describe Chef::Resource::Notification do
end
it "resolves a lazy reference to a resource" do
- notification.resource = { :cat => "keyboard_cat" }
+ notification.resource = { cat: "keyboard_cat" }
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
@resource_collection = Chef::ResourceCollection.new
@resource_collection << @keyboard_cat
@@ -78,7 +78,7 @@ describe Chef::Resource::Notification do
it "resolves a lazy reference to its notifying resource" do
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
notification.resource = @keyboard_cat
- notification.notifying_resource = { :cat => "long_cat" }
+ notification.notifying_resource = { cat: "long_cat" }
@long_cat = Chef::Resource::Cat.new("long_cat")
@resource_collection = Chef::ResourceCollection.new
@resource_collection << @long_cat
@@ -87,11 +87,11 @@ describe Chef::Resource::Notification do
end
it "resolves lazy references to both its resource and its notifying resource" do
- notification.resource = { :cat => "keyboard_cat" }
+ notification.resource = { cat: "keyboard_cat" }
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
@resource_collection = Chef::ResourceCollection.new
@resource_collection << @keyboard_cat
- notification.notifying_resource = { :cat => "long_cat" }
+ notification.notifying_resource = { cat: "long_cat" }
@long_cat = Chef::Resource::Cat.new("long_cat")
@resource_collection << @long_cat
notification.resolve_resource_reference(@resource_collection)
@@ -100,7 +100,7 @@ describe Chef::Resource::Notification do
end
it "raises a RuntimeError if you try to reference multiple resources" do
- notification.resource = { :cat => %w{keyboard_cat cheez_cat} }
+ notification.resource = { cat: %w{keyboard_cat cheez_cat} }
@keyboard_cat = Chef::Resource::Cat.new("keyboard_cat")
@cheez_cat = Chef::Resource::Cat.new("cheez_cat")
@resource_collection = Chef::ResourceCollection.new
@@ -112,7 +112,7 @@ describe Chef::Resource::Notification do
end
it "raises a RuntimeError if you try to reference multiple notifying resources" do
- notification.notifying_resource = { :cat => %w{long_cat cheez_cat} }
+ notification.notifying_resource = { cat: %w{long_cat cheez_cat} }
@long_cat = Chef::Resource::Cat.new("long_cat")
@cheez_cat = Chef::Resource::Cat.new("cheez_cat")
@resource_collection = Chef::ResourceCollection.new
@@ -124,7 +124,7 @@ describe Chef::Resource::Notification do
end
it "raises a RuntimeError if it can't find a resource in the resource collection when resolving a lazy reference" do
- notification.resource = { :cat => "keyboard_cat" }
+ notification.resource = { cat: "keyboard_cat" }
@cheez_cat = Chef::Resource::Cat.new("cheez_cat")
@resource_collection = Chef::ResourceCollection.new
@resource_collection << @cheez_cat
@@ -134,7 +134,7 @@ describe Chef::Resource::Notification do
end
it "raises a RuntimeError if it can't find a notifying resource in the resource collection when resolving a lazy reference" do
- notification.notifying_resource = { :cat => "long_cat" }
+ notification.notifying_resource = { cat: "long_cat" }
@cheez_cat = Chef::Resource::Cat.new("cheez_cat")
@resource_collection = Chef::ResourceCollection.new
@resource_collection << @cheez_cat
diff --git a/spec/unit/resource/service_spec.rb b/spec/unit/resource/service_spec.rb
index fc82c19b79..963c2b2d89 100644
--- a/spec/unit/resource/service_spec.rb
+++ b/spec/unit/resource/service_spec.rb
@@ -168,19 +168,19 @@ describe Chef::Resource::Service do
end
it "defaults all the feature support to nil" do
- support_hash = { :status => nil, :restart => nil, :reload => nil }
+ support_hash = { status: nil, restart: nil, reload: nil }
expect(resource.supports).to eq(support_hash)
end
it "allows you to set what features this resource supports as a array" do
support_array = [ :status, :restart ]
- support_hash = { :status => true, :restart => true }
+ support_hash = { status: true, restart: true }
resource.supports(support_array)
expect(resource.supports).to eq(support_hash)
end
it "allows you to set what features this resource supports as a hash" do
- support_hash = { :status => true, :restart => true }
+ support_hash = { status: true, restart: true }
resource.supports(support_hash)
expect(resource.supports).to eq(support_hash)
end
diff --git a/spec/unit/resource/template_spec.rb b/spec/unit/resource/template_spec.rb
index 06469f2f9c..56af50517c 100644
--- a/spec/unit/resource/template_spec.rb
+++ b/spec/unit/resource/template_spec.rb
@@ -64,8 +64,8 @@ describe Chef::Resource::Template do
describe "variables" do
it "accepts a hash for the variable list" do
- resource.variables({ :reluctance => :awkward })
- expect(resource.variables).to eq({ :reluctance => :awkward })
+ resource.variables({ reluctance: :awkward })
+ expect(resource.variables).to eq({ reluctance: :awkward })
end
end
diff --git a/spec/unit/resource/user_spec.rb b/spec/unit/resource/user_spec.rb
index 1c583afc44..2a96c5328d 100644
--- a/spec/unit/resource/user_spec.rb
+++ b/spec/unit/resource/user_spec.rb
@@ -75,7 +75,7 @@ end
end
it "does not allow a hash" do
- expect { resource.send(attrib, { :woot => "i found it" }) }.to raise_error(ArgumentError)
+ expect { resource.send(attrib, { woot: "i found it" }) }.to raise_error(ArgumentError)
end
end
end
@@ -95,7 +95,7 @@ end
end
it "does not allow a hash" do
- expect { resource.send(attrib, { :woot => "i found it" }) }.to raise_error(ArgumentError)
+ expect { resource.send(attrib, { woot: "i found it" }) }.to raise_error(ArgumentError)
end
end
diff --git a/spec/unit/resource/yum_package_spec.rb b/spec/unit/resource/yum_package_spec.rb
index ce289ce45a..d1dc1a3cce 100644
--- a/spec/unit/resource/yum_package_spec.rb
+++ b/spec/unit/resource/yum_package_spec.rb
@@ -90,19 +90,19 @@ describe Chef::Resource::YumPackage, "flush_cache" do
end
it "should default the flush timing to false" do
- flush_hash = { :before => false, :after => false }
+ flush_hash = { before: false, after: false }
expect(@resource.flush_cache).to eq(flush_hash)
end
it "should allow you to set the flush timing with an array" do
flush_array = [ :before, :after ]
- flush_hash = { :before => true, :after => true }
+ flush_hash = { before: true, after: true }
@resource.flush_cache(flush_array)
expect(@resource.flush_cache).to eq(flush_hash)
end
it "should allow you to set the flush timing with a hash" do
- flush_hash = { :before => true, :after => true }
+ flush_hash = { before: true, after: true }
@resource.flush_cache(flush_hash)
expect(@resource.flush_cache).to eq(flush_hash)
end
diff --git a/spec/unit/resource_collection/resource_set_spec.rb b/spec/unit/resource_collection/resource_set_spec.rb
index 9955bc2bea..403be4c566 100644
--- a/spec/unit/resource_collection/resource_set_spec.rb
+++ b/spec/unit/resource_collection/resource_set_spec.rb
@@ -73,25 +73,25 @@ describe Chef::ResourceCollection::ResourceSet do
it "should find a resource by type symbol and name" do
collection.insert_as(zen_master)
- expect(collection.find(:zen_master => zen_master_name)).to equal(zen_master)
+ expect(collection.find(zen_master: zen_master_name)).to equal(zen_master)
end
it "should find a resource by type symbol and array of names" do
collection.insert_as(zen_master)
collection.insert_as(zen_master2)
- check_by_names(collection.find(:zen_master => [zen_master_name, zen_master2_name]), zen_master_name, zen_master2_name)
+ check_by_names(collection.find(zen_master: [zen_master_name, zen_master2_name]), zen_master_name, zen_master2_name)
end
it "should find a resource by type symbol and array of names with custom names" do
collection.insert_as(zen_master, :zzz, "name1")
collection.insert_as(zen_master2, :zzz, "name2")
- check_by_names(collection.find( :zzz => %w{name1 name2}), zen_master_name, zen_master2_name)
+ check_by_names(collection.find( zzz: %w{name1 name2}), zen_master_name, zen_master2_name)
end
it "should find resources of multiple kinds (:zen_master => a, :zen_follower => b)" do
collection.insert_as(zen_master)
collection.insert_as(zen_follower)
- check_by_names(collection.find(:zen_master => [zen_master_name], :zen_follower => [zen_follower_name]),
+ check_by_names(collection.find(zen_master: [zen_master_name], zen_follower: [zen_follower_name]),
zen_master_name, zen_follower_name)
end
@@ -99,7 +99,7 @@ describe Chef::ResourceCollection::ResourceSet do
collection.insert_as(zen_master, :zzz, "name1")
collection.insert_as(zen_master2, :zzz, "name2")
collection.insert_as(zen_follower, :yyy, "name3")
- check_by_names(collection.find(:zzz => %w{name1 name2}, :yyy => ["name3"]),
+ check_by_names(collection.find(zzz: %w{name1 name2}, yyy: ["name3"]),
zen_master_name, zen_follower_name, zen_master2_name)
end
@@ -215,7 +215,7 @@ describe Chef::ResourceCollection::ResourceSet do
end
it "accepts a single-element :resource_type => 'resource_name' Hash" do
- expect(collection.validate_lookup_spec!(:service => "apache2")).to be_truthy
+ expect(collection.validate_lookup_spec!(service: "apache2")).to be_truthy
end
it "accepts a chef resource object" do
diff --git a/spec/unit/resource_collection_spec.rb b/spec/unit/resource_collection_spec.rb
index c696572b13..8dd367b0ec 100644
--- a/spec/unit/resource_collection_spec.rb
+++ b/spec/unit/resource_collection_spec.rb
@@ -65,7 +65,7 @@ describe Chef::ResourceCollection do
end
it "should accept named arguments in any order" do
- rc.insert(resource, :instance_name => "foo", :resource_type => "bar")
+ rc.insert(resource, instance_name: "foo", resource_type: "bar")
expect(rc[0]).to eq(resource)
end
@@ -196,19 +196,19 @@ describe Chef::ResourceCollection do
it "should find a resource by symbol and name (:zen_master => monkey)" do
load_up_resources
- expect(rc.resources(:zen_master => "monkey").name).to eql("monkey")
+ expect(rc.resources(zen_master: "monkey").name).to eql("monkey")
end
it "should find a resource by symbol and array of names (:zen_master => [a,b])" do
load_up_resources
- results = rc.resources(:zen_master => %w{monkey dog})
+ results = rc.resources(zen_master: %w{monkey dog})
expect(results.length).to eql(2)
check_by_names(results, "monkey", "dog")
end
it "should find resources of multiple kinds (:zen_master => a, :file => b)" do
load_up_resources
- results = rc.resources(:zen_master => "monkey", :file => "something")
+ results = rc.resources(zen_master: "monkey", file: "something")
expect(results.length).to eql(2)
check_by_names(results, "monkey", "something")
end
@@ -253,7 +253,7 @@ describe Chef::ResourceCollection do
end
it "accepts a single-element :resource_type => 'resource_name' Hash" do
- expect(rc.validate_lookup_spec!(:service => "apache2")).to be_truthy
+ expect(rc.validate_lookup_spec!(service: "apache2")).to be_truthy
end
it "accepts a chef resource object" do
diff --git a/spec/unit/resource_definition_spec.rb b/spec/unit/resource_definition_spec.rb
index cc19cc7a01..5be3e59009 100644
--- a/spec/unit/resource_definition_spec.rb
+++ b/spec/unit/resource_definition_spec.rb
@@ -66,13 +66,13 @@ describe Chef::ResourceDefinition do
it "should accept a new definition with a hash" do
expect do
- defn.define :smoke, :cigar => "cuban", :cigarette => "marlboro" do
+ defn.define :smoke, cigar: "cuban", cigarette: "marlboro" do
end
end.not_to raise_error
end
it "should expose the prototype hash params in the params hash" do
- defn.define(:smoke, :cigar => "cuban", :cigarette => "marlboro") {}
+ defn.define(:smoke, cigar: "cuban", cigarette: "marlboro") {}
expect(defn.params[:cigar]).to eql("cuban")
expect(defn.params[:cigarette]).to eql("marlboro")
end
diff --git a/spec/unit/resource_reporter_spec.rb b/spec/unit/resource_reporter_spec.rb
index 97a4fe4b30..042b09659c 100644
--- a/spec/unit/resource_reporter_spec.rb
+++ b/spec/unit/resource_reporter_spec.rb
@@ -42,7 +42,7 @@ describe Chef::ResourceReporter do
@new_resource = Chef::Resource::File.new("/tmp/a-file.txt")
@cookbook_name = "monkey"
@new_resource.cookbook_name = @cookbook_name
- @cookbook_version = double("Cookbook::Version", :version => "1.2.3")
+ @cookbook_version = double("Cookbook::Version", version: "1.2.3")
allow(@new_resource).to receive(:cookbook_version).and_return(@cookbook_version)
@current_resource = Chef::Resource::File.new("/tmp/a-file.txt")
@start_time = Time.new
@@ -285,7 +285,7 @@ describe Chef::ResourceReporter do
end
it "resource_command in prepared_run_data should be blank" do
- expect(@first_update_report["after"]).to eq({ :command => "sensitive-resource" })
+ expect(@first_update_report["after"]).to eq({ command: "sensitive-resource" })
end
end
@@ -317,9 +317,9 @@ describe Chef::ResourceReporter do
context "the new_resource name and id are hashes" do
before do
@bad_resource = Chef::Resource::File.new("/tmp/filename_as_hash.txt")
- allow(@bad_resource).to receive(:name).and_return({ :foo => :bar })
- allow(@bad_resource).to receive(:identity).and_return({ :foo => :bar })
- allow(@bad_resource).to receive(:path).and_return({ :foo => :bar })
+ allow(@bad_resource).to receive(:name).and_return({ foo: :bar })
+ allow(@bad_resource).to receive(:identity).and_return({ foo: :bar })
+ allow(@bad_resource).to receive(:path).and_return({ foo: :bar })
@resource_reporter.resource_action_start(@bad_resource, :create)
@resource_reporter.resource_current_state_loaded(@bad_resource, :create, @current_resource)
@resource_reporter.resource_updated(@bad_resource, :create)
@@ -472,7 +472,7 @@ describe Chef::ResourceReporter do
context "when the resource is a RegistryKey with binary data" do
let(:new_resource) do
resource = Chef::Resource::RegistryKey.new('Wubba\Lubba\Dub\Dubs')
- resource.values([ { :name => "rick", :type => :binary, :data => 255.chr * 1 } ])
+ resource.values([ { name: "rick", type: :binary, data: 255.chr * 1 } ])
allow(resource).to receive(:cookbook_name).and_return(@cookbook_name)
allow(resource).to receive(:cookbook_version).and_return(@cookbook_version)
resource
@@ -480,7 +480,7 @@ describe Chef::ResourceReporter do
let(:current_resource) do
resource = Chef::Resource::RegistryKey.new('Wubba\Lubba\Dub\Dubs')
- resource.values([ { :name => "rick", :type => :binary, :data => 255.chr * 1 } ])
+ resource.values([ { name: "rick", type: :binary, data: 255.chr * 1 } ])
resource
end
@@ -617,8 +617,8 @@ describe Chef::ResourceReporter do
@response = Net::HTTPNotFound.new("a response body", "404", "Not Found")
@error = Net::HTTPServerException.new("404 message", @response)
expect(@rest_client).to receive(:post).
- with("reports/nodes/spitfire/runs", { :action => :start, :run_id => @run_id,
- :start_time => @start_time.to_s },
+ with("reports/nodes/spitfire/runs", { action: :start, run_id: @run_id,
+ start_time: @start_time.to_s },
{ "X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION }).
and_raise(@error)
end
@@ -647,7 +647,7 @@ describe Chef::ResourceReporter do
@response = Net::HTTPInternalServerError.new("a response body", "500", "Internal Server Error")
@error = Net::HTTPServerException.new("500 message", @response)
expect(@rest_client).to receive(:post).
- with("reports/nodes/spitfire/runs", { :action => :start, :run_id => @run_id, :start_time => @start_time.to_s },
+ with("reports/nodes/spitfire/runs", { action: :start, run_id: @run_id, start_time: @start_time.to_s },
{ "X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION }).
and_raise(@error)
end
@@ -677,7 +677,7 @@ describe Chef::ResourceReporter do
@response = Net::HTTPInternalServerError.new("a response body", "500", "Internal Server Error")
@error = Net::HTTPServerException.new("500 message", @response)
expect(@rest_client).to receive(:post).
- with("reports/nodes/spitfire/runs", { :action => :start, :run_id => @run_id, :start_time => @start_time.to_s },
+ with("reports/nodes/spitfire/runs", { action: :start, run_id: @run_id, start_time: @start_time.to_s },
{ "X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION }).
and_raise(@error)
end
@@ -698,7 +698,7 @@ describe Chef::ResourceReporter do
before do
response = { "uri" => "https://example.com/reports/nodes/spitfire/runs/@run_id" }
expect(@rest_client).to receive(:post).
- with("reports/nodes/spitfire/runs", { :action => :start, :run_id => @run_id, :start_time => @start_time.to_s },
+ with("reports/nodes/spitfire/runs", { action: :start, run_id: @run_id, start_time: @start_time.to_s },
{ "X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION }).
and_return(response)
@resource_reporter.run_started(@run_status)
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index 26660c9415..28a1e01872 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -230,54 +230,54 @@ describe Chef::Resource do
describe "notifies" do
it "should make notified resources appear in the actions hash" do
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
- resource.notifies :reload, run_context.resource_collection.find(:zen_master => "coffee")
+ resource.notifies :reload, run_context.resource_collection.find(zen_master: "coffee")
expect(resource.delayed_notifications.detect { |e| e.resource.name == "coffee" && e.action == :reload }).not_to be_nil
end
it "should make notified resources be capable of acting immediately" do
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
- resource.notifies :reload, run_context.resource_collection.find(:zen_master => "coffee"), :immediate
+ resource.notifies :reload, run_context.resource_collection.find(zen_master: "coffee"), :immediate
expect(resource.immediate_notifications.detect { |e| e.resource.name == "coffee" && e.action == :reload }).not_to be_nil
end
it "should raise an exception if told to act in other than :delay or :immediate(ly)" do
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
expect do
- resource.notifies :reload, run_context.resource_collection.find(:zen_master => "coffee"), :someday
+ resource.notifies :reload, run_context.resource_collection.find(zen_master: "coffee"), :someday
end.to raise_error(ArgumentError)
end
it "should allow multiple notified resources appear in the actions hash" do
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
- resource.notifies :reload, run_context.resource_collection.find(:zen_master => "coffee")
+ resource.notifies :reload, run_context.resource_collection.find(zen_master: "coffee")
expect(resource.delayed_notifications.detect { |e| e.resource.name == "coffee" && e.action == :reload }).not_to be_nil
run_context.resource_collection << Chef::Resource::ZenMaster.new("beans")
- resource.notifies :reload, run_context.resource_collection.find(:zen_master => "beans")
+ resource.notifies :reload, run_context.resource_collection.find(zen_master: "beans")
expect(resource.delayed_notifications.detect { |e| e.resource.name == "beans" && e.action == :reload }).not_to be_nil
end
it "creates a notification for a resource that is not yet in the resource collection" do
- resource.notifies(:restart, :service => "apache")
- expected_notification = Chef::Resource::Notification.new({ :service => "apache" }, :restart, resource)
+ resource.notifies(:restart, service: "apache")
+ expected_notification = Chef::Resource::Notification.new({ service: "apache" }, :restart, resource)
expect(resource.delayed_notifications).to include(expected_notification)
end
it "notifies another resource immediately" do
- resource.notifies_immediately(:restart, :service => "apache")
- expected_notification = Chef::Resource::Notification.new({ :service => "apache" }, :restart, resource)
+ resource.notifies_immediately(:restart, service: "apache")
+ expected_notification = Chef::Resource::Notification.new({ service: "apache" }, :restart, resource)
expect(resource.immediate_notifications).to include(expected_notification)
end
it "notifies a resource to take action at the end of the chef run" do
- resource.notifies_delayed(:restart, :service => "apache")
- expected_notification = Chef::Resource::Notification.new({ :service => "apache" }, :restart, resource)
+ resource.notifies_delayed(:restart, service: "apache")
+ expected_notification = Chef::Resource::Notification.new({ service: "apache" }, :restart, resource)
expect(resource.delayed_notifications).to include(expected_notification)
end
it "notifies a resource with an array for its name via its prettified string name" do
run_context.resource_collection << Chef::Resource::ZenMaster.new(%w{coffee tea})
- resource.notifies :reload, run_context.resource_collection.find(:zen_master => "coffee, tea")
+ resource.notifies :reload, run_context.resource_collection.find(zen_master: "coffee, tea")
expect(resource.delayed_notifications.detect { |e| e.resource.name == "coffee, tea" && e.action == :reload }).not_to be_nil
end
@@ -302,26 +302,26 @@ describe Chef::Resource do
describe "subscribes" do
it "should make resources appear in the actions hash of subscribed nodes" do
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
- zr = run_context.resource_collection.find(:zen_master => "coffee")
+ zr = run_context.resource_collection.find(zen_master: "coffee")
resource.subscribes :reload, zr
expect(zr.delayed_notifications.detect { |e| e.resource.name == "funk" && e.action == :reload }).not_to be_nil
end
it "should make resources appear in the actions hash of subscribed nodes" do
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
- zr = run_context.resource_collection.find(:zen_master => "coffee")
+ zr = run_context.resource_collection.find(zen_master: "coffee")
resource.subscribes :reload, zr
expect(zr.delayed_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
run_context.resource_collection << Chef::Resource::ZenMaster.new("bean")
- zrb = run_context.resource_collection.find(:zen_master => "bean")
+ zrb = run_context.resource_collection.find(zen_master: "bean")
zrb.subscribes :reload, zr
expect(zr.delayed_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
end
it "should make subscribed resources be capable of acting immediately" do
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
- zr = run_context.resource_collection.find(:zen_master => "coffee")
+ zr = run_context.resource_collection.find(zen_master: "coffee")
resource.subscribes :reload, zr, :immediately
expect(zr.immediate_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
end
@@ -691,8 +691,8 @@ end
it "accepts command options for only_if conditionals" do
expect_any_instance_of(Chef::Resource::Conditional).to receive(:evaluate_command).at_least(1).times
- resource.only_if("true", :cwd => "/tmp")
- expect(resource.only_if.first.command_opts).to eq({ :cwd => "/tmp" })
+ resource.only_if("true", cwd: "/tmp")
+ expect(resource.only_if.first.command_opts).to eq({ cwd: "/tmp" })
resource.run_action(:purr)
end
@@ -715,8 +715,8 @@ end
end
it "accepts command options for not_if conditionals" do
- resource.not_if("pwd" , :cwd => "/tmp")
- expect(resource.not_if.first.command_opts).to eq({ :cwd => "/tmp" })
+ resource.not_if("pwd" , cwd: "/tmp")
+ expect(resource.not_if.first.command_opts).to eq({ cwd: "/tmp" })
end
it "accepts multiple not_if conditionals" do
@@ -951,7 +951,7 @@ end
node.name("bumblebee")
node.automatic[:platform] = "autobots"
node.automatic[:platform_version] = "6.1"
- klz2.provides :dinobot, :platform => ["autobots"]
+ klz2.provides :dinobot, platform: ["autobots"]
Object.const_set("Grimlock", klz2)
klz2.provides :grimlock
end
diff --git a/spec/unit/role_spec.rb b/spec/unit/role_spec.rb
index 1bbbc4c7b0..9c8900d464 100644
--- a/spec/unit/role_spec.rb
+++ b/spec/unit/role_spec.rb
@@ -104,12 +104,12 @@ describe Chef::Role do
describe "default_attributes" do
it "should let you set the default attributes hash explicitly" do
- expect(@role.default_attributes({ :one => "two" })).to eq({ :one => "two" })
+ expect(@role.default_attributes({ one: "two" })).to eq({ one: "two" })
end
it "should let you return the default attributes hash" do
- @role.default_attributes({ :one => "two" })
- expect(@role.default_attributes).to eq({ :one => "two" })
+ @role.default_attributes({ one: "two" })
+ expect(@role.default_attributes).to eq({ one: "two" })
end
it "should throw an ArgumentError if we aren't a kind of hash" do
@@ -119,12 +119,12 @@ describe Chef::Role do
describe "override_attributes" do
it "should let you set the override attributes hash explicitly" do
- expect(@role.override_attributes({ :one => "two" })).to eq({ :one => "two" })
+ expect(@role.override_attributes({ one: "two" })).to eq({ one: "two" })
end
it "should let you return the override attributes hash" do
- @role.override_attributes({ :one => "two" })
- expect(@role.override_attributes).to eq({ :one => "two" })
+ @role.override_attributes({ one: "two" })
+ expect(@role.override_attributes).to eq({ one: "two" })
end
it "should throw an ArgumentError if we aren't a kind of hash" do
@@ -137,15 +137,15 @@ describe Chef::Role do
@role.name("mars_volta")
@role.description("Great band!")
@role.run_list("one", "two", "role[a]")
- @role.default_attributes({ :el_groupo => "nuevo" })
- @role.override_attributes({ :deloused => "in the comatorium" })
+ @role.default_attributes({ el_groupo: "nuevo" })
+ @role.override_attributes({ deloused: "in the comatorium" })
@example = Chef::Role.new
@example.name("newname")
@example.description("Really Great band!")
@example.run_list("alpha", "bravo", "role[alpha]")
- @example.default_attributes({ :el_groupo => "nuevo dos" })
- @example.override_attributes({ :deloused => "in the comatorium XOXO" })
+ @example.default_attributes({ el_groupo: "nuevo dos" })
+ @example.override_attributes({ deloused: "in the comatorium XOXO" })
end
it "should update all fields except for name" do
@@ -158,13 +158,13 @@ describe Chef::Role do
end
end
- describe "when serialized as JSON", :json => true do
+ describe "when serialized as JSON", json: true do
before(:each) do
@role.name("mars_volta")
@role.description("Great band!")
@role.run_list("one", "two", "role[a]")
- @role.default_attributes({ :el_groupo => "nuevo" })
- @role.override_attributes({ :deloused => "in the comatorium" })
+ @role.default_attributes({ el_groupo: "nuevo" })
+ @role.override_attributes({ deloused: "in the comatorium" })
@serialized_role = Chef::JSONCompat.to_json(@role)
end
@@ -197,7 +197,7 @@ describe Chef::Role do
describe "and it has per-environment run lists" do
before do
@role.env_run_lists("_default" => ["one", "two", "role[a]"], "production" => ["role[monitoring]", "role[auditing]", "role[apache]"], "dev" => ["role[nginx]"])
- @serialized_role = Chef::JSONCompat.parse(Chef::JSONCompat.to_json(@role), :create_additions => false)
+ @serialized_role = Chef::JSONCompat.parse(Chef::JSONCompat.to_json(@role), create_additions: false)
end
it "includes the per-environment run lists" do
@@ -218,7 +218,7 @@ describe Chef::Role do
end
end
- describe "when created from JSON", :json => true do
+ describe "when created from JSON", json: true do
before(:each) do
@role.name("mars_volta")
@role.description("Great band!")
diff --git a/spec/unit/run_context_spec.rb b/spec/unit/run_context_spec.rb
index f1c3072b8e..bfef3f8836 100644
--- a/spec/unit/run_context_spec.rb
+++ b/spec/unit/run_context_spec.rb
@@ -184,7 +184,7 @@ describe Chef::RunContext do
describe "handling reboot requests" do
let(:expected) do
- { :reason => "spec tests require a reboot" }
+ { reason: "spec tests require a reboot" }
end
it "stores and deletes the reboot request" do
diff --git a/spec/unit/run_list/run_list_item_spec.rb b/spec/unit/run_list/run_list_item_spec.rb
index 3f8fd2ab3b..b57a7dcd53 100644
--- a/spec/unit/run_list/run_list_item_spec.rb
+++ b/spec/unit/run_list/run_list_item_spec.rb
@@ -22,15 +22,15 @@ describe Chef::RunList::RunListItem do
describe "when creating from a Hash" do
it "raises an exception when the hash doesn't have a :type key" do
- expect { Chef::RunList::RunListItem.new(:name => "tatft") }.to raise_error(ArgumentError)
+ expect { Chef::RunList::RunListItem.new(name: "tatft") }.to raise_error(ArgumentError)
end
it "raises an exception when the hash doesn't have an :name key" do
- expect { Chef::RunList::RunListItem.new(:type => "R") }.to raise_error(ArgumentError)
+ expect { Chef::RunList::RunListItem.new(type: "R") }.to raise_error(ArgumentError)
end
it "sets the name and type as given in the hash" do
- item = Chef::RunList::RunListItem.new(:type => "fuuu", :name => "uuuu")
+ item = Chef::RunList::RunListItem.new(type: "fuuu", name: "uuuu")
expect(item.to_s).to eq("fuuu[uuuu]")
end
diff --git a/spec/unit/run_list/versioned_recipe_list_spec.rb b/spec/unit/run_list/versioned_recipe_list_spec.rb
index 859fee75ec..e116ffc130 100644
--- a/spec/unit/run_list/versioned_recipe_list_spec.rb
+++ b/spec/unit/run_list/versioned_recipe_list_spec.rb
@@ -54,25 +54,25 @@ describe Chef::RunList::VersionedRecipeList do
it "should allow you to specify a version" do
list.add_recipe "rails", "1.0.0"
expect(list).to eq(%w{apt god apache2 rails})
- expect(list.with_versions).to include({ :name => "rails", :version => "1.0.0" })
+ expect(list.with_versions).to include({ name: "rails", version: "1.0.0" })
end
it "should allow you to specify a version for a recipe that already exists" do
list.add_recipe "apt", "1.2.3"
expect(list).to eq(%w{apt god apache2})
- expect(list.with_versions).to include({ :name => "apt", :version => "1.2.3" })
+ expect(list.with_versions).to include({ name: "apt", version: "1.2.3" })
end
it "should allow you to specify the same version of a recipe twice" do
list.add_recipe "rails", "1.0.0"
list.add_recipe "rails", "1.0.0"
- expect(list.with_versions).to include({ :name => "rails", :version => "1.0.0" })
+ expect(list.with_versions).to include({ name: "rails", version: "1.0.0" })
end
it "should allow you to spcify no version, even when a version already exists" do
list.add_recipe "rails", "1.0.0"
list.add_recipe "rails"
- expect(list.with_versions).to include({ :name => "rails", :version => "1.0.0" })
+ expect(list.with_versions).to include({ name: "rails", version: "1.0.0" })
end
it "should not allow multiple versions of the same recipe" do
@@ -85,9 +85,9 @@ describe Chef::RunList::VersionedRecipeList do
let(:versioned_recipes) do
[
- { :name => "apt", :version => "1.0.0" },
- { :name => "god", :version => nil },
- { :name => "apache2", :version => "0.0.1" },
+ { name: "apt", version: "1.0.0" },
+ { name: "god", version: nil },
+ { name: "apache2", version: "0.0.1" },
]
end
it "should return an array of hashes with :name and :version" do
@@ -106,9 +106,9 @@ describe Chef::RunList::VersionedRecipeList do
let(:versioned_recipes) do
[
- { :name => "apt", :version => "~> 1.2.0" },
- { :name => "god", :version => nil },
- { :name => "apache2", :version => "0.0.1" },
+ { name: "apt", version: "~> 1.2.0" },
+ { name: "god", version: nil },
+ { name: "apache2", version: "0.0.1" },
]
end
@@ -151,7 +151,7 @@ describe Chef::RunList::VersionedRecipeList do
let(:versioned_recipes) do
[
- { :name => "apt", :version => "~> 1.2.0" },
+ { name: "apt", version: "~> 1.2.0" },
]
end
@@ -170,7 +170,7 @@ describe Chef::RunList::VersionedRecipeList do
let(:versioned_recipes) do
[
- { :name => "apt::cacher", :version => "~> 1.2.0" },
+ { name: "apt::cacher", version: "~> 1.2.0" },
]
end
diff --git a/spec/unit/run_list_spec.rb b/spec/unit/run_list_spec.rb
index 0dcd349ced..6117a89ca7 100644
--- a/spec/unit/run_list_spec.rb
+++ b/spec/unit/run_list_spec.rb
@@ -170,12 +170,12 @@ describe Chef::RunList do
@role = Chef::Role.new
@role.name "stubby"
@role.run_list "one", "two"
- @role.default_attributes :one => :two
- @role.override_attributes :three => :four
+ @role.default_attributes one: :two
+ @role.override_attributes three: :four
@role.env_run_list["production"] = Chef::RunList.new( "one", "two", "five")
allow(Chef::Role).to receive(:load).and_return(@role)
- @rest = double("Chef::ServerAPI", { :get => @role.to_hash, :url => "/" })
+ @rest = double("Chef::ServerAPI", { get: @role.to_hash, url: "/" })
allow(Chef::ServerAPI).to receive(:new).and_return(@rest)
@run_list << "role[stubby]"
@@ -263,7 +263,7 @@ describe Chef::RunList do
it "should recurse into a child role" do
dog = Chef::Role.new
dog.name "dog"
- dog.default_attributes :seven => :nine
+ dog.default_attributes seven: :nine
dog.run_list "three"
@role.run_list << "role[dog]"
allow(Chef::Role).to receive(:from_disk).with("stubby").and_return(@role)
@@ -277,7 +277,7 @@ describe Chef::RunList do
it "should not recurse infinitely" do
dog = Chef::Role.new
dog.name "dog"
- dog.default_attributes :seven => :nine
+ dog.default_attributes seven: :nine
dog.run_list "role[dog]", "three"
@role.run_list << "role[dog]"
allow(Chef::Role).to receive(:from_disk).with("stubby").and_return(@role)
diff --git a/spec/unit/scan_access_control_spec.rb b/spec/unit/scan_access_control_spec.rb
index c747f6cc4a..ec3c088b48 100644
--- a/spec/unit/scan_access_control_spec.rb
+++ b/spec/unit/scan_access_control_spec.rb
@@ -49,7 +49,7 @@ describe Chef::ScanAccessControl do
describe "when the fs entity exists" do
before do
- @stat = double("File::Stat for #{@new_resource.path}", :uid => 0, :gid => 0, :mode => 00100644)
+ @stat = double("File::Stat for #{@new_resource.path}", uid: 0, gid: 0, mode: 00100644)
expect(File).to receive(:realpath).with(@new_resource.path).and_return(@real_file)
expect(File).to receive(:stat).with(@real_file).and_return(@stat)
expect(File).to receive(:exist?).with(@new_resource.path).and_return(true)
@@ -128,7 +128,7 @@ describe Chef::ScanAccessControl do
end
it "sets the owner of current_resource to the username of the current owner" do
- @root_passwd = double("Struct::Passwd for uid 0", :name => "root")
+ @root_passwd = double("Struct::Passwd for uid 0", name: "root")
expect(Etc).to receive(:getpwuid).with(0).and_return(@root_passwd)
@scanner.set_all!
@@ -163,7 +163,7 @@ describe Chef::ScanAccessControl do
end
it "sets the group of the current resource to the group name" do
- @group_entry = double("Struct::Group for wheel", :name => "wheel")
+ @group_entry = double("Struct::Group for wheel", name: "wheel")
expect(Etc).to receive(:getgrgid).with(0).and_return(@group_entry)
@scanner.set_all!
diff --git a/spec/unit/shell/model_wrapper_spec.rb b/spec/unit/shell/model_wrapper_spec.rb
index 00425f2a01..bcce7c1a08 100644
--- a/spec/unit/shell/model_wrapper_spec.rb
+++ b/spec/unit/shell/model_wrapper_spec.rb
@@ -21,13 +21,13 @@ require "ostruct"
describe Shell::ModelWrapper do
before do
- @model = OpenStruct.new(:name => "Chef::Node")
+ @model = OpenStruct.new(name: "Chef::Node")
@wrapper = Shell::ModelWrapper.new(@model)
end
describe "when created with an explicit model_symbol" do
before do
- @model = OpenStruct.new(:name => "Chef::ApiClient")
+ @model = OpenStruct.new(name: "Chef::ApiClient")
@wrapper = Shell::ModelWrapper.new(@model, :client)
end
@@ -46,7 +46,7 @@ describe Shell::ModelWrapper do
@node_1.name("sammich")
@node_2 = Chef::Node.new
@node_2.name("yummy")
- @server_response = { :node_1 => @node_1, :node_2 => @node_2 }
+ @server_response = { node_1: @node_1, node_2: @node_2 }
@wrapper = Shell::ModelWrapper.new(Chef::Node)
allow(Chef::Node).to receive(:list).and_return(@server_response)
end
@@ -67,7 +67,7 @@ describe Shell::ModelWrapper do
@node_1.name("sammich")
@node_2 = Chef::Node.new
@node_2.name("yummy")
- @server_response = { :node_1 => @node_1, :node_2 => @node_2 }
+ @server_response = { node_1: @node_1, node_2: @node_2 }
@wrapper = Shell::ModelWrapper.new(Chef::Node)
# Creating a Chef::Search::Query object tries to read the private key...
diff --git a/spec/unit/shell/shell_ext_spec.rb b/spec/unit/shell/shell_ext_spec.rb
index 0afa1f6390..7ddacf8476 100644
--- a/spec/unit/shell/shell_ext_spec.rb
+++ b/spec/unit/shell/shell_ext_spec.rb
@@ -34,8 +34,8 @@ describe Shell::Extensions do
it "finds a subsession in irb for an object" do
target_context_obj = Chef::Node.new
- irb_context = double("context", :main => target_context_obj)
- irb_session = double("irb session", :context => irb_context)
+ irb_context = double("context", main: target_context_obj)
+ irb_session = double("irb session", context: irb_context)
@job_manager.jobs = [[:thread, irb_session]]
allow(@root_context).to receive(:jobs).and_return(@job_manager)
@root_context.ensure_session_select_defined
@@ -92,9 +92,9 @@ describe Shell::Extensions do
end
it "prints node attributes" do
- node = double("node", :attribute => { :foo => :bar })
+ node = double("node", attribute: { foo: :bar })
@shell_client.node = node
- expect(@root_context).to receive(:pp).with({ :foo => :bar })
+ expect(@root_context).to receive(:pp).with({ foo: :bar })
@root_context.ohai
expect(@root_context).to receive(:pp).with(:bar)
@root_context.ohai(:foo)
diff --git a/spec/unit/shell/shell_session_spec.rb b/spec/unit/shell/shell_session_spec.rb
index c96453eeae..c4cb7c6815 100644
--- a/spec/unit/shell/shell_session_spec.rb
+++ b/spec/unit/shell/shell_session_spec.rb
@@ -53,16 +53,16 @@ describe Shell::ClientSession do
let(:session) { Shell::ClientSession.instance }
let(:client) do
double("Chef::Client.new",
- :run_ohai => true,
- :load_node => true,
- :build_node => true,
- :register => true,
- :sync_cookbooks => {}
+ run_ohai: true,
+ load_node: true,
+ build_node: true,
+ register: true,
+ sync_cookbooks: {}
)
end
before do
- Chef::Config[:shell_config] = { :override_runlist => [Chef::RunList::RunListItem.new("shell::override")] }
+ Chef::Config[:shell_config] = { override_runlist: [Chef::RunList::RunListItem.new("shell::override")] }
session.node = node
session.json_configuration = json_attribs
end
@@ -90,16 +90,16 @@ describe Shell::SoloSession do
let(:session) { Shell::SoloSession.instance }
let(:client) do
double("Chef::Client.new",
- :run_ohai => true,
- :load_node => true,
- :build_node => true,
- :register => true,
- :sync_cookbooks => {}
+ run_ohai: true,
+ load_node: true,
+ build_node: true,
+ register: true,
+ sync_cookbooks: {}
)
end
before do
- Chef::Config[:shell_config] = { :override_runlist => [Chef::RunList::RunListItem.new("shell::override")] }
+ Chef::Config[:shell_config] = { override_runlist: [Chef::RunList::RunListItem.new("shell::override")] }
session.node = node
session.json_configuration = json_attribs
end
@@ -128,18 +128,18 @@ describe Shell::StandAloneSession do
let(:session) { Shell::StandAloneSession.instance }
let(:client) do
double("Chef::Client.new",
- :run_ohai => true,
- :load_node => true,
- :build_node => true,
- :register => true,
- :sync_cookbooks => {}
+ run_ohai: true,
+ load_node: true,
+ build_node: true,
+ register: true,
+ sync_cookbooks: {}
)
end
let(:recipe) { Chef::Recipe.new(nil, nil, run_context) }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
before do
- Chef::Config[:shell_config] = { :override_runlist => [Chef::RunList::RunListItem.new("shell::override")] }
+ Chef::Config[:shell_config] = { override_runlist: [Chef::RunList::RunListItem.new("shell::override")] }
session.node = node
session.json_configuration = json_attribs
session.run_context = run_context
@@ -166,7 +166,7 @@ describe Shell::StandAloneSession do
it "runs chef with the standalone recipe" do
allow(session).to receive(:node_built?).and_return(true)
allow(Chef::Log).to receive(:level)
- chef_runner = double("Chef::Runner.new", :converge => :converged)
+ chef_runner = double("Chef::Runner.new", converge: :converged)
# pre-heat resource collection cache
session.resource_collection
@@ -185,7 +185,7 @@ describe Shell::SoloLegacySession do
let(:json_attribs) { { "a" => "b" } }
before do
- Chef::Config[:shell_config] = { :override_runlist => [Chef::RunList::RunListItem.new("shell::override")] }
+ Chef::Config[:shell_config] = { override_runlist: [Chef::RunList::RunListItem.new("shell::override")] }
Chef::Config[:shell_solo] = true
@session = Shell::SoloLegacySession.instance
@node = Chef::Node.new
@@ -229,7 +229,7 @@ describe Shell::SoloLegacySession do
it "runs chef with a resource collection from the compiled cookbooks" do
allow(@session).to receive(:node_built?).and_return(true)
- chef_runner = double("Chef::Runner.new", :converge => :converged)
+ chef_runner = double("Chef::Runner.new", converge: :converged)
expect(Chef::Runner).to receive(:new).with(an_instance_of(Chef::RunContext)).and_return(chef_runner)
expect(@recipe.run_chef).to eq(:converged)
@@ -237,11 +237,11 @@ describe Shell::SoloLegacySession do
it "passes the shell CLI args to the client" do
@client = double("Chef::Client.new",
- :run_ohai => true,
- :load_node => true,
- :build_node => true,
- :register => true,
- :sync_cookbooks => {})
+ run_ohai: true,
+ load_node: true,
+ build_node: true,
+ register: true,
+ sync_cookbooks: {})
expect(Chef::Client).to receive(:new).with(json_attribs, Chef::Config[:shell_config]).and_return(@client)
@session.json_configuration = json_attribs
@session.send(:rebuild_node)
diff --git a/spec/unit/user_spec.rb b/spec/unit/user_spec.rb
index 10a79f6c8a..48dbf010e9 100644
--- a/spec/unit/user_spec.rb
+++ b/spec/unit/user_spec.rb
@@ -243,7 +243,7 @@ describe Chef::User do
describe "create" do
it "creates a new user via the API" do
@user.password "password"
- expect(@http_client).to receive(:post).with("users", { :name => "foobar", :admin => false, :password => "password" }).and_return({})
+ expect(@http_client).to receive(:post).with("users", { name: "foobar", admin: false, password: "password" }).and_return({})
@user.create
end
end
@@ -260,7 +260,7 @@ describe Chef::User do
describe "update" do
it "updates an existing user on via the API" do
- expect(@http_client).to receive(:put).with("users/foobar", { :name => "foobar", :admin => false }).and_return({})
+ expect(@http_client).to receive(:put).with("users/foobar", { name: "foobar", admin: false }).and_return({})
@user.update
end
end
diff --git a/spec/unit/user_v1_spec.rb b/spec/unit/user_v1_spec.rb
index 16f0d0158b..074a68840e 100644
--- a/spec/unit/user_v1_spec.rb
+++ b/spec/unit/user_v1_spec.rb
@@ -311,7 +311,7 @@ describe Chef::UserV1 do
end
describe "Versioned API Interactions" do
- let(:response_406) { OpenStruct.new(:code => "406") }
+ let(:response_406) { OpenStruct.new(code: "406") }
let(:exception_406) { Net::HTTPServerException.new("406 Not Acceptable", response_406) }
before (:each) do
@@ -334,13 +334,13 @@ describe Chef::UserV1 do
let(:payload) do
{
- :username => "some_username",
- :display_name => "some_display_name",
- :first_name => "some_first_name",
- :middle_name => "some_middle_name",
- :last_name => "some_last_name",
- :email => "some_email",
- :password => "some_password",
+ username: "some_username",
+ display_name: "some_display_name",
+ first_name: "some_first_name",
+ middle_name: "some_middle_name",
+ last_name: "some_last_name",
+ email: "some_email",
+ password: "some_password",
}
end
@@ -356,14 +356,14 @@ describe Chef::UserV1 do
context "when server API V1 is not valid on the Chef Server receiving the request" do
let(:payload) do
{
- :username => "some_username",
- :display_name => "some_display_name",
- :first_name => "some_first_name",
- :middle_name => "some_middle_name",
- :last_name => "some_last_name",
- :email => "some_email",
- :password => "some_password",
- :public_key => "some_public_key",
+ username: "some_username",
+ display_name: "some_display_name",
+ first_name: "some_first_name",
+ middle_name: "some_middle_name",
+ last_name: "some_last_name",
+ email: "some_email",
+ password: "some_password",
+ public_key: "some_public_key",
}
end
@@ -373,7 +373,7 @@ describe Chef::UserV1 do
end
context "when the server returns a 400" do
- let(:response_400) { OpenStruct.new(:code => "400") }
+ let(:response_400) { OpenStruct.new(code: "400") }
let(:exception_400) { Net::HTTPServerException.new("400 Bad Request", response_400) }
context "when the 400 was due to public / private key fields no longer being supported" do
@@ -444,12 +444,12 @@ describe Chef::UserV1 do
describe "create" do
let(:payload) do
{
- :username => "some_username",
- :display_name => "some_display_name",
- :first_name => "some_first_name",
- :last_name => "some_last_name",
- :email => "some_email",
- :password => "some_password",
+ username: "some_username",
+ display_name: "some_display_name",
+ first_name: "some_first_name",
+ last_name: "some_last_name",
+ email: "some_email",
+ password: "some_password",
}
end
before do
@@ -473,7 +473,7 @@ describe Chef::UserV1 do
context "when handling API V1" do
it "creates a new user via the API with a middle_name when it exists" do
@user.middle_name "some_middle_name"
- expect(@user.chef_root_rest_v1).to receive(:post).with("users", payload.merge({ :middle_name => "some_middle_name" })).and_return({})
+ expect(@user.chef_root_rest_v1).to receive(:post).with("users", payload.merge({ middle_name: "some_middle_name" })).and_return({})
@user.create
end
end # when server API V1 is valid on the Chef Server receiving the request
@@ -496,7 +496,7 @@ describe Chef::UserV1 do
it "creates a new user via the API with a middle_name when it exists" do
@user.middle_name "some_middle_name"
- expect(@user.chef_root_rest_v0).to receive(:post).with("users", payload.merge({ :middle_name => "some_middle_name" })).and_return({})
+ expect(@user.chef_root_rest_v0).to receive(:post).with("users", payload.merge({ middle_name: "some_middle_name" })).and_return({})
@user.create
end
end # when server API V1 is not valid on the Chef Server receiving the request
diff --git a/spec/unit/util/diff_spec.rb b/spec/unit/util/diff_spec.rb
index 4bb0abd087..70376bcdb1 100644
--- a/spec/unit/util/diff_spec.rb
+++ b/spec/unit/util/diff_spec.rb
@@ -546,7 +546,7 @@ shared_examples_for "a diff util" do
end
-describe Chef::Util::Diff, :uses_diff => true do
+describe Chef::Util::Diff, uses_diff: true do
let!(:old_file) { old_tempfile.path }
let!(:new_file) { new_tempfile.path }
diff --git a/spec/unit/util/dsc/configuration_generator_spec.rb b/spec/unit/util/dsc/configuration_generator_spec.rb
index cfa7a4e264..faf554326d 100644
--- a/spec/unit/util/dsc/configuration_generator_spec.rb
+++ b/spec/unit/util/dsc/configuration_generator_spec.rb
@@ -76,7 +76,7 @@ describe Chef::Util::DSC::ConfigurationGenerator do
context "when symbols are used as switches" do
it "should merge the hash if there are no restricted switches" do
- merged = conf_man.send(:get_merged_configuration_flags!, { :flag => "a" }, "hello")
+ merged = conf_man.send(:get_merged_configuration_flags!, { flag: "a" }, "hello")
expect(merged).to include(:flag)
expect(merged[:flag]).to eql("a")
expect(merged).to include(:outputpath)
@@ -84,18 +84,18 @@ describe Chef::Util::DSC::ConfigurationGenerator do
it "should raise an ArgumentError if you try to override outputpath" do
expect do
- conf_man.send(:get_merged_configuration_flags!, { :outputpath => "a" }, "hello")
+ conf_man.send(:get_merged_configuration_flags!, { outputpath: "a" }, "hello")
end.to raise_error(ArgumentError)
end
it "should be case insensitive for switches that are not allowed" do
expect do
- conf_man.send(:get_merged_configuration_flags!, { :OutputPath => "a" }, "hello")
+ conf_man.send(:get_merged_configuration_flags!, { OutputPath: "a" }, "hello")
end.to raise_error(ArgumentError)
end
it "should be case insensitive to switches that are allowed" do
- merged = conf_man.send(:get_merged_configuration_flags!, { :FLAG => "a" }, "hello")
+ merged = conf_man.send(:get_merged_configuration_flags!, { FLAG: "a" }, "hello")
expect(merged).to include(:flag)
end
end
diff --git a/spec/unit/util/dsc/local_configuration_manager_spec.rb b/spec/unit/util/dsc/local_configuration_manager_spec.rb
index 4c33fc8616..33c618f2eb 100644
--- a/spec/unit/util/dsc/local_configuration_manager_spec.rb
+++ b/spec/unit/util/dsc/local_configuration_manager_spec.rb
@@ -50,7 +50,7 @@ EOH
end
let(:lcm_status) do
- double("LCM cmdlet status", :stderr => lcm_standard_error, :return_value => lcm_standard_output, :succeeded? => lcm_cmdlet_success)
+ double("LCM cmdlet status", stderr: lcm_standard_error, return_value: lcm_standard_output, succeeded?: lcm_cmdlet_success)
end
describe "test_configuration method invocation" do
@@ -192,7 +192,7 @@ EOH
context "when invalid dsc script is given" do
it "raises exception" do
configuration_document = "invalid-config"
- shellout_flags = { :cwd => nil, :environment => nil, :timeout => nil }
+ shellout_flags = { cwd: nil, environment: nil, timeout: nil }
expect { lcm.send(:run_configuration_cmdlet, configuration_document, true, shellout_flags) }.to raise_error(Chef::Exceptions::PowershellCmdletException)
end
end
diff --git a/spec/unit/util/powershell/cmdlet_spec.rb b/spec/unit/util/powershell/cmdlet_spec.rb
index 800e4cc9c0..144e363979 100644
--- a/spec/unit/util/powershell/cmdlet_spec.rb
+++ b/spec/unit/util/powershell/cmdlet_spec.rb
@@ -75,7 +75,7 @@ describe Chef::Util::Powershell::Cmdlet do
it "does not allow invalid switch names" do
expect do
- @cmdlet.send(:command_switches_string, { :foo! => "bar" })
+ @cmdlet.send(:command_switches_string, { foo!: "bar" })
end.to raise_error(ArgumentError)
end
diff --git a/spec/unit/util/selinux_spec.rb b/spec/unit/util/selinux_spec.rb
index 8da6492fae..0d2d1aeb3f 100644
--- a/spec/unit/util/selinux_spec.rb
+++ b/spec/unit/util/selinux_spec.rb
@@ -60,8 +60,8 @@ describe Chef::Util::Selinux do
describe "when selinux is enabled" do
before do
- cmd_result = double("Cmd Result", :exitstatus => 0)
- expect(@test_instance).to receive(:shell_out!).once.with(@selinux_enabled_path, { :returns => [0, 1] }).and_return(cmd_result)
+ cmd_result = double("Cmd Result", exitstatus: 0)
+ expect(@test_instance).to receive(:shell_out!).once.with(@selinux_enabled_path, { returns: [0, 1] }).and_return(cmd_result)
end
it "should report selinux is enabled" do
@@ -73,8 +73,8 @@ describe Chef::Util::Selinux do
describe "when selinux is disabled" do
before do
- cmd_result = double("Cmd Result", :exitstatus => 1)
- expect(@test_instance).to receive(:shell_out!).once.with(@selinux_enabled_path, { :returns => [0, 1] }).and_return(cmd_result)
+ cmd_result = double("Cmd Result", exitstatus: 1)
+ expect(@test_instance).to receive(:shell_out!).once.with(@selinux_enabled_path, { returns: [0, 1] }).and_return(cmd_result)
end
it "should report selinux is disabled" do
@@ -86,8 +86,8 @@ describe Chef::Util::Selinux do
describe "when selinux gives an unexpected status" do
before do
- cmd_result = double("Cmd Result", :exitstatus => 101)
- expect(@test_instance).to receive(:shell_out!).once.with(@selinux_enabled_path, { :returns => [0, 1] }).and_return(cmd_result)
+ cmd_result = double("Cmd Result", exitstatus: 101)
+ expect(@test_instance).to receive(:shell_out!).once.with(@selinux_enabled_path, { returns: [0, 1] }).and_return(cmd_result)
end
it "should throw an error" do
diff --git a/spec/unit/win32/registry_spec.rb b/spec/unit/win32/registry_spec.rb
index 1523ac1919..c880c8922a 100644
--- a/spec/unit/win32/registry_spec.rb
+++ b/spec/unit/win32/registry_spec.rb
@@ -21,8 +21,8 @@ require "spec_helper"
describe Chef::Win32::Registry do
include_context "Win32"
- let(:value1) { { :name => "one", :type => :string, :data => "1" } }
- let(:value1_upcase_name) { { :name => "ONE", :type => :string, :data => "1" } }
+ let(:value1) { { name: "one", type: :string, data: "1" } }
+ let(:value1_upcase_name) { { name: "ONE", type: :string, data: "1" } }
let(:key_path) { 'HKCU\Software\OpscodeNumbers' }
let(:key) { 'Software\OpscodeNumbers' }
let(:key_parent) { "Software" }
diff --git a/spec/unit/windows_service_spec.rb b/spec/unit/windows_service_spec.rb
index 71e01a0b6b..45af0f9d9f 100644
--- a/spec/unit/windows_service_spec.rb
+++ b/spec/unit/windows_service_spec.rb
@@ -32,8 +32,8 @@ describe "Chef::Application::WindowsService", :windows_only do
let(:timeout) { 7200 }
let(:shellout_options) do
{
- :timeout => timeout,
- :logger => Chef::Log,
+ timeout: timeout,
+ logger: Chef::Log,
}
end
diff --git a/tasks/cbgb.rb b/tasks/cbgb.rb
index 09363b42d2..801739a6af 100644
--- a/tasks/cbgb.rb
+++ b/tasks/cbgb.rb
@@ -25,7 +25,7 @@ CBGB_TARGET = File.join(File.dirname(__FILE__), "..", "CBGB.md")
begin
require "tomlrb"
- task :default => :generate
+ task default: :generate
namespace :cbgb do
desc "Generate MarkDown version of CBGB file"
diff --git a/tasks/dependencies.rb b/tasks/dependencies.rb
index 93b357af82..12beab9808 100644
--- a/tasks/dependencies.rb
+++ b/tasks/dependencies.rb
@@ -37,7 +37,7 @@ namespace :dependencies do
# Update all dependencies to the latest constraint-matching version
desc "Update all dependencies. dependencies:update to update as little as possible (CI-only)."
- task :update_ci => %w{
+ task update_ci: %w{
dependencies:update_gemfile_lock
dependencies:update_omnibus_gemfile_lock
dependencies:update_audit_tests_berksfile_lock
@@ -87,6 +87,6 @@ namespace :dependencies do
end
desc "Update all dependencies and check for outdated gems."
-task :dependencies_ci => [ "dependencies:update_ci" ]
-task :dependencies => [ "dependencies:update" ]
-task :update => [ "dependencies:update" ]
+task dependencies_ci: [ "dependencies:update_ci" ]
+task dependencies: [ "dependencies:update" ]
+task update: [ "dependencies:update" ]
diff --git a/tasks/maintainers.rb b/tasks/maintainers.rb
index d2fc482a28..1adac47ecc 100644
--- a/tasks/maintainers.rb
+++ b/tasks/maintainers.rb
@@ -33,7 +33,7 @@ begin
require "pp"
namespace :maintainers do
- task :default => :generate
+ task default: :generate
desc "Generate MarkDown version of MAINTAINERS file"
task :generate do
@@ -63,7 +63,7 @@ begin
end
def github
- @github ||= Octokit::Client.new(:netrc => true)
+ @github ||= Octokit::Client.new(netrc: true)
end
def source
diff --git a/tasks/rspec.rb b/tasks/rspec.rb
index 848c50eb40..afd7d12705 100644
--- a/tasks/rspec.rb
+++ b/tasks/rspec.rb
@@ -35,9 +35,9 @@ begin
end
end
- task :default => :spec
+ task default: :spec
- task :spec => :component_specs
+ task spec: :component_specs
desc "Run standard specs (minus long running specs)"
RSpec::Core::RakeTask.new(:spec) do |t|