summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-01-14 14:08:03 +0000
committerThom May <thom@chef.io>2016-01-14 14:08:03 +0000
commit51cfbdc4d16739caac4d946fadbe678444aafe34 (patch)
tree56dfd8f1cd9fd933de27268b32402e955a43ac2b
parent05064423057d4cf46f4713b81b08829cf6d20af6 (diff)
downloadchef-51cfbdc4d16739caac4d946fadbe678444aafe34.tar.gz
Use double quotes by default
This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
-rw-r--r--.rubocop.yml2
-rw-r--r--Gemfile12
-rw-r--r--Rakefile28
-rw-r--r--acceptance/Gemfile18
-rw-r--r--acceptance/trivial/test/integration/chef-current-install/inspec/chef_client_spec.rb2
-rwxr-xr-xbin/chef-apply4
-rwxr-xr-xbin/chef-client6
-rwxr-xr-xbin/chef-service-manager10
-rwxr-xr-xbin/chef-shell2
-rwxr-xr-xbin/chef-solo4
-rwxr-xr-xbin/chef-windows-service6
-rwxr-xr-xbin/knife4
-rw-r--r--chef-config/Gemfile2
-rw-r--r--chef-config/Rakefile10
-rw-r--r--chef-config/chef-config.gemspec4
-rw-r--r--chef-config/lib/chef-config/config.rb86
-rw-r--r--chef-config/lib/chef-config/exceptions.rb4
-rw-r--r--chef-config/lib/chef-config/package_task.rb36
-rw-r--r--chef-config/lib/chef-config/path_helper.rb32
-rw-r--r--chef-config/lib/chef-config/version.rb2
-rw-r--r--chef-config/lib/chef-config/workstation_config_loader.rb34
-rw-r--r--chef-config/spec/spec_helper.rb4
-rw-r--r--chef-config/spec/unit/config_spec.rb66
-rw-r--r--chef-config/spec/unit/path_helper_spec.rb22
-rw-r--r--chef-config/spec/unit/workstation_config_loader_spec.rb14
-rw-r--r--chef.gemspec8
-rw-r--r--ext/win32-eventlog/Rakefile22
-rw-r--r--kitchen-tests/Gemfile12
-rw-r--r--kitchen-tests/cookbooks/audit_test/metadata.rb14
-rw-r--r--kitchen-tests/cookbooks/webapp/attributes/default.rb14
-rw-r--r--kitchen-tests/cookbooks/webapp/metadata.rb22
-rw-r--r--kitchen-tests/cookbooks/webapp/recipes/default.rb40
-rw-r--r--kitchen-tests/test/fixtures/serverspec_helper.rb16
-rw-r--r--kitchen-tests/test/integration/webapp/serverspec/Gemfile2
-rw-r--r--lib-backcompat/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb2
-rw-r--r--lib-backcompat/chef/chef_fs/file_system/chef_server_root_dir.rb2
-rw-r--r--lib/chef.rb30
-rw-r--r--lib/chef/api_client.rb18
-rw-r--r--lib/chef/api_client/registration.rb6
-rw-r--r--lib/chef/api_client_v1.rb32
-rw-r--r--lib/chef/application.rb28
-rw-r--r--lib/chef/application/apply.rb28
-rw-r--r--lib/chef/application/client.rb40
-rw-r--r--lib/chef/application/knife.rb18
-rw-r--r--lib/chef/application/solo.rb46
-rw-r--r--lib/chef/application/windows_service.rb26
-rw-r--r--lib/chef/application/windows_service_manager.rb32
-rw-r--r--lib/chef/applications.rb8
-rw-r--r--lib/chef/audit/audit_event_proxy.rb2
-rw-r--r--lib/chef/audit/audit_reporter.rb10
-rw-r--r--lib/chef/audit/control_group_data.rb2
-rw-r--r--lib/chef/audit/logger.rb2
-rw-r--r--lib/chef/audit/rspec_formatter.rb2
-rw-r--r--lib/chef/audit/runner.rb24
-rw-r--r--lib/chef/chef_class.rb10
-rw-r--r--lib/chef/chef_fs.rb2
-rw-r--r--lib/chef/chef_fs/chef_fs_data_store.rb158
-rw-r--r--lib/chef/chef_fs/command_line.rb12
-rw-r--r--lib/chef/chef_fs/config.rb26
-rw-r--r--lib/chef/chef_fs/data_handler/acl_data_handler.rb18
-rw-r--r--lib/chef/chef_fs/data_handler/client_data_handler.rb24
-rw-r--r--lib/chef/chef_fs/data_handler/container_data_handler.rb10
-rw-r--r--lib/chef/chef_fs/data_handler/cookbook_data_handler.rb26
-rw-r--r--lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb18
-rw-r--r--lib/chef/chef_fs/data_handler/data_handler_base.rb6
-rw-r--r--lib/chef/chef_fs/data_handler/environment_data_handler.rb24
-rw-r--r--lib/chef/chef_fs/data_handler/group_data_handler.rb36
-rw-r--r--lib/chef/chef_fs/data_handler/node_data_handler.rb26
-rw-r--r--lib/chef/chef_fs/data_handler/organization_data_handler.rb16
-rw-r--r--lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb4
-rw-r--r--lib/chef/chef_fs/data_handler/organization_members_data_handler.rb4
-rw-r--r--lib/chef/chef_fs/data_handler/policy_data_handler.rb16
-rw-r--r--lib/chef/chef_fs/data_handler/policy_group_data_handler.rb2
-rw-r--r--lib/chef/chef_fs/data_handler/role_data_handler.rb28
-rw-r--r--lib/chef/chef_fs/data_handler/user_data_handler.rb22
-rw-r--r--lib/chef/chef_fs/file_pattern.rb28
-rw-r--r--lib/chef/chef_fs/file_system.rb10
-rw-r--r--lib/chef/chef_fs/file_system/already_exists_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/base_fs_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/base_fs_object.rb12
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/acl_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/acl_entry.rb8
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/acls_dir.rb16
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb54
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb18
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb14
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb8
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/environments_dir.rb10
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb8
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/org_entry.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb14
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb10
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policies_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb10
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb8
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb14
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/cookbook_frozen_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/memory/memory_dir.rb10
-rw-r--r--lib/chef/chef_fs/file_system/memory/memory_file.rb2
-rw-r--r--lib/chef/chef_fs/file_system/memory/memory_root.rb4
-rw-r--r--lib/chef/chef_fs/file_system/multiplexed_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/must_delete_recursively_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/nonexistent_fs_object.rb4
-rw-r--r--lib/chef/chef_fs/file_system/not_found_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/operation_failed_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/operation_not_allowed_error.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb8
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb14
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb10
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb10
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb6
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb8
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb58
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir.rb4
-rw-r--r--lib/chef/chef_fs/file_system/repository/file_system_entry.rb16
-rw-r--r--lib/chef/chef_fs/file_system/repository/file_system_root_dir.rb2
-rw-r--r--lib/chef/chef_fs/knife.rb26
-rw-r--r--lib/chef/chef_fs/parallelizer.rb4
-rw-r--r--lib/chef/chef_fs/parallelizer/parallel_enumerable.rb2
-rw-r--r--lib/chef/chef_fs/path_utils.rb12
-rw-r--r--lib/chef/client.rb80
-rw-r--r--lib/chef/config.rb10
-rw-r--r--lib/chef/config_fetcher.rb8
-rw-r--r--lib/chef/cookbook/chefignore.rb2
-rw-r--r--lib/chef/cookbook/cookbook_collection.rb2
-rw-r--r--lib/chef/cookbook/cookbook_version_loader.rb26
-rw-r--r--lib/chef/cookbook/file_system_file_vendor.rb2
-rw-r--r--lib/chef/cookbook/metadata.rb76
-rw-r--r--lib/chef/cookbook/remote_file_vendor.rb6
-rw-r--r--lib/chef/cookbook/synchronizer.rb14
-rw-r--r--lib/chef/cookbook/syntax_check.rb16
-rw-r--r--lib/chef/cookbook_loader.rb12
-rw-r--r--lib/chef/cookbook_manifest.rb20
-rw-r--r--lib/chef/cookbook_site_streaming_uploader.rb20
-rw-r--r--lib/chef/cookbook_uploader.rb32
-rw-r--r--lib/chef/cookbook_version.rb28
-rw-r--r--lib/chef/daemon.rb6
-rw-r--r--lib/chef/data_bag.rb22
-rw-r--r--lib/chef/data_bag_item.rb24
-rw-r--r--lib/chef/deprecation/mixin/template.rb4
-rw-r--r--lib/chef/deprecation/provider/file.rb4
-rw-r--r--lib/chef/deprecation/provider/remote_directory.rb4
-rw-r--r--lib/chef/deprecation/provider/template.rb2
-rw-r--r--lib/chef/digester.rb6
-rw-r--r--lib/chef/dsl.rb12
-rw-r--r--lib/chef/dsl/audit.rb2
-rw-r--r--lib/chef/dsl/chef_provisioning.rb2
-rw-r--r--lib/chef/dsl/cheffish.rb2
-rw-r--r--lib/chef/dsl/data_query.rb12
-rw-r--r--lib/chef/dsl/declare_resource.rb4
-rw-r--r--lib/chef/dsl/include_attribute.rb4
-rw-r--r--lib/chef/dsl/include_recipe.rb4
-rw-r--r--lib/chef/dsl/platform_introspection.rb6
-rw-r--r--lib/chef/dsl/powershell.rb4
-rw-r--r--lib/chef/dsl/reboot_pending.rb8
-rw-r--r--lib/chef/dsl/recipe.rb30
-rw-r--r--lib/chef/dsl/resources.rb4
-rw-r--r--lib/chef/encrypted_data_bag_item.rb14
-rw-r--r--lib/chef/encrypted_data_bag_item/assertions.rb4
-rw-r--r--lib/chef/encrypted_data_bag_item/check_encrypted.rb2
-rw-r--r--lib/chef/encrypted_data_bag_item/decryptor.rb20
-rw-r--r--lib/chef/encrypted_data_bag_item/encryptor.rb18
-rw-r--r--lib/chef/environment.rb16
-rw-r--r--lib/chef/event_dispatch/dispatcher.rb2
-rw-r--r--lib/chef/event_dispatch/dsl.rb6
-rw-r--r--lib/chef/event_loggers/base.rb2
-rw-r--r--lib/chef/event_loggers/windows_eventlog.rb10
-rw-r--r--lib/chef/exceptions.rb12
-rw-r--r--lib/chef/file_access_control.rb6
-rw-r--r--lib/chef/file_access_control/unix.rb2
-rw-r--r--lib/chef/file_access_control/windows.rb4
-rw-r--r--lib/chef/file_cache.rb12
-rw-r--r--lib/chef/file_content_management/deploy.rb6
-rw-r--r--lib/chef/file_content_management/deploy/mv_windows.rb4
-rw-r--r--lib/chef/formatters/base.rb10
-rw-r--r--lib/chef/formatters/doc.rb6
-rw-r--r--lib/chef/formatters/error_descriptor.rb4
-rw-r--r--lib/chef/formatters/error_inspectors.rb10
-rw-r--r--lib/chef/formatters/error_inspectors/api_error_formatting.rb4
-rw-r--r--lib/chef/formatters/error_inspectors/compile_error_inspector.rb2
-rw-r--r--lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb2
-rw-r--r--lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb2
-rw-r--r--lib/chef/formatters/error_inspectors/node_load_error_inspector.rb2
-rw-r--r--lib/chef/formatters/error_inspectors/registration_error_inspector.rb2
-rw-r--r--lib/chef/formatters/error_inspectors/resource_failure_inspector.rb2
-rw-r--r--lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb2
-rw-r--r--lib/chef/formatters/indentable_output_stream.rb10
-rw-r--r--lib/chef/formatters/minimal.rb4
-rw-r--r--lib/chef/guard_interpreter.rb4
-rw-r--r--lib/chef/guard_interpreter/default_guard_interpreter.rb2
-rw-r--r--lib/chef/guard_interpreter/resource_guard_interpreter.rb4
-rw-r--r--lib/chef/handler.rb4
-rw-r--r--lib/chef/handler/error_report.rb4
-rw-r--r--lib/chef/handler/json_file.rb4
-rw-r--r--lib/chef/http.rb24
-rw-r--r--lib/chef/http/auth_credentials.rb4
-rw-r--r--lib/chef/http/authenticator.rb8
-rw-r--r--lib/chef/http/basic_client.rb12
-rw-r--r--lib/chef/http/cookie_jar.rb2
-rw-r--r--lib/chef/http/cookie_manager.rb8
-rw-r--r--lib/chef/http/decompressor.rb6
-rw-r--r--lib/chef/http/http_request.rb16
-rw-r--r--lib/chef/http/json_input.rb6
-rw-r--r--lib/chef/http/json_output.rb8
-rw-r--r--lib/chef/http/json_to_model_output.rb2
-rw-r--r--lib/chef/http/remote_request_id.rb4
-rw-r--r--lib/chef/http/simple.rb10
-rw-r--r--lib/chef/http/simple_json.rb10
-rw-r--r--lib/chef/http/socketless_chef_zero_client.rb104
-rw-r--r--lib/chef/http/ssl_policies.rb6
-rw-r--r--lib/chef/http/validate_content_length.rb16
-rw-r--r--lib/chef/json_compat.rb6
-rw-r--r--lib/chef/key.rb26
-rw-r--r--lib/chef/knife.rb52
-rw-r--r--lib/chef/knife/bootstrap.rb44
-rw-r--r--lib/chef/knife/bootstrap/chef_vault_handler.rb6
-rw-r--r--lib/chef/knife/bootstrap/client_builder.rb12
-rw-r--r--lib/chef/knife/client_bulk_delete.rb6
-rw-r--r--lib/chef/knife/client_create.rb6
-rw-r--r--lib/chef/knife/client_delete.rb8
-rw-r--r--lib/chef/knife/client_edit.rb6
-rw-r--r--lib/chef/knife/client_key_create.rb8
-rw-r--r--lib/chef/knife/client_key_delete.rb8
-rw-r--r--lib/chef/knife/client_key_edit.rb12
-rw-r--r--lib/chef/knife/client_key_list.rb6
-rw-r--r--lib/chef/knife/client_key_show.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/client_show.rb6
-rw-r--r--lib/chef/knife/configure.rb20
-rw-r--r--lib/chef/knife/configure_client.rb8
-rw-r--r--lib/chef/knife/cookbook_bulk_delete.rb8
-rw-r--r--lib/chef/knife/cookbook_create.rb12
-rw-r--r--lib/chef/knife/cookbook_delete.rb10
-rw-r--r--lib/chef/knife/cookbook_download.rb8
-rw-r--r--lib/chef/knife/cookbook_list.rb2
-rw-r--r--lib/chef/knife/cookbook_metadata.rb12
-rw-r--r--lib/chef/knife/cookbook_metadata_from_file.rb4
-rw-r--r--lib/chef/knife/cookbook_show.rb14
-rw-r--r--lib/chef/knife/cookbook_site_download.rb18
-rw-r--r--lib/chef/knife/cookbook_site_install.rb14
-rw-r--r--lib/chef/knife/cookbook_site_list.rb4
-rw-r--r--lib/chef/knife/cookbook_site_search.rb2
-rw-r--r--lib/chef/knife/cookbook_site_share.rb24
-rw-r--r--lib/chef/knife/cookbook_site_show.rb2
-rw-r--r--lib/chef/knife/cookbook_site_unshare.rb4
-rw-r--r--lib/chef/knife/cookbook_site_vendor.rb6
-rw-r--r--lib/chef/knife/cookbook_test.rb6
-rw-r--r--lib/chef/knife/cookbook_upload.rb26
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb8
-rw-r--r--lib/chef/knife/core/cookbook_scm_repo.rb14
-rw-r--r--lib/chef/knife/core/custom_manifest_loader.rb2
-rw-r--r--lib/chef/knife/core/gem_glob_loader.rb10
-rw-r--r--lib/chef/knife/core/generic_presenter.rb12
-rw-r--r--lib/chef/knife/core/hashed_command_loader.rb8
-rw-r--r--lib/chef/knife/core/node_editor.rb10
-rw-r--r--lib/chef/knife/core/node_presenter.rb16
-rw-r--r--lib/chef/knife/core/object_loader.rb12
-rw-r--r--lib/chef/knife/core/status_presenter.rb30
-rw-r--r--lib/chef/knife/core/subcommand_loader.rb28
-rw-r--r--lib/chef/knife/core/text_formatter.rb2
-rw-r--r--lib/chef/knife/core/ui.rb18
-rw-r--r--lib/chef/knife/data_bag_create.rb8
-rw-r--r--lib/chef/knife/data_bag_delete.rb4
-rw-r--r--lib/chef/knife/data_bag_edit.rb8
-rw-r--r--lib/chef/knife/data_bag_from_file.rb16
-rw-r--r--lib/chef/knife/data_bag_list.rb4
-rw-r--r--lib/chef/knife/data_bag_secret_options.rb8
-rw-r--r--lib/chef/knife/data_bag_show.rb8
-rw-r--r--lib/chef/knife/delete.rb12
-rw-r--r--lib/chef/knife/deps.rb32
-rw-r--r--lib/chef/knife/diff.rb16
-rw-r--r--lib/chef/knife/download.rb22
-rw-r--r--lib/chef/knife/edit.rb10
-rw-r--r--lib/chef/knife/environment_compare.rb8
-rw-r--r--lib/chef/knife/environment_create.rb6
-rw-r--r--lib/chef/knife/environment_delete.rb6
-rw-r--r--lib/chef/knife/environment_edit.rb6
-rw-r--r--lib/chef/knife/environment_from_file.rb4
-rw-r--r--lib/chef/knife/environment_list.rb6
-rw-r--r--lib/chef/knife/environment_show.rb6
-rw-r--r--lib/chef/knife/exec.rb10
-rw-r--r--lib/chef/knife/help.rb10
-rw-r--r--lib/chef/knife/index_rebuild.rb2
-rw-r--r--lib/chef/knife/key_create.rb6
-rw-r--r--lib/chef/knife/key_delete.rb2
-rw-r--r--lib/chef/knife/key_edit.rb6
-rw-r--r--lib/chef/knife/key_list.rb20
-rw-r--r--lib/chef/knife/key_show.rb6
-rw-r--r--lib/chef/knife/list.rb26
-rw-r--r--lib/chef/knife/node_bulk_delete.rb6
-rw-r--r--lib/chef/knife/node_create.rb6
-rw-r--r--lib/chef/knife/node_delete.rb6
-rw-r--r--lib/chef/knife/node_edit.rb8
-rw-r--r--lib/chef/knife/node_environment_set.rb4
-rw-r--r--lib/chef/knife/node_from_file.rb10
-rw-r--r--lib/chef/knife/node_list.rb6
-rw-r--r--lib/chef/knife/node_run_list_add.rb10
-rw-r--r--lib/chef/knife/node_run_list_remove.rb12
-rw-r--r--lib/chef/knife/node_run_list_set.rb10
-rw-r--r--lib/chef/knife/node_show.rb8
-rw-r--r--lib/chef/knife/osc_user_create.rb6
-rw-r--r--lib/chef/knife/osc_user_delete.rb6
-rw-r--r--lib/chef/knife/osc_user_edit.rb6
-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/osc_user_show.rb6
-rw-r--r--lib/chef/knife/raw.rb36
-rw-r--r--lib/chef/knife/recipe_list.rb4
-rw-r--r--lib/chef/knife/rehash.rb12
-rw-r--r--lib/chef/knife/role_bulk_delete.rb6
-rw-r--r--lib/chef/knife/role_create.rb6
-rw-r--r--lib/chef/knife/role_delete.rb6
-rw-r--r--lib/chef/knife/role_edit.rb6
-rw-r--r--lib/chef/knife/role_env_run_list_add.rb10
-rw-r--r--lib/chef/knife/role_env_run_list_clear.rb6
-rw-r--r--lib/chef/knife/role_env_run_list_remove.rb6
-rw-r--r--lib/chef/knife/role_env_run_list_replace.rb6
-rw-r--r--lib/chef/knife/role_env_run_list_set.rb10
-rw-r--r--lib/chef/knife/role_from_file.rb8
-rw-r--r--lib/chef/knife/role_list.rb6
-rw-r--r--lib/chef/knife/role_run_list_add.rb10
-rw-r--r--lib/chef/knife/role_run_list_clear.rb6
-rw-r--r--lib/chef/knife/role_run_list_remove.rb6
-rw-r--r--lib/chef/knife/role_run_list_replace.rb6
-rw-r--r--lib/chef/knife/role_run_list_set.rb10
-rw-r--r--lib/chef/knife/role_show.rb6
-rw-r--r--lib/chef/knife/search.rb14
-rw-r--r--lib/chef/knife/serve.rb16
-rw-r--r--lib/chef/knife/show.rb8
-rw-r--r--lib/chef/knife/ssh.rb48
-rw-r--r--lib/chef/knife/ssl_check.rb16
-rw-r--r--lib/chef/knife/ssl_fetch.rb18
-rw-r--r--lib/chef/knife/status.rb8
-rw-r--r--lib/chef/knife/tag_create.rb4
-rw-r--r--lib/chef/knife/tag_delete.rb4
-rw-r--r--lib/chef/knife/tag_list.rb4
-rw-r--r--lib/chef/knife/upload.rb20
-rw-r--r--lib/chef/knife/user_create.rb8
-rw-r--r--lib/chef/knife/user_delete.rb6
-rw-r--r--lib/chef/knife/user_edit.rb6
-rw-r--r--lib/chef/knife/user_key_create.rb10
-rw-r--r--lib/chef/knife/user_key_delete.rb8
-rw-r--r--lib/chef/knife/user_key_edit.rb12
-rw-r--r--lib/chef/knife/user_key_list.rb6
-rw-r--r--lib/chef/knife/user_key_show.rb6
-rw-r--r--lib/chef/knife/user_list.rb6
-rw-r--r--lib/chef/knife/user_reregister.rb6
-rw-r--r--lib/chef/knife/user_show.rb6
-rw-r--r--lib/chef/knife/xargs.rb42
-rw-r--r--lib/chef/local_mode.rb18
-rw-r--r--lib/chef/log.rb12
-rw-r--r--lib/chef/log/syslog.rb8
-rw-r--r--lib/chef/log/winevt.rb10
-rw-r--r--lib/chef/mixin/checksum.rb4
-rw-r--r--lib/chef/mixin/command.rb14
-rw-r--r--lib/chef/mixin/command/unix.rb2
-rw-r--r--lib/chef/mixin/command/windows.rb2
-rw-r--r--lib/chef/mixin/convert_to_class_name.rb12
-rw-r--r--lib/chef/mixin/create_path.rb2
-rw-r--r--lib/chef/mixin/enforce_ownership_and_permissions.rb2
-rw-r--r--lib/chef/mixin/file_class.rb2
-rw-r--r--lib/chef/mixin/homebrew_user.rb6
-rw-r--r--lib/chef/mixin/language.rb6
-rw-r--r--lib/chef/mixin/language_include_attribute.rb4
-rw-r--r--lib/chef/mixin/language_include_recipe.rb4
-rw-r--r--lib/chef/mixin/params_validate.rb6
-rw-r--r--lib/chef/mixin/path_sanity.rb4
-rw-r--r--lib/chef/mixin/powershell_out.rb4
-rw-r--r--lib/chef/mixin/powershell_type_coercions.rb6
-rw-r--r--lib/chef/mixin/properties.rb6
-rw-r--r--lib/chef/mixin/provides.rb2
-rw-r--r--lib/chef/mixin/proxified_socket.rb6
-rw-r--r--lib/chef/mixin/recipe_definition_dsl_core.rb2
-rw-r--r--lib/chef/mixin/shell_out.rb16
-rw-r--r--lib/chef/mixin/template.rb4
-rw-r--r--lib/chef/mixin/uris.rb2
-rw-r--r--lib/chef/mixin/which.rb4
-rw-r--r--lib/chef/mixin/wide_string.rb12
-rw-r--r--lib/chef/mixin/windows_architecture_helper.rb14
-rw-r--r--lib/chef/mixin/windows_env_helper.rb16
-rw-r--r--lib/chef/mixin/xml_escape.rb10
-rw-r--r--lib/chef/mixins.rb26
-rw-r--r--lib/chef/monkey_patches/net-ssh-multi.rb4
-rw-r--r--lib/chef/monkey_patches/net_http.rb2
-rw-r--r--lib/chef/monkey_patches/webrick-utils.rb2
-rw-r--r--lib/chef/monkey_patches/win32/registry.rb8
-rw-r--r--lib/chef/monologger.rb4
-rw-r--r--lib/chef/node.rb40
-rw-r--r--lib/chef/node/attribute.rb10
-rw-r--r--lib/chef/node_map.rb6
-rw-r--r--lib/chef/org.rb20
-rw-r--r--lib/chef/platform.rb4
-rw-r--r--lib/chef/platform/handler_map.rb2
-rw-r--r--lib/chef/platform/priority_map.rb2
-rw-r--r--lib/chef/platform/provider_handler_map.rb4
-rw-r--r--lib/chef/platform/provider_mapping.rb12
-rw-r--r--lib/chef/platform/provider_priority_map.rb4
-rw-r--r--lib/chef/platform/query_helpers.rb16
-rw-r--r--lib/chef/platform/rebooter.rb6
-rw-r--r--lib/chef/platform/resource_handler_map.rb4
-rw-r--r--lib/chef/platform/resource_priority_map.rb4
-rw-r--r--lib/chef/platform/service_helpers.rb2
-rw-r--r--lib/chef/policy_builder.rb6
-rw-r--r--lib/chef/policy_builder/dynamic.rb12
-rw-r--r--lib/chef/policy_builder/expand_node_object.rb18
-rw-r--r--lib/chef/policy_builder/policyfile.rb10
-rw-r--r--lib/chef/property.rb8
-rw-r--r--lib/chef/provider.rb42
-rw-r--r--lib/chef/provider/batch.rb6
-rw-r--r--lib/chef/provider/cookbook_file.rb6
-rw-r--r--lib/chef/provider/cookbook_file/content.rb4
-rw-r--r--lib/chef/provider/cron.rb6
-rw-r--r--lib/chef/provider/cron/unix.rb10
-rw-r--r--lib/chef/provider/deploy/revision.rb6
-rw-r--r--lib/chef/provider/directory.rb12
-rw-r--r--lib/chef/provider/dsc_resource.rb16
-rw-r--r--lib/chef/provider/dsc_script.rb20
-rw-r--r--lib/chef/provider/env.rb6
-rw-r--r--lib/chef/provider/env/windows.rb4
-rw-r--r--lib/chef/provider/erl_call.rb8
-rw-r--r--lib/chef/provider/execute.rb6
-rw-r--r--lib/chef/provider/file.rb32
-rw-r--r--lib/chef/provider/file/content.rb4
-rw-r--r--lib/chef/provider/git.rb40
-rw-r--r--lib/chef/provider/group.rb8
-rw-r--r--lib/chef/provider/group/aix.rb6
-rw-r--r--lib/chef/provider/group/dscl.rb10
-rw-r--r--lib/chef/provider/group/gpasswd.rb2
-rw-r--r--lib/chef/provider/group/groupadd.rb2
-rw-r--r--lib/chef/provider/group/groupmod.rb2
-rw-r--r--lib/chef/provider/group/pw.rb2
-rw-r--r--lib/chef/provider/group/suse.rb6
-rw-r--r--lib/chef/provider/group/usermod.rb2
-rw-r--r--lib/chef/provider/group/windows.rb6
-rw-r--r--lib/chef/provider/http_request.rb4
-rw-r--r--lib/chef/provider/ifconfig.rb16
-rw-r--r--lib/chef/provider/ifconfig/aix.rb2
-rw-r--r--lib/chef/provider/ifconfig/debian.rb8
-rw-r--r--lib/chef/provider/ifconfig/redhat.rb2
-rw-r--r--lib/chef/provider/link.rb18
-rw-r--r--lib/chef/provider/lwrp_base.rb6
-rw-r--r--lib/chef/provider/mdadm.rb4
-rw-r--r--lib/chef/provider/mount.rb6
-rw-r--r--lib/chef/provider/mount/aix.rb2
-rw-r--r--lib/chef/provider/mount/mount.rb4
-rw-r--r--lib/chef/provider/mount/solaris.rb44
-rw-r--r--lib/chef/provider/mount/windows.rb6
-rw-r--r--lib/chef/provider/ohai.rb2
-rw-r--r--lib/chef/provider/osx_profile.rb32
-rw-r--r--lib/chef/provider/package.rb16
-rw-r--r--lib/chef/provider/package/aix.rb8
-rw-r--r--lib/chef/provider/package/apt.rb20
-rw-r--r--lib/chef/provider/package/chocolatey.rb12
-rw-r--r--lib/chef/provider/package/dpkg.rb4
-rw-r--r--lib/chef/provider/package/easy_install.rb12
-rw-r--r--lib/chef/provider/package/freebsd/base.rb6
-rw-r--r--lib/chef/provider/package/freebsd/pkg.rb10
-rw-r--r--lib/chef/provider/package/freebsd/pkgng.rb8
-rw-r--r--lib/chef/provider/package/freebsd/port.rb2
-rw-r--r--lib/chef/provider/package/homebrew.rb26
-rw-r--r--lib/chef/provider/package/ips.rb10
-rw-r--r--lib/chef/provider/package/openbsd.rb16
-rw-r--r--lib/chef/provider/package/pacman.rb8
-rw-r--r--lib/chef/provider/package/paludis.rb10
-rw-r--r--lib/chef/provider/package/portage.rb12
-rw-r--r--lib/chef/provider/package/rpm.rb8
-rw-r--r--lib/chef/provider/package/rubygems.rb48
-rw-r--r--lib/chef/provider/package/smartos.rb6
-rw-r--r--lib/chef/provider/package/solaris.rb10
-rw-r--r--lib/chef/provider/package/windows.rb22
-rw-r--r--lib/chef/provider/package/windows/exe.rb10
-rw-r--r--lib/chef/provider/package/windows/msi.rb4
-rw-r--r--lib/chef/provider/package/windows/registry_uninstall_entry.rb10
-rw-r--r--lib/chef/provider/package/yum.rb28
-rw-r--r--lib/chef/provider/package/zypper.rb12
-rw-r--r--lib/chef/provider/powershell_script.rb16
-rw-r--r--lib/chef/provider/reboot.rb4
-rw-r--r--lib/chef/provider/registry_key.rb18
-rw-r--r--lib/chef/provider/remote_directory.rb26
-rw-r--r--lib/chef/provider/remote_file.rb6
-rw-r--r--lib/chef/provider/remote_file/cache_control_data.rb12
-rw-r--r--lib/chef/provider/remote_file/content.rb8
-rw-r--r--lib/chef/provider/remote_file/ftp.rb20
-rw-r--r--lib/chef/provider/remote_file/http.rb12
-rw-r--r--lib/chef/provider/remote_file/local_file.rb6
-rw-r--r--lib/chef/provider/remote_file/network_file.rb6
-rw-r--r--lib/chef/provider/route.rb84
-rw-r--r--lib/chef/provider/script.rb6
-rw-r--r--lib/chef/provider/service.rb30
-rw-r--r--lib/chef/provider/service/aix.rb4
-rw-r--r--lib/chef/provider/service/aixinit.rb16
-rw-r--r--lib/chef/provider/service/arch.rb4
-rw-r--r--lib/chef/provider/service/debian.rb4
-rw-r--r--lib/chef/provider/service/freebsd.rb10
-rw-r--r--lib/chef/provider/service/gentoo.rb6
-rw-r--r--lib/chef/provider/service/init.rb6
-rw-r--r--lib/chef/provider/service/insserv.rb4
-rw-r--r--lib/chef/provider/service/invokercd.rb4
-rw-r--r--lib/chef/provider/service/macosx.rb28
-rw-r--r--lib/chef/provider/service/openbsd.rb24
-rw-r--r--lib/chef/provider/service/redhat.rb6
-rw-r--r--lib/chef/provider/service/simple.rb6
-rw-r--r--lib/chef/provider/service/solaris.rb12
-rw-r--r--lib/chef/provider/service/systemd.rb6
-rw-r--r--lib/chef/provider/service/upstart.rb12
-rw-r--r--lib/chef/provider/service/windows.rb32
-rw-r--r--lib/chef/provider/subversion.rb14
-rw-r--r--lib/chef/provider/template.rb8
-rw-r--r--lib/chef/provider/template/content.rb4
-rw-r--r--lib/chef/provider/user.rb10
-rw-r--r--lib/chef/provider/user/dscl.rb26
-rw-r--r--lib/chef/provider/user/pw.rb12
-rw-r--r--lib/chef/provider/user/solaris.rb10
-rw-r--r--lib/chef/provider/user/useradd.rb12
-rw-r--r--lib/chef/provider/user/windows.rb16
-rw-r--r--lib/chef/provider/windows_script.rb6
-rw-r--r--lib/chef/provider_resolver.rb4
-rw-r--r--lib/chef/providers.rb220
-rw-r--r--lib/chef/recipe.rb24
-rw-r--r--lib/chef/request_id.rb4
-rw-r--r--lib/chef/resource.rb74
-rw-r--r--lib/chef/resource/action_class.rb2
-rw-r--r--lib/chef/resource/apt_package.rb4
-rw-r--r--lib/chef/resource/bash.rb4
-rw-r--r--lib/chef/resource/batch.rb2
-rw-r--r--lib/chef/resource/bff_package.rb4
-rw-r--r--lib/chef/resource/breakpoint.rb2
-rw-r--r--lib/chef/resource/chef_gem.rb4
-rw-r--r--lib/chef/resource/chocolatey_package.rb2
-rw-r--r--lib/chef/resource/conditional.rb4
-rw-r--r--lib/chef/resource/cookbook_file.rb6
-rw-r--r--lib/chef/resource/cron.rb4
-rw-r--r--lib/chef/resource/csh.rb4
-rw-r--r--lib/chef/resource/deploy.rb4
-rw-r--r--lib/chef/resource/directory.rb6
-rw-r--r--lib/chef/resource/dpkg_package.rb2
-rw-r--r--lib/chef/resource/dsc_resource.rb2
-rw-r--r--lib/chef/resource/dsc_script.rb6
-rw-r--r--lib/chef/resource/easy_install_package.rb2
-rw-r--r--lib/chef/resource/erl_call.rb4
-rw-r--r--lib/chef/resource/execute.rb4
-rw-r--r--lib/chef/resource/file.rb8
-rw-r--r--lib/chef/resource/file/verification.rb12
-rw-r--r--lib/chef/resource/freebsd_package.rb10
-rw-r--r--lib/chef/resource/gem_package.rb2
-rw-r--r--lib/chef/resource/homebrew_package.rb4
-rw-r--r--lib/chef/resource/http_request.rb4
-rw-r--r--lib/chef/resource/ifconfig.rb2
-rw-r--r--lib/chef/resource/ips_package.rb4
-rw-r--r--lib/chef/resource/ksh.rb2
-rw-r--r--lib/chef/resource/link.rb6
-rw-r--r--lib/chef/resource/log.rb4
-rw-r--r--lib/chef/resource/lwrp_base.rb16
-rw-r--r--lib/chef/resource/macosx_service.rb2
-rw-r--r--lib/chef/resource/macports_package.rb2
-rw-r--r--lib/chef/resource/mdadm.rb2
-rw-r--r--lib/chef/resource/mount.rb6
-rw-r--r--lib/chef/resource/openbsd_package.rb6
-rw-r--r--lib/chef/resource/osx_profile.rb2
-rw-r--r--lib/chef/resource/package.rb2
-rw-r--r--lib/chef/resource/pacman_package.rb2
-rw-r--r--lib/chef/resource/paludis_package.rb4
-rw-r--r--lib/chef/resource/perl.rb4
-rw-r--r--lib/chef/resource/portage_package.rb2
-rw-r--r--lib/chef/resource/powershell_script.rb2
-rw-r--r--lib/chef/resource/python.rb4
-rw-r--r--lib/chef/resource/reboot.rb2
-rw-r--r--lib/chef/resource/registry_key.rb6
-rw-r--r--lib/chef/resource/remote_directory.rb6
-rw-r--r--lib/chef/resource/remote_file.rb10
-rw-r--r--lib/chef/resource/resource_notification.rb2
-rw-r--r--lib/chef/resource/route.rb2
-rw-r--r--lib/chef/resource/rpm_package.rb4
-rw-r--r--lib/chef/resource/ruby.rb4
-rw-r--r--lib/chef/resource/ruby_block.rb4
-rw-r--r--lib/chef/resource/scm.rb2
-rw-r--r--lib/chef/resource/script.rb4
-rw-r--r--lib/chef/resource/service.rb2
-rw-r--r--lib/chef/resource/smartos_package.rb4
-rw-r--r--lib/chef/resource/solaris_package.rb4
-rw-r--r--lib/chef/resource/subversion.rb4
-rw-r--r--lib/chef/resource/template.rb6
-rw-r--r--lib/chef/resource/user.rb2
-rw-r--r--lib/chef/resource/windows_package.rb10
-rw-r--r--lib/chef/resource/windows_script.rb6
-rw-r--r--lib/chef/resource/windows_service.rb2
-rw-r--r--lib/chef/resource/yum_package.rb4
-rw-r--r--lib/chef/resource/zypper_package.rb2
-rw-r--r--lib/chef/resource_builder.rb6
-rw-r--r--lib/chef/resource_collection.rb10
-rw-r--r--lib/chef/resource_collection/resource_collection_serialization.rb4
-rw-r--r--lib/chef/resource_collection/resource_list.rb8
-rw-r--r--lib/chef/resource_collection/resource_set.rb4
-rw-r--r--lib/chef/resource_definition.rb4
-rw-r--r--lib/chef/resource_definition_list.rb4
-rw-r--r--lib/chef/resource_reporter.rb12
-rw-r--r--lib/chef/resource_resolver.rb6
-rw-r--r--lib/chef/resources.rb136
-rw-r--r--lib/chef/rest.rb24
-rw-r--r--lib/chef/role.rb24
-rw-r--r--lib/chef/run_context.rb20
-rw-r--r--lib/chef/run_context/cookbook_compiler.rb12
-rw-r--r--lib/chef/run_list.rb14
-rw-r--r--lib/chef/run_list/run_list_expansion.rb14
-rw-r--r--lib/chef/run_list/run_list_item.rb10
-rw-r--r--lib/chef/run_list/versioned_recipe_list.rb8
-rw-r--r--lib/chef/run_lock.rb16
-rw-r--r--lib/chef/runner.rb8
-rw-r--r--lib/chef/search/query.rb26
-rw-r--r--lib/chef/server_api.rb18
-rw-r--r--lib/chef/shell.rb44
-rw-r--r--lib/chef/shell/ext.rb18
-rw-r--r--lib/chef/shell/model_wrapper.rb4
-rw-r--r--lib/chef/shell/shell_session.rb24
-rw-r--r--lib/chef/shell_out.rb2
-rw-r--r--lib/chef/tasks/chef_repo.rake106
-rw-r--r--lib/chef/user.rb30
-rw-r--r--lib/chef/user_v1.rb52
-rw-r--r--lib/chef/util/backup.rb4
-rw-r--r--lib/chef/util/diff.rb10
-rw-r--r--lib/chef/util/dsc/configuration_generator.rb12
-rw-r--r--lib/chef/util/dsc/lcm_output_parser.rb8
-rw-r--r--lib/chef/util/dsc/local_configuration_manager.rb14
-rw-r--r--lib/chef/util/dsc/resource_store.rb14
-rw-r--r--lib/chef/util/file_edit.rb6
-rw-r--r--lib/chef/util/path_helper.rb2
-rw-r--r--lib/chef/util/powershell/cmdlet.rb22
-rw-r--r--lib/chef/util/powershell/cmdlet_result.rb2
-rw-r--r--lib/chef/util/powershell/ps_credential.rb2
-rw-r--r--lib/chef/util/selinux.rb4
-rw-r--r--lib/chef/util/threaded_job_queue.rb2
-rw-r--r--lib/chef/util/windows/net_group.rb170
-rw-r--r--lib/chef/util/windows/net_use.rb6
-rw-r--r--lib/chef/util/windows/net_user.rb8
-rw-r--r--lib/chef/util/windows/volume.rb4
-rw-r--r--lib/chef/version.rb2
-rw-r--r--lib/chef/version/platform.rb2
-rw-r--r--lib/chef/version_constraint.rb8
-rw-r--r--lib/chef/version_constraint/platform.rb4
-rw-r--r--lib/chef/whitelist.rb2
-rw-r--r--lib/chef/win32/api.rb6
-rw-r--r--lib/chef/win32/api/crypto.rb4
-rw-r--r--lib/chef/win32/api/error.rb4
-rw-r--r--lib/chef/win32/api/file.rb10
-rw-r--r--lib/chef/win32/api/installer.rb10
-rw-r--r--lib/chef/win32/api/memory.rb4
-rw-r--r--lib/chef/win32/api/net.rb4
-rw-r--r--lib/chef/win32/api/process.rb4
-rw-r--r--lib/chef/win32/api/psapi.rb4
-rw-r--r--lib/chef/win32/api/registry.rb4
-rw-r--r--lib/chef/win32/api/security.rb2
-rw-r--r--lib/chef/win32/api/synchronization.rb4
-rw-r--r--lib/chef/win32/api/system.rb4
-rw-r--r--lib/chef/win32/api/unicode.rb4
-rw-r--r--lib/chef/win32/crypto.rb100
-rw-r--r--lib/chef/win32/error.rb8
-rw-r--r--lib/chef/win32/eventlog.rb2
-rw-r--r--lib/chef/win32/file.rb14
-rw-r--r--lib/chef/win32/file/info.rb2
-rw-r--r--lib/chef/win32/file/version_info.rb2
-rw-r--r--lib/chef/win32/handle.rb8
-rw-r--r--lib/chef/win32/memory.rb4
-rw-r--r--lib/chef/win32/mutex.rb4
-rw-r--r--lib/chef/win32/net.rb6
-rw-r--r--lib/chef/win32/process.rb10
-rw-r--r--lib/chef/win32/registry.rb14
-rw-r--r--lib/chef/win32/security.rb24
-rw-r--r--lib/chef/win32/security/ace.rb8
-rw-r--r--lib/chef/win32/security/acl.rb6
-rw-r--r--lib/chef/win32/security/securable_object.rb6
-rw-r--r--lib/chef/win32/security/security_descriptor.rb6
-rw-r--r--lib/chef/win32/security/sid.rb82
-rw-r--r--lib/chef/win32/security/token.rb8
-rwxr-xr-xlib/chef/win32/system.rb6
-rw-r--r--lib/chef/win32/unicode.rb4
-rw-r--r--lib/chef/win32/version.rb12
-rw-r--r--lib/chef/workstation_config_loader.rb2
-rw-r--r--omnibus/Berksfile10
-rw-r--r--omnibus/Gemfile14
-rw-r--r--omnibus/config/projects/angrychef.rb2
-rw-r--r--omnibus/config/projects/chef-fips.rb2
-rw-r--r--omnibus/config/projects/chef.rb10
-rw-r--r--omnibus/omnibus.rb10
-rw-r--r--spec/functional/application_spec.rb4
-rw-r--r--spec/functional/audit/rspec_formatter_spec.rb12
-rw-r--r--spec/functional/audit/runner_spec.rb12
-rw-r--r--spec/functional/dsl/reboot_pending_spec.rb14
-rw-r--r--spec/functional/dsl/registry_helper_spec.rb4
-rw-r--r--spec/functional/event_loggers/windows_eventlog_spec.rb34
-rw-r--r--spec/functional/file_content_management/deploy_strategies_spec.rb2
-rw-r--r--spec/functional/http/simple_spec.rb18
-rw-r--r--spec/functional/knife/configure_spec.rb12
-rw-r--r--spec/functional/knife/cookbook_delete_spec.rb16
-rw-r--r--spec/functional/knife/exec_spec.rb6
-rw-r--r--spec/functional/knife/smoke_test.rb2
-rw-r--r--spec/functional/knife/ssh_spec.rb38
-rw-r--r--spec/functional/mixin/powershell_out_spec.rb4
-rw-r--r--spec/functional/mixin/shell_out_spec.rb14
-rw-r--r--spec/functional/notifications_spec.rb4
-rwxr-xr-xspec/functional/provider/remote_file/cache_control_data_spec.rb6
-rw-r--r--spec/functional/provider/whyrun_safe_ruby_block_spec.rb2
-rw-r--r--spec/functional/rebooter_spec.rb16
-rwxr-xr-xspec/functional/resource/aix_service_spec.rb12
-rwxr-xr-xspec/functional/resource/aixinit_service_spec.rb20
-rw-r--r--spec/functional/resource/bash_spec.rb8
-rw-r--r--spec/functional/resource/batch_spec.rb6
-rw-r--r--spec/functional/resource/bff_spec.rb10
-rw-r--r--spec/functional/resource/cookbook_file_spec.rb14
-rw-r--r--spec/functional/resource/cron_spec.rb22
-rw-r--r--spec/functional/resource/deploy_revision_spec.rb4
-rw-r--r--spec/functional/resource/directory_spec.rb2
-rw-r--r--spec/functional/resource/dpkg_package_spec.rb70
-rw-r--r--spec/functional/resource/dsc_resource_spec.rb30
-rw-r--r--spec/functional/resource/dsc_script_spec.rb146
-rwxr-xr-xspec/functional/resource/env_spec.rb50
-rw-r--r--spec/functional/resource/execute_spec.rb14
-rw-r--r--spec/functional/resource/file_spec.rb8
-rw-r--r--spec/functional/resource/git_spec.rb32
-rw-r--r--spec/functional/resource/group_spec.rb14
-rw-r--r--spec/functional/resource/ifconfig_spec.rb20
-rw-r--r--spec/functional/resource/link_spec.rb262
-rw-r--r--spec/functional/resource/mount_spec.rb22
-rw-r--r--spec/functional/resource/ohai_spec.rb2
-rw-r--r--spec/functional/resource/package_spec.rb8
-rw-r--r--spec/functional/resource/powershell_script_spec.rb40
-rw-r--r--spec/functional/resource/reboot_spec.rb18
-rw-r--r--spec/functional/resource/registry_spec.rb4
-rw-r--r--spec/functional/resource/remote_directory_spec.rb42
-rw-r--r--spec/functional/resource/remote_file_spec.rb28
-rw-r--r--spec/functional/resource/rpm_spec.rb18
-rw-r--r--spec/functional/resource/template_spec.rb10
-rw-r--r--spec/functional/resource/user/dscl_spec.rb4
-rw-r--r--spec/functional/resource/user/useradd_spec.rb20
-rw-r--r--spec/functional/resource/user/windows_spec.rb38
-rw-r--r--spec/functional/resource/windows_package_spec.rb42
-rw-r--r--spec/functional/resource/windows_service_spec.rb2
-rw-r--r--spec/functional/rest_spec.rb6
-rw-r--r--spec/functional/run_lock_spec.rb12
-rw-r--r--spec/functional/shell_spec.rb12
-rw-r--r--spec/functional/tiny_server_spec.rb24
-rw-r--r--spec/functional/util/path_helper_spec.rb8
-rw-r--r--spec/functional/util/powershell/cmdlet_spec.rb32
-rw-r--r--spec/functional/version_spec.rb8
-rw-r--r--spec/functional/win32/crypto_spec.rb10
-rw-r--r--spec/functional/win32/registry_spec.rb24
-rw-r--r--spec/functional/win32/security_spec.rb24
-rw-r--r--spec/functional/win32/service_manager_spec.rb4
-rw-r--r--spec/functional/win32/sid_spec.rb24
-rw-r--r--spec/functional/win32/version_info_spec.rb12
-rw-r--r--spec/functional/win32/versions_spec.rb22
-rw-r--r--spec/integration/client/client_spec.rb124
-rw-r--r--spec/integration/client/ipv6_spec.rb18
-rw-r--r--spec/integration/knife/chef_fs_data_store_spec.rb298
-rw-r--r--spec/integration/knife/chef_repo_path_spec.rb496
-rw-r--r--spec/integration/knife/chef_repository_file_system_spec.rb164
-rw-r--r--spec/integration/knife/chefignore_spec.rb160
-rw-r--r--spec/integration/knife/common_options_spec.rb78
-rw-r--r--spec/integration/knife/cookbook_api_ipv6_spec.rb8
-rw-r--r--spec/integration/knife/delete_spec.rb512
-rw-r--r--spec/integration/knife/deps_spec.rb556
-rw-r--r--spec/integration/knife/diff_spec.rb466
-rw-r--r--spec/integration/knife/download_spec.rb876
-rw-r--r--spec/integration/knife/list_spec.rb266
-rw-r--r--spec/integration/knife/raw_spec.rb74
-rw-r--r--spec/integration/knife/redirection_spec.rb20
-rw-r--r--spec/integration/knife/serve_spec.rb20
-rw-r--r--spec/integration/knife/show_spec.rb114
-rw-r--r--spec/integration/knife/upload_spec.rb1180
-rw-r--r--spec/integration/recipes/lwrp_inline_resources_spec.rb36
-rw-r--r--spec/integration/recipes/lwrp_spec.rb14
-rw-r--r--spec/integration/recipes/provider_choice.rb4
-rw-r--r--spec/integration/recipes/recipe_dsl_spec.rb244
-rw-r--r--spec/integration/recipes/remote_directory.rb4
-rw-r--r--spec/integration/recipes/resource_action_spec.rb100
-rw-r--r--spec/integration/recipes/resource_converge_if_changed_spec.rb22
-rw-r--r--spec/integration/recipes/resource_load_spec.rb48
-rw-r--r--spec/integration/solo/solo_spec.rb56
-rw-r--r--spec/scripts/ssl-serve.rb14
-rw-r--r--spec/spec_helper.rb72
-rw-r--r--spec/stress/win32/file_spec.rb6
-rw-r--r--spec/stress/win32/memory_spec.rb4
-rw-r--r--spec/stress/win32/security_spec.rb10
-rw-r--r--spec/support/chef_helpers.rb6
-rw-r--r--spec/support/key_helpers.rb2
-rw-r--r--spec/support/lib/chef/resource/with_state.rb4
-rw-r--r--spec/support/lib/chef/resource/zen_follower.rb4
-rw-r--r--spec/support/lib/chef/resource/zen_master.rb4
-rw-r--r--spec/support/matchers/leak.rb4
-rw-r--r--spec/support/mock/constant.rb4
-rw-r--r--spec/support/mock/platform.rb4
-rw-r--r--spec/support/platform_helpers.rb40
-rw-r--r--spec/support/platforms/prof/win32.rb2
-rw-r--r--spec/support/platforms/win32/spec_service.rb4
-rw-r--r--spec/support/shared/context/client.rb4
-rw-r--r--spec/support/shared/context/config.rb6
-rw-r--r--spec/support/shared/context/win32.rb8
-rw-r--r--spec/support/shared/examples/client.rb4
-rw-r--r--spec/support/shared/functional/directory_resource.rb6
-rw-r--r--spec/support/shared/functional/file_resource.rb10
-rw-r--r--spec/support/shared/functional/http.rb60
-rw-r--r--spec/support/shared/functional/securable_resource.rb74
-rw-r--r--spec/support/shared/functional/securable_resource_with_reporting.rb12
-rw-r--r--spec/support/shared/functional/win32_service.rb4
-rw-r--r--spec/support/shared/functional/windows_script.rb18
-rw-r--r--spec/support/shared/integration/app_server_support.rb4
-rw-r--r--spec/support/shared/integration/integration_helper.rb28
-rw-r--r--spec/support/shared/integration/knife_support.rb20
-rw-r--r--spec/support/shared/matchers/exit_with_code.rb2
-rw-r--r--spec/support/shared/matchers/match_environment_variable.rb4
-rw-r--r--spec/support/shared/unit/api_versioning.rb6
-rw-r--r--spec/support/shared/unit/execute_resource.rb2
-rw-r--r--spec/support/shared/unit/file_system_support.rb10
-rw-r--r--spec/support/shared/unit/platform_introspector.rb54
-rw-r--r--spec/support/shared/unit/provider/file.rb18
-rw-r--r--spec/support/shared/unit/provider/useradd_based_user_provider.rb48
-rw-r--r--spec/support/shared/unit/script_resource.rb12
-rw-r--r--spec/support/shared/unit/windows_script_resource.rb8
-rw-r--r--spec/tiny_server.rb22
-rw-r--r--spec/unit/api_client/registration_spec.rb20
-rw-r--r--spec/unit/api_client_spec.rb10
-rw-r--r--spec/unit/api_client_v1_spec.rb16
-rw-r--r--spec/unit/application/apply_spec.rb2
-rw-r--r--spec/unit/application/client_spec.rb10
-rw-r--r--spec/unit/application/knife_spec.rb20
-rw-r--r--spec/unit/application/solo_spec.rb6
-rw-r--r--spec/unit/application_spec.rb16
-rw-r--r--spec/unit/audit/audit_event_proxy_spec.rb4
-rw-r--r--spec/unit/audit/audit_reporter_spec.rb4
-rw-r--r--spec/unit/audit/control_group_data_spec.rb4
-rw-r--r--spec/unit/audit/logger_spec.rb8
-rw-r--r--spec/unit/audit/rspec_formatter_spec.rb4
-rw-r--r--spec/unit/audit/runner_spec.rb16
-rw-r--r--spec/unit/chef_class_spec.rb8
-rw-r--r--spec/unit/chef_fs/config_spec.rb18
-rw-r--r--spec/unit/chef_fs/data_handler/group_handler_spec.rb30
-rw-r--r--spec/unit/chef_fs/diff_spec.rb120
-rw-r--r--spec/unit/chef_fs/file_pattern_spec.rb732
-rw-r--r--spec/unit/chef_fs/file_system/cookbook_subdir_spec.rb12
-rw-r--r--spec/unit/chef_fs/file_system/operation_failed_error_spec.rb14
-rw-r--r--spec/unit/chef_fs/file_system_spec.rb138
-rw-r--r--spec/unit/chef_fs/parallelizer.rb50
-rw-r--r--spec/unit/chef_fs/path_util_spec.rb88
-rw-r--r--spec/unit/chef_spec.rb2
-rw-r--r--spec/unit/client_spec.rb20
-rw-r--r--spec/unit/config_fetcher_spec.rb4
-rw-r--r--spec/unit/config_spec.rb4
-rw-r--r--spec/unit/cookbook/chefignore_spec.rb12
-rw-r--r--spec/unit/cookbook/cookbook_version_loader_spec.rb6
-rw-r--r--spec/unit/cookbook/file_vendor_spec.rb2
-rw-r--r--spec/unit/cookbook/metadata_spec.rb44
-rw-r--r--spec/unit/cookbook/synchronizer_spec.rb30
-rw-r--r--spec/unit/cookbook/syntax_check_spec.rb36
-rw-r--r--spec/unit/cookbook_loader_spec.rb4
-rw-r--r--spec/unit/cookbook_manifest_spec.rb36
-rw-r--r--spec/unit/cookbook_site_streaming_uploader_spec.rb46
-rw-r--r--spec/unit/cookbook_spec.rb2
-rw-r--r--spec/unit/cookbook_uploader_spec.rb2
-rw-r--r--spec/unit/cookbook_version_file_specificity_spec.rb20
-rw-r--r--spec/unit/cookbook_version_spec.rb78
-rw-r--r--spec/unit/daemon_spec.rb8
-rw-r--r--spec/unit/data_bag_item_spec.rb18
-rw-r--r--spec/unit/data_bag_spec.rb76
-rw-r--r--spec/unit/deprecation_spec.rb18
-rw-r--r--spec/unit/digester_spec.rb4
-rw-r--r--spec/unit/dsl/audit_spec.rb4
-rw-r--r--spec/unit/dsl/data_query_spec.rb4
-rw-r--r--spec/unit/dsl/platform_introspection_spec.rb26
-rw-r--r--spec/unit/dsl/reboot_pending_spec.rb14
-rw-r--r--spec/unit/dsl/recipe_spec.rb4
-rw-r--r--spec/unit/dsl/regsitry_helper_spec.rb12
-rw-r--r--spec/unit/dsl/resources_spec.rb20
-rw-r--r--spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb4
-rw-r--r--spec/unit/encrypted_data_bag_item_spec.rb4
-rw-r--r--spec/unit/environment_spec.rb66
-rw-r--r--spec/unit/event_dispatch/dispatcher_spec.rb4
-rw-r--r--spec/unit/event_dispatch/dsl_spec.rb26
-rw-r--r--spec/unit/exceptions_spec.rb2
-rw-r--r--spec/unit/file_access_control_spec.rb60
-rw-r--r--spec/unit/file_cache_spec.rb34
-rw-r--r--spec/unit/file_content_management/deploy/cp_spec.rb2
-rw-r--r--spec/unit/file_content_management/deploy/mv_unix_spec.rb2
-rw-r--r--spec/unit/file_content_management/deploy/mv_windows_spec.rb4
-rw-r--r--spec/unit/formatters/base_spec.rb2
-rw-r--r--spec/unit/formatters/doc_spec.rb2
-rw-r--r--spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb8
-rw-r--r--spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb2
-rw-r--r--spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb2
-rw-r--r--spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb2
-rw-r--r--spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb2
-rw-r--r--spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb2
-rw-r--r--spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb2
-rw-r--r--spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb2
-rw-r--r--spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb8
-rw-r--r--spec/unit/guard_interpreter_spec.rb2
-rw-r--r--spec/unit/handler/json_file_spec.rb16
-rw-r--r--spec/unit/handler_spec.rb6
-rw-r--r--spec/unit/http/authenticator_spec.rb10
-rw-r--r--spec/unit/http/basic_client_spec.rb4
-rw-r--r--spec/unit/http/http_request_spec.rb42
-rw-r--r--spec/unit/http/json_input_spec.rb4
-rw-r--r--spec/unit/http/simple_spec.rb2
-rw-r--r--spec/unit/http/socketless_chef_zero_client_spec.rb2
-rw-r--r--spec/unit/http/ssl_policies_spec.rb20
-rw-r--r--spec/unit/http/validate_content_length_spec.rb6
-rw-r--r--spec/unit/http_spec.rb34
-rw-r--r--spec/unit/json_compat_spec.rb14
-rw-r--r--spec/unit/key_spec.rb6
-rw-r--r--spec/unit/knife/bootstrap/chef_vault_handler_spec.rb52
-rw-r--r--spec/unit/knife/bootstrap/client_builder_spec.rb14
-rw-r--r--spec/unit/knife/bootstrap_spec.rb34
-rw-r--r--spec/unit/knife/client_bulk_delete_spec.rb2
-rw-r--r--spec/unit/knife/client_create_spec.rb14
-rw-r--r--spec/unit/knife/client_delete_spec.rb22
-rw-r--r--spec/unit/knife/client_edit_spec.rb14
-rw-r--r--spec/unit/knife/client_list_spec.rb8
-rw-r--r--spec/unit/knife/client_reregister_spec.rb24
-rw-r--r--spec/unit/knife/client_show_spec.rb20
-rw-r--r--spec/unit/knife/configure_client_spec.rb32
-rw-r--r--spec/unit/knife/configure_spec.rb68
-rw-r--r--spec/unit/knife/cookbook_bulk_delete_spec.rb18
-rw-r--r--spec/unit/knife/cookbook_create_spec.rb4
-rw-r--r--spec/unit/knife/cookbook_delete_spec.rb150
-rw-r--r--spec/unit/knife/cookbook_download_spec.rb148
-rw-r--r--spec/unit/knife/cookbook_list_spec.rb40
-rw-r--r--spec/unit/knife/cookbook_metadata_from_file_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_metadata_spec.rb86
-rw-r--r--spec/unit/knife/cookbook_show_spec.rb4
-rw-r--r--spec/unit/knife/cookbook_site_download_spec.rb68
-rw-r--r--spec/unit/knife/cookbook_site_install_spec.rb6
-rw-r--r--spec/unit/knife/cookbook_site_share_spec.rb60
-rw-r--r--spec/unit/knife/cookbook_site_unshare_spec.rb26
-rw-r--r--spec/unit/knife/cookbook_test_spec.rb4
-rw-r--r--spec/unit/knife/cookbook_upload_spec.rb112
-rw-r--r--spec/unit/knife/core/bootstrap_context_spec.rb26
-rw-r--r--spec/unit/knife/core/cookbook_scm_repo_spec.rb48
-rw-r--r--spec/unit/knife/core/custom_manifest_loader_spec.rb4
-rw-r--r--spec/unit/knife/core/gem_glob_loader_spec.rb28
-rw-r--r--spec/unit/knife/core/hashed_command_loader_spec.rb4
-rw-r--r--spec/unit/knife/core/node_editor_spec.rb130
-rw-r--r--spec/unit/knife/core/object_loader_spec.rb20
-rw-r--r--spec/unit/knife/core/subcommand_loader_spec.rb18
-rw-r--r--spec/unit/knife/core/ui_spec.rb48
-rw-r--r--spec/unit/knife/data_bag_create_spec.rb8
-rw-r--r--spec/unit/knife/data_bag_edit_spec.rb4
-rw-r--r--spec/unit/knife/data_bag_from_file_spec.rb8
-rw-r--r--spec/unit/knife/data_bag_secret_options_spec.rb8
-rw-r--r--spec/unit/knife/data_bag_show_spec.rb10
-rw-r--r--spec/unit/knife/environment_compare_spec.rb44
-rw-r--r--spec/unit/knife/environment_create_spec.rb2
-rw-r--r--spec/unit/knife/environment_delete_spec.rb2
-rw-r--r--spec/unit/knife/environment_edit_spec.rb2
-rw-r--r--spec/unit/knife/environment_from_file_spec.rb4
-rw-r--r--spec/unit/knife/environment_list_spec.rb2
-rw-r--r--spec/unit/knife/environment_show_spec.rb2
-rw-r--r--spec/unit/knife/index_rebuild_spec.rb2
-rw-r--r--spec/unit/knife/key_create_spec.rb10
-rw-r--r--spec/unit/knife/key_delete_spec.rb10
-rw-r--r--spec/unit/knife/key_edit_spec.rb10
-rw-r--r--spec/unit/knife/key_helper.rb2
-rw-r--r--spec/unit/knife/key_list_spec.rb10
-rw-r--r--spec/unit/knife/key_show_spec.rb14
-rw-r--r--spec/unit/knife/knife_help.rb2
-rw-r--r--spec/unit/knife/node_bulk_delete_spec.rb10
-rw-r--r--spec/unit/knife/node_delete_spec.rb2
-rw-r--r--spec/unit/knife/node_edit_spec.rb4
-rw-r--r--spec/unit/knife/node_environment_set_spec.rb4
-rw-r--r--spec/unit/knife/node_from_file_spec.rb4
-rw-r--r--spec/unit/knife/node_list_spec.rb2
-rw-r--r--spec/unit/knife/node_run_list_add_spec.rb4
-rw-r--r--spec/unit/knife/node_run_list_remove_spec.rb48
-rw-r--r--spec/unit/knife/node_run_list_set_spec.rb4
-rw-r--r--spec/unit/knife/node_show_spec.rb8
-rw-r--r--spec/unit/knife/osc_user_create_spec.rb10
-rw-r--r--spec/unit/knife/osc_user_delete_spec.rb10
-rw-r--r--spec/unit/knife/osc_user_edit_spec.rb8
-rw-r--r--spec/unit/knife/osc_user_list_spec.rb4
-rw-r--r--spec/unit/knife/osc_user_reregister_spec.rb16
-rw-r--r--spec/unit/knife/osc_user_show_spec.rb12
-rw-r--r--spec/unit/knife/raw_spec.rb8
-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_edit_spec.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_add_spec.rb6
-rw-r--r--spec/unit/knife/role_env_run_list_clear_spec.rb20
-rw-r--r--spec/unit/knife/role_env_run_list_remove_spec.rb34
-rw-r--r--spec/unit/knife/role_env_run_list_replace_spec.rb38
-rw-r--r--spec/unit/knife/role_env_run_list_set_spec.rb26
-rw-r--r--spec/unit/knife/role_from_file_spec.rb8
-rw-r--r--spec/unit/knife/role_list_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.rb4
-rw-r--r--spec/unit/knife/role_run_list_remove_spec.rb20
-rw-r--r--spec/unit/knife/role_run_list_replace_spec.rb30
-rw-r--r--spec/unit/knife/role_run_list_set_spec.rb2
-rw-r--r--spec/unit/knife/role_show_spec.rb20
-rw-r--r--spec/unit/knife/ssh_spec.rb40
-rw-r--r--spec/unit/knife/ssl_check_spec.rb2
-rw-r--r--spec/unit/knife/ssl_fetch_spec.rb4
-rw-r--r--spec/unit/knife/status_spec.rb2
-rw-r--r--spec/unit/knife/tag_create_spec.rb2
-rw-r--r--spec/unit/knife/tag_delete_spec.rb2
-rw-r--r--spec/unit/knife/tag_list_spec.rb2
-rw-r--r--spec/unit/knife/user_create_spec.rb52
-rw-r--r--spec/unit/knife/user_delete_spec.rb14
-rw-r--r--spec/unit/knife/user_edit_spec.rb8
-rw-r--r--spec/unit/knife/user_list_spec.rb4
-rw-r--r--spec/unit/knife/user_reregister_spec.rb18
-rw-r--r--spec/unit/knife/user_show_spec.rb16
-rw-r--r--spec/unit/knife_spec.rb44
-rw-r--r--spec/unit/log/syslog_spec.rb4
-rw-r--r--spec/unit/log/winevt_spec.rb2
-rw-r--r--spec/unit/log_spec.rb6
-rw-r--r--spec/unit/lwrp_spec.rb70
-rw-r--r--spec/unit/mash_spec.rb4
-rw-r--r--spec/unit/mixin/api_version_request_handling_spec.rb8
-rw-r--r--spec/unit/mixin/checksum_spec.rb6
-rw-r--r--spec/unit/mixin/command_spec.rb2
-rw-r--r--spec/unit/mixin/convert_to_class_name_spec.rb2
-rw-r--r--spec/unit/mixin/deep_merge_spec.rb16
-rw-r--r--spec/unit/mixin/deprecation_spec.rb6
-rw-r--r--spec/unit/mixin/enforce_ownership_and_permissions_spec.rb14
-rw-r--r--spec/unit/mixin/homebrew_user_spec.rb22
-rw-r--r--spec/unit/mixin/params_validate_spec.rb22
-rw-r--r--spec/unit/mixin/path_sanity_spec.rb16
-rw-r--r--spec/unit/mixin/powershell_out_spec.rb4
-rw-r--r--spec/unit/mixin/powershell_type_coercions_spec.rb40
-rw-r--r--spec/unit/mixin/properties_spec.rb54
-rw-r--r--spec/unit/mixin/proxified_socket_spec.rb8
-rw-r--r--spec/unit/mixin/securable_spec.rb64
-rw-r--r--spec/unit/mixin/shell_out_spec.rb112
-rw-r--r--spec/unit/mixin/subclass_directive_spec.rb2
-rw-r--r--spec/unit/mixin/template_spec.rb16
-rw-r--r--spec/unit/mixin/unformatter_spec.rb4
-rw-r--r--spec/unit/mixin/uris_spec.rb12
-rw-r--r--spec/unit/mixin/windows_architecture_helper_spec.rb4
-rw-r--r--spec/unit/mixin/xml_escape_spec.rb2
-rw-r--r--spec/unit/monkey_patches/uri_spec.rb2
-rw-r--r--spec/unit/monologger_spec.rb6
-rw-r--r--spec/unit/node/attribute_spec.rb32
-rw-r--r--spec/unit/node/immutable_collections_spec.rb16
-rw-r--r--spec/unit/node_map_spec.rb8
-rw-r--r--spec/unit/node_spec.rb98
-rw-r--r--spec/unit/org_spec.rb8
-rw-r--r--spec/unit/platform/query_helpers_spec.rb42
-rw-r--r--spec/unit/platform_spec.rb4
-rw-r--r--spec/unit/policy_builder/dynamic_spec.rb4
-rw-r--r--spec/unit/policy_builder/expand_node_object_spec.rb4
-rw-r--r--spec/unit/policy_builder/policyfile_spec.rb4
-rw-r--r--spec/unit/policy_builder_spec.rb4
-rw-r--r--spec/unit/property/state_spec.rb90
-rw-r--r--spec/unit/property/validation_spec.rb234
-rw-r--r--spec/unit/property_spec.rb168
-rw-r--r--spec/unit/provider/breakpoint_spec.rb2
-rw-r--r--spec/unit/provider/cookbook_file/content_spec.rb14
-rw-r--r--spec/unit/provider/cookbook_file_spec.rb16
-rw-r--r--spec/unit/provider/cron/unix_spec.rb10
-rw-r--r--spec/unit/provider/cron_spec.rb124
-rw-r--r--spec/unit/provider/deploy/revision_spec.rb2
-rw-r--r--spec/unit/provider/deploy/timestamped_spec.rb2
-rw-r--r--spec/unit/provider/deploy_spec.rb12
-rw-r--r--spec/unit/provider/directory_spec.rb12
-rw-r--r--spec/unit/provider/dsc_resource_spec.rb42
-rw-r--r--spec/unit/provider/dsc_script_spec.rb88
-rw-r--r--spec/unit/provider/env/windows_spec.rb30
-rw-r--r--spec/unit/provider/env_spec.rb2
-rw-r--r--spec/unit/provider/erl_call_spec.rb4
-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.rb10
-rw-r--r--spec/unit/provider/git_spec.rb56
-rw-r--r--spec/unit/provider/group/dscl_spec.rb10
-rw-r--r--spec/unit/provider/group/gpasswd_spec.rb2
-rw-r--r--spec/unit/provider/group/groupadd_spec.rb2
-rw-r--r--spec/unit/provider/group/groupmod_spec.rb2
-rw-r--r--spec/unit/provider/group/pw_spec.rb2
-rw-r--r--spec/unit/provider/group/usermod_spec.rb2
-rw-r--r--spec/unit/provider/group/windows_spec.rb4
-rw-r--r--spec/unit/provider/group_spec.rb6
-rw-r--r--spec/unit/provider/http_request_spec.rb4
-rw-r--r--spec/unit/provider/ifconfig/aix_spec.rb4
-rw-r--r--spec/unit/provider/ifconfig/debian_spec.rb4
-rw-r--r--spec/unit/provider/ifconfig/redhat_spec.rb4
-rw-r--r--spec/unit/provider/ifconfig_spec.rb4
-rw-r--r--spec/unit/provider/link_spec.rb20
-rw-r--r--spec/unit/provider/log_spec.rb2
-rw-r--r--spec/unit/provider/mdadm_spec.rb14
-rw-r--r--spec/unit/provider/mount/aix_spec.rb6
-rw-r--r--spec/unit/provider/mount/mount_spec.rb20
-rw-r--r--spec/unit/provider/mount/solaris_spec.rb46
-rw-r--r--spec/unit/provider/mount/windows_spec.rb2
-rw-r--r--spec/unit/provider/mount_spec.rb6
-rw-r--r--spec/unit/provider/ohai_spec.rb16
-rw-r--r--spec/unit/provider/osx_profile_spec.rb98
-rw-r--r--spec/unit/provider/package/aix_spec.rb2
-rw-r--r--spec/unit/provider/package/apt_spec.rb10
-rw-r--r--spec/unit/provider/package/chocolatey_spec.rb2
-rw-r--r--spec/unit/provider/package/dpkg_spec.rb22
-rw-r--r--spec/unit/provider/package/easy_install_spec.rb6
-rw-r--r--spec/unit/provider/package/freebsd/pkg_spec.rb8
-rw-r--r--spec/unit/provider/package/freebsd/pkgng_spec.rb20
-rw-r--r--spec/unit/provider/package/freebsd/port_spec.rb14
-rw-r--r--spec/unit/provider/package/homebrew_spec.rb274
-rw-r--r--spec/unit/provider/package/ips_spec.rb8
-rw-r--r--spec/unit/provider/package/macports_spec.rb2
-rw-r--r--spec/unit/provider/package/openbsd_spec.rb58
-rw-r--r--spec/unit/provider/package/pacman_spec.rb2
-rw-r--r--spec/unit/provider/package/paludis_spec.rb4
-rw-r--r--spec/unit/provider/package/portage_spec.rb2
-rw-r--r--spec/unit/provider/package/rpm_spec.rb6
-rw-r--r--spec/unit/provider/package/rubygems_spec.rb254
-rw-r--r--spec/unit/provider/package/smartos_spec.rb10
-rw-r--r--spec/unit/provider/package/solaris_spec.rb2
-rw-r--r--spec/unit/provider/package/windows/exe_spec.rb24
-rw-r--r--spec/unit/provider/package/windows/msi_spec.rb24
-rw-r--r--spec/unit/provider/package/windows_spec.rb56
-rw-r--r--spec/unit/provider/package/yum_spec.rb234
-rw-r--r--spec/unit/provider/package/zypper_spec.rb2
-rw-r--r--spec/unit/provider/package_spec.rb176
-rw-r--r--spec/unit/provider/powershell_script_spec.rb34
-rw-r--r--spec/unit/provider/registry_key_spec.rb2
-rw-r--r--spec/unit/provider/remote_directory_spec.rb82
-rw-r--r--spec/unit/provider/remote_file/cache_control_data_spec.rb14
-rw-r--r--spec/unit/provider/remote_file/content_spec.rb2
-rw-r--r--spec/unit/provider/remote_file/fetcher_spec.rb2
-rw-r--r--spec/unit/provider/remote_file/ftp_spec.rb2
-rw-r--r--spec/unit/provider/remote_file/http_spec.rb2
-rw-r--r--spec/unit/provider/remote_file/local_file_spec.rb2
-rw-r--r--spec/unit/provider/remote_file/network_file_spec.rb2
-rw-r--r--spec/unit/provider/remote_file_spec.rb12
-rw-r--r--spec/unit/provider/route_spec.rb42
-rw-r--r--spec/unit/provider/ruby_block_spec.rb2
-rw-r--r--spec/unit/provider/script_spec.rb16
-rw-r--r--spec/unit/provider/service/aix_service_spec.rb8
-rw-r--r--spec/unit/provider/service/aixinit_service_spec.rb24
-rw-r--r--spec/unit/provider/service/arch_service_spec.rb12
-rw-r--r--spec/unit/provider/service/debian_service_spec.rb4
-rw-r--r--spec/unit/provider/service/freebsd_service_spec.rb2
-rw-r--r--spec/unit/provider/service/gentoo_service_spec.rb2
-rw-r--r--spec/unit/provider/service/init_service_spec.rb4
-rw-r--r--spec/unit/provider/service/insserv_service_spec.rb2
-rw-r--r--spec/unit/provider/service/invokercd_service_spec.rb4
-rw-r--r--spec/unit/provider/service/macosx_spec.rb26
-rw-r--r--spec/unit/provider/service/openbsd_service_spec.rb40
-rw-r--r--spec/unit/provider/service/redhat_spec.rb4
-rw-r--r--spec/unit/provider/service/simple_service_spec.rb2
-rw-r--r--spec/unit/provider/service/solaris_smf_service_spec.rb76
-rw-r--r--spec/unit/provider/service/systemd_service_spec.rb6
-rw-r--r--spec/unit/provider/service/upstart_service_spec.rb20
-rw-r--r--spec/unit/provider/service/windows_spec.rb12
-rw-r--r--spec/unit/provider/service_spec.rb2
-rw-r--r--spec/unit/provider/subversion_spec.rb34
-rw-r--r--spec/unit/provider/template/content_spec.rb36
-rw-r--r--spec/unit/provider/template_spec.rb24
-rw-r--r--spec/unit/provider/user/dscl_spec.rb64
-rw-r--r--spec/unit/provider/user/pw_spec.rb12
-rw-r--r--spec/unit/provider/user/solaris_spec.rb54
-rw-r--r--spec/unit/provider/user/useradd_spec.rb14
-rw-r--r--spec/unit/provider/user/windows_spec.rb8
-rw-r--r--spec/unit/provider/user_spec.rb30
-rw-r--r--spec/unit/provider/whyrun_safe_ruby_block_spec.rb2
-rw-r--r--spec/unit/provider_resolver_spec.rb34
-rw-r--r--spec/unit/provider_spec.rb2
-rw-r--r--spec/unit/pure_application_spec.rb2
-rw-r--r--spec/unit/recipe_spec.rb4
-rw-r--r--spec/unit/resource/apt_package_spec.rb4
-rw-r--r--spec/unit/resource/bash_spec.rb2
-rw-r--r--spec/unit/resource/batch_spec.rb6
-rw-r--r--spec/unit/resource/breakpoint_spec.rb4
-rw-r--r--spec/unit/resource/chef_gem_spec.rb4
-rw-r--r--spec/unit/resource/chocolatey_package_spec.rb2
-rw-r--r--spec/unit/resource/conditional_action_not_nothing_spec.rb2
-rw-r--r--spec/unit/resource/conditional_spec.rb16
-rw-r--r--spec/unit/resource/cookbook_file_spec.rb12
-rw-r--r--spec/unit/resource/cron_spec.rb2
-rw-r--r--spec/unit/resource/csh_spec.rb2
-rw-r--r--spec/unit/resource/deploy_revision_spec.rb4
-rw-r--r--spec/unit/resource/deploy_spec.rb4
-rw-r--r--spec/unit/resource/directory_spec.rb2
-rw-r--r--spec/unit/resource/dpkg_package_spec.rb6
-rw-r--r--spec/unit/resource/dsc_resource_spec.rb14
-rw-r--r--spec/unit/resource/dsc_script_spec.rb22
-rw-r--r--spec/unit/resource/easy_install_package_spec.rb4
-rw-r--r--spec/unit/resource/env_spec.rb2
-rw-r--r--spec/unit/resource/erl_call_spec.rb2
-rw-r--r--spec/unit/resource/execute_spec.rb2
-rw-r--r--spec/unit/resource/file/verification_spec.rb10
-rw-r--r--spec/unit/resource/file_spec.rb2
-rw-r--r--spec/unit/resource/freebsd_package_spec.rb6
-rw-r--r--spec/unit/resource/gem_package_spec.rb4
-rw-r--r--spec/unit/resource/git_spec.rb4
-rw-r--r--spec/unit/resource/group_spec.rb2
-rw-r--r--spec/unit/resource/homebrew_package_spec.rb22
-rw-r--r--spec/unit/resource/http_request_spec.rb2
-rw-r--r--spec/unit/resource/ifconfig_spec.rb14
-rw-r--r--spec/unit/resource/ips_package_spec.rb4
-rw-r--r--spec/unit/resource/ksh_spec.rb2
-rw-r--r--spec/unit/resource/link_spec.rb2
-rw-r--r--spec/unit/resource/log_spec.rb2
-rw-r--r--spec/unit/resource/macports_package_spec.rb4
-rw-r--r--spec/unit/resource/mdadm_spec.rb2
-rw-r--r--spec/unit/resource/mount_spec.rb4
-rw-r--r--spec/unit/resource/ohai_spec.rb2
-rw-r--r--spec/unit/resource/openbsd_package_spec.rb4
-rw-r--r--spec/unit/resource/osx_profile_spec.rb4
-rw-r--r--spec/unit/resource/package_spec.rb2
-rw-r--r--spec/unit/resource/pacman_package_spec.rb4
-rw-r--r--spec/unit/resource/perl_spec.rb2
-rw-r--r--spec/unit/resource/powershell_script_spec.rb14
-rw-r--r--spec/unit/resource/python_spec.rb2
-rw-r--r--spec/unit/resource/registry_key_spec.rb34
-rw-r--r--spec/unit/resource/remote_directory_spec.rb2
-rw-r--r--spec/unit/resource/remote_file_spec.rb8
-rw-r--r--spec/unit/resource/resource_notification_spec.rb4
-rw-r--r--spec/unit/resource/route_spec.rb2
-rw-r--r--spec/unit/resource/rpm_package_spec.rb4
-rw-r--r--spec/unit/resource/ruby_block_spec.rb2
-rw-r--r--spec/unit/resource/ruby_spec.rb2
-rw-r--r--spec/unit/resource/scm_spec.rb4
-rw-r--r--spec/unit/resource/script_spec.rb2
-rw-r--r--spec/unit/resource/service_spec.rb2
-rw-r--r--spec/unit/resource/smartos_package_spec.rb4
-rw-r--r--spec/unit/resource/solaris_package_spec.rb4
-rw-r--r--spec/unit/resource/subversion_spec.rb8
-rw-r--r--spec/unit/resource/template_spec.rb2
-rw-r--r--spec/unit/resource/timestamped_deploy_spec.rb6
-rw-r--r--spec/unit/resource/user_spec.rb2
-rw-r--r--spec/unit/resource/windows_package_spec.rb10
-rw-r--r--spec/unit/resource/windows_service_spec.rb2
-rw-r--r--spec/unit/resource/yum_package_spec.rb8
-rw-r--r--spec/unit/resource_collection/resource_list_spec.rb2
-rw-r--r--spec/unit/resource_collection/resource_set_spec.rb2
-rw-r--r--spec/unit/resource_collection/stepable_iterator_spec.rb2
-rw-r--r--spec/unit/resource_collection_spec.rb4
-rw-r--r--spec/unit/resource_definition_spec.rb2
-rw-r--r--spec/unit/resource_reporter_spec.rb26
-rw-r--r--spec/unit/resource_resolver_spec.rb8
-rw-r--r--spec/unit/resource_spec.rb68
-rw-r--r--spec/unit/rest/auth_credentials_spec.rb12
-rw-r--r--spec/unit/rest_spec.rb98
-rw-r--r--spec/unit/role_spec.rb108
-rw-r--r--spec/unit/run_context/child_run_context_spec.rb38
-rw-r--r--spec/unit/run_context/cookbook_compiler_spec.rb6
-rw-r--r--spec/unit/run_context_spec.rb6
-rw-r--r--spec/unit/run_list/run_list_expansion_spec.rb42
-rw-r--r--spec/unit/run_list/run_list_item_spec.rb44
-rw-r--r--spec/unit/run_list/versioned_recipe_list_spec.rb2
-rw-r--r--spec/unit/run_list_spec.rb46
-rw-r--r--spec/unit/run_lock_spec.rb8
-rw-r--r--spec/unit/run_status_spec.rb4
-rw-r--r--spec/unit/runner_spec.rb2
-rw-r--r--spec/unit/scan_access_control_spec.rb4
-rw-r--r--spec/unit/search/query_spec.rb12
-rw-r--r--spec/unit/shell/model_wrapper_spec.rb10
-rw-r--r--spec/unit/shell/shell_ext_spec.rb2
-rw-r--r--spec/unit/shell/shell_session_spec.rb8
-rw-r--r--spec/unit/shell_out_spec.rb2
-rw-r--r--spec/unit/shell_spec.rb6
-rw-r--r--spec/unit/user_spec.rb6
-rw-r--r--spec/unit/user_v1_spec.rb14
-rw-r--r--spec/unit/util/backup_spec.rb30
-rw-r--r--spec/unit/util/diff_spec.rb4
-rw-r--r--spec/unit/util/dsc/configuration_generator_spec.rb84
-rw-r--r--spec/unit/util/dsc/lcm_output_parser_spec.rb34
-rw-r--r--spec/unit/util/dsc/local_configuration_manager_spec.rb56
-rw-r--r--spec/unit/util/dsc/resource_store.rb42
-rw-r--r--spec/unit/util/editor_spec.rb130
-rw-r--r--spec/unit/util/file_edit_spec.rb6
-rw-r--r--spec/unit/util/powershell/cmdlet_spec.rb44
-rw-r--r--spec/unit/util/powershell/ps_credential_spec.rb22
-rw-r--r--spec/unit/util/selinux_spec.rb4
-rw-r--r--spec/unit/util/threaded_job_queue_spec.rb2
-rw-r--r--spec/unit/version/platform_spec.rb6
-rw-r--r--spec/unit/version_class_spec.rb4
-rw-r--r--spec/unit/version_constraint/platform_spec.rb4
-rw-r--r--spec/unit/version_constraint_spec.rb34
-rw-r--r--spec/unit/win32/registry_spec.rb16
-rw-r--r--spec/unit/windows_service_spec.rb14
-rw-r--r--tasks/external_tests.rb16
-rw-r--r--tasks/maintainers.rb8
-rw-r--r--tasks/rspec.rb16
1292 files changed, 13082 insertions, 13080 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index c4272bd0f4..3c2a48e548 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -2,3 +2,5 @@ AllCops:
Exclude:
- "spec/data/**/*"
- "vendor/**/*"
+ - "pkg/**/*"
+ - "chef-config/pkg/**/*"
diff --git a/Gemfile b/Gemfile
index 3a29aa52aa..0dc69a120a 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,7 +3,7 @@ gemspec :name => "chef"
gem "activesupport", "< 4.0.0", :group => :compat_testing, :platform => "ruby"
-gem 'chef-config', path: "chef-config" if File.exists?(__FILE__ + '../chef-config')
+gem "chef-config", path: "chef-config" if File.exists?(__FILE__ + "../chef-config")
group(:docgen) do
gem "yard"
@@ -25,13 +25,13 @@ end
group(:development, :test) do
gem "simplecov"
- gem 'rack', "~> 1.5.1"
+ gem "rack", "~> 1.5.1"
# for testing new chefstyle rules
# gem 'chefstyle', github: 'chef/chefstyle'
- gem 'chefstyle', '= 0.1.0'
+ gem "chefstyle", "= 0.1.0"
- gem 'ruby-shadow', :platforms => :ruby unless RUBY_PLATFORM.downcase.match(/(aix|cygwin)/)
+ gem "ruby-shadow", :platforms => :ruby unless RUBY_PLATFORM.downcase.match(/(aix|cygwin)/)
# For external tests
# gem 'chef-zero', github: 'chef/chef-zero'
@@ -47,8 +47,8 @@ group(:development, :test) do
# gem 'chef-rewind'
end
-instance_eval(ENV['GEMFILE_MOD']) if ENV['GEMFILE_MOD']
+instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
# If you want to load debugging tools into the bundle exec sandbox,
# add these additional dependencies into chef/Gemfile.local
-eval(IO.read(__FILE__ + '.local'), binding) if File.exists?(__FILE__ + '.local')
+eval(IO.read(__FILE__ + ".local"), binding) if File.exists?(__FILE__ + ".local")
diff --git a/Rakefile b/Rakefile
index 9fe1147928..36a8e9715b 100644
--- a/Rakefile
+++ b/Rakefile
@@ -19,29 +19,29 @@
VERSION = IO.read(File.expand_path("../VERSION", __FILE__)).strip
-require 'rubygems'
-require 'chef-config/package_task'
-require 'rdoc/task'
-require_relative 'tasks/rspec'
-require_relative 'tasks/external_tests'
-require_relative 'tasks/maintainers'
+require "rubygems"
+require "chef-config/package_task"
+require "rdoc/task"
+require_relative "tasks/rspec"
+require_relative "tasks/external_tests"
+require_relative "tasks/maintainers"
-ChefConfig::PackageTask.new(File.expand_path('..', __FILE__), 'Chef') do |package|
- package.component_paths = ['chef-config']
+ChefConfig::PackageTask.new(File.expand_path("..", __FILE__), "Chef") do |package|
+ package.component_paths = ["chef-config"]
package.generate_version_class = true
end
task :pedant, :chef_zero_spec
task :build_eventlog do
- Dir.chdir 'ext/win32-eventlog/' do
- system 'rake build'
+ Dir.chdir "ext/win32-eventlog/" do
+ system "rake build"
end
end
task :register_eventlog do
- Dir.chdir 'ext/win32-eventlog/' do
- system 'rake register'
+ Dir.chdir "ext/win32-eventlog/" do
+ system "rake register"
end
end
@@ -53,14 +53,14 @@ RuboCop::RakeTask.new(:style) do |task|
end
begin
- require 'yard'
+ require "yard"
DOC_FILES = [ "README.rdoc", "LICENSE", "spec/tiny_server.rb", "lib/**/*.rb" ]
namespace :yard do
desc "Create YARD documentation"
YARD::Rake::YardocTask.new(:html) do |t|
t.files = DOC_FILES
- t.options = ['--format', 'html']
+ t.options = ["--format", "html"]
end
end
diff --git a/acceptance/Gemfile b/acceptance/Gemfile
index 3de932f988..70d99492dd 100644
--- a/acceptance/Gemfile
+++ b/acceptance/Gemfile
@@ -1,10 +1,10 @@
-source 'https://rubygems.org'
+source "https://rubygems.org"
-gem 'mixlib-install', github: 'chef/mixlib-install'
-gem 'chef-acceptance', github: 'chef/chef-acceptance'
-gem 'test-kitchen', github: 'sersut/test-kitchen',
- branch: 'sersut/mixlib-install-update'
-gem 'kitchen-inspec'
-gem 'kitchen-vagrant'
-gem 'windows_chef_zero'
-gem 'winrm-transport'
+gem "mixlib-install", github: "chef/mixlib-install"
+gem "chef-acceptance", github: "chef/chef-acceptance"
+gem "test-kitchen", github: "sersut/test-kitchen",
+ branch: "sersut/mixlib-install-update"
+gem "kitchen-inspec"
+gem "kitchen-vagrant"
+gem "windows_chef_zero"
+gem "winrm-transport"
diff --git a/acceptance/trivial/test/integration/chef-current-install/inspec/chef_client_spec.rb b/acceptance/trivial/test/integration/chef-current-install/inspec/chef_client_spec.rb
index 9c4a34f544..0564080caf 100644
--- a/acceptance/trivial/test/integration/chef-current-install/inspec/chef_client_spec.rb
+++ b/acceptance/trivial/test/integration/chef-current-install/inspec/chef_client_spec.rb
@@ -1,3 +1,3 @@
-describe command('chef-client') do
+describe command("chef-client") do
it { should exist }
end
diff --git a/bin/chef-apply b/bin/chef-apply
index c617129aa3..5d857167ae 100755
--- a/bin/chef-apply
+++ b/bin/chef-apply
@@ -18,8 +18,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'rubygems'
+require "rubygems"
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
-require 'chef/application/apply'
+require "chef/application/apply"
Chef::Application::Apply.new.run
diff --git a/bin/chef-client b/bin/chef-client
index 5b2b058f91..6f4f4d8b04 100755
--- a/bin/chef-client
+++ b/bin/chef-client
@@ -18,9 +18,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'rubygems'
+require "rubygems"
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
-require 'chef'
-require 'chef/application/client'
+require "chef"
+require "chef/application/client"
Chef::Application::Client.new.run
diff --git a/bin/chef-service-manager b/bin/chef-service-manager
index 43d9c8a933..9bdd244e1d 100755
--- a/bin/chef-service-manager
+++ b/bin/chef-service-manager
@@ -18,19 +18,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'rubygems'
+require "rubygems"
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
-require 'chef'
-require 'chef/application/windows_service_manager'
+require "chef"
+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),
+ :service_file_path => File.expand_path("../chef-windows-service", $PROGRAM_NAME),
:delayed_start => true,
- :dependencies => ['Winmgmt'],
+ :dependencies => ["Winmgmt"],
}
Chef::Application::WindowsServiceManager.new(chef_client_service).run
else
diff --git a/bin/chef-shell b/bin/chef-shell
index f334635742..9cc7651c70 100755
--- a/bin/chef-shell
+++ b/bin/chef-shell
@@ -25,7 +25,7 @@ end
require "irb"
require "irb/completion"
-require 'irb/ext/save-history'
+require "irb/ext/save-history"
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
diff --git a/bin/chef-solo b/bin/chef-solo
index 958ab21a41..11961f810d 100755
--- a/bin/chef-solo
+++ b/bin/chef-solo
@@ -18,8 +18,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'rubygems'
+require "rubygems"
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
-require 'chef/application/solo'
+require "chef/application/solo"
Chef::Application::Solo.new.run
diff --git a/bin/chef-windows-service b/bin/chef-windows-service
index 292d5651fc..ffc4676fda 100755
--- a/bin/chef-windows-service
+++ b/bin/chef-windows-service
@@ -23,10 +23,10 @@
# generate will call that file, and will be registered as
# a windows service.
-require 'rubygems'
+require "rubygems"
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
-require 'chef'
-require 'chef/application/windows_service'
+require "chef"
+require "chef/application/windows_service"
if Chef::Platform.windows?
Chef::Application::WindowsService.mainloop
diff --git a/bin/knife b/bin/knife
index 6173aadd86..387cf7c2c7 100755
--- a/bin/knife
+++ b/bin/knife
@@ -18,9 +18,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'rubygems'
+require "rubygems"
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")))
-require 'chef/application/knife'
+require "chef/application/knife"
Chef::Application::Knife.new.run
diff --git a/chef-config/Gemfile b/chef-config/Gemfile
index d39725ff87..96ab544690 100644
--- a/chef-config/Gemfile
+++ b/chef-config/Gemfile
@@ -1,4 +1,4 @@
-source 'https://rubygems.org'
+source "https://rubygems.org"
# Specify your gem's dependencies in chef-config.gemspec
gemspec
diff --git a/chef-config/Rakefile b/chef-config/Rakefile
index 36e7e2572d..ac088852cf 100644
--- a/chef-config/Rakefile
+++ b/chef-config/Rakefile
@@ -1,14 +1,14 @@
-require 'rspec/core/rake_task'
-require 'chef-config/package_task'
+require "rspec/core/rake_task"
+require "chef-config/package_task"
-ChefConfig::PackageTask.new(File.expand_path('..', __FILE__), 'ChefConfig') do |package|
- package.module_path = 'chef-config'
+ChefConfig::PackageTask.new(File.expand_path("..", __FILE__), "ChefConfig") do |package|
+ package.module_path = "chef-config"
end
task :default => :spec
desc "Run standard specs"
RSpec::Core::RakeTask.new(:spec) do |t|
- t.pattern = FileList['spec/**/*_spec.rb']
+ t.pattern = FileList["spec/**/*_spec.rb"]
end
diff --git a/chef-config/chef-config.gemspec b/chef-config/chef-config.gemspec
index 6619f04169..f67f3010ca 100644
--- a/chef-config/chef-config.gemspec
+++ b/chef-config/chef-config.gemspec
@@ -1,7 +1,7 @@
# coding: utf-8
-lib = File.expand_path('../lib', __FILE__)
+lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require 'chef-config/version'
+require "chef-config/version"
Gem::Specification.new do |spec|
spec.name = "chef-config"
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index 1ad6266d14..81e9cf3f68 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -19,14 +19,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'mixlib/config'
-require 'pathname'
+require "mixlib/config"
+require "pathname"
-require 'chef-config/logger'
-require 'chef-config/windows'
-require 'chef-config/path_helper'
-require 'mixlib/shellout'
-require 'uri'
+require "chef-config/logger"
+require "chef-config/windows"
+require "chef-config/path_helper"
+require "mixlib/shellout"
+require "uri"
module ChefConfig
@@ -49,8 +49,8 @@ module ChefConfig
path = PathHelper.cleanpath(path)
if ChefConfig.windows?
# turns \etc\chef\client.rb and \var\chef\client.rb into C:/chef/client.rb
- if env['SYSTEMDRIVE'] && path[0] == '\\' && path.split('\\')[2] == 'chef'
- path = PathHelper.join(env['SYSTEMDRIVE'], path.split('\\', 3)[2])
+ if env["SYSTEMDRIVE"] && path[0] == '\\' && path.split('\\')[2] == "chef"
+ path = PathHelper.join(env["SYSTEMDRIVE"], path.split('\\', 3)[2])
end
end
path
@@ -107,10 +107,10 @@ module ChefConfig
default :chef_repo_path do
if self.configuration[:cookbook_path]
if self.configuration[:cookbook_path].kind_of?(String)
- File.expand_path('..', self.configuration[:cookbook_path])
+ File.expand_path("..", self.configuration[:cookbook_path])
else
self.configuration[:cookbook_path].map do |path|
- File.expand_path('..', path)
+ File.expand_path("..", path)
end
end
else
@@ -123,7 +123,7 @@ module ChefConfig
# This allows us to run config-free.
path = cwd
until File.directory?(PathHelper.join(path, "cookbooks"))
- new_path = File.expand_path('..', path)
+ new_path = File.expand_path("..", path)
if new_path == path
ChefConfig.logger.warn("No cookbooks directory found at or above current directory. Assuming #{Dir.pwd}.")
return Dir.pwd
@@ -145,66 +145,66 @@ module ChefConfig
# Location of acls on disk. String or array of strings.
# Defaults to <chef_repo_path>/acls.
# Only applies to Enterprise Chef commands.
- default(:acl_path) { derive_path_from_chef_repo_path('acls') }
+ default(:acl_path) { derive_path_from_chef_repo_path("acls") }
# Location of clients on disk. String or array of strings.
# Defaults to <chef_repo_path>/acls.
- default(:client_path) { derive_path_from_chef_repo_path('clients') }
+ default(:client_path) { derive_path_from_chef_repo_path("clients") }
# Location of cookbooks on disk. String or array of strings.
# Defaults to <chef_repo_path>/cookbooks. If chef_repo_path
# is not specified, this is set to [/var/chef/cookbooks, /var/chef/site-cookbooks]).
default(:cookbook_path) do
if self.configuration[:chef_repo_path]
- derive_path_from_chef_repo_path('cookbooks')
+ derive_path_from_chef_repo_path("cookbooks")
else
- Array(derive_path_from_chef_repo_path('cookbooks')).flatten +
- Array(derive_path_from_chef_repo_path('site-cookbooks')).flatten
+ Array(derive_path_from_chef_repo_path("cookbooks")).flatten +
+ Array(derive_path_from_chef_repo_path("site-cookbooks")).flatten
end
end
# Location of containers on disk. String or array of strings.
# Defaults to <chef_repo_path>/containers.
# Only applies to Enterprise Chef commands.
- default(:container_path) { derive_path_from_chef_repo_path('containers') }
+ default(:container_path) { derive_path_from_chef_repo_path("containers") }
# Location of data bags on disk. String or array of strings.
# Defaults to <chef_repo_path>/data_bags.
- default(:data_bag_path) { derive_path_from_chef_repo_path('data_bags') }
+ default(:data_bag_path) { derive_path_from_chef_repo_path("data_bags") }
# Location of environments on disk. String or array of strings.
# Defaults to <chef_repo_path>/environments.
- default(:environment_path) { derive_path_from_chef_repo_path('environments') }
+ default(:environment_path) { derive_path_from_chef_repo_path("environments") }
# Location of groups on disk. String or array of strings.
# Defaults to <chef_repo_path>/groups.
# Only applies to Enterprise Chef commands.
- default(:group_path) { derive_path_from_chef_repo_path('groups') }
+ default(:group_path) { derive_path_from_chef_repo_path("groups") }
# Location of nodes on disk. String or array of strings.
# Defaults to <chef_repo_path>/nodes.
- default(:node_path) { derive_path_from_chef_repo_path('nodes') }
+ default(:node_path) { derive_path_from_chef_repo_path("nodes") }
# Location of policies on disk. String or array of strings.
# Defaults to <chef_repo_path>/policies.
- default(:policy_path) { derive_path_from_chef_repo_path('policies') }
+ default(:policy_path) { derive_path_from_chef_repo_path("policies") }
# Location of policy_groups on disk. String or array of strings.
# Defaults to <chef_repo_path>/policy_groups.
- default(:policy_group_path) { derive_path_from_chef_repo_path('policy_groups') }
+ default(:policy_group_path) { derive_path_from_chef_repo_path("policy_groups") }
# Location of roles on disk. String or array of strings.
# Defaults to <chef_repo_path>/roles.
- default(:role_path) { derive_path_from_chef_repo_path('roles') }
+ default(:role_path) { derive_path_from_chef_repo_path("roles") }
# Location of users on disk. String or array of strings.
# Defaults to <chef_repo_path>/users.
# Does not apply to Enterprise Chef commands.
- default(:user_path) { derive_path_from_chef_repo_path('users') }
+ default(:user_path) { derive_path_from_chef_repo_path("users") }
# Location of policies on disk. String or array of strings.
# Defaults to <chef_repo_path>/policies.
- default(:policy_path) { derive_path_from_chef_repo_path('policies') }
+ default(:policy_path) { derive_path_from_chef_repo_path("policies") }
# Turn on "path sanity" by default. See also: http://wiki.opscode.com/display/chef/User+Environment+PATH+Sanity
default :enforce_path_sanity, true
@@ -222,7 +222,7 @@ module ChefConfig
# this is under the user's home directory.
default(:cache_path) do
if local_mode
- PathHelper.join(config_dir, 'local-mode-cache')
+ PathHelper.join(config_dir, "local-mode-cache")
else
primary_cache_root = platform_specific_path("/var")
primary_cache_path = platform_specific_path("/var/chef")
@@ -231,7 +231,7 @@ module ChefConfig
# Otherwise, we'll create .chef under the user's home directory and use that as
# the cache path.
unless path_accessible?(primary_cache_path) || path_accessible?(primary_cache_root)
- secondary_cache_path = PathHelper.join(user_home, '.chef')
+ secondary_cache_path = PathHelper.join(user_home, ".chef")
ChefConfig.logger.info("Unable to access cache at #{primary_cache_path}. Switching cache to #{secondary_cache_path}")
secondary_cache_path
else
@@ -318,7 +318,7 @@ module ChefConfig
config_context :chef_zero do
config_strict_mode true
default(:enabled) { ChefConfig::Config.local_mode }
- default :host, 'localhost'
+ default :host, "localhost"
default :port, 8889.upto(9999) # Will try ports from 8889-9999 until one works
end
default :chef_server_url, "https://localhost:443"
@@ -327,7 +327,7 @@ module ChefConfig
# if the chef_server_url is a path to an organization, aka
# 'some_url.../organizations/*' then remove the '/organization/*' by default
if self.configuration[:chef_server_url] =~ /\/organizations\/\S*$/
- self.configuration[:chef_server_url].split('/')[0..-3].join('/')
+ self.configuration[:chef_server_url].split("/")[0..-3].join("/")
elsif self.configuration[:chef_server_url] # default to whatever chef_server_url is
self.configuration[:chef_server_url]
else
@@ -742,7 +742,7 @@ module ChefConfig
# pass = password
# @api private
def self.export_proxy(scheme, path, user, pass)
- path = "#{scheme}://#{path}" unless path.include?('://')
+ path = "#{scheme}://#{path}" unless path.include?("://")
# URI.split returns the following parts:
# [scheme, userinfo, host, port, registry, path, opaque, query, fragment]
parts = URI.split(URI.encode(path))
@@ -750,7 +750,7 @@ module ChefConfig
# returns a string for the port.
parts[3] = parts[3].to_i if parts[3]
if user && !user.empty?
- userinfo = URI.encode(URI.encode(user), '@:')
+ userinfo = URI.encode(URI.encode(user), "@:")
if pass
userinfo << ":#{URI.encode(URI.encode(pass), '@:')}"
end
@@ -764,8 +764,8 @@ module ChefConfig
# @api private
def self.export_no_proxy(value)
- ENV['no_proxy'] = value unless ENV['no_proxy']
- ENV['NO_PROXY'] = value unless ENV['NO_PROXY']
+ ENV["no_proxy"] = value unless ENV["no_proxy"]
+ ENV["NO_PROXY"] = value unless ENV["NO_PROXY"]
end
# Chef requires an English-language UTF-8 locale to function properly. We attempt
@@ -793,12 +793,12 @@ module ChefConfig
cmd.error!
locales = cmd.stdout.split
case
- when locales.include?('C.UTF-8')
- 'C.UTF-8'
- when locales.include?('en_US.UTF-8'), locales.include?('en_US.utf8')
- 'en_US.UTF-8'
- when locales.include?('en.UTF-8')
- 'en.UTF-8'
+ when locales.include?("C.UTF-8")
+ "C.UTF-8"
+ when locales.include?("en_US.UTF-8"), locales.include?("en_US.utf8")
+ "en_US.UTF-8"
+ when locales.include?("en.UTF-8")
+ "en.UTF-8"
else
# Will match en_ZZ.UTF-8, en_ZZ.utf-8, en_ZZ.UTF8, en_ZZ.utf8
guesses = locales.select { |l| l =~ /^en_.*UTF-?8$/i }
@@ -808,7 +808,7 @@ module ChefConfig
guessed_locale.gsub(/UTF-?8$/i, "UTF-8")
else
ChefConfig.logger.warn "Please install an English UTF-8 locale for Chef to use, falling back to C locale and disabling UTF-8 support."
- 'C'
+ "C"
end
end
rescue
@@ -817,7 +817,7 @@ module ChefConfig
else
ChefConfig.logger.debug "No usable locale -a command found, assuming you have en_US.UTF-8 installed."
end
- 'en_US.UTF-8'
+ "en_US.UTF-8"
end
default :internal_locale, guess_internal_locale
diff --git a/chef-config/lib/chef-config/exceptions.rb b/chef-config/lib/chef-config/exceptions.rb
index 1f80e505df..b4efe17329 100644
--- a/chef-config/lib/chef-config/exceptions.rb
+++ b/chef-config/lib/chef-config/exceptions.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'chef-config/windows'
-require 'chef-config/logger'
+require "chef-config/windows"
+require "chef-config/logger"
module ChefConfig
diff --git a/chef-config/lib/chef-config/package_task.rb b/chef-config/lib/chef-config/package_task.rb
index 2e9b36d939..59620ad03a 100644
--- a/chef-config/lib/chef-config/package_task.rb
+++ b/chef-config/lib/chef-config/package_task.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'rake'
-require 'rubygems'
-require 'rubygems/package_task'
+require "rake"
+require "rubygems"
+require "rubygems/package_task"
module ChefConfig
class PackageTask < Rake::TaskLib
@@ -70,9 +70,9 @@ module ChefConfig
@module_name = module_name
@component_paths = []
@module_path = nil
- @version_file_path = 'VERSION'
- @package_dir = 'pkg'
- @git_remote = 'origin'
+ @version_file_path = "VERSION"
+ @package_dir = "pkg"
+ @git_remote = "origin"
@generate_version_class = false
end
@@ -93,7 +93,7 @@ module ChefConfig
end
def class_or_module
- generate_version_class ? 'class' : 'module'
+ generate_version_class ? "class" : "module"
end
def with_clean_env(&block)
@@ -105,46 +105,46 @@ module ChefConfig
end
def define
- raise 'Need to provide package root and module name' if root_path.nil? || module_name.nil?
+ raise "Need to provide package root and module name" if root_path.nil? || module_name.nil?
- desc 'Build Gems of component dependencies'
+ desc "Build Gems of component dependencies"
task :package_components do
component_full_paths.each do |component_path|
Dir.chdir(component_path) do
- sh 'rake package'
+ sh "rake package"
end
end
end
task :package => :package_components
- desc 'Build and install component dependencies'
+ desc "Build and install component dependencies"
task :install_components => :package_components do
component_full_paths.each do |component_path|
Dir.chdir(component_path) do
- sh 'rake install'
+ sh "rake install"
end
end
end
task :install => :install_components
- desc 'Clean up builds of component dependencies'
+ desc "Clean up builds of component dependencies"
task :clobber_component_packages do
component_full_paths.each do |component_path|
Dir.chdir(component_path) do
- sh 'rake clobber_package'
+ sh "rake clobber_package"
end
end
end
task :clobber_package => :clobber_component_packages
- desc 'Update the version number for component dependencies'
+ desc "Update the version number for component dependencies"
task :update_components_versions do
component_full_paths.each do |component_path|
Dir.chdir(component_path) do
- sh 'rake version'
+ sh "rake version"
end
end
end
@@ -209,11 +209,11 @@ end
sh %{gem uninstall #{module_path} -x -v #{version} }
end
- desc 'Build it, tag it and ship it'
+ desc "Build it, tag it and ship it"
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|
+ Dir[File.expand_path("*.gem", full_package_dir)].reverse.each do |built_gem|
sh("gem push #{built_gem}")
end
end
diff --git a/chef-config/lib/chef-config/path_helper.rb b/chef-config/lib/chef-config/path_helper.rb
index ce6c440571..05c1cb88b7 100644
--- a/chef-config/lib/chef-config/path_helper.rb
+++ b/chef-config/lib/chef-config/path_helper.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef-config/windows'
-require 'chef-config/logger'
-require 'chef-config/exceptions'
+require "chef-config/windows"
+require "chef-config/logger"
+require "chef-config/exceptions"
module ChefConfig
class PathHelper
@@ -32,7 +32,7 @@ module ChefConfig
loop do
slash = path.rindex(/[#{Regexp.escape(File::SEPARATOR)}#{Regexp.escape(path_separator)}]/, end_slash - 1)
if !slash
- return end_slash == path.size ? '.' : path_separator
+ return end_slash == path.size ? "." : path_separator
elsif slash == end_slash - 1
end_slash = slash
else
@@ -64,8 +64,8 @@ module ChefConfig
leading_slashes = /^[#{path_separator_regex}]+/
args.flatten.inject() do |joined_path, component|
- joined_path = joined_path.sub(trailing_slashes, '')
- component = component.sub(leading_slashes, '')
+ joined_path = joined_path.sub(trailing_slashes, "")
+ component = component.sub(leading_slashes, "")
joined_path += "#{path_separator}#{component}"
end
end
@@ -201,12 +201,12 @@ module ChefConfig
# HOMESHARE HOMEPATH
# USERPROFILE
- paths << ENV['HOME']
- paths << ENV['HOMEDRIVE'] + ENV['HOMEPATH'] if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
- paths << ENV['HOMESHARE'] + ENV['HOMEPATH'] if ENV['HOMESHARE'] && ENV['HOMEPATH']
- paths << ENV['USERPROFILE']
+ paths << ENV["HOME"]
+ paths << ENV["HOMEDRIVE"] + ENV["HOMEPATH"] if ENV["HOMEDRIVE"] && ENV["HOMEPATH"]
+ paths << ENV["HOMESHARE"] + ENV["HOMEPATH"] if ENV["HOMESHARE"] && ENV["HOMEPATH"]
+ paths << ENV["USERPROFILE"]
end
- paths << Dir.home if ENV['HOME']
+ paths << Dir.home if ENV["HOME"]
# Depending on what environment variables we're using, the slashes can go in any which way.
# Just change them all to / to keep things consistent.
@@ -231,10 +231,10 @@ module ChefConfig
# Determine if the given path is protected by OS X System Integrity Protection.
def self.is_sip_path?(path, node)
- if node['platform'] == 'mac_os_x' and Gem::Version.new(node['platform_version']) >= Gem::Version.new('10.11')
+ if node["platform"] == "mac_os_x" and Gem::Version.new(node["platform_version"]) >= Gem::Version.new("10.11")
# todo: parse rootless.conf for this?
sip_paths= [
- '/System', '/bin', '/sbin', '/usr'
+ "/System", "/bin", "/sbin", "/usr"
]
sip_paths.each do |sip_path|
ChefConfig.logger.info("This is a SIP path, checking if it in exceptions list.")
@@ -249,9 +249,9 @@ module ChefConfig
def self.writable_sip_path?(path)
# todo: parse rootless.conf for this?
sip_exceptions = [
- '/System/Library/Caches', '/System/Library/Extensions',
- '/System/Library/Speech', '/System/Library/User Template',
- '/usr/libexec/cups', '/usr/local', '/usr/share/man'
+ "/System/Library/Caches", "/System/Library/Extensions",
+ "/System/Library/Speech", "/System/Library/User Template",
+ "/usr/libexec/cups", "/usr/local", "/usr/share/man"
]
sip_exceptions.each do |exception_path|
return true if path.start_with?(exception_path)
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index 2c5e2dec8a..dd2a5bb9ad 100644
--- a/chef-config/lib/chef-config/version.rb
+++ b/chef-config/lib/chef-config/version.rb
@@ -21,7 +21,7 @@
module ChefConfig
CHEFCONFIG_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__)))
- VERSION = '12.6.0'
+ VERSION = "12.6.0"
end
#
diff --git a/chef-config/lib/chef-config/workstation_config_loader.rb b/chef-config/lib/chef-config/workstation_config_loader.rb
index 177cd776d4..ec291b80a7 100644
--- a/chef-config/lib/chef-config/workstation_config_loader.rb
+++ b/chef-config/lib/chef-config/workstation_config_loader.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef-config/config'
-require 'chef-config/exceptions'
-require 'chef-config/logger'
-require 'chef-config/path_helper'
-require 'chef-config/windows'
+require "chef-config/config"
+require "chef-config/exceptions"
+require "chef-config/logger"
+require "chef-config/path_helper"
+require "chef-config/windows"
module ChefConfig
class WorkstationConfigLoader
@@ -99,24 +99,24 @@ module ChefConfig
candidate_configs = []
# Look for $KNIFE_HOME/knife.rb (allow multiple knives config on same machine)
- if env['KNIFE_HOME']
- candidate_configs << File.join(env['KNIFE_HOME'], 'config.rb')
- candidate_configs << File.join(env['KNIFE_HOME'], 'knife.rb')
+ if env["KNIFE_HOME"]
+ candidate_configs << File.join(env["KNIFE_HOME"], "config.rb")
+ candidate_configs << File.join(env["KNIFE_HOME"], "knife.rb")
end
# Look for $PWD/knife.rb
if Dir.pwd
- candidate_configs << File.join(Dir.pwd, 'config.rb')
- candidate_configs << File.join(Dir.pwd, 'knife.rb')
+ candidate_configs << File.join(Dir.pwd, "config.rb")
+ candidate_configs << File.join(Dir.pwd, "knife.rb")
end
# Look for $UPWARD/.chef/knife.rb
if chef_config_dir
- candidate_configs << File.join(chef_config_dir, 'config.rb')
- candidate_configs << File.join(chef_config_dir, 'knife.rb')
+ candidate_configs << File.join(chef_config_dir, "config.rb")
+ candidate_configs << File.join(chef_config_dir, "knife.rb")
end
# Look for $HOME/.chef/knife.rb
- PathHelper.home('.chef') do |dot_chef_dir|
- candidate_configs << File.join(dot_chef_dir, 'config.rb')
- candidate_configs << File.join(dot_chef_dir, 'knife.rb')
+ PathHelper.home(".chef") do |dot_chef_dir|
+ candidate_configs << File.join(dot_chef_dir, "config.rb")
+ candidate_configs << File.join(dot_chef_dir, "knife.rb")
end
candidate_configs.find do | candidate_config |
@@ -126,9 +126,9 @@ module ChefConfig
def working_directory
a = if ChefConfig.windows?
- env['CD']
+ env["CD"]
else
- env['PWD']
+ env["PWD"]
end || Dir.pwd
a
diff --git a/chef-config/spec/spec_helper.rb b/chef-config/spec/spec_helper.rb
index df9461cde9..107becb9eb 100644
--- a/chef-config/spec/spec_helper.rb
+++ b/chef-config/spec/spec_helper.rb
@@ -1,4 +1,4 @@
-require 'chef-config/windows'
+require "chef-config/windows"
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
@@ -53,7 +53,7 @@ RSpec.configure do |config|
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
- config.default_formatter = 'doc'
+ config.default_formatter = "doc"
end
# Print the 10 slowest examples and example groups at the
diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb
index 8c20b0bef8..5983981ddd 100644
--- a/chef-config/spec/unit/config_spec.rb
+++ b/chef-config/spec/unit/config_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef-config/config'
+require "spec_helper"
+require "chef-config/config"
RSpec.describe ChefConfig::Config do
before(:each) do
@@ -28,7 +28,7 @@ RSpec.describe ChefConfig::Config do
ChefConfig::Config.treat_deprecation_warnings_as_errors(true)
# Set environment variable so the setting persists in child processes
- ENV['CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS'] = "1"
+ ENV["CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS"] = "1"
end
describe "config attribute writer: chef_server_url" do
@@ -123,7 +123,7 @@ RSpec.describe ChefConfig::Config do
if is_windows
it "should return a windows path on windows systems" do
path = "/etc/chef/cookbooks"
- allow(ChefConfig::Config).to receive(:env).and_return({ 'SYSTEMDRIVE' => 'C:' })
+ allow(ChefConfig::Config).to receive(:env).and_return({ "SYSTEMDRIVE" => "C:" })
# match on a regex that looks for the base path with an optional
# system drive at the beginning (c:)
# system drive is not hardcoded b/c it can change and b/c it is not present on linux systems
@@ -156,10 +156,10 @@ RSpec.describe ChefConfig::Config do
before do
if is_windows
- allow(ChefConfig::Config).to receive(:env).and_return({ 'SYSTEMDRIVE' => 'C:' })
+ allow(ChefConfig::Config).to receive(:env).and_return({ "SYSTEMDRIVE" => "C:" })
ChefConfig::Config[:user_home] = 'C:\Users\charlie'
else
- ChefConfig::Config[:user_home] = '/Users/charlie'
+ ChefConfig::Config[:user_home] = "/Users/charlie"
end
allow(ChefConfig::Config).to receive(:path_accessible?).and_return(false)
@@ -250,21 +250,21 @@ RSpec.describe ChefConfig::Config do
context "and config_dir is /a/b/c" do
before do
- ChefConfig::Config.config_dir to_platform('/a/b/c')
+ ChefConfig::Config.config_dir to_platform("/a/b/c")
end
it "cache_path is /a/b/c/local-mode-cache" do
- expect(ChefConfig::Config.cache_path).to eq(to_platform('/a/b/c/local-mode-cache'))
+ expect(ChefConfig::Config.cache_path).to eq(to_platform("/a/b/c/local-mode-cache"))
end
end
context "and config_dir is /a/b/c/" do
before do
- ChefConfig::Config.config_dir to_platform('/a/b/c/')
+ ChefConfig::Config.config_dir to_platform("/a/b/c/")
end
it "cache_path is /a/b/c/local-mode-cache" do
- expect(ChefConfig::Config.cache_path).to eq(to_platform('/a/b/c/local-mode-cache'))
+ expect(ChefConfig::Config.cache_path).to eq(to_platform("/a/b/c/local-mode-cache"))
end
end
end
@@ -326,7 +326,7 @@ RSpec.describe ChefConfig::Config do
it "does not set derived paths at FS root" do
ChefConfig::Config.local_mode = true
- expect(ChefConfig::Config.cache_path.downcase).to eq(to_platform(File.join(Dir.pwd, 'local-mode-cache')).downcase)
+ expect(ChefConfig::Config.cache_path.downcase).to eq(to_platform(File.join(Dir.pwd, "local-mode-cache")).downcase)
end
end
@@ -371,7 +371,7 @@ RSpec.describe ChefConfig::Config do
end
it "config_dir is /home/charlie/.chef/" do
- expect(ChefConfig::Config.config_dir).to eq(ChefConfig::PathHelper.join(to_platform("/home/charlie/.chef"), ''))
+ expect(ChefConfig::Config.config_dir).to eq(ChefConfig::PathHelper.join(to_platform("/home/charlie/.chef"), ""))
end
context "and chef is running in local mode" do
@@ -380,7 +380,7 @@ RSpec.describe ChefConfig::Config do
end
it "config_dir is /home/charlie/.chef/" do
- expect(ChefConfig::Config.config_dir).to eq(ChefConfig::PathHelper.join(to_platform("/home/charlie/.chef"), ''))
+ expect(ChefConfig::Config.config_dir).to eq(ChefConfig::PathHelper.join(to_platform("/home/charlie/.chef"), ""))
end
end
end
@@ -468,7 +468,7 @@ RSpec.describe ChefConfig::Config do
describe "ChefConfig::Config[:user_valid_regex]" do
context "on a platform that is not Windows" do
it "allows one letter usernames" do
- any_match = ChefConfig::Config[:user_valid_regex].any? { |regex| regex.match('a') }
+ any_match = ChefConfig::Config[:user_valid_regex].any? { |regex| regex.match("a") }
expect(any_match).to be_truthy
end
end
@@ -543,7 +543,7 @@ RSpec.describe ChefConfig::Config do
it "should fall back to C locale" do
expect(ChefConfig.logger).to receive(:warn).with("Please install an English UTF-8 locale for Chef to use, falling back to C locale and disabling UTF-8 support.")
- expect(ChefConfig::Config.guess_internal_locale).to eq 'C'
+ expect(ChefConfig::Config.guess_internal_locale).to eq "C"
end
end
@@ -585,8 +585,8 @@ RSpec.describe ChefConfig::Config do
ChefConfig::Config.http_proxy_pass = proxy_pass
end
it "exports ENV['http_proxy']" do
- expect(ENV).to receive(:[]=).with('http_proxy', "http://http_user:http_pass@localhost:7979")
- expect(ENV).to receive(:[]=).with('HTTP_PROXY', "http://http_user:http_pass@localhost:7979")
+ expect(ENV).to receive(:[]=).with("http_proxy", "http://http_user:http_pass@localhost:7979")
+ expect(ENV).to receive(:[]=).with("HTTP_PROXY", "http://http_user:http_pass@localhost:7979")
ChefConfig::Config.export_proxies
end
end
@@ -598,8 +598,8 @@ RSpec.describe ChefConfig::Config do
ChefConfig::Config.https_proxy_pass = proxy_pass
end
it "exports ENV['https_proxy']" do
- expect(ENV).to receive(:[]=).with('https_proxy', "https://http_user:http_pass@localhost:7979")
- expect(ENV).to receive(:[]=).with('HTTPS_PROXY', "https://http_user:http_pass@localhost:7979")
+ expect(ENV).to receive(:[]=).with("https_proxy", "https://http_user:http_pass@localhost:7979")
+ expect(ENV).to receive(:[]=).with("HTTPS_PROXY", "https://http_user:http_pass@localhost:7979")
ChefConfig::Config.export_proxies
end
end
@@ -611,16 +611,16 @@ RSpec.describe ChefConfig::Config do
ChefConfig::Config.ftp_proxy_pass = proxy_pass
end
it "exports ENV['ftp_proxy']" do
- expect(ENV).to receive(:[]=).with('ftp_proxy', "ftp://http_user:http_pass@localhost:7979")
- expect(ENV).to receive(:[]=).with('FTP_PROXY', "ftp://http_user:http_pass@localhost:7979")
+ expect(ENV).to receive(:[]=).with("ftp_proxy", "ftp://http_user:http_pass@localhost:7979")
+ expect(ENV).to receive(:[]=).with("FTP_PROXY", "ftp://http_user:http_pass@localhost:7979")
ChefConfig::Config.export_proxies
end
end
shared_examples "no user pass" do
it "does not populate the user or password" do
- expect(ENV).to receive(:[]=).with('http_proxy', "http://localhost:7979")
- expect(ENV).to receive(:[]=).with('HTTP_PROXY', "http://localhost:7979")
+ expect(ENV).to receive(:[]=).with("http_proxy", "http://localhost:7979")
+ expect(ENV).to receive(:[]=).with("HTTP_PROXY", "http://localhost:7979")
ChefConfig::Config.export_proxies
end
end
@@ -646,8 +646,8 @@ RSpec.describe ChefConfig::Config do
ChefConfig::Config.http_proxy = "localhost:1111"
end
it "automatically adds the scheme to the proxy url" do
- expect(ENV).to receive(:[]=).with('http_proxy', "http://localhost:1111")
- expect(ENV).to receive(:[]=).with('HTTP_PROXY', "http://localhost:1111")
+ expect(ENV).to receive(:[]=).with("http_proxy", "http://localhost:1111")
+ expect(ENV).to receive(:[]=).with("HTTP_PROXY", "http://localhost:1111")
ChefConfig::Config.export_proxies
end
end
@@ -655,10 +655,10 @@ RSpec.describe ChefConfig::Config do
shared_examples "no export" do
it "does not export any proxy settings" do
ChefConfig::Config.export_proxies
- expect(ENV['http_proxy']).to eq(nil)
- expect(ENV['https_proxy']).to eq(nil)
- expect(ENV['ftp_proxy']).to eq(nil)
- expect(ENV['no_proxy']).to eq(nil)
+ expect(ENV["http_proxy"]).to eq(nil)
+ expect(ENV["https_proxy"]).to eq(nil)
+ expect(ENV["ftp_proxy"]).to eq(nil)
+ expect(ENV["no_proxy"]).to eq(nil)
end
end
@@ -683,8 +683,8 @@ RSpec.describe ChefConfig::Config do
ChefConfig::Config.no_proxy = "localhost"
end
it "exports ENV['no_proxy']" do
- expect(ENV).to receive(:[]=).with('no_proxy', "localhost")
- expect(ENV).to receive(:[]=).with('NO_PROXY', "localhost")
+ expect(ENV).to receive(:[]=).with("no_proxy", "localhost")
+ expect(ENV).to receive(:[]=).with("NO_PROXY", "localhost")
ChefConfig::Config.export_proxies
end
end
@@ -707,7 +707,7 @@ RSpec.describe ChefConfig::Config do
end
it "sets CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS environment variable" do
- expect(ENV['CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS']).to eq("1")
+ expect(ENV["CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS"]).to eq("1")
end
it "treats deprecation warnings as errors in child processes when testing" do
@@ -725,7 +725,7 @@ RSpec.describe ChefConfig::Config do
context "outside of our test environment" do
before do
- ENV.delete('CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS')
+ ENV.delete("CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS")
ChefConfig::Config.reset
end
diff --git a/chef-config/spec/unit/path_helper_spec.rb b/chef-config/spec/unit/path_helper_spec.rb
index 3e2a0fd129..8b2fe62ce6 100644
--- a/chef-config/spec/unit/path_helper_spec.rb
+++ b/chef-config/spec/unit/path_helper_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef-config/path_helper'
-require 'spec_helper'
+require "chef-config/path_helper"
+require "spec_helper"
RSpec.describe ChefConfig::PathHelper do
@@ -27,30 +27,30 @@ RSpec.describe ChefConfig::PathHelper do
describe "join" do
it "joins starting with '' resolve to absolute paths" do
- expect(path_helper.join('', 'a', 'b')).to eq("#{path_helper.path_separator}a#{path_helper.path_separator}b")
+ expect(path_helper.join("", "a", "b")).to eq("#{path_helper.path_separator}a#{path_helper.path_separator}b")
end
it "joins ending with '' add a / to the end" do
- expect(path_helper.join('a', 'b', '')).to eq("a#{path_helper.path_separator}b#{path_helper.path_separator}")
+ expect(path_helper.join("a", "b", "")).to eq("a#{path_helper.path_separator}b#{path_helper.path_separator}")
end
end
describe "dirname" do
it "dirname('abc') is '.'" do
- expect(path_helper.dirname('abc')).to eq('.')
+ expect(path_helper.dirname("abc")).to eq(".")
end
it "dirname('/') is '/'" do
expect(path_helper.dirname(path_helper.path_separator)).to eq(path_helper.path_separator)
end
it "dirname('a/b/c') is 'a/b'" do
- expect(path_helper.dirname(path_helper.join('a', 'b', 'c'))).to eq(path_helper.join('a', 'b'))
+ expect(path_helper.dirname(path_helper.join("a", "b", "c"))).to eq(path_helper.join("a", "b"))
end
it "dirname('a/b/c/') is 'a/b'" do
- expect(path_helper.dirname(path_helper.join('a', 'b', 'c', ''))).to eq(path_helper.join('a', 'b'))
+ expect(path_helper.dirname(path_helper.join("a", "b", "c", ""))).to eq(path_helper.join("a", "b"))
end
it "dirname('/a/b/c') is '/a/b'" do
- expect(path_helper.dirname(path_helper.join('', 'a', 'b', 'c'))).to eq(path_helper.join('', 'a', 'b'))
+ expect(path_helper.dirname(path_helper.join("", "a", "b", "c"))).to eq(path_helper.join("", "a", "b"))
end
end
end
@@ -113,11 +113,11 @@ RSpec.describe ChefConfig::PathHelper do
include_examples("common_functionality")
it "path_separator is /" do
- expect(path_helper.path_separator).to eq('/')
+ expect(path_helper.path_separator).to eq("/")
end
it "cleanpath removes extra slashes alone" do
- expect(path_helper.cleanpath('/a///b/c/d/')).to eq('/a/b/c/d')
+ expect(path_helper.cleanpath("/a///b/c/d/")).to eq("/a/b/c/d")
end
describe "platform-specific #join behavior" do
@@ -269,7 +269,7 @@ RSpec.describe ChefConfig::PathHelper do
describe "all_homes" do
before do
- stub_const('ENV', env)
+ stub_const("ENV", env)
allow(ChefConfig).to receive(:windows?).and_return(is_windows)
end
diff --git a/chef-config/spec/unit/workstation_config_loader_spec.rb b/chef-config/spec/unit/workstation_config_loader_spec.rb
index 9f24a4f11b..77e573c776 100644
--- a/chef-config/spec/unit/workstation_config_loader_spec.rb
+++ b/chef-config/spec/unit/workstation_config_loader_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tempfile'
+require "spec_helper"
+require "tempfile"
-require 'chef-config/exceptions'
-require 'chef-config/windows'
-require 'chef-config/workstation_config_loader'
+require "chef-config/exceptions"
+require "chef-config/windows"
+require "chef-config/workstation_config_loader"
RSpec.describe ChefConfig::WorkstationConfigLoader do
@@ -45,7 +45,7 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
end
it "tests a path's existence" do
- expect(config_loader.path_exists?('/nope/nope/nope/nope/frab/jab/nab')).to be(false)
+ expect(config_loader.path_exists?("/nope/nope/nope/nope/frab/jab/nab")).to be(false)
expect(config_loader.path_exists?(__FILE__)).to be(true)
end
@@ -68,7 +68,7 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
let(:home) { "/Users/example.user" }
before do
- allow(ChefConfig::PathHelper).to receive(:home).with('.chef').and_yield(File.join(home, '.chef'))
+ allow(ChefConfig::PathHelper).to receive(:home).with(".chef").and_yield(File.join(home, ".chef"))
allow(config_loader).to receive(:path_exists?).with("#{home}/.chef/knife.rb").and_return(true)
end
diff --git a/chef.gemspec b/chef.gemspec
index 359e002189..c6edfbd13e 100644
--- a/chef.gemspec
+++ b/chef.gemspec
@@ -1,8 +1,8 @@
-$:.unshift(File.dirname(__FILE__) + '/lib')
-require 'chef/version'
+$:.unshift(File.dirname(__FILE__) + "/lib")
+require "chef/version"
Gem::Specification.new do |s|
- s.name = 'chef'
+ s.name = "chef"
s.version = Chef::VERSION
s.platform = Gem::Platform::RUBY
s.extra_rdoc_files = ["README.md", "CONTRIBUTING.md", "LICENSE" ]
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
s.add_dependency "chef-zero", "~> 4.4.0", ">= 4.2.2"
s.add_dependency "pry", "~> 0.9"
- s.add_dependency 'plist', '~> 3.1.0'
+ s.add_dependency "plist", "~> 3.1.0"
# Audit mode requires these, so they are non-developmental dependencies now
%w(rspec-core rspec-expectations rspec-mocks).each { |gem| s.add_dependency gem, "~> 3.4" }
diff --git a/ext/win32-eventlog/Rakefile b/ext/win32-eventlog/Rakefile
index 0aaf5df62f..81137b0d8d 100644
--- a/ext/win32-eventlog/Rakefile
+++ b/ext/win32-eventlog/Rakefile
@@ -1,6 +1,6 @@
-require 'rubygems'
-require 'rake'
-require 'mkmf'
+require "rubygems"
+require "rake"
+require "mkmf"
desc "Building event log dll"
@@ -13,13 +13,13 @@ def ensure_present(commands)
end
-EVT_MC_FILE = 'chef-log.man'
-EVT_RC_FILE = 'chef-log.rc'
-EVT_RESOURCE_OBJECT = 'resource.o'
-EVT_SHARED_OBJECT = 'chef-log.dll'
-MC = 'windmc'
-RC = 'windres'
-CC = 'gcc'
+EVT_MC_FILE = "chef-log.man"
+EVT_RC_FILE = "chef-log.rc"
+EVT_RESOURCE_OBJECT = "resource.o"
+EVT_SHARED_OBJECT = "chef-log.dll"
+MC = "windmc"
+RC = "windres"
+CC = "gcc"
ensure_present [MC, RC, CC]
@@ -39,7 +39,7 @@ file EVT_SHARED_OBJECT => EVT_RESOURCE_OBJECT do
end
task :register => EVT_SHARED_OBJECT do
- require 'win32/eventlog'
+ require "win32/eventlog"
dll_file = File.expand_path(EVT_SHARED_OBJECT)
begin
Win32::EventLog.add_event_source(
diff --git a/kitchen-tests/Gemfile b/kitchen-tests/Gemfile
index 6ded6a784c..874f052ae8 100644
--- a/kitchen-tests/Gemfile
+++ b/kitchen-tests/Gemfile
@@ -1,10 +1,10 @@
source "https://rubygems.org"
group :end_to_end do
- gem 'berkshelf'
- gem 'test-kitchen', '~> 1.4'
- gem 'kitchen-appbundle-updater', '~> 0.0.1'
- gem "kitchen-vagrant", '~> 0.17'
- gem 'kitchen-ec2', github: 'test-kitchen/kitchen-ec2'
- gem 'vagrant-wrapper'
+ gem "berkshelf"
+ gem "test-kitchen", "~> 1.4"
+ gem "kitchen-appbundle-updater", "~> 0.0.1"
+ gem "kitchen-vagrant", "~> 0.17"
+ gem "kitchen-ec2", github: "test-kitchen/kitchen-ec2"
+ gem "vagrant-wrapper"
end
diff --git a/kitchen-tests/cookbooks/audit_test/metadata.rb b/kitchen-tests/cookbooks/audit_test/metadata.rb
index 4a60104e92..91cf94c0ff 100644
--- a/kitchen-tests/cookbooks/audit_test/metadata.rb
+++ b/kitchen-tests/cookbooks/audit_test/metadata.rb
@@ -1,8 +1,8 @@
-name 'audit_test'
-maintainer 'The Authors'
-maintainer_email 'you@example.com'
-license 'all_rights'
-description 'Installs/Configures audit_test'
-long_description 'Installs/Configures audit_test'
-version '0.1.0'
+name "audit_test"
+maintainer "The Authors"
+maintainer_email "you@example.com"
+license "all_rights"
+description "Installs/Configures audit_test"
+long_description "Installs/Configures audit_test"
+version "0.1.0"
diff --git a/kitchen-tests/cookbooks/webapp/attributes/default.rb b/kitchen-tests/cookbooks/webapp/attributes/default.rb
index fb33efa49e..2ff7a6c5ff 100644
--- a/kitchen-tests/cookbooks/webapp/attributes/default.rb
+++ b/kitchen-tests/cookbooks/webapp/attributes/default.rb
@@ -1,14 +1,14 @@
-default['apache']['remote_host_ip'] = '127.0.0.1'
+default["apache"]["remote_host_ip"] = "127.0.0.1"
-default['webapp']['database'] = 'webapp'
-default['webapp']['db_username'] = 'webapp'
-default['webapp']['path'] = '/srv/webapp'
+default["webapp"]["database"] = "webapp"
+default["webapp"]["db_username"] = "webapp"
+default["webapp"]["path"] = "/srv/webapp"
# XXX: apache2 cookbook 2.0.0 has bugs around changing the mpm and then attempting a graceful restart
# which fails and leaves the service down.
-case node['platform']
+case node["platform"]
when "ubuntu"
- if node['platform_version'].to_f >= 14.04
- default[:apache][:mpm] = 'event'
+ if node["platform_version"].to_f >= 14.04
+ default[:apache][:mpm] = "event"
end
end
diff --git a/kitchen-tests/cookbooks/webapp/metadata.rb b/kitchen-tests/cookbooks/webapp/metadata.rb
index c26ad23979..f1f07d952b 100644
--- a/kitchen-tests/cookbooks/webapp/metadata.rb
+++ b/kitchen-tests/cookbooks/webapp/metadata.rb
@@ -1,12 +1,12 @@
-name 'webapp'
-maintainer ''
-maintainer_email ''
-license ''
-description 'Installs/Configures webapp'
-long_description 'Installs/Configures webapp'
-version '0.1.0'
+name "webapp"
+maintainer ""
+maintainer_email ""
+license ""
+description "Installs/Configures webapp"
+long_description "Installs/Configures webapp"
+version "0.1.0"
-depends 'apache2'
-depends 'database', '~> 2.3.1'
-depends 'mysql'
-depends 'php'
+depends "apache2"
+depends "database", "~> 2.3.1"
+depends "mysql"
+depends "php"
diff --git a/kitchen-tests/cookbooks/webapp/recipes/default.rb b/kitchen-tests/cookbooks/webapp/recipes/default.rb
index e0cbbdd4a8..3dc22ea0fa 100644
--- a/kitchen-tests/cookbooks/webapp/recipes/default.rb
+++ b/kitchen-tests/cookbooks/webapp/recipes/default.rb
@@ -11,43 +11,43 @@ include_recipe "php"
creds = Hash.new
%w(mysql webapp).each do |item_name|
- creds[item_name] = data_bag_item('passwords', item_name)
+ creds[item_name] = data_bag_item("passwords", item_name)
end
web_app "webapp" do
- server_name 'localhost'
- server_aliases [node['fqdn'], node['hostname'], 'localhost.localdomain']
- docroot node['webapp']['path']
- cookbook 'apache2'
+ server_name "localhost"
+ server_aliases [node["fqdn"], node["hostname"], "localhost.localdomain"]
+ docroot node["webapp"]["path"]
+ cookbook "apache2"
end
mysql_service "default" do
- server_root_password creds['mysql']['server_root_password']
- server_repl_password creds['mysql']['server_repl_password']
+ server_root_password creds["mysql"]["server_root_password"]
+ server_repl_password creds["mysql"]["server_repl_password"]
end
-mysql_database node['webapp']['database'] do
+mysql_database node["webapp"]["database"] do
connection ({
- :host => 'localhost',
- :username => 'root',
- :password => creds['mysql']['server_root_password'],
+ :host => "localhost",
+ :username => "root",
+ :password => creds["mysql"]["server_root_password"],
})
action :create
end
-mysql_database_user node['webapp']['db_username'] do
+mysql_database_user node["webapp"]["db_username"] do
connection ({
- :host => 'localhost',
- :username => 'root',
- :password => creds['mysql']['server_root_password'],
+ :host => "localhost",
+ :username => "root",
+ :password => creds["mysql"]["server_root_password"],
})
- password creds['webapp']['db_password']
- database_name node['webapp']['database']
+ password creds["webapp"]["db_password"]
+ database_name node["webapp"]["database"]
privileges [:select, :update, :insert, :create, :delete]
action :grant
end
-directory node['webapp']['path'] do
+directory node["webapp"]["path"] do
owner "root"
group "root"
mode "0755"
@@ -56,9 +56,9 @@ directory node['webapp']['path'] do
end
template "#{node['webapp']['path']}/index.html" do
- source 'index.html.erb'
+ source "index.html.erb"
end
template "#{node['webapp']['path']}/index.php" do
- source 'index.php.erb'
+ source "index.php.erb"
end
diff --git a/kitchen-tests/test/fixtures/serverspec_helper.rb b/kitchen-tests/test/fixtures/serverspec_helper.rb
index ad1f866775..feb4c21200 100644
--- a/kitchen-tests/test/fixtures/serverspec_helper.rb
+++ b/kitchen-tests/test/fixtures/serverspec_helper.rb
@@ -2,24 +2,24 @@
# The commented-out platforms in the osmapping hash can be added once we have added them into
# our .kitchen.yml and .kitchen.travis.yml and added the appropriate JSON under test/fixtures/platforms.
-require 'serverspec'
-require 'json'
-require 'ffi_yajl'
+require "serverspec"
+require "json"
+require "ffi_yajl"
set :backend, :exec
include Specinfra::Helper::Properties
-require 'pp'
+require "pp"
pp os
def load_nodestub
case os[:family]
- when 'ubuntu', 'debian'
+ when "ubuntu", "debian"
platform = os[:family]
platform_version = os[:release]
- when 'redhat'
- platform = 'centos'
+ when "redhat"
+ platform = "centos"
platform_version = os[:release].to_i
end
FFI_Yajl::Parser.parse(IO.read("#{ENV['BUSSER_ROOT']}/../kitchen/data/platforms/#{platform}/#{platform_version}.json"), :symbolize_names => true)
@@ -27,6 +27,6 @@ end
# centos-59 doesn't have /sbin in the default path,
# so we must ensure it's on serverspec's path
-set :path, '$PATH:/sbin'
+set :path, "$PATH:/sbin"
set_property load_nodestub
diff --git a/kitchen-tests/test/integration/webapp/serverspec/Gemfile b/kitchen-tests/test/integration/webapp/serverspec/Gemfile
index 0cb00ce354..eef1450f7a 100644
--- a/kitchen-tests/test/integration/webapp/serverspec/Gemfile
+++ b/kitchen-tests/test/integration/webapp/serverspec/Gemfile
@@ -1,4 +1,4 @@
# This Gemfile is only needed so that busser will install gems it needs for serverspec_helper.rb to work
source "https://rubygems.org"
-gem 'ffi-yajl', '~> 1.1' # Go away, JSON gem
+gem "ffi-yajl", "~> 1.1" # Go away, JSON gem
diff --git a/lib-backcompat/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb b/lib-backcompat/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb
index 88ede9c692..123fb9ee9a 100644
--- a/lib-backcompat/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb
+++ b/lib-backcompat/chef/chef_fs/file_system/chef_repository_file_system_root_dir.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir"
module Chef::ChefFS::FileSystem
ChefRepositoryFileSystemRootDir = Repository::ChefRepositoryFileSystemRootDir
diff --git a/lib-backcompat/chef/chef_fs/file_system/chef_server_root_dir.rb b/lib-backcompat/chef/chef_fs/file_system/chef_server_root_dir.rb
index c475057e7a..acb81dd08a 100644
--- a/lib-backcompat/chef/chef_fs/file_system/chef_server_root_dir.rb
+++ b/lib-backcompat/chef/chef_fs/file_system/chef_server_root_dir.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/file_system/chef_server/chef_server_root_dir'
+require "chef/chef_fs/file_system/chef_server/chef_server_root_dir"
module Chef::ChefFS::FileSystem
ChefServerRootDir = ChefServer::ChefServerRootDir
diff --git a/lib/chef.rb b/lib/chef.rb
index 1a0b802adb..37f987991a 100644
--- a/lib/chef.rb
+++ b/lib/chef.rb
@@ -16,20 +16,20 @@
# limitations under the License.
#
-require 'chef/version'
-require 'chef/nil_argument'
-require 'chef/mash'
-require 'chef/exceptions'
-require 'chef/log'
-require 'chef/config'
-require 'chef/providers'
-require 'chef/resources'
-require 'chef/shell_out'
+require "chef/version"
+require "chef/nil_argument"
+require "chef/mash"
+require "chef/exceptions"
+require "chef/log"
+require "chef/config"
+require "chef/providers"
+require "chef/resources"
+require "chef/shell_out"
-require 'chef/daemon'
+require "chef/daemon"
-require 'chef/run_status'
-require 'chef/handler'
-require 'chef/handler/json_file'
-require 'chef/event_dispatch/dsl'
-require 'chef/chef_class'
+require "chef/run_status"
+require "chef/handler"
+require "chef/handler/json_file"
+require "chef/event_dispatch/dsl"
+require "chef/chef_class"
diff --git a/lib/chef/api_client.rb b/lib/chef/api_client.rb
index 940ec19d90..9def6199b7 100644
--- a/lib/chef/api_client.rb
+++ b/lib/chef/api_client.rb
@@ -17,13 +17,13 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/mixin/params_validate'
-require 'chef/mixin/from_file'
-require 'chef/mash'
-require 'chef/json_compat'
-require 'chef/search/query'
-require 'chef/server_api'
+require "chef/config"
+require "chef/mixin/params_validate"
+require "chef/mixin/from_file"
+require "chef/mash"
+require "chef/json_compat"
+require "chef/search/query"
+require "chef/server_api"
# DEPRECATION NOTE
#
@@ -38,7 +38,7 @@ class Chef
# Create a new Chef::ApiClient object.
def initialize
- @name = ''
+ @name = ""
@public_key = nil
@private_key = nil
@admin = false
@@ -116,7 +116,7 @@ class Chef
"public_key" => @public_key,
"validator" => @validator,
"admin" => @admin,
- 'json_class' => self.class.name,
+ "json_class" => self.class.name,
"chef_type" => "client",
}
result["private_key"] = @private_key if @private_key
diff --git a/lib/chef/api_client/registration.rb b/lib/chef/api_client/registration.rb
index f7278a8a48..2128c3b477 100644
--- a/lib/chef/api_client/registration.rb
+++ b/lib/chef/api_client/registration.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/server_api'
-require 'chef/exceptions'
+require "chef/config"
+require "chef/server_api"
+require "chef/exceptions"
class Chef
class ApiClient
diff --git a/lib/chef/api_client_v1.rb b/lib/chef/api_client_v1.rb
index 7329343f43..6b3db812c0 100644
--- a/lib/chef/api_client_v1.rb
+++ b/lib/chef/api_client_v1.rb
@@ -17,16 +17,16 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/mixin/params_validate'
-require 'chef/mixin/from_file'
-require 'chef/mash'
-require 'chef/json_compat'
-require 'chef/search/query'
-require 'chef/exceptions'
-require 'chef/mixin/api_version_request_handling'
-require 'chef/server_api'
-require 'chef/api_client'
+require "chef/config"
+require "chef/mixin/params_validate"
+require "chef/mixin/from_file"
+require "chef/mash"
+require "chef/json_compat"
+require "chef/search/query"
+require "chef/exceptions"
+require "chef/mixin/api_version_request_handling"
+require "chef/server_api"
+require "chef/api_client"
# COMPATIBILITY NOTE
#
@@ -48,7 +48,7 @@ class Chef
# Create a new Chef::ApiClientV1 object.
def initialize
- @name = ''
+ @name = ""
@public_key = nil
@private_key = nil
@admin = false
@@ -294,12 +294,12 @@ class Chef
new_client = chef_rest_v1.post("clients", payload)
# get the private_key out of the chef_key hash if it exists
- if new_client['chef_key']
- if new_client['chef_key']['private_key']
- new_client['private_key'] = new_client['chef_key']['private_key']
+ if new_client["chef_key"]
+ if new_client["chef_key"]["private_key"]
+ new_client["private_key"] = new_client["chef_key"]["private_key"]
end
- new_client['public_key'] = new_client['chef_key']['public_key']
- new_client.delete('chef_key')
+ new_client["public_key"] = new_client["chef_key"]["public_key"]
+ new_client.delete("chef_key")
end
rescue Net::HTTPServerException => e
diff --git a/lib/chef/application.rb b/lib/chef/application.rb
index 680f99df56..4562d84a5d 100644
--- a/lib/chef/application.rb
+++ b/lib/chef/application.rb
@@ -16,17 +16,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'pp'
-require 'socket'
-require 'chef/config'
-require 'chef/config_fetcher'
-require 'chef/exceptions'
-require 'chef/local_mode'
-require 'chef/log'
-require 'chef/platform'
-require 'mixlib/cli'
-require 'tmpdir'
-require 'rbconfig'
+require "pp"
+require "socket"
+require "chef/config"
+require "chef/config_fetcher"
+require "chef/exceptions"
+require "chef/local_mode"
+require "chef/log"
+require "chef/platform"
+require "mixlib/cli"
+require "tmpdir"
+require "rbconfig"
class Chef
class Application
@@ -197,7 +197,7 @@ class Chef
# Initializes Chef::Client instance and runs it
def run_chef_client(specific_recipes = [])
unless specific_recipes.respond_to?(:size)
- raise ArgumentError, 'received non-Array like specific_recipes argument'
+ raise ArgumentError, "received non-Array like specific_recipes argument"
end
Chef::LocalMode.with_server_connectivity do
@@ -235,7 +235,7 @@ class Chef
# signal to finish the converge and exists.
def run_with_graceful_exit_option
# Override the TERM signal.
- trap('TERM') do
+ trap("TERM") do
Chef::Log.debug("SIGTERM received during converge," +
" finishing converge to exit normally (send SIGINT to terminate immediately)")
end
@@ -249,7 +249,7 @@ class Chef
pid = fork do
# Want to allow forked processes to finish converging when
# TERM singal is received (exit gracefully)
- trap('TERM') do
+ trap("TERM") do
Chef::Log.debug("SIGTERM received during converge," +
" finishing converge to exit normally (send SIGINT to terminate immediately)")
end
diff --git a/lib/chef/application/apply.rb b/lib/chef/application/apply.rb
index 6a371c89c4..f6348a951b 100644
--- a/lib/chef/application/apply.rb
+++ b/lib/chef/application/apply.rb
@@ -17,15 +17,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef'
-require 'chef/application'
-require 'chef/client'
-require 'chef/config'
-require 'chef/log'
-require 'fileutils'
-require 'tempfile'
-require 'chef/providers'
-require 'chef/resources'
+require "chef"
+require "chef/application"
+require "chef/client"
+require "chef/config"
+require "chef/log"
+require "fileutils"
+require "tempfile"
+require "chef/providers"
+require "chef/resources"
class Chef::Application::Apply < Chef::Application
@@ -92,9 +92,9 @@ class Chef::Application::Apply < Chef::Application
:exit => 0
option :why_run,
- :short => '-W',
- :long => '--why-run',
- :description => 'Enable whyrun mode',
+ :short => "-W",
+ :long => "--why-run",
+ :description => "Enable whyrun mode",
:boolean => true
option :profile_ruby,
@@ -104,7 +104,7 @@ class Chef::Application::Apply < Chef::Application
:default => false
option :color,
- :long => '--[no-]color',
+ :long => "--[no-]color",
:boolean => true,
:default => true,
:description => "Use colored output, defaults to enabled"
@@ -167,7 +167,7 @@ class Chef::Application::Apply < Chef::Application
# write recipe to temp file, so in case of error,
# user gets error w/ context
def temp_recipe_file
- @recipe_fh = Tempfile.open('recipe-temporary-file')
+ @recipe_fh = Tempfile.open("recipe-temporary-file")
@recipe_fh.write(@recipe_text)
@recipe_fh.rewind
@recipe_filename = @recipe_fh.path
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index 8cc045cb8e..ba357b420d 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -17,14 +17,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/application'
-require 'chef/client'
-require 'chef/config'
-require 'chef/daemon'
-require 'chef/log'
-require 'chef/config_fetcher'
-require 'chef/handler/error_report'
-require 'chef/workstation_config_loader'
+require "chef/application"
+require "chef/client"
+require "chef/config"
+require "chef/daemon"
+require "chef/log"
+require "chef/config_fetcher"
+require "chef/handler/error_report"
+require "chef/workstation_config_loader"
class Chef::Application::Client < Chef::Application
include Chef::Mixin::ShellOut
@@ -62,7 +62,7 @@ class Chef::Application::Client < Chef::Application
:default => false
option :color,
- :long => '--[no-]color',
+ :long => "--[no-]color",
:boolean => true,
:default => true,
:description => "Use colored output, defaults to enabled"
@@ -172,9 +172,9 @@ class Chef::Application::Client < Chef::Application
: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",
@@ -189,7 +189,7 @@ class Chef::Application::Client < Chef::Application
:long => "--override-runlist RunlistItem,RunlistItem...",
:description => "Replace current run list with specified items for a single run",
:proc => lambda{|items|
- items = items.split(',')
+ items = items.split(",")
items.compact.map{|item|
Chef::RunList::RunListItem.new(item)
}
@@ -200,15 +200,15 @@ class Chef::Application::Client < Chef::Application
:long => "--runlist RunlistItem,RunlistItem...",
:description => "Permanently replace current run list with specified items",
:proc => lambda{|items|
- items = items.split(',')
+ items = items.split(",")
items.compact.map{|item|
Chef::RunList::RunListItem.new(item)
}
}
option :why_run,
- :short => '-W',
- :long => '--why-run',
- :description => 'Enable whyrun mode',
+ :short => "-W",
+ :long => "--why-run",
+ :description => "Enable whyrun mode",
:boolean => true
option :client_fork,
@@ -283,7 +283,7 @@ class Chef::Application::Client < Chef::Application
def reconfigure
super
- raise Chef::Exceptions::PIDFileLockfileMatch if Chef::Util::PathHelper.paths_eql? (Chef::Config[:pid_file] || '' ), (Chef::Config[:lockfile] || '')
+ raise Chef::Exceptions::PIDFileLockfileMatch if Chef::Util::PathHelper.paths_eql? (Chef::Config[:pid_file] || "" ), (Chef::Config[:lockfile] || "")
set_specific_recipes
@@ -305,7 +305,7 @@ class Chef::Application::Client < Chef::Application
elsif Chef::Config.local_mode && Chef::Config.has_key?(:recipe_url)
Chef::Log.debug "Creating path #{Chef::Config.chef_repo_path} to extract recipes into"
FileUtils.mkdir_p(Chef::Config.chef_repo_path)
- tarball_path = File.join(Chef::Config.chef_repo_path, 'recipes.tgz')
+ tarball_path = File.join(Chef::Config.chef_repo_path, "recipes.tgz")
fetch_recipe_tarball(Chef::Config[:recipe_url], tarball_path)
result = shell_out!("tar zxvf #{tarball_path} -C #{Chef::Config.chef_repo_path}")
Chef::Log.debug "#{result.stdout}"
@@ -472,7 +472,7 @@ class Chef::Application::Client < Chef::Application
def fetch_recipe_tarball(url, path)
Chef::Log.debug("Download recipes tarball from #{url} to #{path}")
- File.open(path, 'wb') do |f|
+ File.open(path, "wb") do |f|
open(url) do |r|
f.write(r.read)
end
diff --git a/lib/chef/application/knife.rb b/lib/chef/application/knife.rb
index 11e3246cfb..1742223657 100644
--- a/lib/chef/application/knife.rb
+++ b/lib/chef/application/knife.rb
@@ -15,11 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/knife'
-require 'chef/application'
-require 'mixlib/log'
-require 'ohai/config'
-require 'chef/monkey_patches/net_http.rb'
+require "chef/knife"
+require "chef/application"
+require "mixlib/log"
+require "ohai/config"
+require "chef/monkey_patches/net_http.rb"
class Chef::Application::Knife < Chef::Application
@@ -35,14 +35,14 @@ class Chef::Application::Knife < Chef::Application
verbosity_level = 0
option :verbosity,
- :short => '-V',
- :long => '--verbose',
+ :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',
+ :long => "--[no-]color",
:boolean => true,
:default => true,
:description => "Use colored output, defaults to enabled"
@@ -56,7 +56,7 @@ class Chef::Application::Knife < Chef::Application
:short => "-e EDITOR",
:long => "--editor EDITOR",
:description => "Set the editor to use for interactive commands",
- :default => ENV['EDITOR']
+ :default => ENV["EDITOR"]
option :disable_editing,
:short => "-d",
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index 4b472e9662..b3197c3dbe 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -16,22 +16,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef'
-require 'chef/application'
-require 'chef/client'
-require 'chef/config'
-require 'chef/daemon'
-require 'chef/log'
-require 'chef/rest'
-require 'chef/config_fetcher'
-require 'fileutils'
+require "chef"
+require "chef/application"
+require "chef/client"
+require "chef/config"
+require "chef/daemon"
+require "chef/log"
+require "chef/rest"
+require "chef/config_fetcher"
+require "fileutils"
class Chef::Application::Solo < Chef::Application
option :config_file,
:short => "-c CONFIG",
:long => "--config CONFIG",
- :default => Chef::Config.platform_specific_path('/etc/chef/solo.rb'),
+ :default => Chef::Config.platform_specific_path("/etc/chef/solo.rb"),
:description => "The configuration file to use"
option :formatter,
@@ -59,7 +59,7 @@ class Chef::Application::Solo < Chef::Application
:default => false
option :color,
- :long => '--[no-]color',
+ :long => "--[no-]color",
:boolean => true,
:default => !Chef::Platform.windows?,
:description => "Use colored output, defaults to enabled"
@@ -153,7 +153,7 @@ class Chef::Application::Solo < Chef::Application
:long => "--override-runlist RunlistItem,RunlistItem...",
:description => "Replace current run list with specified items",
:proc => lambda{|items|
- items = items.split(',')
+ items = items.split(",")
items.compact.map{|item|
Chef::RunList::RunListItem.new(item)
}
@@ -166,20 +166,20 @@ class Chef::Application::Solo < Chef::Application
:boolean => true
option :why_run,
- :short => '-W',
- :long => '--why-run',
- :description => 'Enable whyrun mode',
+ :short => "-W",
+ :long => "--why-run",
+ :description => "Enable whyrun mode",
:boolean => true
option :ez,
- :long => '--ez',
- :description => 'A memorial for Ezra Zygmuntowicz',
+ :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",
@@ -212,13 +212,13 @@ class Chef::Application::Solo < Chef::Application
if Chef::Config[:recipe_url]
cookbooks_path = Array(Chef::Config[:cookbook_path]).detect{|e| e =~ /\/cookbooks\/*$/ }
- recipes_path = File.expand_path(File.join(cookbooks_path, '..'))
+ recipes_path = File.expand_path(File.join(cookbooks_path, ".."))
Chef::Log.debug "Cleanup path #{recipes_path} before extract recipes into it"
FileUtils.rm_rf(recipes_path, :secure => true)
Chef::Log.debug "Creating path #{recipes_path} to extract recipes into"
FileUtils.mkdir_p(recipes_path)
- tarball_path = File.join(recipes_path, 'recipes.tgz')
+ tarball_path = File.join(recipes_path, "recipes.tgz")
fetch_recipe_tarball(Chef::Config[:recipe_url], tarball_path)
Mixlib::ShellOut.new("tar zxvf #{tarball_path} -C #{recipes_path}").run_command
end
@@ -303,7 +303,7 @@ EOH
def fetch_recipe_tarball(url, path)
Chef::Log.debug("Download recipes tarball from #{url} to #{path}")
- File.open(path, 'wb') do |f|
+ File.open(path, "wb") do |f|
open(url) do |r|
f.write(r.read)
end
diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb
index fd7cc7dd18..957123b1e9 100644
--- a/lib/chef/application/windows_service.rb
+++ b/lib/chef/application/windows_service.rb
@@ -16,19 +16,19 @@
# limitations under the License.
#
-require 'chef'
-require 'chef/monologger'
-require 'chef/application'
-require 'chef/client'
-require 'chef/config'
-require 'chef/handler/error_report'
-require 'chef/log'
-require 'chef/http'
-require 'mixlib/cli'
-require 'socket'
-require 'uri'
-require 'win32/daemon'
-require 'chef/mixin/shell_out'
+require "chef"
+require "chef/monologger"
+require "chef/application"
+require "chef/client"
+require "chef/config"
+require "chef/handler/error_report"
+require "chef/log"
+require "chef/http"
+require "mixlib/cli"
+require "socket"
+require "uri"
+require "win32/daemon"
+require "chef/mixin/shell_out"
class Chef
class Application
diff --git a/lib/chef/application/windows_service_manager.rb b/lib/chef/application/windows_service_manager.rb
index 4bb624989e..b651d622e6 100644
--- a/lib/chef/application/windows_service_manager.rb
+++ b/lib/chef/application/windows_service_manager.rb
@@ -17,10 +17,10 @@
#
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'win32/service'
+ require "win32/service"
end
-require 'chef/config'
-require 'mixlib/cli'
+require "chef/config"
+require "mixlib/cli"
class Chef
class Application
@@ -99,11 +99,11 @@ class Chef
parse_options(params)
case config[:action]
- when 'install'
+ when "install"
if service_exists?
puts "Service #{@service_name} already exists on the system."
else
- ruby = File.join(RbConfig::CONFIG['bindir'], 'ruby')
+ ruby = File.join(RbConfig::CONFIG["bindir"], "ruby")
opts = ""
opts << " -c #{config[:config_file]}" if config[:config_file]
@@ -132,29 +132,29 @@ class Chef
) unless @delayed_start.nil?
puts "Service '#{@service_name}' has successfully been installed."
end
- when 'status'
+ when "status"
if !service_exists?
puts "Service #{@service_name} doesn't exist on the system."
else
puts "State of #{@service_name} service is: #{current_state}"
end
- when 'start'
+ when "start"
# TODO: allow override of startup parameters here?
- take_action('start', RUNNING)
- when 'stop'
- take_action('stop', STOPPED)
- when 'uninstall', 'delete'
- take_action('stop', STOPPED)
+ take_action("start", RUNNING)
+ when "stop"
+ take_action("stop", STOPPED)
+ when "uninstall", "delete"
+ take_action("stop", STOPPED)
unless service_exists?
puts "Service #{@service_name} doesn't exist on the system."
else
::Win32::Service.delete(@service_name)
puts "Service #{@service_name} deleted"
end
- when 'pause'
- take_action('pause', PAUSED)
- when 'resume'
- take_action('resume', RUNNING)
+ when "pause"
+ take_action("pause", PAUSED)
+ when "resume"
+ take_action("resume", RUNNING)
end
end
diff --git a/lib/chef/applications.rb b/lib/chef/applications.rb
index 6a1a2e8a92..97c896e12e 100644
--- a/lib/chef/applications.rb
+++ b/lib/chef/applications.rb
@@ -1,4 +1,4 @@
-require 'chef/application/client'
-require 'chef/application/knife'
-require 'chef/application/solo'
-require 'chef/application/apply'
+require "chef/application/client"
+require "chef/application/knife"
+require "chef/application/solo"
+require "chef/application/apply"
diff --git a/lib/chef/audit/audit_event_proxy.rb b/lib/chef/audit/audit_event_proxy.rb
index ddcb170955..36f0030b84 100644
--- a/lib/chef/audit/audit_event_proxy.rb
+++ b/lib/chef/audit/audit_event_proxy.rb
@@ -60,7 +60,7 @@ class Chef
def build_control_from(example)
described_class = example.metadata[:described_class]
if described_class
- resource_type = described_class.class.name.split(':')[-1]
+ resource_type = described_class.class.name.split(":")[-1]
resource_name = described_class.name
end
diff --git a/lib/chef/audit/audit_reporter.rb b/lib/chef/audit/audit_reporter.rb
index face24f1f5..5dc05055e2 100644
--- a/lib/chef/audit/audit_reporter.rb
+++ b/lib/chef/audit/audit_reporter.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'chef/event_dispatch/base'
-require 'chef/audit/control_group_data'
-require 'time'
+require "chef/event_dispatch/base"
+require "chef/audit/control_group_data"
+require "time"
class Chef
class Audit
@@ -28,7 +28,7 @@ class Chef
attr_reader :rest_client, :audit_data, :ordered_control_groups, :run_status
private :rest_client, :audit_data, :ordered_control_groups, :run_status
- PROTOCOL_VERSION = '0.1.1'
+ PROTOCOL_VERSION = "0.1.1"
def initialize(rest_client)
@rest_client = rest_client
@@ -154,7 +154,7 @@ class Chef
end
def headers(additional_headers = {})
- options = {'X-Ops-Audit-Report-Protocol-Version' => PROTOCOL_VERSION}
+ options = {"X-Ops-Audit-Report-Protocol-Version" => PROTOCOL_VERSION}
options.merge(additional_headers)
end
diff --git a/lib/chef/audit/control_group_data.rb b/lib/chef/audit/control_group_data.rb
index 62623b0b64..cb1a648cc2 100644
--- a/lib/chef/audit/control_group_data.rb
+++ b/lib/chef/audit/control_group_data.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'securerandom'
+require "securerandom"
class Chef
class Audit
diff --git a/lib/chef/audit/logger.rb b/lib/chef/audit/logger.rb
index e46f54e582..da335eda98 100644
--- a/lib/chef/audit/logger.rb
+++ b/lib/chef/audit/logger.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'stringio'
+require "stringio"
class Chef
class Audit
diff --git a/lib/chef/audit/rspec_formatter.rb b/lib/chef/audit/rspec_formatter.rb
index 074a11bed3..5af9a89123 100644
--- a/lib/chef/audit/rspec_formatter.rb
+++ b/lib/chef/audit/rspec_formatter.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'rspec/core'
+require "rspec/core"
class Chef
class Audit
diff --git a/lib/chef/audit/runner.rb b/lib/chef/audit/runner.rb
index a3bf0b6898..d2d822eea2 100644
--- a/lib/chef/audit/runner.rb
+++ b/lib/chef/audit/runner.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/audit/logger'
+require "chef/audit/logger"
class Chef
class Audit
@@ -78,16 +78,16 @@ class Chef
# prevents Specinfra and Serverspec from modifying the RSpec configuration
# used by our spec tests.
def require_deps
- require 'rspec'
- require 'rspec/its'
- require 'specinfra'
- require 'specinfra/helper'
- require 'specinfra/helper/set'
- require 'serverspec/helper'
- require 'serverspec/matcher'
- require 'serverspec/subject'
- require 'chef/audit/audit_event_proxy'
- require 'chef/audit/rspec_formatter'
+ require "rspec"
+ require "rspec/its"
+ require "specinfra"
+ require "specinfra/helper"
+ require "specinfra/helper/set"
+ require "serverspec/helper"
+ require "serverspec/matcher"
+ require "serverspec/subject"
+ require "chef/audit/audit_event_proxy"
+ require "chef/audit/rspec_formatter"
Specinfra::Backend::Cmd.send(:include, Specinfra::Helper::Set)
end
@@ -147,7 +147,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_class.rb b/lib/chef/chef_class.rb
index 5ccb8bb92b..a2b572335b 100644
--- a/lib/chef/chef_class.rb
+++ b/lib/chef/chef_class.rb
@@ -26,10 +26,10 @@
# injected" into this class by other objects and do not reference the class symbols in those files
# directly and we do not need to require those files here.
-require 'chef/platform/provider_priority_map'
-require 'chef/platform/resource_priority_map'
-require 'chef/platform/provider_handler_map'
-require 'chef/platform/resource_handler_map'
+require "chef/platform/provider_priority_map"
+require "chef/platform/resource_priority_map"
+require "chef/platform/provider_handler_map"
+require "chef/platform/resource_handler_map"
class Chef
class << self
@@ -56,7 +56,7 @@ class Chef
#
# @return[Chef::EventDispatch::Base] handler object
def event_handler(&block)
- dsl = Chef::EventDispatch::DSL.new('Chef client DSL')
+ dsl = Chef::EventDispatch::DSL.new("Chef client DSL")
dsl.instance_eval(&block)
end
diff --git a/lib/chef/chef_fs.rb b/lib/chef/chef_fs.rb
index 13cf39c9ec..43a9efd5e2 100644
--- a/lib/chef/chef_fs.rb
+++ b/lib/chef/chef_fs.rb
@@ -1,4 +1,4 @@
-require 'chef/platform'
+require "chef/platform"
#
# ChefFS was designed to be a near-1:1 translation between Chef server endpoints
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb
index 07cb3d2cd5..99a668d50d 100644
--- a/lib/chef/chef_fs/chef_fs_data_store.rb
+++ b/lib/chef/chef_fs/chef_fs_data_store.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/cookbook_manifest'
-require 'chef_zero/data_store/memory_store'
-require 'chef_zero/data_store/data_already_exists_error'
-require 'chef_zero/data_store/data_not_found_error'
-require 'chef/chef_fs/file_pattern'
-require 'chef/chef_fs/file_system'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/memory/memory_root'
-require 'fileutils'
+require "chef/cookbook_manifest"
+require "chef_zero/data_store/memory_store"
+require "chef_zero/data_store/data_already_exists_error"
+require "chef_zero/data_store/data_not_found_error"
+require "chef/chef_fs/file_pattern"
+require "chef/chef_fs/file_system"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/memory/memory_root"
+require "fileutils"
class Chef
module ChefFS
@@ -185,15 +185,15 @@ class Chef
if use_memory_store?(path)
@memory_store.create(path, name, data, *options)
- elsif path[0] == 'cookbooks' && path.length == 2
+ elsif path[0] == "cookbooks" && path.length == 2
# Do nothing. The entry gets created when the cookbook is created.
# create [/organizations/ORG]/users/NAME (with content '{}')
# Manipulate the `members.json` file that contains a list of all users
- elsif is_org? && path == [ 'users' ]
- update_json('members.json', []) do |members|
+ elsif is_org? && path == [ "users" ]
+ update_json("members.json", []) do |members|
# Format of each entry: { "user": { "username": "jkeiser" } }
- if members.any? { |member| member['user']['username'] == name }
+ if members.any? { |member| member["user"]["username"] == name }
raise ChefZero::DataStore::DataAlreadyExistsError.new(path, entry)
end
@@ -203,10 +203,10 @@ class Chef
# create [/organizations/ORG]/association_requests/NAME (with content '{}')
# Manipulate the `invitations.json` file that contains a list of all users
- elsif is_org? && path == [ 'association_requests' ]
- update_json('invitations.json', []) do |invitations|
+ elsif is_org? && path == [ "association_requests" ]
+ update_json("invitations.json", []) do |invitations|
# Format of each entry: { "id" => "jkeiser-chef", 'username' => 'jkeiser' }
- if invitations.any? { |member| member['username'] == name }
+ if invitations.any? { |member| member["username"] == name }
raise ChefZero::DataStore::DataAlreadyExistsError.new(path)
end
@@ -233,8 +233,8 @@ class Chef
if use_memory_store?(path)
@memory_store.get(path)
- elsif path[0] == 'file_store' && path[1] == 'repo'
- entry = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path[2..-1].join('/'))
+ elsif path[0] == "file_store" && path[1] == "repo"
+ entry = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path[2..-1].join("/"))
begin
entry.read
rescue Chef::ChefFS::FileSystem::NotFoundError => e
@@ -242,10 +242,10 @@ class Chef
end
# /policy_groups/NAME/policies/POLICYNAME: return the revision of the given policy
- elsif path[0] == 'policy_groups' && path[2] == 'policies' && path.length == 4
+ elsif path[0] == "policy_groups" && path[2] == "policies" && path.length == 4
with_entry(path[0..1]) do |entry|
policy_group = Chef::JSONCompat.parse(entry)
- if !policy_group['policies'] || !policy_group['policies'][path[3]] || !policy_group['policies'][path[3]]
+ if !policy_group["policies"] || !policy_group["policies"][path[3]] || !policy_group["policies"][path[3]]
raise ChefZero::DataStore::DataNotFoundError.new(path, entry)
end
# The policy group looks like:
@@ -254,30 +254,30 @@ class Chef
# "x": { "revision_id": "10" }
# }
# }
- Chef::JSONCompat.to_json_pretty(policy_group['policies'][path[3]]["revision_id"])
+ Chef::JSONCompat.to_json_pretty(policy_group["policies"][path[3]]["revision_id"])
end
# GET [/organizations/ORG]/users/NAME -> /users/NAME
# Manipulates members.json
- elsif is_org? && path[0] == 'users' && path.length == 2
- if get_json('members.json', []).any? { |member| member['user']['username'] == path[1] }
- '{}'
+ elsif is_org? && path[0] == "users" && path.length == 2
+ if get_json("members.json", []).any? { |member| member["user"]["username"] == path[1] }
+ "{}"
else
raise ChefZero::DataStore::DataNotFoundError.new(path)
end
# GET [/organizations/ORG]/association_requests/NAME -> /users/NAME
# Manipulates invites.json
- elsif is_org? && path[0] == 'association_requests' && path.length == 2
- if get_json('invites.json', []).any? { |member| member['user']['username'] == path[1] }
- '{}'
+ elsif is_org? && path[0] == "association_requests" && path.length == 2
+ if get_json("invites.json", []).any? { |member| member["user"]["username"] == path[1] }
+ "{}"
else
raise ChefZero::DataStore::DataNotFoundError.new(path)
end
else
with_entry(path) do |entry|
- if path[0] == 'cookbooks' && path.length == 3
+ if path[0] == "cookbooks" && path.length == 3
# get /cookbooks/NAME/version
result = nil
begin
@@ -289,15 +289,15 @@ class Chef
result.each_pair do |key, value|
if value.is_a?(Array)
value.each do |file|
- if file.is_a?(Hash) && file.has_key?('checksum')
- relative = ['file_store', 'repo', 'cookbooks']
+ if file.is_a?(Hash) && file.has_key?("checksum")
+ relative = ["file_store", "repo", "cookbooks"]
if chef_fs.versioned_cookbooks
relative << "#{path[1]}-#{path[2]}"
else
relative << path[1]
end
- relative = relative + file[:path].split('/')
- file['url'] = ChefZero::RestBase::build_uri(request.base_uri, relative)
+ relative = relative + file[:path].split("/")
+ file["url"] = ChefZero::RestBase::build_uri(request.base_uri, relative)
end
end
end
@@ -324,7 +324,7 @@ class Chef
end
# Write out the files!
- if path[0] == 'cookbooks' && path.length == 3
+ if path[0] == "cookbooks" && path.length == 3
write_cookbook(path, data, *options)
else
with_dir(path[0..-2]) do |parent|
@@ -345,9 +345,9 @@ class Chef
# DELETE [/organizations/ORG]/users/NAME
# Manipulates members.json
- elsif is_org? && path[0] == 'users' && path.length == 2
- update_json('members.json', []) do |members|
- result = members.reject { |member| member['user']['username'] == path[1] }
+ elsif is_org? && path[0] == "users" && path.length == 2
+ update_json("members.json", []) do |members|
+ result = members.reject { |member| member["user"]["username"] == path[1] }
if result.size == members.size
raise ChefZero::DataStore::DataNotFoundError.new(path)
end
@@ -356,9 +356,9 @@ class Chef
# DELETE [/organizations/ORG]/users/NAME
# Manipulates members.json
- elsif is_org? && path[0] == 'association_requests' && path.length == 2
- update_json('invitations.json', []) do |invitations|
- result = invitations.reject { |invitation| invitation['username'] == path[1] }
+ elsif is_org? && path[0] == "association_requests" && path.length == 2
+ update_json("invitations.json", []) do |invitations|
+ result = invitations.reject { |invitation| invitation["username"] == path[1] }
if result.size == invitations.size
raise ChefZero::DataStore::DataNotFoundError.new(path)
end
@@ -368,7 +368,7 @@ class Chef
else
with_entry(path) do |entry|
begin
- if path[0] == 'cookbooks' && path.length >= 3
+ if path[0] == "cookbooks" && path.length >= 3
entry.delete(true)
else
entry.delete(false)
@@ -398,18 +398,18 @@ class Chef
if use_memory_store?(path)
@memory_store.list(path)
- elsif path[0] == 'policy_groups' && path.length == 2
+ elsif path[0] == "policy_groups" && path.length == 2
with_entry(path) do |entry|
- [ 'policies' ]
+ [ "policies" ]
end
- elsif path[0] == 'policy_groups' && path[2] == 'policies' && path.length == 3
- with_entry([ 'policy_groups', path[1] ]) do |entry|
+ elsif path[0] == "policy_groups" && path[2] == "policies" && path.length == 3
+ with_entry([ "policy_groups", path[1] ]) do |entry|
policy_group = Chef::JSONCompat.parse(entry.read)
- (policy_group['policies'] || {}).keys
+ (policy_group["policies"] || {}).keys
end
- elsif path[0] == 'cookbooks' && path.length == 1
+ elsif path[0] == "cookbooks" && path.length == 1
with_entry(path) do |entry|
begin
if chef_fs.versioned_cookbooks
@@ -424,9 +424,9 @@ class Chef
end
end
- elsif path[0] == 'cookbooks' && path.length == 2
+ elsif path[0] == "cookbooks" && path.length == 2
if chef_fs.versioned_cookbooks
- result = with_entry([ 'cookbooks' ]) do |entry|
+ result = with_entry([ "cookbooks" ]) do |entry|
# list /cookbooks/name = filter /cookbooks/name-version down to name
entry.children.map { |child| split_name_version(child.name) }.
select { |name, version| name == path[1] }.
@@ -476,13 +476,13 @@ class Chef
def exists_dir?(path)
if use_memory_store?(path)
@memory_store.exists_dir?(path)
- elsif path[0] == 'cookbooks' && path.length == 2
+ elsif path[0] == "cookbooks" && path.length == 2
list([ path[0] ]).include?(path[1])
# /policy_groups/NAME/policies
- elsif path[0] == 'policy_groups' && path[2] == 'policies' && path.length == 3
+ elsif path[0] == "policy_groups" && path[2] == "policies" && path.length == 3
exists_dir?(path[0..1])
# /policy_groups/NAME/policies/POLICYNAME
- elsif path[0] == 'policy_groups' && path[2] == 'policies' && path.length == 4
+ elsif path[0] == "policy_groups" && path[2] == "policies" && path.length == 4
exists_dir?(path[0..1]) && list(path[0..2]).include?(path[3])
else
Chef::ChefFS::FileSystem.resolve_path(chef_fs, to_chef_fs_path(path)).exists?
@@ -492,34 +492,34 @@ class Chef
private
def use_memory_store?(path)
- return path[0] == 'sandboxes' || path[0] == 'file_store' && path[1] == 'checksums' || path == [ 'environments', '_default' ]
+ return path[0] == "sandboxes" || path[0] == "file_store" && path[1] == "checksums" || path == [ "environments", "_default" ]
end
def write_cookbook(path, data, *options)
if chef_fs.versioned_cookbooks
- cookbook_path = File.join('cookbooks', "#{path[1]}-#{path[2]}")
+ cookbook_path = File.join("cookbooks", "#{path[1]}-#{path[2]}")
else
- cookbook_path = File.join('cookbooks', path[1])
+ cookbook_path = File.join("cookbooks", path[1])
end
# Create a little Chef::ChefFS memory filesystem with the data
- cookbook_fs = Chef::ChefFS::FileSystem::Memory::MemoryRoot.new('uploading')
+ cookbook_fs = Chef::ChefFS::FileSystem::Memory::MemoryRoot.new("uploading")
cookbook = Chef::JSONCompat.parse(data)
cookbook.each_pair do |key, value|
if value.is_a?(Array)
value.each do |file|
- if file.is_a?(Hash) && file.has_key?('checksum')
- file_data = @memory_store.get(['file_store', 'checksums', file['checksum']])
- cookbook_fs.add_file(File.join(cookbook_path, file['path']), file_data)
+ if file.is_a?(Hash) && file.has_key?("checksum")
+ file_data = @memory_store.get(["file_store", "checksums", file["checksum"]])
+ cookbook_fs.add_file(File.join(cookbook_path, file["path"]), file_data)
end
end
end
end
# Create the .uploaded-cookbook-version.json
- cookbooks = chef_fs.child('cookbooks')
+ cookbooks = chef_fs.child("cookbooks")
if !cookbooks.exists?
- cookbooks = chef_fs.create_child('cookbooks')
+ cookbooks = chef_fs.create_child("cookbooks")
end
# We are calling a cookbooks-specific API, so get multiplexed_dirs out of the way if it is there
if cookbooks.respond_to?(:multiplexed_dirs)
@@ -529,14 +529,14 @@ class Chef
end
def split_name_version(entry_name)
- name_version = entry_name.split('-')
- name = name_version[0..-2].join('-')
+ name_version = entry_name.split("-")
+ name = name_version[0..-2].join("-")
version = name_version[-1]
[name,version]
end
def to_chef_fs_path(path)
- _to_chef_fs_path(path).join('/')
+ _to_chef_fs_path(path).join("/")
end
def chef_fs_filename(path)
@@ -544,18 +544,18 @@ class Chef
end
def _to_chef_fs_path(path)
- if path[0] == 'data'
+ if path[0] == "data"
path = path.dup
- path[0] = 'data_bags'
+ path[0] = "data_bags"
if path.length >= 3
path[2] = "#{path[2]}.json"
end
- elsif path[0] == 'policies'
+ elsif path[0] == "policies"
path = path.dup
if path.length >= 3
path[2] = "#{path[2]}.json"
end
- elsif path[0] == 'cookbooks'
+ elsif path[0] == "cookbooks"
if path.length == 2
raise ChefZero::DataStore::DataNotFoundError.new(path)
elsif chef_fs.versioned_cookbooks
@@ -575,10 +575,10 @@ class Chef
end
end
- elsif path[0] == 'acls'
+ elsif path[0] == "acls"
# /acls/containers|nodes|.../x.json
# /acls/organization.json
- if path.length == 3 || path == [ 'acls', 'organization' ]
+ if path.length == 3 || path == [ "acls", "organization" ]
path = path.dup
path[-1] = "#{path[-1]}.json"
end
@@ -595,15 +595,15 @@ class Chef
end
def to_zero_path(entry)
- path = entry.path.split('/')[1..-1]
- if path[0] == 'data_bags'
+ path = entry.path.split("/")[1..-1]
+ if path[0] == "data_bags"
path = path.dup
- path[0] = 'data'
+ path[0] = "data"
if path.length >= 3
path[2] = path[2][0..-6]
end
- elsif path[0] == 'cookbooks'
+ elsif path[0] == "cookbooks"
if chef_fs.versioned_cookbooks
# cookbooks/name-version/... -> cookbooks/name/version/...
if path.length >= 2
@@ -618,7 +618,7 @@ class Chef
end
end
- elsif path.length == 2 && path[0] != 'cookbooks'
+ elsif path.length == 2 && path[0] != "cookbooks"
path = path.dup
path[1] = path[1][0..-6]
end
@@ -643,7 +643,7 @@ class Chef
def with_dir(path)
# Do not automatically create data bags
- create = !(path[0] == 'data' && path.size >= 2)
+ create = !(path[0] == "data" && path.size >= 2)
begin
yield get_dir(_to_chef_fs_path(path), create)
@@ -655,7 +655,7 @@ class Chef
end
def get_dir(path, create=false)
- result = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path.join('/'))
+ result = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path.join("/"))
if result.exists?
result
elsif create
@@ -666,9 +666,9 @@ class Chef
end
def get_single_cookbook_version(path)
- dir = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path[0..1].join('/'))
+ dir = Chef::ChefFS::FileSystem.resolve_path(chef_fs, path[0..1].join("/"))
metadata = ChefZero::CookbookData.metadata_from(dir, path[1], nil, [])
- metadata[:version] || '0.0.0'
+ metadata[:version] || "0.0.0"
end
def update_json(path, default_value)
@@ -694,7 +694,7 @@ class Chef
end
def is_org?
- repo_mode == 'hosted_everything'
+ repo_mode == "hosted_everything"
end
end
end
diff --git a/lib/chef/chef_fs/command_line.rb b/lib/chef/chef_fs/command_line.rb
index 8a205eef78..e48d5d67cd 100644
--- a/lib/chef/chef_fs/command_line.rb
+++ b/lib/chef/chef_fs/command_line.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system'
-require 'chef/chef_fs/file_system/operation_failed_error'
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
-require 'chef/util/diff'
+require "chef/chef_fs/file_system"
+require "chef/chef_fs/file_system/operation_failed_error"
+require "chef/chef_fs/file_system/operation_not_allowed_error"
+require "chef/util/diff"
class Chef
module ChefFS
@@ -72,7 +72,7 @@ class Chef
elsif old_value
result = "diff --knife #{old_path} #{new_path}\n"
result << "deleted file\n"
- result << diff_text(old_path, '/dev/null', old_value, '')
+ result << diff_text(old_path, "/dev/null", old_value, "")
yield result
else
yield "Only in #{format_path.call(old_entry.parent)}: #{old_entry.name}\n"
@@ -87,7 +87,7 @@ class Chef
elsif new_value
result = "diff --knife #{old_path} #{new_path}\n"
result << "new file\n"
- result << diff_text('/dev/null', new_path, '', new_value)
+ result << diff_text("/dev/null", new_path, "", new_value)
yield result
else
yield "Only in #{format_path.call(new_entry.parent)}: #{new_entry.name}\n"
diff --git a/lib/chef/chef_fs/config.rb b/lib/chef/chef_fs/config.rb
index 29c9d3b879..dbba396ebb 100644
--- a/lib/chef/chef_fs/config.rb
+++ b/lib/chef/chef_fs/config.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/chef_fs/path_utils'
+require "chef/log"
+require "chef/chef_fs/path_utils"
class Chef
module ChefFS
@@ -115,7 +115,7 @@ class Chef
@cwd = File.expand_path(cwd)
@cookbook_version = options[:cookbook_version]
- if @chef_config[:repo_mode] == 'everything' && is_hosted? && !ui.nil?
+ if @chef_config[:repo_mode] == "everything" && is_hosted? && !ui.nil?
ui.warn %Q{You have repo_mode set to 'everything', but your chef_server_url
looks like it might be a hosted setup. If this is the case please use
hosted_everything or allow repo_mode to default}
@@ -123,9 +123,9 @@ class Chef
# Default to getting *everything* from the server.
if !@chef_config[:repo_mode]
if is_hosted?
- @chef_config[:repo_mode] = 'hosted_everything'
+ @chef_config[:repo_mode] = "hosted_everything"
else
- @chef_config[:repo_mode] = 'everything'
+ @chef_config[:repo_mode] = "everything"
end
end
end
@@ -143,7 +143,7 @@ class Chef
end
def create_chef_fs
- require 'chef/chef_fs/file_system/chef_server/chef_server_root_dir'
+ 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)
end
@@ -152,7 +152,7 @@ class Chef
end
def create_local_fs
- require 'chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir'
+ require "chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir"
Chef::ChefFS::FileSystem::Repository::ChefRepositoryFileSystemRootDir.new(object_paths, Array(chef_config[:chef_repo_path]).flatten, @chef_config)
end
@@ -198,7 +198,7 @@ class Chef
# path and use realpath because a repo_path if provided *must* exist.
realest_chef_repo_path = Chef::ChefFS::PathUtils.realest_path(chef_repo_path, @cwd)
if Chef::ChefFS::PathUtils.os_path_eq?(target_path, realest_chef_repo_path)
- return '/'
+ return "/"
end
end
@@ -216,10 +216,10 @@ class Chef
server_path = entry.path
if base_path && server_path[0,base_path.length] == base_path
if server_path == base_path
- return '.'
- elsif server_path[base_path.length,1] == '/'
+ return "."
+ elsif server_path[base_path.length,1] == "/"
return server_path[base_path.length + 1, server_path.length - base_path.length - 1]
- elsif base_path == '/' && server_path[0,1] == '/'
+ elsif base_path == "/" && server_path[0,1] == "/"
return server_path[1, server_path.length - 1]
end
end
@@ -232,9 +232,9 @@ class Chef
@object_paths ||= begin
result = {}
case @chef_config[:repo_mode]
- when 'static'
+ when "static"
object_names = %w(cookbooks data_bags environments roles)
- when 'hosted_everything'
+ when "hosted_everything"
object_names = %w(acls clients cookbooks containers data_bags environments groups nodes roles policies policy_groups)
else
object_names = %w(clients cookbooks data_bags environments nodes roles users)
diff --git a/lib/chef/chef_fs/data_handler/acl_data_handler.rb b/lib/chef/chef_fs/data_handler/acl_data_handler.rb
index 6096b6e43c..91e48101c4 100644
--- a/lib/chef/chef_fs/data_handler/acl_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/acl_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
@@ -7,16 +7,16 @@ class Chef
def normalize(acl, entry)
# Normalize the order of the keys for easier reading
result = normalize_hash(acl, {
- 'create' => {},
- 'read' => {},
- 'update' => {},
- 'delete' => {},
- 'grant' => {},
+ "create" => {},
+ "read" => {},
+ "update" => {},
+ "delete" => {},
+ "grant" => {},
},)
result.keys.each do |key|
- result[key] = normalize_hash(result[key], { 'actors' => [], 'groups' => [] })
- result[key]['actors'] = result[key]['actors'].sort
- result[key]['groups'] = result[key]['groups'].sort
+ result[key] = normalize_hash(result[key], { "actors" => [], "groups" => [] })
+ result[key]["actors"] = result[key]["actors"].sort
+ result[key]["groups"] = result[key]["groups"].sort
end
result
end
diff --git a/lib/chef/chef_fs/data_handler/client_data_handler.rb b/lib/chef/chef_fs/data_handler/client_data_handler.rb
index 421a463c2f..5e120035ac 100644
--- a/lib/chef/chef_fs/data_handler/client_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/client_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/api_client'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/api_client"
class Chef
module ChefFS
@@ -7,25 +7,25 @@ class Chef
class ClientDataHandler < DataHandlerBase
def normalize(client, entry)
defaults = {
- 'name' => remove_dot_json(entry.name),
- 'clientname' => remove_dot_json(entry.name),
- 'admin' => false,
- 'validator' => false,
- 'chef_type' => 'client',
+ "name" => remove_dot_json(entry.name),
+ "clientname" => remove_dot_json(entry.name),
+ "admin" => false,
+ "validator" => false,
+ "chef_type" => "client",
}
# Handle the fact that admin/validator have changed type from string -> boolean
- client['admin'] = (client['admin'] == 'true') if client['admin'].is_a?(String)
- client['validator'] = (client['validator'] == 'true') if client['validator'].is_a?(String)
+ client["admin"] = (client["admin"] == "true") if client["admin"].is_a?(String)
+ client["validator"] = (client["validator"] == "true") if client["validator"].is_a?(String)
if entry.respond_to?(:org) && entry.org
- defaults['orgname'] = entry.org
+ defaults["orgname"] = entry.org
end
result = normalize_hash(client, defaults)
- result.delete('json_class')
+ result.delete("json_class")
result
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def chef_class
diff --git a/lib/chef/chef_fs/data_handler/container_data_handler.rb b/lib/chef/chef_fs/data_handler/container_data_handler.rb
index f03005f947..d1e8d2f3af 100644
--- a/lib/chef/chef_fs/data_handler/container_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/container_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
@@ -6,18 +6,18 @@ class Chef
class ContainerDataHandler < DataHandlerBase
def normalize(container, entry)
normalize_hash(container, {
- 'containername' => remove_dot_json(entry.name),
- 'containerpath' => remove_dot_json(entry.name),
+ "containername" => remove_dot_json(entry.name),
+ "containerpath" => remove_dot_json(entry.name),
},)
end
def preserve_key?(key)
- return key == 'containername'
+ return key == "containername"
end
def verify_integrity(object, entry, &on_error)
base_name = remove_dot_json(entry.name)
- if object['containername'] != base_name
+ if object["containername"] != base_name
on_error.call("Name in #{entry.path_for_printing} must be '#{base_name}' (is '#{object['name']}')")
end
end
diff --git a/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb b/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
index 0f2cad7983..f75f96f773 100644
--- a/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/cookbook/metadata'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/cookbook/metadata"
class Chef
module ChefFS
@@ -9,22 +9,22 @@ class Chef
version = entry.name
name = entry.parent.name
result = normalize_hash(cookbook, {
- 'name' => "#{name}-#{version}",
- 'version' => version,
- 'cookbook_name' => name,
- 'json_class' => 'Chef::CookbookVersion',
- 'chef_type' => 'cookbook_version',
- 'frozen?' => false,
- 'metadata' => {},
+ "name" => "#{name}-#{version}",
+ "version" => version,
+ "cookbook_name" => name,
+ "json_class" => "Chef::CookbookVersion",
+ "chef_type" => "cookbook_version",
+ "frozen?" => false,
+ "metadata" => {},
},)
- result['metadata'] = normalize_hash(result['metadata'], {
- 'version' => version,
- 'name' => name,
+ result["metadata"] = normalize_hash(result["metadata"], {
+ "version" => version,
+ "name" => name,
},)
end
def preserve_key?(key)
- return key == 'cookbook_name' || key == 'version'
+ return key == "cookbook_name" || key == "version"
end
def chef_class
diff --git a/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb b/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
index e2d0f43de2..d56f662c5c 100644
--- a/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/data_bag_item'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/data_bag_item"
class Chef
module ChefFS
@@ -7,19 +7,19 @@ class Chef
class DataBagItemDataHandler < DataHandlerBase
def normalize(data_bag_item, entry)
# If it's wrapped with raw_data, unwrap it.
- if data_bag_item['json_class'] == 'Chef::DataBagItem' && data_bag_item['raw_data']
- data_bag_item = data_bag_item['raw_data']
+ if data_bag_item["json_class"] == "Chef::DataBagItem" && data_bag_item["raw_data"]
+ data_bag_item = data_bag_item["raw_data"]
end
# chef_type and data_bag come back in PUT and POST results, but we don't
# use those in knife-essentials.
normalize_hash(data_bag_item, {
- 'id' => remove_dot_json(entry.name)
+ "id" => remove_dot_json(entry.name)
},)
end
def normalize_for_post(data_bag_item, entry)
- if data_bag_item['json_class'] == 'Chef::DataBagItem' && data_bag_item['raw_data']
- data_bag_item = data_bag_item['raw_data']
+ if data_bag_item["json_class"] == "Chef::DataBagItem" && data_bag_item["raw_data"]
+ data_bag_item = data_bag_item["raw_data"]
end
{
"name" => "data_bag_item_#{entry.parent.name}_#{remove_dot_json(entry.name)}",
@@ -35,7 +35,7 @@ class Chef
end
def preserve_key?(key)
- return key == 'id'
+ return key == "id"
end
def chef_class
@@ -44,7 +44,7 @@ class Chef
def verify_integrity(object, entry, &on_error)
base_name = remove_dot_json(entry.name)
- if object['raw_data']['id'] != base_name
+ if object["raw_data"]["id"] != base_name
on_error.call("ID in #{entry.path_for_printing} must be '#{base_name}' (is '#{object['raw_data']['id']}')")
end
end
diff --git a/lib/chef/chef_fs/data_handler/data_handler_base.rb b/lib/chef/chef_fs/data_handler/data_handler_base.rb
index a3dc92405c..53936979e3 100644
--- a/lib/chef/chef_fs/data_handler/data_handler_base.rb
+++ b/lib/chef/chef_fs/data_handler/data_handler_base.rb
@@ -147,7 +147,7 @@ class Chef
# environment "desert"'
#
def to_ruby_keys(object, keys)
- result = ''
+ result = ""
keys.each do |key|
if object[key]
if object[key].is_a?(Hash)
@@ -158,7 +158,7 @@ class Chef
if first
first = false
else
- result << ' '*key.length
+ result << " "*key.length
end
result << " #{k.inspect} => #{v.inspect}\n"
end
@@ -191,7 +191,7 @@ class Chef
#
def verify_integrity(object, entry, &on_error)
base_name = remove_dot_json(entry.name)
- if object['name'] != base_name
+ if object["name"] != base_name
on_error.call("Name must be '#{base_name}' (is '#{object['name']}')")
end
end
diff --git a/lib/chef/chef_fs/data_handler/environment_data_handler.rb b/lib/chef/chef_fs/data_handler/environment_data_handler.rb
index 5152a01e39..2480415f85 100644
--- a/lib/chef/chef_fs/data_handler/environment_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/environment_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/environment'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/environment"
class Chef
module ChefFS
@@ -7,18 +7,18 @@ class Chef
class EnvironmentDataHandler < DataHandlerBase
def normalize(environment, entry)
normalize_hash(environment, {
- 'name' => remove_dot_json(entry.name),
- 'description' => '',
- 'cookbook_versions' => {},
- 'default_attributes' => {},
- 'override_attributes' => {},
- 'json_class' => 'Chef::Environment',
- 'chef_type' => 'environment',
+ "name" => remove_dot_json(entry.name),
+ "description" => "",
+ "cookbook_versions" => {},
+ "default_attributes" => {},
+ "override_attributes" => {},
+ "json_class" => "Chef::Environment",
+ "chef_type" => "environment",
},)
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def chef_class
@@ -27,8 +27,8 @@ class Chef
def to_ruby(object)
result = to_ruby_keys(object, %w(name description default_attributes override_attributes))
- if object['cookbook_versions']
- object['cookbook_versions'].each_pair do |name, version|
+ if object["cookbook_versions"]
+ object["cookbook_versions"].each_pair do |name, version|
result << "cookbook #{name.inspect}, #{version.inspect}"
end
end
diff --git a/lib/chef/chef_fs/data_handler/group_data_handler.rb b/lib/chef/chef_fs/data_handler/group_data_handler.rb
index 40cb57b78a..7f38784826 100644
--- a/lib/chef/chef_fs/data_handler/group_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/group_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/api_client'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/api_client"
class Chef
module ChefFS
@@ -7,32 +7,32 @@ class Chef
class GroupDataHandler < DataHandlerBase
def normalize(group, entry)
defaults = {
- 'name' => remove_dot_json(entry.name),
- 'groupname' => remove_dot_json(entry.name),
- 'users' => [],
- 'clients' => [],
- 'groups' => [],
+ "name" => remove_dot_json(entry.name),
+ "groupname" => remove_dot_json(entry.name),
+ "users" => [],
+ "clients" => [],
+ "groups" => [],
}
if entry.org
- defaults['orgname'] = entry.org
+ defaults["orgname"] = entry.org
end
result = normalize_hash(group, defaults)
- if result['actors'] && result['actors'].sort.uniq == (result['users'] + result['clients']).sort.uniq
- result.delete('actors')
+ if result["actors"] && result["actors"].sort.uniq == (result["users"] + result["clients"]).sort.uniq
+ result.delete("actors")
end
result
end
def normalize_for_put(group, entry)
result = super(group, entry)
- result['actors'] = {
- 'users' => result['users'],
- 'clients' => result['clients'],
- 'groups' => result['groups'],
+ result["actors"] = {
+ "users" => result["users"],
+ "clients" => result["clients"],
+ "groups" => result["groups"],
}
- result.delete('users')
- result.delete('clients')
- result.delete('groups')
+ result.delete("users")
+ result.delete("clients")
+ result.delete("groups")
result
end
@@ -41,7 +41,7 @@ class Chef
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def chef_class
diff --git a/lib/chef/chef_fs/data_handler/node_data_handler.rb b/lib/chef/chef_fs/data_handler/node_data_handler.rb
index c4910b55b9..fcec74d2fb 100644
--- a/lib/chef/chef_fs/data_handler/node_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/node_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/node'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/node"
class Chef
module ChefFS
@@ -7,22 +7,22 @@ class Chef
class NodeDataHandler < DataHandlerBase
def normalize(node, entry)
result = normalize_hash(node, {
- 'name' => remove_dot_json(entry.name),
- 'json_class' => 'Chef::Node',
- 'chef_type' => 'node',
- 'chef_environment' => '_default',
- 'override' => {},
- 'normal' => {},
- 'default' => {},
- 'automatic' => {},
- 'run_list' => [],
+ "name" => remove_dot_json(entry.name),
+ "json_class" => "Chef::Node",
+ "chef_type" => "node",
+ "chef_environment" => "_default",
+ "override" => {},
+ "normal" => {},
+ "default" => {},
+ "automatic" => {},
+ "run_list" => [],
},)
- result['run_list'] = normalize_run_list(result['run_list'])
+ result["run_list"] = normalize_run_list(result["run_list"])
result
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def chef_class
diff --git a/lib/chef/chef_fs/data_handler/organization_data_handler.rb b/lib/chef/chef_fs/data_handler/organization_data_handler.rb
index 7b1bcc4c6c..d9f97b29ac 100644
--- a/lib/chef/chef_fs/data_handler/organization_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/organization_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
@@ -6,21 +6,21 @@ class Chef
class OrganizationDataHandler < DataHandlerBase
def normalize(organization, entry)
result = normalize_hash(organization, {
- 'name' => entry.org,
- 'full_name' => entry.org,
- 'org_type' => 'Business',
- 'clientname' => "#{entry.org}-validator",
- 'billing_plan' => 'platform-free',
+ "name" => entry.org,
+ "full_name" => entry.org,
+ "org_type" => "Business",
+ "clientname" => "#{entry.org}-validator",
+ "billing_plan" => "platform-free",
},)
result
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def verify_integrity(object, entry, &on_error)
- if entry.org != object['name']
+ if entry.org != object["name"]
on_error.call("Name must be '#{entry.org}' (is '#{object['name']}')")
end
end
diff --git a/lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb b/lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb
index db56ecc504..c5a5f873c5 100644
--- a/lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/organization_invites_data_handler.rb
@@ -1,11 +1,11 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
module DataHandler
class OrganizationInvitesDataHandler < DataHandlerBase
def normalize(invites, entry)
- invites.map { |invite| invite.is_a?(Hash) ? invite['username'] : invite }.sort.uniq
+ invites.map { |invite| invite.is_a?(Hash) ? invite["username"] : invite }.sort.uniq
end
def minimize(invites, entry)
diff --git a/lib/chef/chef_fs/data_handler/organization_members_data_handler.rb b/lib/chef/chef_fs/data_handler/organization_members_data_handler.rb
index afa331775c..8e452a413c 100644
--- a/lib/chef/chef_fs/data_handler/organization_members_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/organization_members_data_handler.rb
@@ -1,11 +1,11 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
module DataHandler
class OrganizationMembersDataHandler < DataHandlerBase
def normalize(members, entry)
- members.map { |member| member.is_a?(Hash) ? member['user']['username'] : member }.sort.uniq
+ members.map { |member| member.is_a?(Hash) ? member["user"]["username"] : member }.sort.uniq
end
def minimize(members, entry)
diff --git a/lib/chef/chef_fs/data_handler/policy_data_handler.rb b/lib/chef/chef_fs/data_handler/policy_data_handler.rb
index 32a7a791f7..477d2bf637 100644
--- a/lib/chef/chef_fs/data_handler/policy_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/policy_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
@@ -10,7 +10,7 @@ class Chef
if name =~ /^(.*)-([^-]*)$/
name, revision_id = $1, $2
end
- revision_id ||= '0.0.0'
+ revision_id ||= "0.0.0"
[ name, revision_id ]
end
@@ -18,21 +18,21 @@ class Chef
# foo-1.0.0 = foo, 1.0.0
name, revision_id = name_and_revision(entry.name)
defaults = {
- 'name' => name,
- 'revision_id' => revision_id,
- 'run_list' => [],
- 'cookbook_locks' => {},
+ "name" => name,
+ "revision_id" => revision_id,
+ "run_list" => [],
+ "cookbook_locks" => {},
}
normalize_hash(policy, defaults)
end
def verify_integrity(object_data, entry, &on_error)
name, revision = name_and_revision(entry.name)
- if object_data['name'] != name
+ if object_data["name"] != name
on_error.call("Object name '#{object_data['name']}' doesn't match entry '#{entry.name}'.")
end
- if object_data['revision_id'] != revision
+ if object_data["revision_id"] != revision
on_error.call("Object revision ID '#{object_data['revision']}' doesn't match entry '#{entry.name}'.")
end
end
diff --git a/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb b/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb
index 10de6abb42..e5c430ab64 100644
--- a/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/policy_group_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/data_handler/role_data_handler.rb b/lib/chef/chef_fs/data_handler/role_data_handler.rb
index d7530f0b9b..a3a1a31dc7 100644
--- a/lib/chef/chef_fs/data_handler/role_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/role_data_handler.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
-require 'chef/role'
+require "chef/chef_fs/data_handler/data_handler_base"
+require "chef/role"
class Chef
module ChefFS
@@ -7,24 +7,24 @@ class Chef
class RoleDataHandler < DataHandlerBase
def normalize(role, entry)
result = normalize_hash(role, {
- 'name' => remove_dot_json(entry.name),
- 'description' => '',
- 'json_class' => 'Chef::Role',
- 'chef_type' => 'role',
- 'default_attributes' => {},
- 'override_attributes' => {},
- 'run_list' => [],
- 'env_run_lists' => {},
+ "name" => remove_dot_json(entry.name),
+ "description" => "",
+ "json_class" => "Chef::Role",
+ "chef_type" => "role",
+ "default_attributes" => {},
+ "override_attributes" => {},
+ "run_list" => [],
+ "env_run_lists" => {},
},)
- result['run_list'] = normalize_run_list(result['run_list'])
- result['env_run_lists'].each_pair do |env, run_list|
- result['env_run_lists'][env] = normalize_run_list(run_list)
+ result["run_list"] = normalize_run_list(result["run_list"])
+ result["env_run_lists"].each_pair do |env, run_list|
+ result["env_run_lists"][env] = normalize_run_list(run_list)
end
result
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
def chef_class
diff --git a/lib/chef/chef_fs/data_handler/user_data_handler.rb b/lib/chef/chef_fs/data_handler/user_data_handler.rb
index 01c673b460..392e67f822 100644
--- a/lib/chef/chef_fs/data_handler/user_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/user_data_handler.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/data_handler/data_handler_base'
+require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
@@ -6,20 +6,20 @@ class Chef
class UserDataHandler < DataHandlerBase
def normalize(user, entry)
normalize_hash(user, {
- 'name' => remove_dot_json(entry.name),
- 'username' => remove_dot_json(entry.name),
- 'display_name' => remove_dot_json(entry.name),
- 'admin' => false,
- 'json_class' => 'Chef::WebUIUser',
- 'chef_type' => 'webui_user',
- 'salt' => nil,
- 'password' => nil,
- 'openid' => nil,
+ "name" => remove_dot_json(entry.name),
+ "username" => remove_dot_json(entry.name),
+ "display_name" => remove_dot_json(entry.name),
+ "admin" => false,
+ "json_class" => "Chef::WebUIUser",
+ "chef_type" => "webui_user",
+ "salt" => nil,
+ "password" => nil,
+ "openid" => nil,
},)
end
def preserve_key?(key)
- return key == 'name'
+ return key == "name"
end
# There is no chef_class for users, nor does to_ruby work.
diff --git a/lib/chef/chef_fs/file_pattern.rb b/lib/chef/chef_fs/file_pattern.rb
index b2351dac68..f6081a5f33 100644
--- a/lib/chef/chef_fs/file_pattern.rb
+++ b/lib/chef/chef_fs/file_pattern.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs'
-require 'chef/chef_fs/path_utils'
+require "chef/chef_fs"
+require "chef/chef_fs/path_utils"
class Chef
module ChefFS
@@ -70,7 +70,7 @@ class Chef
# abc/def.could_match_children?('x') == false
# a**z.could_match_children?('ab/cd') == true
def could_match_children?(path)
- return false if path == '' # Empty string is not a path
+ return false if path == "" # Empty string is not a path
argument_is_absolute = Chef::ChefFS::PathUtils::is_absolute?(path)
return false if is_absolute != argument_is_absolute
@@ -125,7 +125,7 @@ class Chef
def exact_path
return nil if has_double_star || exact_parts.any? { |part| part.nil? }
result = Chef::ChefFS::PathUtils::join(*exact_parts)
- is_absolute ? Chef::ChefFS::PathUtils::join('', result) : result
+ is_absolute ? Chef::ChefFS::PathUtils::join("", result) : result
end
# Returns the normalized version of the pattern, with / as the directory
@@ -199,12 +199,12 @@ class Chef
end
# Skip // and /./ (pretend it's not there)
- if exact == '' || exact == '.'
+ if exact == "" || exact == "."
next
end
# Back up when you see .. (unless the prior part has ** in it, in which case .. must be preserved)
- if exact == '..'
+ if exact == ".."
if @is_absolute && normalized_parts.length == 0
# If we are at the root, just pretend the .. isn't there
next
@@ -234,7 +234,7 @@ class Chef
@regexp = Regexp.new("^#{full_regexp_parts.join(Chef::ChefFS::PathUtils::regexp_path_separator)}$")
@normalized_pattern = Chef::ChefFS::PathUtils.join(*normalized_parts)
- @normalized_pattern = Chef::ChefFS::PathUtils.join('', @normalized_pattern) if @is_absolute
+ @normalized_pattern = Chef::ChefFS::PathUtils.join("", @normalized_pattern) if @is_absolute
end
end
@@ -249,7 +249,7 @@ class Chef
end
def self.regexp_escape_characters
- [ '[', '\\', '^', '$', '.', '|', '?', '*', '+', '(', ')', '{', '}' ]
+ [ "[", '\\', "^", "$", ".", "|", "?", "*", "+", "(", ")", "{", "}" ]
end
def self.pattern_to_regexp(pattern)
@@ -264,16 +264,16 @@ class Chef
else
case part
# **, * and ? happen on both platforms.
- when '**'
+ when "**"
exact = nil
has_double_star = true
- regexp << '.*'
- when '*'
+ regexp << ".*"
+ when "*"
exact = nil
regexp << '[^\/]*'
- when '?'
+ when "?"
exact = nil
- regexp << '.'
+ regexp << "."
else
if part[0,1] == '\\' && part.length == 2
# backslash escapes are only supported on Unix, and are handled here by leaving the escape on (it means the same thing in a regex)
@@ -283,7 +283,7 @@ class Chef
else
regexp << part[1,1]
end
- elsif part[0,1] == '[' && part.length > 1
+ elsif part[0,1] == "[" && part.length > 1
# [...] happens only on Unix, and is handled here by *not* backslashing (it means the same thing in and out of regex)
exact = nil
regexp << part
diff --git a/lib/chef/chef_fs/file_system.rb b/lib/chef/chef_fs/file_system.rb
index 3ab59046cc..f2d6fe1026 100644
--- a/lib/chef/chef_fs/file_system.rb
+++ b/lib/chef/chef_fs/file_system.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/chef_fs/path_utils'
-require 'chef/chef_fs/file_system/default_environment_cannot_be_modified_error'
-require 'chef/chef_fs/file_system/operation_failed_error'
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
-require 'chef/chef_fs/parallelizer'
+require "chef/chef_fs/path_utils"
+require "chef/chef_fs/file_system/default_environment_cannot_be_modified_error"
+require "chef/chef_fs/file_system/operation_failed_error"
+require "chef/chef_fs/file_system/operation_not_allowed_error"
+require "chef/chef_fs/parallelizer"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/already_exists_error.rb b/lib/chef/chef_fs/file_system/already_exists_error.rb
index e6d4a8fa2c..ef93ed7729 100644
--- a/lib/chef/chef_fs/file_system/already_exists_error.rb
+++ b/lib/chef/chef_fs/file_system/already_exists_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/operation_failed_error'
+require "chef/chef_fs/file_system/operation_failed_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/base_fs_dir.rb b/lib/chef/chef_fs/file_system/base_fs_dir.rb
index 47e33f961a..2c3f0bf5ae 100644
--- a/lib/chef/chef_fs/file_system/base_fs_dir.rb
+++ b/lib/chef/chef_fs/file_system/base_fs_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_object'
-require 'chef/chef_fs/file_system/nonexistent_fs_object'
+require "chef/chef_fs/file_system/base_fs_object"
+require "chef/chef_fs/file_system/nonexistent_fs_object"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/base_fs_object.rb b/lib/chef/chef_fs/file_system/base_fs_object.rb
index 916ab8297d..5af8a99dd3 100644
--- a/lib/chef/chef_fs/file_system/base_fs_object.rb
+++ b/lib/chef/chef_fs/file_system/base_fs_object.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/path_utils'
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
+require "chef/chef_fs/path_utils"
+require "chef/chef_fs/file_system/operation_not_allowed_error"
class Chef
module ChefFS
@@ -29,10 +29,10 @@ class Chef
if parent
@path = Chef::ChefFS::PathUtils::join(parent.path, name)
else
- if name != ''
+ if name != ""
raise ArgumentError, "Name of root object must be empty string: was '#{name}' instead"
end
- @path = '/'
+ @path = "/"
end
end
@@ -146,7 +146,7 @@ class Chef
def path_for_printing
if parent
parent_path = parent.path_for_printing
- if parent_path == '.'
+ if parent_path == "."
name
else
Chef::ChefFS::PathUtils::join(parent.path_for_printing, name)
@@ -180,4 +180,4 @@ class Chef
end
end
-require 'chef/chef_fs/file_system/nonexistent_fs_object'
+require "chef/chef_fs/file_system/nonexistent_fs_object"
diff --git a/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb b/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb
index fff47c986d..65d21a90b0 100644
--- a/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/acl_dir.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/acl_entry'
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/acl_entry"
+require "chef/chef_fs/file_system/operation_not_allowed_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
index f87a7eaca9..4a602ba66d 100644
--- a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
-require 'chef/chef_fs/file_system/operation_failed_error'
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/operation_not_allowed_error"
+require "chef/chef_fs/file_system/operation_failed_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb b/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb
index bc7168e31d..aa1ebf159e 100644
--- a/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/acl_dir'
-require 'chef/chef_fs/file_system/chef_server/cookbooks_acl_dir'
-require 'chef/chef_fs/file_system/chef_server/acl_entry'
-require 'chef/chef_fs/data_handler/acl_data_handler'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/acl_dir"
+require "chef/chef_fs/file_system/chef_server/cookbooks_acl_dir"
+require "chef/chef_fs/file_system/chef_server/acl_entry"
+require "chef/chef_fs/data_handler/acl_data_handler"
class Chef
module ChefFS
@@ -42,20 +42,20 @@ class Chef
end
def can_have_child?(name, is_dir)
- is_dir ? ENTITY_TYPES.include?(name) : name == 'organization.json'
+ is_dir ? ENTITY_TYPES.include?(name) : name == "organization.json"
end
def children
if @children.nil?
@children = ENTITY_TYPES.map do |entity_type|
case entity_type
- when 'cookbooks'
+ when "cookbooks"
CookbooksAclDir.new(entity_type, self)
else
AclDir.new(entity_type, self)
end
end
- @children << AclEntry.new('organization.json', self, true) # the org acl is retrieved as GET /organizations/ORGNAME/ANYTHINGATALL/_acl
+ @children << AclEntry.new("organization.json", self, true) # the org acl is retrieved as GET /organizations/ORGNAME/ANYTHINGATALL/_acl
end
@children
end
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 38abd60668..4a45d218d1 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
@@ -16,29 +16,29 @@
# limitations under the License.
#
-require 'chef/server_api'
-require 'chef/chef_fs/file_system/chef_server/acls_dir'
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/chef_server/cookbooks_dir'
-require 'chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir'
-require 'chef/chef_fs/file_system/chef_server/data_bags_dir'
-require 'chef/chef_fs/file_system/chef_server/nodes_dir'
-require 'chef/chef_fs/file_system/chef_server/org_entry'
-require 'chef/chef_fs/file_system/chef_server/organization_invites_entry'
-require 'chef/chef_fs/file_system/chef_server/organization_members_entry'
-require 'chef/chef_fs/file_system/chef_server/policies_dir'
-require 'chef/chef_fs/file_system/chef_server/policy_groups_dir'
-require 'chef/chef_fs/file_system/chef_server/environments_dir'
-require 'chef/chef_fs/data_handler/acl_data_handler'
-require 'chef/chef_fs/data_handler/client_data_handler'
-require 'chef/chef_fs/data_handler/environment_data_handler'
-require 'chef/chef_fs/data_handler/node_data_handler'
-require 'chef/chef_fs/data_handler/role_data_handler'
-require 'chef/chef_fs/data_handler/user_data_handler'
-require 'chef/chef_fs/data_handler/group_data_handler'
-require 'chef/chef_fs/data_handler/container_data_handler'
-require 'chef/chef_fs/data_handler/policy_group_data_handler'
+require "chef/server_api"
+require "chef/chef_fs/file_system/chef_server/acls_dir"
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/chef_server/cookbooks_dir"
+require "chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir"
+require "chef/chef_fs/file_system/chef_server/data_bags_dir"
+require "chef/chef_fs/file_system/chef_server/nodes_dir"
+require "chef/chef_fs/file_system/chef_server/org_entry"
+require "chef/chef_fs/file_system/chef_server/organization_invites_entry"
+require "chef/chef_fs/file_system/chef_server/organization_members_entry"
+require "chef/chef_fs/file_system/chef_server/policies_dir"
+require "chef/chef_fs/file_system/chef_server/policy_groups_dir"
+require "chef/chef_fs/file_system/chef_server/environments_dir"
+require "chef/chef_fs/data_handler/acl_data_handler"
+require "chef/chef_fs/data_handler/client_data_handler"
+require "chef/chef_fs/data_handler/environment_data_handler"
+require "chef/chef_fs/data_handler/node_data_handler"
+require "chef/chef_fs/data_handler/role_data_handler"
+require "chef/chef_fs/data_handler/user_data_handler"
+require "chef/chef_fs/data_handler/group_data_handler"
+require "chef/chef_fs/data_handler/container_data_handler"
+require "chef/chef_fs/data_handler/policy_group_data_handler"
class Chef
module ChefFS
@@ -125,11 +125,11 @@ class Chef
def org
@org ||= begin
path = Pathname.new(URI.parse(chef_server_url).path).cleanpath
- if File.dirname(path) == '/organizations'
+ if File.dirname(path) == "/organizations"
File.basename(path)
else
# In Chef 12, everything is in an org.
- 'chef'
+ "chef"
end
end
end
@@ -150,7 +150,7 @@ class Chef
# /roles
RestListDir.new("roles", self, nil, Chef::ChefFS::DataHandler::RoleDataHandler.new),
]
- if repo_mode == 'hosted_everything'
+ if repo_mode == "hosted_everything"
result += [
# /acls
AclsDir.new("acls", self),
@@ -173,7 +173,7 @@ class Chef
# /policy_groups
PolicyGroupsDir.new("policy_groups", self, nil, Chef::ChefFS::DataHandler::PolicyGroupDataHandler.new),
]
- elsif repo_mode != 'static'
+ elsif repo_mode != "static"
result += [
# /clients
RestListDir.new("clients", self, nil, Chef::ChefFS::DataHandler::ClientDataHandler.new),
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
index 433f1a009d..18bf748d87 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/chef_fs/command_line'
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/chef_server/cookbook_subdir'
-require 'chef/chef_fs/file_system/chef_server/cookbook_file'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/cookbook_version'
-require 'chef/cookbook_uploader'
+require "chef/chef_fs/command_line"
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/chef_server/cookbook_subdir"
+require "chef/chef_fs/file_system/chef_server/cookbook_file"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/cookbook_version"
+require "chef/cookbook_uploader"
class Chef
module ChefFS
@@ -82,7 +82,7 @@ class Chef
def can_have_child?(name, is_dir)
# A cookbook's root may not have directories unless they are segment directories
- return name != 'root_files' && COOKBOOK_SEGMENT_INFO.keys.include?(name.to_sym) if is_dir
+ return name != "root_files" && COOKBOOK_SEGMENT_INFO.keys.include?(name.to_sym) if is_dir
return true
end
@@ -96,7 +96,7 @@ class Chef
# Go through each file in the manifest for the segment, and
# add cookbook subdirs and files for it.
manifest[segment].each do |segment_file|
- parts = segment_file[:path].split('/')
+ parts = segment_file[:path].split("/")
# Get or create the path to the file
container = self
parts[0,parts.length-1].each do |part|
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb
index 721c5092cf..fc9ad46d71 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_object'
-require 'chef/http/simple'
-require 'openssl'
+require "chef/chef_fs/file_system/base_fs_object"
+require "chef/http/simple"
+require "openssl"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb
index 55c0168077..9bc1821c48 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_subdir.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
+require "chef/chef_fs/file_system/base_fs_dir"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb
index 999fb58f79..2460aba47f 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbooks_acl_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/acl_dir'
-require 'chef/chef_fs/file_system/chef_server/acl_entry'
+require "chef/chef_fs/file_system/chef_server/acl_dir"
+require "chef/chef_fs/file_system/chef_server/acl_entry"
class Chef
module ChefFS
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 5fd8111d7a..660cc95734 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
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/chef_server/cookbook_dir'
-require 'chef/chef_fs/file_system/operation_failed_error'
-require 'chef/chef_fs/file_system/cookbook_frozen_error'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir'
-require 'chef/mixin/file_class'
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/chef_server/cookbook_dir"
+require "chef/chef_fs/file_system/operation_failed_error"
+require "chef/chef_fs/file_system/cookbook_frozen_error"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir"
+require "chef/mixin/file_class"
-require 'tmpdir'
+require "tmpdir"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb b/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
index b657243d64..60875d7b4c 100644
--- a/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/data_bag_dir.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/must_delete_recursively_error'
-require 'chef/chef_fs/data_handler/data_bag_item_data_handler'
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/must_delete_recursively_error"
+require "chef/chef_fs/data_handler/data_bag_item_data_handler"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb b/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb
index 50952cfc1b..710c8f0a72 100644
--- a/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/chef_server/data_bag_dir'
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/chef_server/data_bag_dir"
class Chef
module ChefFS
@@ -49,7 +49,7 @@ class Chef
def create_child(name, file_contents)
begin
- rest.post(api_path, { 'name' => name })
+ rest.post(api_path, { "name" => name })
rescue Timeout::Error => e
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:create_child, self, e, "Timeout creating child '#{name}': #{e}")
rescue Net::HTTPServerException => e
diff --git a/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb b/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb
index 721c8a38d4..aa9423a43d 100644
--- a/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/environments_dir.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/default_environment_cannot_be_modified_error'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/default_environment_cannot_be_modified_error"
class Chef
module ChefFS
@@ -27,7 +27,7 @@ class Chef
module ChefServer
class EnvironmentsDir < RestListDir
def make_child_entry(name, exists = nil)
- if name == '_default.json'
+ if name == "_default.json"
DefaultEnvironmentEntry.new(name, self, exists)
else
super
diff --git a/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb b/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
index c0728fbe1f..596a63b0b8 100644
--- a/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/data_handler/node_data_handler'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/data_handler/node_data_handler"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/org_entry.rb b/lib/chef/chef_fs/file_system/chef_server/org_entry.rb
index 82c5764b42..87be36b932 100644
--- a/lib/chef/chef_fs/file_system/chef_server/org_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/org_entry.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/data_handler/organization_data_handler'
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/data_handler/organization_data_handler"
class Chef
module ChefFS
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 cf276c6466..986a04ff4a 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
@@ -1,6 +1,6 @@
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/data_handler/organization_invites_data_handler'
-require 'chef/json_compat'
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/data_handler/organization_invites_data_handler"
+require "chef/json_compat"
class Chef
module ChefFS
@@ -24,7 +24,7 @@ class Chef
# /organizations/foo/invites.json -> /organizations/foo/association_requests
def api_path
- File.join(parent.api_path, 'association_requests')
+ File.join(parent.api_path, "association_requests")
end
def exists?
@@ -37,13 +37,13 @@ class Chef
def write(contents)
desired_invites = minimize_value(Chef::JSONCompat.parse(contents, :create_additions => false))
- actual_invites = _read_json.inject({}) { |h,val| h[val['username']] = val['id']; h }
+ actual_invites = _read_json.inject({}) { |h,val| h[val["username"]] = val["id"]; h }
invites = actual_invites.keys
(desired_invites - invites).each do |invite|
begin
- rest.post(api_path, { 'user' => invite })
+ rest.post(api_path, { "user" => invite })
rescue Net::HTTPServerException => e
- if e.response.code == '409'
+ if e.response.code == "409"
Chef::Log.warn("Could not invite #{invite} to organization #{org}: #{api_error_text(e.response)}")
else
raise
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 1c1c231643..00c1c71b71 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
@@ -1,6 +1,6 @@
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/data_handler/organization_members_data_handler'
-require 'chef/json_compat'
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/data_handler/organization_members_data_handler"
+require "chef/json_compat"
class Chef
module ChefFS
@@ -24,7 +24,7 @@ class Chef
# /organizations/foo/members.json -> /organizations/foo/users
def api_path
- File.join(parent.api_path, 'users')
+ File.join(parent.api_path, "users")
end
def exists?
@@ -40,7 +40,7 @@ class Chef
members = minimize_value(_read_json)
(desired_members - members).each do |member|
begin
- rest.post(api_path, 'username' => member)
+ rest.post(api_path, "username" => member)
rescue Net::HTTPServerException => e
if %w(404 405).include?(e.response.code)
raise "Chef server at #{api_path} does not allow you to directly add members. Please either upgrade your Chef server or move the users you want into invitations.json instead of members.json."
diff --git a/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb b/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
index b6c34cfee7..ea2a048fbf 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/chef_server/policy_revision_entry'
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/chef_server/policy_revision_entry"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb b/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
index 76ececbd5b..3858ef66c4 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/already_exists_error'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/operation_failed_error'
+require "chef/chef_fs/file_system/already_exists_error"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/operation_failed_error"
class Chef
module ChefFS
@@ -107,8 +107,8 @@ class Chef
end
# Now we need to remove any policies that are *not* in our current group.
- if existing_group && existing_group['policies']
- (existing_group['policies'].keys - policy_datas.keys).each do |policy_name|
+ if existing_group && existing_group["policies"]
+ (existing_group["policies"].keys - policy_datas.keys).each do |policy_name|
rest.delete("#{api_path}/policies/#{policy_name}")
end
end
diff --git a/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb b/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb
index 0c061ebdb2..71e0fc4579 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policy_groups_dir.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/chef_server/policy_group_entry'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/chef_server/policy_group_entry"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb b/lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
index 7ea93278d0..a51a1ff5c9 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policy_revision_entry.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/data_handler/policy_data_handler'
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/data_handler/policy_data_handler"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
index 84790190d1..573f107e54 100644
--- a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_entry'
-require 'chef/chef_fs/file_system/not_found_error'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_entry"
+require "chef/chef_fs/file_system/not_found_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb b/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
index 4ceab42c1b..692b6cfc73 100644
--- a/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_object'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/file_system/operation_failed_error'
-require 'chef/role'
-require 'chef/node'
-require 'chef/json_compat'
+require "chef/chef_fs/file_system/base_fs_object"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/file_system/operation_failed_error"
+require "chef/role"
+require "chef/node"
+require "chef/json_compat"
class Chef
module ChefFS
@@ -174,7 +174,7 @@ class Chef
def api_error_text(response)
begin
- Chef::JSONCompat.parse(response.body)['error'].join("\n")
+ Chef::JSONCompat.parse(response.body)["error"].join("\n")
rescue
response.body
end
diff --git a/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb b/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb
index 25b3fa38cc..ddc3e7a049 100644
--- a/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/versioned_cookbook_dir'
+require "chef/chef_fs/file_system/chef_server/versioned_cookbook_dir"
class Chef
module ChefFS
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 bccb34bb37..c22723d1e2 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
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/chef_server/cookbooks_dir'
-require 'chef/chef_fs/file_system/chef_server/versioned_cookbook_dir'
+require "chef/chef_fs/file_system/chef_server/cookbooks_dir"
+require "chef/chef_fs/file_system/chef_server/versioned_cookbook_dir"
class Chef
module ChefFS
@@ -42,7 +42,7 @@ class Chef
@children ||= begin
result = []
root.get_json("#{api_path}/?num_versions=all").each_pair do |cookbook_name, cookbooks|
- cookbooks['versions'].each do |cookbook_version|
+ cookbooks["versions"].each do |cookbook_version|
result << VersionedCookbookDir.new("#{cookbook_name}-#{cookbook_version['version']}", self)
end
end
diff --git a/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb b/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb
index cbb25cd03a..d081249b24 100644
--- a/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb
+++ b/lib/chef/chef_fs/file_system/cookbook_frozen_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/already_exists_error'
+require "chef/chef_fs/file_system/already_exists_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb b/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
index a077474da8..da5ed90710 100644
--- a/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
+++ b/lib/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/operation_not_allowed_error'
+require "chef/chef_fs/file_system/operation_not_allowed_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/memory/memory_dir.rb b/lib/chef/chef_fs/file_system/memory/memory_dir.rb
index b571a6f469..beb661448d 100644
--- a/lib/chef/chef_fs/file_system/memory/memory_dir.rb
+++ b/lib/chef/chef_fs/file_system/memory/memory_dir.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/memory/memory_file'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/memory/memory_file"
class Chef
module ChefFS
@@ -26,15 +26,15 @@ class Chef
end
def add_file(path, value)
- path_parts = path.split('/')
- dir = add_dir(path_parts[0..-2].join('/'))
+ path_parts = path.split("/")
+ dir = add_dir(path_parts[0..-2].join("/"))
file = MemoryFile.new(path_parts[-1], dir, value)
dir.add_child(file)
file
end
def add_dir(path)
- path_parts = path.split('/')
+ path_parts = path.split("/")
dir = self
path_parts.each do |path_part|
subdir = dir.child(path_part)
diff --git a/lib/chef/chef_fs/file_system/memory/memory_file.rb b/lib/chef/chef_fs/file_system/memory/memory_file.rb
index 8b280eeb7d..644273fa9f 100644
--- a/lib/chef/chef_fs/file_system/memory/memory_file.rb
+++ b/lib/chef/chef_fs/file_system/memory/memory_file.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/file_system/base_fs_object'
+require "chef/chef_fs/file_system/base_fs_object"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/memory/memory_root.rb b/lib/chef/chef_fs/file_system/memory/memory_root.rb
index f4a7b5208b..4881b3d951 100644
--- a/lib/chef/chef_fs/file_system/memory/memory_root.rb
+++ b/lib/chef/chef_fs/file_system/memory/memory_root.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/file_system/memory/memory_dir'
+require "chef/chef_fs/file_system/memory/memory_dir"
class Chef
module ChefFS
@@ -6,7 +6,7 @@ class Chef
module Memory
class MemoryRoot < MemoryDir
def initialize(pretty_name, cannot_be_in_regex = nil)
- super('', nil)
+ super("", nil)
@pretty_name = pretty_name
@cannot_be_in_regex = cannot_be_in_regex
end
diff --git a/lib/chef/chef_fs/file_system/multiplexed_dir.rb b/lib/chef/chef_fs/file_system/multiplexed_dir.rb
index 70b827f85f..e143dde9e8 100644
--- a/lib/chef/chef_fs/file_system/multiplexed_dir.rb
+++ b/lib/chef/chef_fs/file_system/multiplexed_dir.rb
@@ -1,5 +1,5 @@
-require 'chef/chef_fs/file_system/base_fs_object'
-require 'chef/chef_fs/file_system/nonexistent_fs_object'
+require "chef/chef_fs/file_system/base_fs_object"
+require "chef/chef_fs/file_system/nonexistent_fs_object"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb b/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb
index 11b26e514e..b54af68587 100644
--- a/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb
+++ b/lib/chef/chef_fs/file_system/must_delete_recursively_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/file_system_error'
+require "chef/chef_fs/file_system/file_system_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb b/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb
index a587ab47a4..7a09c8fd0b 100644
--- a/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb
+++ b/lib/chef/chef_fs/file_system/nonexistent_fs_object.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_object'
-require 'chef/chef_fs/file_system/not_found_error'
+require "chef/chef_fs/file_system/base_fs_object"
+require "chef/chef_fs/file_system/not_found_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/not_found_error.rb b/lib/chef/chef_fs/file_system/not_found_error.rb
index 088c38cc64..76b8076da1 100644
--- a/lib/chef/chef_fs/file_system/not_found_error.rb
+++ b/lib/chef/chef_fs/file_system/not_found_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/file_system_error'
+require "chef/chef_fs/file_system/file_system_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/operation_failed_error.rb b/lib/chef/chef_fs/file_system/operation_failed_error.rb
index 70461e082e..886a9982bf 100644
--- a/lib/chef/chef_fs/file_system/operation_failed_error.rb
+++ b/lib/chef/chef_fs/file_system/operation_failed_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/file_system_error'
+require "chef/chef_fs/file_system/file_system_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb b/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb
index e756cc76a3..130c10ed5b 100644
--- a/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb
+++ b/lib/chef/chef_fs/file_system/operation_not_allowed_error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/file_system_error'
+require "chef/chef_fs/file_system/file_system_error"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb
index 7d647c0fc3..888ef6d3be 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_entry'
-require 'chef/chef_fs/file_system/chef_server/acls_dir'
-require 'chef/chef_fs/data_handler/acl_data_handler'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
+require "chef/chef_fs/file_system/chef_server/acls_dir"
+require "chef/chef_fs/data_handler/acl_data_handler"
class Chef
module ChefFS
@@ -30,7 +30,7 @@ class Chef
end
def can_have_child?(name, is_dir)
- is_dir ? Chef::ChefFS::FileSystem::ChefServer::AclsDir::ENTITY_TYPES.include?(name) : name == 'organization.json'
+ is_dir ? Chef::ChefFS::FileSystem::ChefServer::AclsDir::ENTITY_TYPES.include?(name) : name == "organization.json"
end
end
end
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 e6557bd05d..17a84ff2bc 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
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry'
-require 'chef/chef_fs/file_system/chef_server/cookbook_dir'
-require 'chef/chef_fs/file_system/chef_server/versioned_cookbook_dir'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/cookbook/chefignore'
-require 'chef/cookbook/cookbook_version_loader'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry"
+require "chef/chef_fs/file_system/chef_server/cookbook_dir"
+require "chef/chef_fs/file_system/chef_server/versioned_cookbook_dir"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/cookbook/chefignore"
+require "chef/cookbook/cookbook_version_loader"
class Chef
module ChefFS
@@ -50,7 +50,7 @@ class Chef
def can_have_child?(name, is_dir)
if is_dir
# Only the given directories will be uploaded.
- return Chef::ChefFS::FileSystem::ChefServer::CookbookDir::COOKBOOK_SEGMENT_INFO.keys.include?(name.to_sym) && name != 'root_files'
+ return Chef::ChefFS::FileSystem::ChefServer::CookbookDir::COOKBOOK_SEGMENT_INFO.keys.include?(name.to_sym) && name != "root_files"
elsif name == Chef::Cookbook::CookbookVersionLoader::UPLOADED_COOKBOOK_VERSION_FILE
return false
end
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
index 574ed44828..ce11849d42 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_entry'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir'
-require 'chef/chef_fs/file_system/not_found_error'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir"
+require "chef/chef_fs/file_system/not_found_error"
class Chef
module ChefFS
@@ -40,9 +40,9 @@ class Chef
def can_have_child?(name, is_dir)
if is_dir
- return recursive && name != '.' && name != '..'
+ return recursive && name != "." && name != ".."
elsif ruby_only
- return false if name[-3..-1] != '.rb'
+ return false if name[-3..-1] != ".rb"
end
# Check chefignore
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb
index 5c88aa2aa1..1ed9d6ee0b 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_entry'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir'
-require 'chef/cookbook/chefignore'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir"
+require "chef/cookbook/chefignore"
class Chef
module ChefFS
@@ -50,7 +50,7 @@ class Chef
end
def can_have_child?(name, is_dir)
- is_dir && !name.start_with?('.')
+ is_dir && !name.start_with?(".")
end
def write_cookbook(cookbook_path, cookbook_version_json, from_fs)
@@ -67,7 +67,7 @@ class Chef
FileUtils.mkdir_p(cookbook_file_path)
end
uploaded_cookbook_version_path = File.join(cookbook_file_path, Chef::Cookbook::CookbookVersionLoader::UPLOADED_COOKBOOK_VERSION_FILE)
- File.open(uploaded_cookbook_version_path, 'w') do |file|
+ File.open(uploaded_cookbook_version_path, "w") do |file|
file.write(cookbook_version_json)
end
end
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb
index a0d564704a..0476d78794 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_entry'
-require 'chef/chef_fs/data_handler/data_bag_item_data_handler'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
+require "chef/chef_fs/data_handler/data_bag_item_data_handler"
class Chef
module ChefFS
@@ -29,7 +29,7 @@ class Chef
end
def can_have_child?(name, is_dir)
- is_dir && !name.start_with?('.')
+ is_dir && !name.start_with?(".")
end
end
end
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb
index 92658c07fa..91813452aa 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/file_system_entry'
-require 'chef/chef_fs/file_system/not_found_error'
+require "chef/chef_fs/file_system/repository/file_system_entry"
+require "chef/chef_fs/file_system/not_found_error"
class Chef
module ChefFS
@@ -54,11 +54,11 @@ class Chef
end
def can_have_child?(name, is_dir)
- !is_dir && name[-5..-1] == '.json'
+ !is_dir && name[-5..-1] == ".json"
end
def write(file_contents)
- if file_contents && write_pretty_json && name[-5..-1] == '.json'
+ if file_contents && write_pretty_json && name[-5..-1] == ".json"
file_contents = minimize(file_contents, self)
end
super(file_contents)
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
index 2e9eeea0ee..3cb3c914b2 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
@@ -16,22 +16,22 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_entry'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir'
-require 'chef/chef_fs/file_system/multiplexed_dir'
-require 'chef/chef_fs/data_handler/client_data_handler'
-require 'chef/chef_fs/data_handler/environment_data_handler'
-require 'chef/chef_fs/data_handler/node_data_handler'
-require 'chef/chef_fs/data_handler/policy_data_handler'
-require 'chef/chef_fs/data_handler/policy_group_data_handler'
-require 'chef/chef_fs/data_handler/role_data_handler'
-require 'chef/chef_fs/data_handler/user_data_handler'
-require 'chef/chef_fs/data_handler/group_data_handler'
-require 'chef/chef_fs/data_handler/container_data_handler'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_data_bags_dir"
+require "chef/chef_fs/file_system/multiplexed_dir"
+require "chef/chef_fs/data_handler/client_data_handler"
+require "chef/chef_fs/data_handler/environment_data_handler"
+require "chef/chef_fs/data_handler/node_data_handler"
+require "chef/chef_fs/data_handler/policy_data_handler"
+require "chef/chef_fs/data_handler/policy_group_data_handler"
+require "chef/chef_fs/data_handler/role_data_handler"
+require "chef/chef_fs/data_handler/user_data_handler"
+require "chef/chef_fs/data_handler/group_data_handler"
+require "chef/chef_fs/data_handler/container_data_handler"
class Chef
module ChefFS
@@ -113,7 +113,7 @@ class Chef
# Used to print out a human-readable file system description
def fs_description
- repo_paths = root_paths || [ File.dirname(child_paths['cookbooks'][0]) ]
+ repo_paths = root_paths || [ File.dirname(child_paths["cookbooks"][0]) ]
result = "repository at #{repo_paths.join(', ')}\n"
if versioned_cookbooks
result << " Multiple versions per cookbook\n"
@@ -162,35 +162,35 @@ class Chef
return NonexistentFSObject.new(name, self)
end
case name
- when 'cookbooks'
+ when "cookbooks"
if versioned_cookbooks
dirs = paths.map { |path| ChefRepositoryFileSystemVersionedCookbooksDir.new(name, self, path) }
else
dirs = paths.map { |path| ChefRepositoryFileSystemCookbooksDir.new(name, self, path) }
end
- when 'data_bags'
+ when "data_bags"
dirs = paths.map { |path| ChefRepositoryFileSystemDataBagsDir.new(name, self, path) }
- when 'acls'
+ when "acls"
dirs = paths.map { |path| ChefRepositoryFileSystemAclsDir.new(name, self, path) }
else
data_handler = case name
- when 'clients'
+ when "clients"
Chef::ChefFS::DataHandler::ClientDataHandler.new
- when 'environments'
+ when "environments"
Chef::ChefFS::DataHandler::EnvironmentDataHandler.new
- when 'nodes'
+ when "nodes"
Chef::ChefFS::DataHandler::NodeDataHandler.new
- when 'policies'
+ when "policies"
Chef::ChefFS::DataHandler::PolicyDataHandler.new
- when 'policy_groups'
+ when "policy_groups"
Chef::ChefFS::DataHandler::PolicyGroupDataHandler.new
- when 'roles'
+ when "roles"
Chef::ChefFS::DataHandler::RoleDataHandler.new
- when 'users'
+ when "users"
Chef::ChefFS::DataHandler::UserDataHandler.new
- when 'groups'
+ when "groups"
Chef::ChefFS::DataHandler::GroupDataHandler.new
- when 'containers'
+ when "containers"
Chef::ChefFS::DataHandler::ContainerDataHandler.new
else
raise "Unknown top level path #{name}"
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb
index cf9378dbf9..f1dbef8195 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir.rb
index 322944fc82..b791957d66 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbooks_dir.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir'
-require 'chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir'
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbooks_dir"
+require "chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/file_system/repository/file_system_entry.rb b/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
index f8c8d490d2..1e64a41b44 100644
--- a/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
+++ b/lib/chef/chef_fs/file_system/repository/file_system_entry.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/base_fs_dir'
-require 'chef/chef_fs/file_system/chef_server/rest_list_dir'
-require 'chef/chef_fs/file_system/already_exists_error'
-require 'chef/chef_fs/file_system/must_delete_recursively_error'
-require 'chef/chef_fs/file_system/not_found_error'
-require 'chef/chef_fs/path_utils'
-require 'fileutils'
+require "chef/chef_fs/file_system/base_fs_dir"
+require "chef/chef_fs/file_system/chef_server/rest_list_dir"
+require "chef/chef_fs/file_system/already_exists_error"
+require "chef/chef_fs/file_system/must_delete_recursively_error"
+require "chef/chef_fs/file_system/not_found_error"
+require "chef/chef_fs/path_utils"
+require "fileutils"
class Chef
module ChefFS
@@ -100,7 +100,7 @@ class Chef
end
def write(content)
- File.open(file_path, 'wb') do |file|
+ File.open(file_path, "wb") do |file|
file.write(content)
end
end
diff --git a/lib/chef/chef_fs/file_system/repository/file_system_root_dir.rb b/lib/chef/chef_fs/file_system/repository/file_system_root_dir.rb
index e4c9a455e3..037f9a8446 100644
--- a/lib/chef/chef_fs/file_system/repository/file_system_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/file_system_root_dir.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system/repository/file_system_entry'
+require "chef/chef_fs/file_system/repository/file_system_entry"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/knife.rb b/lib/chef/chef_fs/knife.rb
index 9101e455f8..83adf6a495 100644
--- a/lib/chef/chef_fs/knife.rb
+++ b/lib/chef/chef_fs/knife.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'pathname'
+require "chef/knife"
+require "pathname"
class Chef
module ChefFS
@@ -25,11 +25,11 @@ class Chef
# Workaround for CHEF-3932
def self.deps
super do
- require 'chef/config'
- require 'chef/chef_fs/parallelizer'
- require 'chef/chef_fs/config'
- require 'chef/chef_fs/file_pattern'
- require 'chef/chef_fs/path_utils'
+ require "chef/config"
+ require "chef/chef_fs/parallelizer"
+ require "chef/chef_fs/config"
+ require "chef/chef_fs/file_pattern"
+ require "chef/chef_fs/path_utils"
yield
end
end
@@ -45,16 +45,16 @@ class Chef
end
option :repo_mode,
- :long => '--repo-mode MODE',
+ :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
@@ -111,7 +111,7 @@ class Chef
end
# Use the original path because we can't be sure.
inferred_path = arg
- elsif arg[0,1] == '~'
+ elsif arg[0,1] == "~"
# Let's be nice and fix it if possible - but warn the user.
ui.warn("A path relative to a user home directory has been provided: #{arg}")
ui.warn("Paths provided need to be rooted at the chef-repo being considered or be relative paths.")
diff --git a/lib/chef/chef_fs/parallelizer.rb b/lib/chef/chef_fs/parallelizer.rb
index 116a626869..6590431d91 100644
--- a/lib/chef/chef_fs/parallelizer.rb
+++ b/lib/chef/chef_fs/parallelizer.rb
@@ -1,5 +1,5 @@
-require 'thread'
-require 'chef/chef_fs/parallelizer/parallel_enumerable'
+require "thread"
+require "chef/chef_fs/parallelizer/parallel_enumerable"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb b/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb
index 26dd30592c..60f283eabe 100644
--- a/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb
+++ b/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/parallelizer/flatten_enumerable'
+require "chef/chef_fs/parallelizer/flatten_enumerable"
class Chef
module ChefFS
diff --git a/lib/chef/chef_fs/path_utils.rb b/lib/chef/chef_fs/path_utils.rb
index 595f966378..6ac106fa40 100644
--- a/lib/chef/chef_fs/path_utils.rb
+++ b/lib/chef/chef_fs/path_utils.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/chef_fs'
-require 'pathname'
+require "chef/chef_fs"
+require "pathname"
class Chef
module ChefFS
@@ -45,9 +45,9 @@ class Chef
# Determine if it started with a slash
absolute = parts[0].length == 0 || parts[0].length > 0 && parts[0] =~ /^#{regexp_path_separator}/
# Remove leading and trailing slashes from each part so that the join will work (and the slash at the end will go away)
- parts = parts.map { |part| part.gsub(/^#{regexp_path_separator}+|#{regexp_path_separator}+$/, '') }
+ parts = parts.map { |part| part.gsub(/^#{regexp_path_separator}+|#{regexp_path_separator}+$/, "") }
# Don't join empty bits
- result = parts.select { |part| part != '' }.join('/')
+ result = parts.select { |part| part != "" }.join("/")
# Put the / back on
absolute ? "/#{result}" : result
end
@@ -57,7 +57,7 @@ class Chef
end
def self.regexp_path_separator
- Chef::ChefFS::windows? ? '[\/\\\\]' : '/'
+ Chef::ChefFS::windows? ? '[\/\\\\]' : "/"
end
# Given a server path, determines if it is absolute.
@@ -113,7 +113,7 @@ class Chef
candidate_fragment = path[0, ancestor.length]
return nil unless PathUtils.os_path_eq?(candidate_fragment, ancestor)
if ancestor.length == path.length
- ''
+ ""
elsif path[ancestor.length,1] =~ /#{PathUtils.regexp_path_separator}/
path[ancestor.length+1..-1]
else
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index 4c06d513c1..2362c14db1 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -18,41 +18,41 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/config'
-require 'chef/mixin/params_validate'
-require 'chef/mixin/path_sanity'
-require 'chef/log'
-require 'chef/server_api'
-require 'chef/api_client'
-require 'chef/api_client/registration'
-require 'chef/audit/runner'
-require 'chef/node'
-require 'chef/role'
-require 'chef/file_cache'
-require 'chef/run_context'
-require 'chef/runner'
-require 'chef/run_status'
-require 'chef/cookbook/cookbook_collection'
-require 'chef/cookbook/file_vendor'
-require 'chef/cookbook/file_system_file_vendor'
-require 'chef/cookbook/remote_file_vendor'
-require 'chef/event_dispatch/dispatcher'
-require 'chef/event_loggers/base'
-require 'chef/event_loggers/windows_eventlog'
-require 'chef/exceptions'
-require 'chef/formatters/base'
-require 'chef/formatters/doc'
-require 'chef/formatters/minimal'
-require 'chef/version'
-require 'chef/resource_reporter'
-require 'chef/audit/audit_reporter'
-require 'chef/run_lock'
-require 'chef/policy_builder'
-require 'chef/request_id'
-require 'chef/platform/rebooter'
-require 'chef/mixin/deprecation'
-require 'ohai'
-require 'rbconfig'
+require "chef/config"
+require "chef/mixin/params_validate"
+require "chef/mixin/path_sanity"
+require "chef/log"
+require "chef/server_api"
+require "chef/api_client"
+require "chef/api_client/registration"
+require "chef/audit/runner"
+require "chef/node"
+require "chef/role"
+require "chef/file_cache"
+require "chef/run_context"
+require "chef/runner"
+require "chef/run_status"
+require "chef/cookbook/cookbook_collection"
+require "chef/cookbook/file_vendor"
+require "chef/cookbook/file_system_file_vendor"
+require "chef/cookbook/remote_file_vendor"
+require "chef/event_dispatch/dispatcher"
+require "chef/event_loggers/base"
+require "chef/event_loggers/windows_eventlog"
+require "chef/exceptions"
+require "chef/formatters/base"
+require "chef/formatters/doc"
+require "chef/formatters/minimal"
+require "chef/version"
+require "chef/resource_reporter"
+require "chef/audit/audit_reporter"
+require "chef/run_lock"
+require "chef/policy_builder"
+require "chef/request_id"
+require "chef/platform/rebooter"
+require "chef/mixin/deprecation"
+require "ohai"
+require "rbconfig"
class Chef
# == Chef::Client
@@ -886,7 +886,7 @@ class Chef
attr_reader :specific_recipes
def profiling_prereqs!
- require 'ruby-prof'
+ require "ruby-prof"
rescue LoadError
raise "You must have the ruby-prof gem installed in order to use --profile-ruby"
end
@@ -934,7 +934,7 @@ class Chef
end
def has_admin_privileges?
- require 'chef/win32/security'
+ require "chef/win32/security"
Chef::ReservedNames::Win32::Security.has_admin_privileges?
end
@@ -942,6 +942,6 @@ class Chef
end
# HACK cannot load this first, but it must be loaded.
-require 'chef/cookbook_loader'
-require 'chef/cookbook_version'
-require 'chef/cookbook/synchronizer'
+require "chef/cookbook_loader"
+require "chef/cookbook_version"
+require "chef/cookbook/synchronizer"
diff --git a/lib/chef/config.rb b/lib/chef/config.rb
index a43985f691..17ce861d4e 100644
--- a/lib/chef/config.rb
+++ b/lib/chef/config.rb
@@ -19,16 +19,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/log'
-require 'chef-config/logger'
+require "chef/log"
+require "chef-config/logger"
# DI our logger into ChefConfig before we load the config. Some defaults are
# auto-detected, and this emits log messages on some systems, all of which will
# occur at require-time. So we need to set the logger first.
ChefConfig.logger = Chef::Log
-require 'chef-config/config'
-require 'chef/platform/query_helpers'
+require "chef-config/config"
+require "chef/platform/query_helpers"
# Ohai::Config defines its own log_level and log_location. When loaded, it will
# override the default ChefConfig::Config values. We save them here before
@@ -41,7 +41,7 @@ LOG_LOCATION = ChefConfig::Config[:log_location] unless defined? LOG_LOCATION
# Load the ohai config into the chef config. We can't have an empty ohai
# configuration context because `ohai.plugins_path << some_path` won't work,
# and providing default ohai config values here isn't DRY.
-require 'ohai/config'
+require "ohai/config"
class Chef
Config = ChefConfig::Config
diff --git a/lib/chef/config_fetcher.rb b/lib/chef/config_fetcher.rb
index a8aad0740d..ac6bdc2249 100644
--- a/lib/chef/config_fetcher.rb
+++ b/lib/chef/config_fetcher.rb
@@ -1,7 +1,7 @@
-require 'chef/application'
-require 'chef/chef_fs/path_utils'
-require 'chef/http/simple'
-require 'chef/json_compat'
+require "chef/application"
+require "chef/chef_fs/path_utils"
+require "chef/http/simple"
+require "chef/json_compat"
class Chef
class ConfigFetcher
diff --git a/lib/chef/cookbook/chefignore.rb b/lib/chef/cookbook/chefignore.rb
index aa9345e64e..529e209084 100644
--- a/lib/chef/cookbook/chefignore.rb
+++ b/lib/chef/cookbook/chefignore.rb
@@ -61,7 +61,7 @@ class Chef
if File.basename(path) =~ /chefignore/
path
else
- File.join(path, 'chefignore')
+ File.join(path, "chefignore")
end
end
diff --git a/lib/chef/cookbook/cookbook_collection.rb b/lib/chef/cookbook/cookbook_collection.rb
index 38784c22fa..3c43244dba 100644
--- a/lib/chef/cookbook/cookbook_collection.rb
+++ b/lib/chef/cookbook/cookbook_collection.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/mash'
+require "chef/mash"
class Chef
# == Chef::CookbookCollection
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb
index 0341c394a8..370a77ecaf 100644
--- a/lib/chef/cookbook/cookbook_version_loader.rb
+++ b/lib/chef/cookbook/cookbook_version_loader.rb
@@ -1,8 +1,8 @@
-require 'chef/cookbook_version'
-require 'chef/cookbook/chefignore'
-require 'chef/cookbook/metadata'
-require 'chef/util/path_helper'
+require "chef/cookbook_version"
+require "chef/cookbook/chefignore"
+require "chef/cookbook/metadata"
+require "chef/util/path_helper"
class Chef
class Cookbook
@@ -78,10 +78,10 @@ class Chef
# re-raise any exception that occurred when reading the metadata
raise_metadata_error!
- load_as(:attribute_filenames, 'attributes', '*.rb')
- load_as(:definition_filenames, 'definitions', '*.rb')
- load_as(:recipe_filenames, 'recipes', '*.rb')
- load_recursively_as(:library_filenames, 'libraries', '*.rb')
+ load_as(:attribute_filenames, "attributes", "*.rb")
+ load_as(:definition_filenames, "definitions", "*.rb")
+ load_as(:recipe_filenames, "recipes", "*.rb")
+ load_recursively_as(:library_filenames, "libraries", "*.rb")
load_recursively_as(:template_filenames, "templates", "*")
load_recursively_as(:file_filenames, "files", "*")
load_recursively_as(:resource_filenames, "resources", "*.rb")
@@ -213,7 +213,7 @@ class Chef
end
def load_root_files
- Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), '*'), File::FNM_DOTMATCH).each do |file|
+ Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), "*"), File::FNM_DOTMATCH).each do |file|
file = Chef::Util::PathHelper.cleanpath(file)
next if File.directory?(file)
next if File.basename(file) == UPLOADED_COOKBOOK_VERSION_FILE
@@ -223,7 +223,7 @@ class Chef
end
def load_recursively_as(category, category_dir, glob)
- file_spec = File.join(Chef::Util::PathHelper.escape_glob(cookbook_path, category_dir), '**', glob)
+ file_spec = File.join(Chef::Util::PathHelper.escape_glob(cookbook_path, category_dir), "**", glob)
Dir.glob(file_spec, File::FNM_DOTMATCH).each do |file|
file = Chef::Util::PathHelper.cleanpath(file)
next if File.directory?(file)
@@ -269,7 +269,7 @@ class Chef
def apply_json_cookbook_version_metadata(file)
begin
data = Chef::JSONCompat.parse(IO.read(file))
- @metadata.from_hash(data['metadata'])
+ @metadata.from_hash(data["metadata"])
# the JSON cookbok metadata file is only used by chef-zero.
# The Chef Server API currently does not enforce that the metadata
# have a `name` field, but that will cause an error when attempting
@@ -278,7 +278,7 @@ class Chef
#
# This behavior can be removed if/when Chef Server enforces that the
# metadata contains a name key.
- @metadata.name(data['cookbook_name']) unless data['metadata'].key?('name')
+ @metadata.name(data["cookbook_name"]) unless data["metadata"].key?("name")
rescue Chef::Exceptions::JSON::ParseError
Chef::Log.error("Couldn't parse cookbook metadata JSON for #@inferred_cookbook_name in " + file)
raise
@@ -289,7 +289,7 @@ class Chef
if uploaded_cookbook_version_file
begin
data = Chef::JSONCompat.parse(IO.read(uploaded_cookbook_version_file))
- @frozen = data['frozen?']
+ @frozen = data["frozen?"]
rescue Chef::Exceptions::JSON::ParseError
Chef::Log.error("Couldn't parse cookbook metadata JSON for #@inferred_cookbook_name in #{uploaded_cookbook_version_file}")
raise
diff --git a/lib/chef/cookbook/file_system_file_vendor.rb b/lib/chef/cookbook/file_system_file_vendor.rb
index e351ec4702..227e873e4c 100644
--- a/lib/chef/cookbook/file_system_file_vendor.rb
+++ b/lib/chef/cookbook/file_system_file_vendor.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/cookbook/file_vendor'
+require "chef/cookbook/file_vendor"
class Chef
class Cookbook
diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb
index 67d762f34b..530254eead 100644
--- a/lib/chef/cookbook/metadata.rb
+++ b/lib/chef/cookbook/metadata.rb
@@ -18,14 +18,14 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/mash'
-require 'chef/mixin/from_file'
-require 'chef/mixin/params_validate'
-require 'chef/log'
-require 'chef/version_class'
-require 'chef/version_constraint'
-require 'chef/json_compat'
+require "chef/exceptions"
+require "chef/mash"
+require "chef/mixin/from_file"
+require "chef/mixin/params_validate"
+require "chef/log"
+require "chef/version_class"
+require "chef/version_constraint"
+require "chef/json_compat"
class Chef
class Cookbook
@@ -35,28 +35,28 @@ class Chef
# about Chef Cookbooks.
class Metadata
- NAME = 'name'.freeze
- DESCRIPTION = 'description'.freeze
- LONG_DESCRIPTION = 'long_description'.freeze
- MAINTAINER = 'maintainer'.freeze
- MAINTAINER_EMAIL = 'maintainer_email'.freeze
- LICENSE = 'license'.freeze
- PLATFORMS = 'platforms'.freeze
- DEPENDENCIES = 'dependencies'.freeze
- RECOMMENDATIONS = 'recommendations'.freeze
- SUGGESTIONS = 'suggestions'.freeze
- CONFLICTING = 'conflicting'.freeze
- PROVIDING = 'providing'.freeze
- REPLACING = 'replacing'.freeze
- ATTRIBUTES = 'attributes'.freeze
- GROUPINGS = 'groupings'.freeze
- RECIPES = 'recipes'.freeze
- VERSION = 'version'.freeze
- SOURCE_URL = 'source_url'.freeze
- ISSUES_URL = 'issues_url'.freeze
- PRIVACY = 'privacy'.freeze
- CHEF_VERSIONS = 'chef_versions'.freeze
- OHAI_VERSIONS = 'ohai_versions'.freeze
+ NAME = "name".freeze
+ DESCRIPTION = "description".freeze
+ LONG_DESCRIPTION = "long_description".freeze
+ MAINTAINER = "maintainer".freeze
+ MAINTAINER_EMAIL = "maintainer_email".freeze
+ LICENSE = "license".freeze
+ PLATFORMS = "platforms".freeze
+ DEPENDENCIES = "dependencies".freeze
+ RECOMMENDATIONS = "recommendations".freeze
+ SUGGESTIONS = "suggestions".freeze
+ CONFLICTING = "conflicting".freeze
+ PROVIDING = "providing".freeze
+ REPLACING = "replacing".freeze
+ ATTRIBUTES = "attributes".freeze
+ GROUPINGS = "groupings".freeze
+ RECIPES = "recipes".freeze
+ VERSION = "version".freeze
+ SOURCE_URL = "source_url".freeze
+ ISSUES_URL = "issues_url".freeze
+ PRIVACY = "privacy".freeze
+ CHEF_VERSIONS = "chef_versions".freeze
+ OHAI_VERSIONS = "ohai_versions".freeze
COMPARISON_FIELDS = [ :name, :description, :long_description, :maintainer,
:maintainer_email, :license, :platforms, :dependencies,
@@ -106,9 +106,9 @@ class Chef
def initialize
@name = nil
- @description = ''
- @long_description = ''
- @license = 'All rights reserved'
+ @description = ""
+ @long_description = ""
+ @license = "All rights reserved"
@maintainer = nil
@maintainer_email = nil
@@ -124,8 +124,8 @@ class Chef
@groupings = Mash.new
@recipes = Mash.new
@version = Version.new("0.0.0")
- @source_url = ''
- @issues_url = ''
+ @source_url = ""
+ @issues_url = ""
@privacy = false
@chef_versions = []
@ohai_versions = []
@@ -404,7 +404,7 @@ class Chef
# @param version_args [Array<String>] Version constraint in String form
# @return [Array<Gem::Dependency>] Current chef_versions array
def chef_version(*version_args)
- @chef_versions << Gem::Dependency.new('chef', *version_args) unless version_args.empty?
+ @chef_versions << Gem::Dependency.new("chef", *version_args) unless version_args.empty?
@chef_versions
end
@@ -415,7 +415,7 @@ class Chef
# @param version_args [Array<String>] Version constraint in String form
# @return [Array<Gem::Dependency>] Current ohai_versions array
def ohai_version(*version_args)
- @ohai_versions << Gem::Dependency.new('ohai', *version_args) unless version_args.empty?
+ @ohai_versions << Gem::Dependency.new("ohai", *version_args) unless version_args.empty?
@ohai_versions
end
@@ -859,7 +859,7 @@ INVALID
def handle_deprecated_constraints(specification)
specification.inject(Mash.new) do |acc, (cb, constraints)|
constraints = Array(constraints)
- acc[cb] = (constraints.empty? || constraints.size > 1) ? [] : constraints.first.gsub(/>>/, '>').gsub(/<</, '<')
+ acc[cb] = (constraints.empty? || constraints.size > 1) ? [] : constraints.first.gsub(/>>/, ">").gsub(/<</, "<")
acc
end
end
diff --git a/lib/chef/cookbook/remote_file_vendor.rb b/lib/chef/cookbook/remote_file_vendor.rb
index b118c75f9e..eefc25c93b 100644
--- a/lib/chef/cookbook/remote_file_vendor.rb
+++ b/lib/chef/cookbook/remote_file_vendor.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/cookbook/file_vendor'
+require "chef/cookbook/file_vendor"
class Chef
class Cookbook
@@ -48,7 +48,7 @@ class Chef
found_manifest_record = @manifest[segment].find {|manifest_record| manifest_record[:path] == filename }
raise "No such file #{filename} in #{@cookbook_name}" unless found_manifest_record
- cache_filename = File.join("cookbooks", @cookbook_name, found_manifest_record['path'])
+ cache_filename = File.join("cookbooks", @cookbook_name, found_manifest_record["path"])
# update valid_cache_entries so the upstream cache cleaner knows what
# we've used.
@@ -62,7 +62,7 @@ class Chef
# If the checksums are different between on-disk (current) and on-server
# (remote, per manifest), do the update. This will also execute if there
# is no current checksum.
- if current_checksum != found_manifest_record['checksum']
+ if current_checksum != found_manifest_record["checksum"]
raw_file = @rest.get(found_manifest_record[:url], true)
Chef::Log.debug("Storing updated #{cache_filename} in the cache.")
diff --git a/lib/chef/cookbook/synchronizer.rb b/lib/chef/cookbook/synchronizer.rb
index b499963653..9955bae6bb 100644
--- a/lib/chef/cookbook/synchronizer.rb
+++ b/lib/chef/cookbook/synchronizer.rb
@@ -1,7 +1,7 @@
-require 'chef/client'
-require 'chef/util/threaded_job_queue'
-require 'chef/server_api'
-require 'singleton'
+require "chef/client"
+require "chef/util/threaded_job_queue"
+require "chef/server_api"
+require "singleton"
class Chef
@@ -245,14 +245,14 @@ class Chef
# === Returns
# Full path to the cached file as a String
def sync_file(file)
- cache_filename = File.join("cookbooks", file.cookbook.name, file.manifest_record['path'])
+ cache_filename = File.join("cookbooks", file.cookbook.name, file.manifest_record["path"])
mark_cached_file_valid(cache_filename)
# If the checksums are different between on-disk (current) and on-server
# (remote, per manifest), do the update. This will also execute if there
# is no current checksum.
- if !cached_copy_up_to_date?(cache_filename, file.manifest_record['checksum'])
- download_file(file.manifest_record['url'], cache_filename)
+ if !cached_copy_up_to_date?(cache_filename, file.manifest_record["checksum"])
+ download_file(file.manifest_record["url"], cache_filename)
@events.updated_cookbook_file(file.cookbook.name, cache_filename)
else
Chef::Log.debug("Not storing #{cache_filename}, as the cache is up to date.")
diff --git a/lib/chef/cookbook/syntax_check.rb b/lib/chef/cookbook/syntax_check.rb
index 96fc7e7b84..5528465f0c 100644
--- a/lib/chef/cookbook/syntax_check.rb
+++ b/lib/chef/cookbook/syntax_check.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'pathname'
-require 'stringio'
-require 'erubis'
-require 'chef/mixin/shell_out'
-require 'chef/mixin/checksum'
-require 'chef/util/path_helper'
+require "pathname"
+require "stringio"
+require "erubis"
+require "chef/mixin/shell_out"
+require "chef/mixin/checksum"
+require "chef/util/path_helper"
class Chef
class Cookbook
@@ -115,7 +115,7 @@ class Chef
def ruby_files
path = Chef::Util::PathHelper.escape_glob(cookbook_path)
- files = Dir[File.join(path, '**', '*.rb')]
+ files = Dir[File.join(path, "**", "*.rb")]
files = remove_ignored_files(files)
files = remove_uninteresting_ruby_files(files)
files
@@ -133,7 +133,7 @@ class Chef
end
def template_files
- remove_ignored_files Dir[File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), '**/templates/**', '*.erb')]
+ remove_ignored_files Dir[File.join(Chef::Util::PathHelper.escape_glob(cookbook_path), "**/templates/**", "*.erb")]
end
def untested_template_files
diff --git a/lib/chef/cookbook_loader.rb b/lib/chef/cookbook_loader.rb
index e783405b9b..0db136e00e 100644
--- a/lib/chef/cookbook_loader.rb
+++ b/lib/chef/cookbook_loader.rb
@@ -18,12 +18,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/config'
-require 'chef/exceptions'
-require 'chef/cookbook/cookbook_version_loader'
-require 'chef/cookbook_version'
-require 'chef/cookbook/chefignore'
-require 'chef/cookbook/metadata'
+require "chef/config"
+require "chef/exceptions"
+require "chef/cookbook/cookbook_version_loader"
+require "chef/cookbook_version"
+require "chef/cookbook/chefignore"
+require "chef/cookbook/metadata"
#
# CookbookLoader class loads the cookbooks lazily as read
diff --git a/lib/chef/cookbook_manifest.rb b/lib/chef/cookbook_manifest.rb
index 27daf287a1..8a1583bf0e 100644
--- a/lib/chef/cookbook_manifest.rb
+++ b/lib/chef/cookbook_manifest.rb
@@ -14,9 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'forwardable'
-require 'chef/util/path_helper'
-require 'chef/log'
+require "forwardable"
+require "chef/util/path_helper"
+require "chef/log"
class Chef
@@ -127,14 +127,14 @@ class Chef
def to_hash
result = manifest.dup
- result['frozen?'] = frozen_version?
- result['chef_type'] = 'cookbook_version'
+ result["frozen?"] = frozen_version?
+ result["chef_type"] = "cookbook_version"
result.to_hash
end
def to_json(*a)
result = to_hash
- result['json_class'] = "Chef::CookbookVersion"
+ result["json_class"] = "Chef::CookbookVersion"
Chef::JSONCompat.to_json(result, *a)
end
@@ -169,7 +169,7 @@ class Chef
COOKBOOK_SEGMENTS.each do |segment|
next unless @manifest.has_key?(segment)
- filenames = @manifest[segment].map{|manifest_record| manifest_record['name']}
+ filenames = @manifest[segment].map{|manifest_record| manifest_record["name"]}
cookbook_version.replace_segment_filenames(segment, filenames)
end
@@ -243,17 +243,17 @@ class Chef
parts = pathname.each_filename.take(2)
# Check if path is actually under root_path
- next if parts[0] == '..'
+ next if parts[0] == ".."
if segment == :templates || segment == :files
# Check if pathname looks like files/foo or templates/foo (unscoped)
if pathname.each_filename.to_a.length == 2
# Use root_default in case the same path exists at root_default and default
- return [ pathname.to_s, 'root_default' ]
+ return [ pathname.to_s, "root_default" ]
else
return [ pathname.to_s, parts[1] ]
end
else
- return [ pathname.to_s, 'default' ]
+ return [ pathname.to_s, "default" ]
end
end
Chef::Log.error("Cookbook file #{segment_file} not under cookbook root paths #{root_paths.inspect}.")
diff --git a/lib/chef/cookbook_site_streaming_uploader.rb b/lib/chef/cookbook_site_streaming_uploader.rb
index 345f6b0106..ccd476f6e9 100644
--- a/lib/chef/cookbook_site_streaming_uploader.rb
+++ b/lib/chef/cookbook_site_streaming_uploader.rb
@@ -18,10 +18,10 @@
# limitations under the License.
#
-require 'uri'
-require 'net/http'
-require 'mixlib/authentication/signedheaderauth'
-require 'openssl'
+require "uri"
+require "net/http"
+require "mixlib/authentication/signedheaderauth"
+require "openssl"
class Chef
# == Chef::CookbookSiteStreamingUploader
@@ -31,7 +31,7 @@ class Chef
# inspired by http://stanislavvitvitskiy.blogspot.com/2008/12/multipart-post-in-ruby.html
class CookbookSiteStreamingUploader
- DefaultHeaders = { 'accept' => 'application/json', 'x-chef-version' => ::Chef::VERSION }
+ DefaultHeaders = { "accept" => "application/json", "x-chef-version" => ::Chef::VERSION }
class << self
@@ -73,7 +73,7 @@ class Chef
end
def make_request(http_verb, to_url, user_id, secret_key_filename, params = {}, headers = {})
- boundary = '----RubyMultipartClient' + rand(1000000).to_s + 'ZZZZZ'
+ boundary = "----RubyMultipartClient" + rand(1000000).to_s + "ZZZZZ"
parts = []
content_file = nil
@@ -138,7 +138,7 @@ class Chef
Net::HTTP::Post.new(url.path, headers)
end
req.content_length = body_stream.size
- req.content_type = 'multipart/form-data; boundary=' + boundary unless parts.empty?
+ req.content_type = "multipart/form-data; boundary=" + boundary unless parts.empty?
req.body_stream = body_stream
http = Chef::HTTP::BasicClient.new(url).http_client
@@ -206,7 +206,7 @@ class Chef
def read(how_much, dst_buf = nil)
if @part_no >= @parts.size
- dst_buf.replace('') if dst_buf
+ dst_buf.replace("") if dst_buf
return dst_buf
end
@@ -230,13 +230,13 @@ class Chef
result = current_part + if next_part
next_part
else
- ''
+ ""
end
else
@part_offset += how_much_current_part
result = current_part
end
- dst_buf ? dst_buf.replace(result || '') : result
+ dst_buf ? dst_buf.replace(result || "") : result
end
end
diff --git a/lib/chef/cookbook_uploader.rb b/lib/chef/cookbook_uploader.rb
index 64a8a4e168..a9f255df43 100644
--- a/lib/chef/cookbook_uploader.rb
+++ b/lib/chef/cookbook_uploader.rb
@@ -1,15 +1,15 @@
-require 'set'
-require 'chef/exceptions'
-require 'chef/knife/cookbook_metadata'
-require 'chef/digester'
-require 'chef/cookbook_manifest'
-require 'chef/cookbook_version'
-require 'chef/cookbook/syntax_check'
-require 'chef/cookbook/file_system_file_vendor'
-require 'chef/util/threaded_job_queue'
-require 'chef/sandbox'
-require 'chef/server_api'
+require "set"
+require "chef/exceptions"
+require "chef/knife/cookbook_metadata"
+require "chef/digester"
+require "chef/cookbook_manifest"
+require "chef/cookbook_version"
+require "chef/cookbook/syntax_check"
+require "chef/cookbook/file_system_file_vendor"
+require "chef/util/threaded_job_queue"
+require "chef/sandbox"
+require "chef/server_api"
class Chef
class CookbookUploader
@@ -65,11 +65,11 @@ class Chef
checksums_to_upload = Set.new
# upload the new checksums and commit the sandbox
- new_sandbox['checksums'].each do |checksum, info|
- if info['needs_upload'] == true
+ new_sandbox["checksums"].each do |checksum, info|
+ if info["needs_upload"] == true
checksums_to_upload << checksum
Chef::Log.info("Uploading #{checksum_files[checksum]} (checksum hex = #{checksum}) to #{info['url']}")
- queue << uploader_function_for(checksum_files[checksum], checksum, info['url'], checksums_to_upload)
+ queue << uploader_function_for(checksum_files[checksum], checksum, info["url"], checksums_to_upload)
else
Chef::Log.debug("#{checksum_files[checksum]} has not changed")
end
@@ -77,7 +77,7 @@ class Chef
queue.process(@concurrency)
- sandbox_url = new_sandbox['uri']
+ sandbox_url = new_sandbox["uri"]
Chef::Log.debug("Committing sandbox")
# Retry if S3 is claims a checksum doesn't exist (the eventual
# in eventual consistency)
@@ -123,7 +123,7 @@ class Chef
file_contents = File.open(file, "rb") {|f| f.read}
# Custom headers. 'content-type' disables JSON serialization of the request body.
- headers = { 'content-type' => 'application/x-binary', 'content-md5' => checksum64, "accept" => 'application/json' }
+ headers = { "content-type" => "application/x-binary", "content-md5" => checksum64, "accept" => "application/json" }
begin
rest.put(url, file_contents, headers)
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb
index 97edb12689..28f817c8ba 100644
--- a/lib/chef/cookbook_version.rb
+++ b/lib/chef/cookbook_version.rb
@@ -19,13 +19,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/log'
-require 'chef/cookbook/file_vendor'
-require 'chef/cookbook/metadata'
-require 'chef/version_class'
-require 'chef/digester'
-require 'chef/cookbook_manifest'
-require 'chef/server_api'
+require "chef/log"
+require "chef/cookbook/file_vendor"
+require "chef/cookbook/metadata"
+require "chef/version_class"
+require "chef/digester"
+require "chef/cookbook_manifest"
+require "chef/server_api"
class Chef
@@ -327,10 +327,10 @@ class Chef
def preferred_filename_on_disk_location(node, segment, filename, current_filepath=nil)
manifest_record = preferred_manifest_record(node, segment, filename)
- if current_filepath && (manifest_record['checksum'] == self.class.checksum_cookbook_file(current_filepath))
+ if current_filepath && (manifest_record["checksum"] == self.class.checksum_cookbook_file(current_filepath))
nil
else
- file_vendor.get_filename(manifest_record['path'])
+ file_vendor.get_filename(manifest_record["path"])
end
end
@@ -431,10 +431,10 @@ class Chef
# Break version into components, eg: "5.7.1" => [ "5.7.1", "5.7", "5" ]
search_versions = []
- parts = version.to_s.split('.')
+ parts = version.to_s.split(".")
parts.size.times do
- search_versions << parts.join('.')
+ search_versions << parts.join(".")
parts.pop
end
@@ -560,7 +560,7 @@ class Chef
# The API returns only a single version of each cookbook in the result from the cookbooks method
def self.list
- chef_server_rest.get('cookbooks')
+ chef_server_rest.get("cookbooks")
end
# Alias latest_cookbooks as list
@@ -569,7 +569,7 @@ class Chef
end
def self.list_all_versions
- chef_server_rest.get('cookbooks?num_versions=all')
+ chef_server_rest.get("cookbooks?num_versions=all")
end
##
@@ -615,7 +615,7 @@ class Chef
# For each filename, produce a mapping of base filename (i.e. recipe name
# or attribute file) to on disk location
def filenames_by_name(filenames)
- filenames.select{|filename| filename =~ /\.rb$/}.inject({}){|memo, filename| memo[File.basename(filename, '.rb')] = filename ; memo }
+ filenames.select{|filename| filename =~ /\.rb$/}.inject({}){|memo, filename| memo[File.basename(filename, ".rb")] = filename ; memo }
end
def file_vendor
diff --git a/lib/chef/daemon.rb b/lib/chef/daemon.rb
index e5abca29d8..f73b1babca 100644
--- a/lib/chef/daemon.rb
+++ b/lib/chef/daemon.rb
@@ -17,9 +17,9 @@
# I love you Merb (lib/merb-core/server.rb)
-require 'chef/config'
-require 'chef/run_lock'
-require 'etc'
+require "chef/config"
+require "chef/run_lock"
+require "etc"
class Chef
class Daemon
diff --git a/lib/chef/data_bag.rb b/lib/chef/data_bag.rb
index 102851b804..66771d325f 100644
--- a/lib/chef/data_bag.rb
+++ b/lib/chef/data_bag.rb
@@ -18,13 +18,13 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/mixin/params_validate'
-require 'chef/mixin/from_file'
-require 'chef/data_bag_item'
-require 'chef/mash'
-require 'chef/json_compat'
-require 'chef/server_api'
+require "chef/config"
+require "chef/mixin/params_validate"
+require "chef/mixin/from_file"
+require "chef/data_bag_item"
+require "chef/mash"
+require "chef/json_compat"
+require "chef/server_api"
class Chef
class DataBag
@@ -44,7 +44,7 @@ class Chef
# Create a new Chef::DataBag
def initialize(chef_server_rest: nil)
- @name = ''
+ @name = ""
@chef_server_rest = chef_server_rest
end
@@ -58,9 +58,9 @@ class Chef
def to_hash
result = {
- 'name' => @name,
- 'json_class' => self.class.name,
- 'chef_type' => 'data_bag',
+ "name" => @name,
+ "json_class" => self.class.name,
+ "chef_type" => "data_bag",
}
result
end
diff --git a/lib/chef/data_bag_item.rb b/lib/chef/data_bag_item.rb
index fd9548eaec..8688693568 100644
--- a/lib/chef/data_bag_item.rb
+++ b/lib/chef/data_bag_item.rb
@@ -18,15 +18,15 @@
# limitations under the License.
#
-require 'forwardable'
+require "forwardable"
-require 'chef/config'
-require 'chef/mixin/params_validate'
-require 'chef/mixin/from_file'
-require 'chef/data_bag'
-require 'chef/mash'
-require 'chef/server_api'
-require 'chef/json_compat'
+require "chef/config"
+require "chef/mixin/params_validate"
+require "chef/mixin/from_file"
+require "chef/data_bag"
+require "chef/mash"
+require "chef/server_api"
+require "chef/json_compat"
class Chef
class DataBagItem
@@ -95,10 +95,10 @@ class Chef
end
def object_name
- raise Exceptions::ValidationFailed, "You must have an 'id' or :id key in the raw data" unless raw_data.has_key?('id')
+ raise Exceptions::ValidationFailed, "You must have an 'id' or :id key in the raw data" unless raw_data.has_key?("id")
raise Exceptions::ValidationFailed, "You must have declared what bag this item belongs to!" unless data_bag
- id = raw_data['id']
+ id = raw_data["id"]
"data_bag_item_#{data_bag}_#{id}"
end
@@ -168,7 +168,7 @@ class Chef
end
# Save this Data Bag Item via RESTful API
- def save(item_id=@raw_data['id'])
+ def save(item_id=@raw_data["id"])
r = chef_server_rest
begin
if Chef::Config[:why_run]
@@ -210,7 +210,7 @@ class Chef
end
def id
- @raw_data['id']
+ @raw_data["id"]
end
end
diff --git a/lib/chef/deprecation/mixin/template.rb b/lib/chef/deprecation/mixin/template.rb
index 58a661c4bd..eaa14b6501 100644
--- a/lib/chef/deprecation/mixin/template.rb
+++ b/lib/chef/deprecation/mixin/template.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'tempfile'
-require 'erubis'
+require "tempfile"
+require "erubis"
class Chef
module Deprecation
diff --git a/lib/chef/deprecation/provider/file.rb b/lib/chef/deprecation/provider/file.rb
index 31038ab3d8..d37bc4241f 100644
--- a/lib/chef/deprecation/provider/file.rb
+++ b/lib/chef/deprecation/provider/file.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/util/path_helper'
+require "chef/util/path_helper"
class Chef
module Deprecation
@@ -59,7 +59,7 @@ class Chef
@current_resource.path
else
suppress_resource_reporting = true # suppress big diffs going to resource reporting service
- tempfile = Tempfile.new('chef-tempfile')
+ tempfile = Tempfile.new("chef-tempfile")
tempfile.path
end
diff --git a/lib/chef/deprecation/provider/remote_directory.rb b/lib/chef/deprecation/provider/remote_directory.rb
index cc8026ec55..ece5ca0945 100644
--- a/lib/chef/deprecation/provider/remote_directory.rb
+++ b/lib/chef/deprecation/provider/remote_directory.rb
@@ -33,13 +33,13 @@ class Chef
# List all excluding . and ..
def ls(path)
- files = Dir.glob(::File.join(Chef::Util::PathHelper.escape_glob(path), '**', '*'),
+ files = Dir.glob(::File.join(Chef::Util::PathHelper.escape_glob(path), "**", "*"),
::File::FNM_DOTMATCH)
# Remove current directory and previous directory
files = files.reject do |name|
basename = Pathname.new(name).basename().to_s
- ['.', '..'].include?(basename)
+ [".", ".."].include?(basename)
end
# Clean all the paths... this is required because of the join
diff --git a/lib/chef/deprecation/provider/template.rb b/lib/chef/deprecation/provider/template.rb
index 34e5f54b7e..c95690f2cc 100644
--- a/lib/chef/deprecation/provider/template.rb
+++ b/lib/chef/deprecation/provider/template.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/deprecation/mixin/template'
+require "chef/deprecation/mixin/template"
class Chef
module Deprecation
diff --git a/lib/chef/digester.rb b/lib/chef/digester.rb
index f2b496b785..a90003c3cd 100644
--- a/lib/chef/digester.rb
+++ b/lib/chef/digester.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'openssl'
-require 'singleton'
+require "openssl"
+require "singleton"
class Chef
class Digester
@@ -60,7 +60,7 @@ class Chef
private
def checksum_file(file, digest)
- File.open(file, 'rb') { |f| checksum_io(f, digest) }
+ File.open(file, "rb") { |f| checksum_io(f, digest) }
end
def checksum_io(io, digest)
diff --git a/lib/chef/dsl.rb b/lib/chef/dsl.rb
index 7717d99113..1fa0099e91 100644
--- a/lib/chef/dsl.rb
+++ b/lib/chef/dsl.rb
@@ -1,6 +1,6 @@
-require 'chef/dsl/recipe'
-require 'chef/dsl/platform_introspection'
-require 'chef/dsl/data_query'
-require 'chef/dsl/include_recipe'
-require 'chef/dsl/include_attribute'
-require 'chef/dsl/registry_helper'
+require "chef/dsl/recipe"
+require "chef/dsl/platform_introspection"
+require "chef/dsl/data_query"
+require "chef/dsl/include_recipe"
+require "chef/dsl/include_attribute"
+require "chef/dsl/registry_helper"
diff --git a/lib/chef/dsl/audit.rb b/lib/chef/dsl/audit.rb
index 569c8a3bc5..e6ae3b681e 100644
--- a/lib/chef/dsl/audit.rb
+++ b/lib/chef/dsl/audit.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/exceptions'
+require "chef/exceptions"
class Chef
module DSL
diff --git a/lib/chef/dsl/chef_provisioning.rb b/lib/chef/dsl/chef_provisioning.rb
index 84a3db39c8..35f175296b 100644
--- a/lib/chef/dsl/chef_provisioning.rb
+++ b/lib/chef/dsl/chef_provisioning.rb
@@ -50,7 +50,7 @@ class Chef
public_instance_methods(false).each do |method_name|
remove_method(method_name)
end
- require 'chef/provisioning'
+ require "chef/provisioning"
end
end
end
diff --git a/lib/chef/dsl/cheffish.rb b/lib/chef/dsl/cheffish.rb
index 304c4df78a..736ad52add 100644
--- a/lib/chef/dsl/cheffish.rb
+++ b/lib/chef/dsl/cheffish.rb
@@ -57,7 +57,7 @@ class Chef
public_instance_methods(false).each do |method_name|
remove_method(method_name)
end
- require 'cheffish'
+ require "cheffish"
end
end
end
diff --git a/lib/chef/dsl/data_query.rb b/lib/chef/dsl/data_query.rb
index e36784271a..a61d5f1c64 100644
--- a/lib/chef/dsl/data_query.rb
+++ b/lib/chef/dsl/data_query.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/search/query'
-require 'chef/data_bag'
-require 'chef/data_bag_item'
-require 'chef/encrypted_data_bag_item'
-require 'chef/encrypted_data_bag_item/check_encrypted'
+require "chef/search/query"
+require "chef/data_bag"
+require "chef/data_bag_item"
+require "chef/encrypted_data_bag_item"
+require "chef/encrypted_data_bag_item/check_encrypted"
class Chef
module DSL
@@ -86,4 +86,4 @@ end
# **DEPRECATED**
# This used to be part of chef/mixin/language. Load the file to activate the deprecation code.
-require 'chef/mixin/language'
+require "chef/mixin/language"
diff --git a/lib/chef/dsl/declare_resource.rb b/lib/chef/dsl/declare_resource.rb
index 93e7e69884..6f9f913392 100644
--- a/lib/chef/dsl/declare_resource.rb
+++ b/lib/chef/dsl/declare_resource.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/exceptions'
+require "chef/exceptions"
class Chef
module DSL
@@ -89,7 +89,7 @@ class Chef
def build_resource(type, name, created_at=nil, run_context: self.run_context, &resource_attrs_block)
created_at ||= caller[0]
Thread.exclusive do
- require 'chef/resource_builder' unless defined?(Chef::ResourceBuilder)
+ require "chef/resource_builder" unless defined?(Chef::ResourceBuilder)
end
Chef::ResourceBuilder.new(
diff --git a/lib/chef/dsl/include_attribute.rb b/lib/chef/dsl/include_attribute.rb
index 3a95ce7268..6f70b4c893 100644
--- a/lib/chef/dsl/include_attribute.rb
+++ b/lib/chef/dsl/include_attribute.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/log'
+require "chef/log"
class Chef
module DSL
@@ -58,6 +58,6 @@ end
# **DEPRECATED**
# This used to be part of chef/mixin/language_include_attribute. Load the file to activate the deprecation code.
-require 'chef/mixin/language_include_attribute'
+require "chef/mixin/language_include_attribute"
diff --git a/lib/chef/dsl/include_recipe.rb b/lib/chef/dsl/include_recipe.rb
index 5ea1075e67..e51f323c60 100644
--- a/lib/chef/dsl/include_recipe.rb
+++ b/lib/chef/dsl/include_recipe.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/log'
+require "chef/log"
class Chef
module DSL
@@ -41,4 +41,4 @@ end
# **DEPRECATED**
# This used to be part of chef/mixin/language_include_recipe. Load the file to activate the deprecation code.
-require 'chef/mixin/language_include_recipe'
+require "chef/mixin/language_include_recipe"
diff --git a/lib/chef/dsl/platform_introspection.rb b/lib/chef/dsl/platform_introspection.rb
index a6bd12d2ef..8518809819 100644
--- a/lib/chef/dsl/platform_introspection.rb
+++ b/lib/chef/dsl/platform_introspection.rb
@@ -106,7 +106,7 @@ class Chef
end
def set(platforms, value)
- if platforms.to_s == 'default'
+ if platforms.to_s == "default"
@values["default"] = value
else
assert_valid_platform_values!(platforms, value)
@@ -212,7 +212,7 @@ class Chef
private
def set(platform_family, value)
- if platform_family.to_s == 'default'
+ if platform_family.to_s == "default"
@values["default"] = value
else
Array(platform_family).each { |family| @values[family.to_s] = value }
@@ -256,5 +256,5 @@ end
# **DEPRECATED**
# This used to be part of chef/mixin/language. Load the file to activate the deprecation code.
-require 'chef/mixin/language'
+require "chef/mixin/language"
diff --git a/lib/chef/dsl/powershell.rb b/lib/chef/dsl/powershell.rb
index a17971c689..c05d092175 100644
--- a/lib/chef/dsl/powershell.rb
+++ b/lib/chef/dsl/powershell.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/util/powershell/ps_credential'
+require "chef/util/powershell/ps_credential"
class Chef
module DSL
module Powershell
- def ps_credential(username='placeholder', password)
+ def ps_credential(username="placeholder", password)
Chef::Util::Powershell::PSCredential.new(username, password)
end
end
diff --git a/lib/chef/dsl/reboot_pending.rb b/lib/chef/dsl/reboot_pending.rb
index 3d84b29ec5..1f04a0107c 100644
--- a/lib/chef/dsl/reboot_pending.rb
+++ b/lib/chef/dsl/reboot_pending.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/dsl/platform_introspection'
-require 'chef/dsl/registry_helper'
+require "chef/dsl/platform_introspection"
+require "chef/dsl/registry_helper"
class Chef
module DSL
@@ -38,7 +38,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
@@ -55,7 +55,7 @@ class Chef
[1,2,3].include?(registry_get_values('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile').select { |v| v[:name] == "Flags" }[0][:data]))
elsif platform?("ubuntu")
# This should work for Debian as well if update-notifier-common happens to be installed. We need an API for that.
- File.exists?('/var/run/reboot-required')
+ File.exists?("/var/run/reboot-required")
else
false
end
diff --git a/lib/chef/dsl/recipe.rb b/lib/chef/dsl/recipe.rb
index 441fcbbd2c..8a25328023 100644
--- a/lib/chef/dsl/recipe.rb
+++ b/lib/chef/dsl/recipe.rb
@@ -17,12 +17,12 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/mixin/shell_out'
-require 'chef/mixin/powershell_out'
-require 'chef/dsl/resources'
-require 'chef/dsl/definitions'
-require 'chef/dsl/declare_resource'
+require "chef/exceptions"
+require "chef/mixin/shell_out"
+require "chef/mixin/powershell_out"
+require "chef/dsl/resources"
+require "chef/dsl/definitions"
+require "chef/dsl/declare_resource"
class Chef
module DSL
@@ -106,13 +106,13 @@ class Chef
end
module FullDSL
- require 'chef/dsl/data_query'
- require 'chef/dsl/platform_introspection'
- require 'chef/dsl/include_recipe'
- require 'chef/dsl/registry_helper'
- require 'chef/dsl/reboot_pending'
- require 'chef/dsl/audit'
- require 'chef/dsl/powershell'
+ require "chef/dsl/data_query"
+ require "chef/dsl/platform_introspection"
+ require "chef/dsl/include_recipe"
+ require "chef/dsl/registry_helper"
+ require "chef/dsl/reboot_pending"
+ require "chef/dsl/audit"
+ require "chef/dsl/powershell"
include Chef::DSL::DataQuery
include Chef::DSL::PlatformIntrospection
include Chef::DSL::IncludeRecipe
@@ -127,8 +127,8 @@ class Chef
end
# Avoid circular references for things that are only used in instance methods
-require 'chef/resource'
+require "chef/resource"
# **DEPRECATED**
# This used to be part of chef/mixin/recipe_definition_dsl_core. Load the file to activate the deprecation code.
-require 'chef/mixin/recipe_definition_dsl_core'
+require "chef/mixin/recipe_definition_dsl_core"
diff --git a/lib/chef/dsl/resources.rb b/lib/chef/dsl/resources.rb
index 3d582dab6d..282937f7a8 100644
--- a/lib/chef/dsl/resources.rb
+++ b/lib/chef/dsl/resources.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/dsl/cheffish'
-require 'chef/dsl/chef_provisioning'
+require "chef/dsl/cheffish"
+require "chef/dsl/chef_provisioning"
class Chef
module DSL
diff --git a/lib/chef/encrypted_data_bag_item.rb b/lib/chef/encrypted_data_bag_item.rb
index 120eb2a4ae..4b39a4f19f 100644
--- a/lib/chef/encrypted_data_bag_item.rb
+++ b/lib/chef/encrypted_data_bag_item.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/data_bag_item'
-require 'chef/encrypted_data_bag_item/decryptor'
-require 'chef/encrypted_data_bag_item/encryptor'
-require 'open-uri'
+require "chef/config"
+require "chef/data_bag_item"
+require "chef/encrypted_data_bag_item/decryptor"
+require "chef/encrypted_data_bag_item/encryptor"
+require "open-uri"
# An EncryptedDataBagItem represents a read-only data bag item where
# all values, except for the value associated with the id key, have
@@ -47,8 +47,8 @@ require 'open-uri'
# such nodes in the infrastructure.
#
class Chef::EncryptedDataBagItem
- ALGORITHM = 'aes-256-cbc'
- AEAD_ALGORITHM = 'aes-256-gcm'
+ ALGORITHM = "aes-256-cbc"
+ AEAD_ALGORITHM = "aes-256-gcm"
#
# === Synopsis
diff --git a/lib/chef/encrypted_data_bag_item/assertions.rb b/lib/chef/encrypted_data_bag_item/assertions.rb
index ab93f46c10..8ee47c8508 100644
--- a/lib/chef/encrypted_data_bag_item/assertions.rb
+++ b/lib/chef/encrypted_data_bag_item/assertions.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/encrypted_data_bag_item/unacceptable_encrypted_data_bag_item_format'
-require 'chef/encrypted_data_bag_item/unsupported_cipher'
+require "chef/encrypted_data_bag_item/unacceptable_encrypted_data_bag_item_format"
+require "chef/encrypted_data_bag_item/unsupported_cipher"
class Chef::EncryptedDataBagItem
diff --git a/lib/chef/encrypted_data_bag_item/check_encrypted.rb b/lib/chef/encrypted_data_bag_item/check_encrypted.rb
index b7cb5841b3..12f7c3aa57 100644
--- a/lib/chef/encrypted_data_bag_item/check_encrypted.rb
+++ b/lib/chef/encrypted_data_bag_item/check_encrypted.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/encrypted_data_bag_item/encryptor'
+require "chef/encrypted_data_bag_item/encryptor"
class Chef::EncryptedDataBagItem
# Common code for checking if a data bag appears encrypted
diff --git a/lib/chef/encrypted_data_bag_item/decryptor.rb b/lib/chef/encrypted_data_bag_item/decryptor.rb
index 86b99cc284..ea41860d6a 100644
--- a/lib/chef/encrypted_data_bag_item/decryptor.rb
+++ b/lib/chef/encrypted_data_bag_item/decryptor.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'yaml'
-require 'chef/json_compat'
-require 'openssl'
-require 'base64'
-require 'digest/sha2'
-require 'chef/encrypted_data_bag_item'
-require 'chef/encrypted_data_bag_item/unsupported_encrypted_data_bag_item_format'
-require 'chef/encrypted_data_bag_item/decryption_failure'
-require 'chef/encrypted_data_bag_item/assertions'
+require "yaml"
+require "chef/json_compat"
+require "openssl"
+require "base64"
+require "digest/sha2"
+require "chef/encrypted_data_bag_item"
+require "chef/encrypted_data_bag_item/unsupported_encrypted_data_bag_item_format"
+require "chef/encrypted_data_bag_item/decryption_failure"
+require "chef/encrypted_data_bag_item/assertions"
class Chef::EncryptedDataBagItem
@@ -214,7 +214,7 @@ class Chef::EncryptedDataBagItem
@openssl_decryptor ||= begin
d = super
d.auth_tag = auth_tag
- d.auth_data = ''
+ d.auth_data = ""
d
end
end
diff --git a/lib/chef/encrypted_data_bag_item/encryptor.rb b/lib/chef/encrypted_data_bag_item/encryptor.rb
index 14c82dcea9..98c83f3201 100644
--- a/lib/chef/encrypted_data_bag_item/encryptor.rb
+++ b/lib/chef/encrypted_data_bag_item/encryptor.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'base64'
-require 'digest/sha2'
-require 'openssl'
-require 'ffi_yajl'
-require 'chef/encrypted_data_bag_item'
-require 'chef/encrypted_data_bag_item/unsupported_encrypted_data_bag_item_format'
-require 'chef/encrypted_data_bag_item/encryption_failure'
-require 'chef/encrypted_data_bag_item/assertions'
+require "base64"
+require "digest/sha2"
+require "openssl"
+require "ffi_yajl"
+require "chef/encrypted_data_bag_item"
+require "chef/encrypted_data_bag_item/unsupported_encrypted_data_bag_item_format"
+require "chef/encrypted_data_bag_item/encryption_failure"
+require "chef/encrypted_data_bag_item/assertions"
class Chef::EncryptedDataBagItem
@@ -201,7 +201,7 @@ class Chef::EncryptedDataBagItem
def openssl_encryptor
@openssl_encryptor ||= begin
encryptor = super
- encryptor.auth_data = ''
+ encryptor.auth_data = ""
encryptor
end
end
diff --git a/lib/chef/environment.rb b/lib/chef/environment.rb
index 45491e0d72..e41f2b66ac 100644
--- a/lib/chef/environment.rb
+++ b/lib/chef/environment.rb
@@ -19,12 +19,12 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/mash'
-require 'chef/mixin/params_validate'
-require 'chef/mixin/from_file'
-require 'chef/version_constraint'
-require 'chef/server_api'
+require "chef/config"
+require "chef/mash"
+require "chef/mixin/params_validate"
+require "chef/mixin/from_file"
+require "chef/version_constraint"
+require "chef/server_api"
class Chef
class Environment
@@ -39,8 +39,8 @@ class Chef
COMBINED_COOKBOOK_CONSTRAINT = /(.+)(?:[\s]+)((?:#{Chef::VersionConstraint::OPS.join('|')})(?:[\s]+).+)$/.freeze
def initialize(chef_server_rest: nil)
- @name = ''
- @description = ''
+ @name = ""
+ @description = ""
@default_attributes = Mash.new
@override_attributes = Mash.new
@cookbook_versions = Hash.new
diff --git a/lib/chef/event_dispatch/dispatcher.rb b/lib/chef/event_dispatch/dispatcher.rb
index ad7df46cd0..dae2c3f6b4 100644
--- a/lib/chef/event_dispatch/dispatcher.rb
+++ b/lib/chef/event_dispatch/dispatcher.rb
@@ -1,4 +1,4 @@
-require 'chef/event_dispatch/base'
+require "chef/event_dispatch/base"
class Chef
module EventDispatch
diff --git a/lib/chef/event_dispatch/dsl.rb b/lib/chef/event_dispatch/dsl.rb
index 0a6e4ca52f..4695699c9a 100644
--- a/lib/chef/event_dispatch/dsl.rb
+++ b/lib/chef/event_dispatch/dsl.rb
@@ -15,9 +15,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/event_dispatch/base'
-require 'chef/exceptions'
-require 'chef/config'
+require "chef/event_dispatch/base"
+require "chef/exceptions"
+require "chef/config"
class Chef
module EventDispatch
diff --git a/lib/chef/event_loggers/base.rb b/lib/chef/event_loggers/base.rb
index 1f676dd516..3f5c35a74c 100644
--- a/lib/chef/event_loggers/base.rb
+++ b/lib/chef/event_loggers/base.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/event_dispatch/base'
+require "chef/event_dispatch/base"
class Chef
module EventLoggers
diff --git a/lib/chef/event_loggers/windows_eventlog.rb b/lib/chef/event_loggers/windows_eventlog.rb
index 9c01b11e76..e7a5b204f9 100644
--- a/lib/chef/event_loggers/windows_eventlog.rb
+++ b/lib/chef/event_loggers/windows_eventlog.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/event_loggers/base'
-require 'chef/platform/query_helpers'
-require 'chef/win32/eventlog'
+require "chef/event_loggers/base"
+require "chef/platform/query_helpers"
+require "chef/win32/eventlog"
class Chef
module EventLoggers
@@ -35,14 +35,14 @@ class Chef
LOG_CATEGORY_ID = 11001
# Since we must install the event logger, this is not really configurable
- SOURCE = 'Chef'
+ SOURCE = "Chef"
def self.available?
return Chef::Platform::windows?
end
def initialize
- @eventlog = ::Win32::EventLog::open('Application')
+ @eventlog = ::Win32::EventLog::open("Application")
end
def run_start(version)
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb
index 74b8d80de2..25f2735b7d 100644
--- a/lib/chef/exceptions.rb
+++ b/lib/chef/exceptions.rb
@@ -17,7 +17,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef-config/exceptions'
+require "chef-config/exceptions"
class Chef
# == Chef::Exceptions
@@ -28,7 +28,7 @@ class Chef
ConfigurationError = ChefConfig::ConfigurationError
# Backcompat with Chef::ShellOut code:
- require 'mixlib/shellout/exceptions'
+ require "mixlib/shellout/exceptions"
def self.const_missing(const_name)
if const_name == :ShellCommandFailed
@@ -274,7 +274,7 @@ class Chef
super
when RunList::RunListExpansion
@expansion = message_or_expansion
- missing_roles = @expansion.errors.join(', ')
+ missing_roles = @expansion.errors.join(", ")
super("The expanded run list includes nonexistent roles: #{missing_roles}")
end
end
@@ -486,14 +486,14 @@ class Chef
class CookbookChefVersionMismatch < RuntimeError
def initialize(chef_version, cookbook_name, cookbook_version, *constraints)
- constraint_str = constraints.map { |c| c.requirement.as_list.to_s }.join(', ')
+ constraint_str = constraints.map { |c| c.requirement.as_list.to_s }.join(", ")
super "Cookbook '#{cookbook_name}' version '#{cookbook_version}' depends on chef version #{constraint_str}, but the running chef version is #{chef_version}"
end
end
class CookbookOhaiVersionMismatch < RuntimeError
def initialize(ohai_version, cookbook_name, cookbook_version, *constraints)
- constraint_str = constraints.map { |c| c.requirement.as_list.to_s }.join(', ')
+ constraint_str = constraints.map { |c| c.requirement.as_list.to_s }.join(", ")
super "Cookbook '#{cookbook_name}' version '#{cookbook_version}' depends on ohai version #{constraint_str}, but the running ohai version is #{ohai_version}"
end
end
@@ -503,7 +503,7 @@ class Chef
def initialize(resources_found)
@resources_found = resources_found
matches_info = @resources_found.each do |r|
- if r['Module'].nil?
+ if r["Module"].nil?
"Resource #{r['Name']} was found in #{r['Module']['Name']}"
else
"Resource #{r['Name']} is a binary resource"
diff --git a/lib/chef/file_access_control.rb b/lib/chef/file_access_control.rb
index cc7fa8fc1a..be42a228d4 100644
--- a/lib/chef/file_access_control.rb
+++ b/lib/chef/file_access_control.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/log'
+require "chef/log"
class Chef
@@ -27,10 +27,10 @@ class Chef
class FileAccessControl
if RUBY_PLATFORM =~ /mswin|mingw|windows/
- require 'chef/file_access_control/windows'
+ require "chef/file_access_control/windows"
include FileAccessControl::Windows
else
- require 'chef/file_access_control/unix'
+ require "chef/file_access_control/unix"
include FileAccessControl::Unix
end
diff --git a/lib/chef/file_access_control/unix.rb b/lib/chef/file_access_control/unix.rb
index 8178d5fbf2..86247eabad 100644
--- a/lib/chef/file_access_control/unix.rb
+++ b/lib/chef/file_access_control/unix.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require 'chef/log'
+require "chef/log"
class Chef
class FileAccessControl
diff --git a/lib/chef/file_access_control/windows.rb b/lib/chef/file_access_control/windows.rb
index 1781a6fa63..5d36a4339e 100644
--- a/lib/chef/file_access_control/windows.rb
+++ b/lib/chef/file_access_control/windows.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/win32/security'
-require 'chef/win32/file'
+require "chef/win32/security"
+require "chef/win32/file"
class Chef
class FileAccessControl
diff --git a/lib/chef/file_cache.rb b/lib/chef/file_cache.rb
index 2d633af4ed..42f54147d3 100644
--- a/lib/chef/file_cache.rb
+++ b/lib/chef/file_cache.rb
@@ -15,12 +15,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/mixin/params_validate'
-require 'chef/mixin/create_path'
-require 'chef/exceptions'
-require 'chef/json_compat'
-require 'fileutils'
-require 'chef/util/path_helper'
+require "chef/mixin/params_validate"
+require "chef/mixin/create_path"
+require "chef/exceptions"
+require "chef/json_compat"
+require "fileutils"
+require "chef/util/path_helper"
class Chef
class FileCache
diff --git a/lib/chef/file_content_management/deploy.rb b/lib/chef/file_content_management/deploy.rb
index 35ea3c6fc8..fd76c4e63e 100644
--- a/lib/chef/file_content_management/deploy.rb
+++ b/lib/chef/file_content_management/deploy.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/file_content_management/deploy/cp'
-require 'chef/file_content_management/deploy/mv_unix'
+require "chef/file_content_management/deploy/cp"
+require "chef/file_content_management/deploy/mv_unix"
if Chef::Platform.windows?
- require 'chef/file_content_management/deploy/mv_windows'
+ require "chef/file_content_management/deploy/mv_windows"
end
class Chef
diff --git a/lib/chef/file_content_management/deploy/mv_windows.rb b/lib/chef/file_content_management/deploy/mv_windows.rb
index e2951dba4c..85c1accc63 100644
--- a/lib/chef/file_content_management/deploy/mv_windows.rb
+++ b/lib/chef/file_content_management/deploy/mv_windows.rb
@@ -21,9 +21,9 @@
# ACL information on the dst file.
#
-require 'chef/platform/query_helpers'
+require "chef/platform/query_helpers"
if Chef::Platform.windows?
- require 'chef/win32/security'
+ require "chef/win32/security"
end
class Chef
diff --git a/lib/chef/formatters/base.rb b/lib/chef/formatters/base.rb
index 4c393f7a48..c881397b60 100644
--- a/lib/chef/formatters/base.rb
+++ b/lib/chef/formatters/base.rb
@@ -17,11 +17,11 @@
# limitations under the License.
#
-require 'chef/event_dispatch/base'
-require 'chef/formatters/error_inspectors'
-require 'chef/formatters/error_descriptor'
-require 'chef/formatters/error_mapper'
-require 'chef/formatters/indentable_output_stream'
+require "chef/event_dispatch/base"
+require "chef/formatters/error_inspectors"
+require "chef/formatters/error_descriptor"
+require "chef/formatters/error_mapper"
+require "chef/formatters/indentable_output_stream"
class Chef
diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb
index 70108f547b..5510956754 100644
--- a/lib/chef/formatters/doc.rb
+++ b/lib/chef/formatters/doc.rb
@@ -1,5 +1,5 @@
-require 'chef/formatters/base'
-require 'chef/config'
+require "chef/formatters/base"
+require "chef/config"
class Chef
module Formatters
@@ -334,7 +334,7 @@ class Chef
# Called before handlers run
def handlers_start(handler_count)
- puts ''
+ puts ""
puts "Running handlers:"
indent
end
diff --git a/lib/chef/formatters/error_descriptor.rb b/lib/chef/formatters/error_descriptor.rb
index f0e7520f31..a48f0609a9 100644
--- a/lib/chef/formatters/error_descriptor.rb
+++ b/lib/chef/formatters/error_descriptor.rb
@@ -48,8 +48,8 @@ class Chef
def for_json()
{
- 'title' => @title,
- 'sections' => @sections,
+ "title" => @title,
+ "sections" => @sections,
}
end
diff --git a/lib/chef/formatters/error_inspectors.rb b/lib/chef/formatters/error_inspectors.rb
index 418457322d..9221ecda4d 100644
--- a/lib/chef/formatters/error_inspectors.rb
+++ b/lib/chef/formatters/error_inspectors.rb
@@ -1,9 +1,9 @@
-require 'chef/formatters/error_inspectors/node_load_error_inspector'
+require "chef/formatters/error_inspectors/node_load_error_inspector"
require "chef/formatters/error_inspectors/registration_error_inspector"
-require 'chef/formatters/error_inspectors/compile_error_inspector'
-require 'chef/formatters/error_inspectors/resource_failure_inspector'
-require 'chef/formatters/error_inspectors/run_list_expansion_error_inspector'
-require 'chef/formatters/error_inspectors/cookbook_resolve_error_inspector'
+require "chef/formatters/error_inspectors/compile_error_inspector"
+require "chef/formatters/error_inspectors/resource_failure_inspector"
+require "chef/formatters/error_inspectors/run_list_expansion_error_inspector"
+require "chef/formatters/error_inspectors/cookbook_resolve_error_inspector"
require "chef/formatters/error_inspectors/cookbook_sync_error_inspector"
class Chef
diff --git a/lib/chef/formatters/error_inspectors/api_error_formatting.rb b/lib/chef/formatters/error_inspectors/api_error_formatting.rb
index 05ee3132a7..5f2a912a01 100644
--- a/lib/chef/formatters/error_inspectors/api_error_formatting.rb
+++ b/lib/chef/formatters/error_inspectors/api_error_formatting.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/http/authenticator'
+require "chef/http/authenticator"
class Chef
module Formatters
@@ -106,7 +106,7 @@ E
# Parses JSON from the error response sent by Chef Server and returns the
# error message
def format_rest_error
- Array(Chef::JSONCompat.from_json(exception.response.body)["error"]).join('; ')
+ Array(Chef::JSONCompat.from_json(exception.response.body)["error"]).join("; ")
rescue Exception
safe_format_rest_error
end
diff --git a/lib/chef/formatters/error_inspectors/compile_error_inspector.rb b/lib/chef/formatters/error_inspectors/compile_error_inspector.rb
index 621fadce40..1c0cce9dd7 100644
--- a/lib/chef/formatters/error_inspectors/compile_error_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/compile_error_inspector.rb
@@ -74,7 +74,7 @@ class Chef
MESSAGE
- error_description.section("Additional information:", msg.gsub(/^ {6}/, ''))
+ error_description.section("Additional information:", msg.gsub(/^ {6}/, ""))
end
end
diff --git a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb
index e011fa9d9b..a1f2c8ce37 100644
--- a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/formatters/error_inspectors/api_error_formatting'
+require "chef/formatters/error_inspectors/api_error_formatting"
class Chef
module Formatters
diff --git a/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb b/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb
index 971dbd664e..30811a6d24 100644
--- a/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/formatters/error_inspectors/api_error_formatting'
+require "chef/formatters/error_inspectors/api_error_formatting"
class Chef
module Formatters
diff --git a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb
index d81a9f7cc8..6371243624 100644
--- a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/formatters/error_inspectors/api_error_formatting'
+require "chef/formatters/error_inspectors/api_error_formatting"
class Chef
module Formatters
diff --git a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb
index dbd23f4a52..312e35adb6 100644
--- a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb
@@ -134,7 +134,7 @@ E
#--
# TODO: this code belongs in Chef::REST
def format_rest_error
- Array(Chef::JSONCompat.from_json(exception.response.body)["error"]).join('; ')
+ Array(Chef::JSONCompat.from_json(exception.response.body)["error"]).join("; ")
rescue Exception
exception.response.body
end
diff --git a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb
index 6e4d9322f9..83e22cb410 100644
--- a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb
@@ -52,7 +52,7 @@ class Chef
end
if Chef::Platform.windows?
- require 'chef/win32/security'
+ require "chef/win32/security"
if !Chef::ReservedNames::Win32::Security.has_admin_privileges?
error_description.section("Missing Windows Admin Privileges", "chef-client doesn't have administrator privileges. This can be a possible reason for the resource failure.")
diff --git a/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb b/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb
index 818228276e..7ba5448227 100644
--- a/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/formatters/error_inspectors/api_error_formatting'
+require "chef/formatters/error_inspectors/api_error_formatting"
class Chef
module Formatters
diff --git a/lib/chef/formatters/indentable_output_stream.rb b/lib/chef/formatters/indentable_output_stream.rb
index f7f470b190..e5e84e0f65 100644
--- a/lib/chef/formatters/indentable_output_stream.rb
+++ b/lib/chef/formatters/indentable_output_stream.rb
@@ -19,7 +19,7 @@ class Chef
def highline
@highline ||= begin
- require 'highline'
+ require "highline"
HighLine.new
end
end
@@ -110,7 +110,7 @@ class Chef
def print_string(string, options)
if string.empty?
if options[:end_line]
- print_line('', options)
+ print_line("", options)
end
else
string.lines.each do |line|
@@ -136,7 +136,7 @@ class Chef
def move_to_next_line
if @line_started
- @out.puts ''
+ @out.puts ""
@line_started = false
end
end
@@ -151,11 +151,11 @@ class Chef
if @current_stream != options[:stream]
@out.print "#{(' ' * indent)}[#{options[:name]}] "
else
- @out.print ' ' * (indent + 3 + options[:name].size)
+ @out.print " " * (indent + 3 + options[:name].size)
end
else
# Otherwise, just print indents.
- @out.print ' ' * indent
+ @out.print " " * indent
end
if @current_stream != options[:stream]
diff --git a/lib/chef/formatters/minimal.rb b/lib/chef/formatters/minimal.rb
index 62db517e3e..2e32968b4b 100644
--- a/lib/chef/formatters/minimal.rb
+++ b/lib/chef/formatters/minimal.rb
@@ -1,4 +1,4 @@
-require 'chef/formatters/base'
+require "chef/formatters/base"
class Chef
@@ -130,7 +130,7 @@ class Chef
# Called after a file in a cookbook is loaded.
def file_loaded(path)
- print '.'
+ print "."
end
def file_load_failed(path, exception)
diff --git a/lib/chef/guard_interpreter.rb b/lib/chef/guard_interpreter.rb
index b968f273b9..ba19a672aa 100644
--- a/lib/chef/guard_interpreter.rb
+++ b/lib/chef/guard_interpreter.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/guard_interpreter/default_guard_interpreter'
-require 'chef/guard_interpreter/resource_guard_interpreter'
+require "chef/guard_interpreter/default_guard_interpreter"
+require "chef/guard_interpreter/resource_guard_interpreter"
class Chef
class GuardInterpreter
diff --git a/lib/chef/guard_interpreter/default_guard_interpreter.rb b/lib/chef/guard_interpreter/default_guard_interpreter.rb
index fead9886b2..4ddab8acbc 100644
--- a/lib/chef/guard_interpreter/default_guard_interpreter.rb
+++ b/lib/chef/guard_interpreter/default_guard_interpreter.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/mixin/shell_out'
+require "chef/mixin/shell_out"
class Chef
class GuardInterpreter
diff --git a/lib/chef/guard_interpreter/resource_guard_interpreter.rb b/lib/chef/guard_interpreter/resource_guard_interpreter.rb
index a333028a22..e0fff72254 100644
--- a/lib/chef/guard_interpreter/resource_guard_interpreter.rb
+++ b/lib/chef/guard_interpreter/resource_guard_interpreter.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/guard_interpreter'
+require "chef/guard_interpreter"
class Chef
class GuardInterpreter
@@ -100,7 +100,7 @@ class Chef
# See https://github.com/chef/chef/issues/3485.
empty_events = Chef::EventDispatch::Dispatcher.new
anonymous_run_context = Chef::RunContext.new(parent_resource.node.dup, {}, empty_events)
- interpreter_resource = resource_class.new('Guard resource', anonymous_run_context)
+ interpreter_resource = resource_class.new("Guard resource", anonymous_run_context)
interpreter_resource.is_guard_interpreter = true
interpreter_resource
diff --git a/lib/chef/handler.rb b/lib/chef/handler.rb
index c4b729eeca..8ae1da96c1 100644
--- a/lib/chef/handler.rb
+++ b/lib/chef/handler.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/client'
-require 'forwardable'
+require "chef/client"
+require "forwardable"
class Chef
# == Chef::Handler
diff --git a/lib/chef/handler/error_report.rb b/lib/chef/handler/error_report.rb
index 8bf676418d..6d0ad32d9f 100644
--- a/lib/chef/handler/error_report.rb
+++ b/lib/chef/handler/error_report.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/handler'
-require 'chef/resource/directory'
+require "chef/handler"
+require "chef/resource/directory"
class Chef
class Handler
diff --git a/lib/chef/handler/json_file.rb b/lib/chef/handler/json_file.rb
index 405c91795e..a695df3219 100644
--- a/lib/chef/handler/json_file.rb
+++ b/lib/chef/handler/json_file.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/handler'
-require 'chef/resource/directory'
+require "chef/handler"
+require "chef/resource/directory"
class Chef
class Handler
diff --git a/lib/chef/http.rb b/lib/chef/http.rb
index a26e82f795..9f76b9de3a 100644
--- a/lib/chef/http.rb
+++ b/lib/chef/http.rb
@@ -21,14 +21,14 @@
# limitations under the License.
#
-require 'tempfile'
-require 'net/https'
-require 'uri'
-require 'chef/http/basic_client'
-require 'chef/monkey_patches/net_http'
-require 'chef/config'
-require 'chef/platform/query_helpers'
-require 'chef/exceptions'
+require "tempfile"
+require "net/https"
+require "uri"
+require "chef/http/basic_client"
+require "chef/monkey_patches/net_http"
+require "chef/config"
+require "chef/platform/query_helpers"
+require "chef/exceptions"
class Chef
@@ -204,7 +204,7 @@ class Chef
# when for most knife/chef-client work we never need/want this loaded.
Thread.exclusive {
unless defined?(SocketlessChefZeroClient)
- require 'chef/http/socketless_chef_zero_client'
+ require "chef/http/socketless_chef_zero_client"
end
}
SocketlessChefZeroClient.new(base_url)
@@ -225,7 +225,7 @@ class Chef
# The regular expressions used here are to make sure '@url' does not have
# any trailing slashes and 'path' does not have any leading slashes. This
# way they are always joined correctly using just one slash.
- URI.parse(@url.gsub(%r{/+$}, '') + '/' + path.gsub(%r{^/+}, ''))
+ URI.parse(@url.gsub(%r{/+$}, "") + "/" + path.gsub(%r{^/+}, ""))
end
end
@@ -381,12 +381,12 @@ class Chef
return nil unless response.kind_of?(Net::HTTPRedirection)
# Net::HTTPNotModified is undesired subclass of Net::HTTPRedirection so test for this
return nil if response.kind_of?(Net::HTTPNotModified)
- response['location']
+ response["location"]
end
def build_headers(method, url, headers={}, json_body=false)
headers = @default_headers.merge(headers)
- headers['Content-Length'] = json_body.bytesize.to_s if json_body
+ headers["Content-Length"] = json_body.bytesize.to_s if json_body
headers.merge!(Chef::Config[:custom_http_headers]) if Chef::Config[:custom_http_headers]
headers
end
diff --git a/lib/chef/http/auth_credentials.rb b/lib/chef/http/auth_credentials.rb
index bd73524b1f..c583352cfd 100644
--- a/lib/chef/http/auth_credentials.rb
+++ b/lib/chef/http/auth_credentials.rb
@@ -20,8 +20,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/log'
-require 'mixlib/authentication/signedheaderauth'
+require "chef/log"
+require "mixlib/authentication/signedheaderauth"
class Chef
class HTTP
diff --git a/lib/chef/http/authenticator.rb b/lib/chef/http/authenticator.rb
index bffa9c4b3a..02074171f8 100644
--- a/lib/chef/http/authenticator.rb
+++ b/lib/chef/http/authenticator.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/http/auth_credentials'
-require 'chef/exceptions'
-require 'openssl'
+require "chef/http/auth_credentials"
+require "chef/exceptions"
+require "openssl"
class Chef
class HTTP
@@ -48,7 +48,7 @@ class Chef
def handle_request(method, url, headers={}, data=false)
headers.merge!(authentication_headers(method, url, data)) if sign_requests?
- headers.merge!({'X-Ops-Server-API-Version' => @api_version})
+ headers.merge!({"X-Ops-Server-API-Version" => @api_version})
[method, url, headers, data]
end
diff --git a/lib/chef/http/basic_client.rb b/lib/chef/http/basic_client.rb
index de5e7c03a8..defa4976d1 100644
--- a/lib/chef/http/basic_client.rb
+++ b/lib/chef/http/basic_client.rb
@@ -20,10 +20,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'uri'
-require 'net/http'
-require 'chef/http/ssl_policies'
-require 'chef/http/http_request'
+require "uri"
+require "net/http"
+require "chef/http/ssl_policies"
+require "chef/http/http_request"
class Chef
class HTTP
@@ -72,7 +72,7 @@ class Chef
Chef::Log.debug("---- End HTTP Status/Header Data ----")
# For non-400's, log the request and response bodies
- if !response.code || !response.code.start_with?('2')
+ if !response.code || !response.code.start_with?("2")
if response.body
Chef::Log.debug("---- HTTP Response Body ----")
Chef::Log.debug(response.body)
@@ -111,7 +111,7 @@ class Chef
end
end
- no_proxy = Chef::Config[:no_proxy] || env['NO_PROXY'] || env['no_proxy']
+ no_proxy = Chef::Config[:no_proxy] || env["NO_PROXY"] || env["no_proxy"]
excludes = no_proxy.to_s.split(/\s*,\s*/).compact
excludes = excludes.map { |exclude| exclude =~ /:\d+$/ ? exclude : "#{exclude}:*" }
return proxy unless excludes.any? { |exclude| File.fnmatch(exclude, "#{host}:#{port}") }
diff --git a/lib/chef/http/cookie_jar.rb b/lib/chef/http/cookie_jar.rb
index 418fb1d352..3f6d879c1f 100644
--- a/lib/chef/http/cookie_jar.rb
+++ b/lib/chef/http/cookie_jar.rb
@@ -20,7 +20,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'singleton'
+require "singleton"
class Chef
class HTTP
diff --git a/lib/chef/http/cookie_manager.rb b/lib/chef/http/cookie_manager.rb
index e9cb7aa4f7..4b48352382 100644
--- a/lib/chef/http/cookie_manager.rb
+++ b/lib/chef/http/cookie_manager.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/http/cookie_jar'
+require "chef/http/cookie_jar"
class Chef
class HTTP
@@ -34,14 +34,14 @@ class Chef
def handle_request(method, url, headers={}, data=false)
@host, @port = url.host, url.port
if @cookies.has_key?("#{@host}:#{@port}")
- headers['Cookie'] = @cookies["#{@host}:#{@port}"]
+ headers["Cookie"] = @cookies["#{@host}:#{@port}"]
end
[method, url, headers, data]
end
def handle_response(http_response, rest_request, return_value)
- if http_response['set-cookie']
- @cookies["#{@host}:#{@port}"] = http_response['set-cookie']
+ if http_response["set-cookie"]
+ @cookies["#{@host}:#{@port}"] = http_response["set-cookie"]
end
[http_response, rest_request, return_value]
end
diff --git a/lib/chef/http/decompressor.rb b/lib/chef/http/decompressor.rb
index a61f510e7d..bc033cc35e 100644
--- a/lib/chef/http/decompressor.rb
+++ b/lib/chef/http/decompressor.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'zlib'
-require 'chef/http/http_request'
+require "zlib"
+require "chef/http/http_request"
class Chef
class HTTP
@@ -132,7 +132,7 @@ class Chef
def handle_options(opts)
opts.each do |name, value|
case name.to_s
- when 'disable_gzip'
+ when "disable_gzip"
@disable_gzip = value
end
end
diff --git a/lib/chef/http/http_request.rb b/lib/chef/http/http_request.rb
index 9e48f6e5e9..891ffef05e 100644
--- a/lib/chef/http/http_request.rb
+++ b/lib/chef/http/http_request.rb
@@ -20,19 +20,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'uri'
-require 'net/http'
+require "uri"
+require "net/http"
# To load faster, we only want ohai's version string.
# However, in ohai before 0.6.0, the version is defined
# in ohai, not ohai/version
begin
- require 'ohai/version' #used in user agent string.
+ require "ohai/version" #used in user agent string.
rescue LoadError
- require 'ohai'
+ require "ohai"
end
-require 'chef/version'
+require "chef/version"
class Chef
class HTTP
@@ -60,7 +60,7 @@ class Chef
HOST_LOWER = "host".freeze
- URI_SCHEME_DEFAULT_PORT = { 'http' => 80, 'https' => 443 }.freeze
+ URI_SCHEME_DEFAULT_PORT = { "http" => 80, "https" => 443 }.freeze
def self.user_agent=(ua)
@user_agent = ua
@@ -139,13 +139,13 @@ class Chef
@headers = headers.dup
# No response compression unless we asked for it explicitly:
@headers[HTTPRequest::ACCEPT_ENCODING] ||= "identity"
- @headers['X-Chef-Version'] = ::Chef::VERSION
+ @headers["X-Chef-Version"] = ::Chef::VERSION
# Only include port in Host header when it is not the default port
# for the url scheme (80;443) - Fixes CHEF-5355
host_header = uri_safe_host.dup
host_header << ":#{port}" unless URI_SCHEME_DEFAULT_PORT[@url.scheme] == port.to_i
- @headers['Host'] = host_header unless @headers.keys.any? {|k| k.downcase.to_s == HOST_LOWER }
+ @headers["Host"] = host_header unless @headers.keys.any? {|k| k.downcase.to_s == HOST_LOWER }
@headers
end
diff --git a/lib/chef/http/json_input.rb b/lib/chef/http/json_input.rb
index 3296d8821f..3bfca38479 100644
--- a/lib/chef/http/json_input.rb
+++ b/lib/chef/http/json_input.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/json_compat'
+require "chef/json_compat"
class Chef
class HTTP
@@ -33,8 +33,8 @@ class Chef
def handle_request(method, url, headers={}, data=false)
if data && should_encode_as_json?(headers)
- headers.delete_if { |key, _value| key.downcase == 'content-type' }
- headers["Content-Type"] = 'application/json'
+ headers.delete_if { |key, _value| key.downcase == "content-type" }
+ headers["Content-Type"] = "application/json"
json_opts = {}
json_opts[:validate_utf8] = opts[:validate_utf8] if opts.has_key?(:validate_utf8)
data = Chef::JSONCompat.to_json(data, json_opts)
diff --git a/lib/chef/http/json_output.rb b/lib/chef/http/json_output.rb
index 069eb6a87f..86165d3d55 100644
--- a/lib/chef/http/json_output.rb
+++ b/lib/chef/http/json_output.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/json_compat'
-require 'chef/log'
+require "chef/json_compat"
+require "chef/log"
class Chef
class HTTP
@@ -38,7 +38,7 @@ class Chef
# Ideally this should always set Accept to application/json, but
# Chef::REST is sometimes used to make non-JSON requests, so it sets
# Accept to the desired value before middlewares get called.
- headers['Accept'] ||= 'application/json'
+ headers["Accept"] ||= "application/json"
[method, url, headers, data]
end
@@ -46,7 +46,7 @@ class Chef
# temporary hack, skip processing if return_value is false
# needed to keep conditional get stuff working correctly.
return [http_response, rest_request, return_value] if return_value == false
- if http_response['content-type'] =~ /json/
+ if http_response["content-type"] =~ /json/
if http_response.body.nil?
return_value = nil
elsif raw_output
diff --git a/lib/chef/http/json_to_model_output.rb b/lib/chef/http/json_to_model_output.rb
index 9bc90a52ae..2290c90b0c 100644
--- a/lib/chef/http/json_to_model_output.rb
+++ b/lib/chef/http/json_to_model_output.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/http/json_output'
+require "chef/http/json_output"
class Chef
class HTTP
diff --git a/lib/chef/http/remote_request_id.rb b/lib/chef/http/remote_request_id.rb
index 6bec5dba4f..bfee5d3ded 100644
--- a/lib/chef/http/remote_request_id.rb
+++ b/lib/chef/http/remote_request_id.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'chef/request_id'
+require "chef/request_id"
class Chef
class HTTP
@@ -25,7 +25,7 @@ class Chef
end
def handle_request(method, url, headers={}, data=false)
- headers.merge!({'X-REMOTE-REQUEST-ID' => Chef::RequestID.instance.request_id})
+ headers.merge!({"X-REMOTE-REQUEST-ID" => Chef::RequestID.instance.request_id})
[method, url, headers, data]
end
diff --git a/lib/chef/http/simple.rb b/lib/chef/http/simple.rb
index f59fcaa08b..d828e98186 100644
--- a/lib/chef/http/simple.rb
+++ b/lib/chef/http/simple.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/http'
-require 'chef/http/authenticator'
-require 'chef/http/decompressor'
-require 'chef/http/cookie_manager'
-require 'chef/http/validate_content_length'
+require "chef/http"
+require "chef/http/authenticator"
+require "chef/http/decompressor"
+require "chef/http/cookie_manager"
+require "chef/http/validate_content_length"
class Chef
class HTTP
diff --git a/lib/chef/http/simple_json.rb b/lib/chef/http/simple_json.rb
index 5dfdfbb680..5c5a87d387 100644
--- a/lib/chef/http/simple_json.rb
+++ b/lib/chef/http/simple_json.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/http'
-require 'chef/http/authenticator'
-require 'chef/http/decompressor'
-require 'chef/http/cookie_manager'
-require 'chef/http/validate_content_length'
+require "chef/http"
+require "chef/http/authenticator"
+require "chef/http/decompressor"
+require "chef/http/cookie_manager"
+require "chef/http/validate_content_length"
class Chef
class HTTP
diff --git a/lib/chef/http/socketless_chef_zero_client.rb b/lib/chef/http/socketless_chef_zero_client.rb
index 8f5543a16f..e81aff6fce 100644
--- a/lib/chef/http/socketless_chef_zero_client.rb
+++ b/lib/chef/http/socketless_chef_zero_client.rb
@@ -43,7 +43,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-require 'chef_zero/server'
+require "chef_zero/server"
class Chef
class HTTP
@@ -81,56 +81,56 @@ class Chef
#
# HTTP status codes and descriptions
STATUS_MESSAGE = {
- 100 => 'Continue',
- 101 => 'Switching Protocols',
- 200 => 'OK',
- 201 => 'Created',
- 202 => 'Accepted',
- 203 => 'Non-Authoritative Information',
- 204 => 'No Content',
- 205 => 'Reset Content',
- 206 => 'Partial Content',
- 207 => 'Multi-Status',
- 300 => 'Multiple Choices',
- 301 => 'Moved Permanently',
- 302 => 'Found',
- 303 => 'See Other',
- 304 => 'Not Modified',
- 305 => 'Use Proxy',
- 307 => 'Temporary Redirect',
- 400 => 'Bad Request',
- 401 => 'Unauthorized',
- 402 => 'Payment Required',
- 403 => 'Forbidden',
- 404 => 'Not Found',
- 405 => 'Method Not Allowed',
- 406 => 'Not Acceptable',
- 407 => 'Proxy Authentication Required',
- 408 => 'Request Timeout',
- 409 => 'Conflict',
- 410 => 'Gone',
- 411 => 'Length Required',
- 412 => 'Precondition Failed',
- 413 => 'Request Entity Too Large',
- 414 => 'Request-URI Too Large',
- 415 => 'Unsupported Media Type',
- 416 => 'Request Range Not Satisfiable',
- 417 => 'Expectation Failed',
- 422 => 'Unprocessable Entity',
- 423 => 'Locked',
- 424 => 'Failed Dependency',
- 426 => 'Upgrade Required',
- 428 => 'Precondition Required',
- 429 => 'Too Many Requests',
- 431 => 'Request Header Fields Too Large',
- 500 => 'Internal Server Error',
- 501 => 'Not Implemented',
- 502 => 'Bad Gateway',
- 503 => 'Service Unavailable',
- 504 => 'Gateway Timeout',
- 505 => 'HTTP Version Not Supported',
- 507 => 'Insufficient Storage',
- 511 => 'Network Authentication Required',
+ 100 => "Continue",
+ 101 => "Switching Protocols",
+ 200 => "OK",
+ 201 => "Created",
+ 202 => "Accepted",
+ 203 => "Non-Authoritative Information",
+ 204 => "No Content",
+ 205 => "Reset Content",
+ 206 => "Partial Content",
+ 207 => "Multi-Status",
+ 300 => "Multiple Choices",
+ 301 => "Moved Permanently",
+ 302 => "Found",
+ 303 => "See Other",
+ 304 => "Not Modified",
+ 305 => "Use Proxy",
+ 307 => "Temporary Redirect",
+ 400 => "Bad Request",
+ 401 => "Unauthorized",
+ 402 => "Payment Required",
+ 403 => "Forbidden",
+ 404 => "Not Found",
+ 405 => "Method Not Allowed",
+ 406 => "Not Acceptable",
+ 407 => "Proxy Authentication Required",
+ 408 => "Request Timeout",
+ 409 => "Conflict",
+ 410 => "Gone",
+ 411 => "Length Required",
+ 412 => "Precondition Failed",
+ 413 => "Request Entity Too Large",
+ 414 => "Request-URI Too Large",
+ 415 => "Unsupported Media Type",
+ 416 => "Request Range Not Satisfiable",
+ 417 => "Expectation Failed",
+ 422 => "Unprocessable Entity",
+ 423 => "Locked",
+ 424 => "Failed Dependency",
+ 426 => "Upgrade Required",
+ 428 => "Precondition Required",
+ 429 => "Too Many Requests",
+ 431 => "Request Header Fields Too Large",
+ 500 => "Internal Server Error",
+ 501 => "Not Implemented",
+ 502 => "Bad Gateway",
+ 503 => "Service Unavailable",
+ 504 => "Gateway Timeout",
+ 505 => "HTTP Version Not Supported",
+ 507 => "Insufficient Storage",
+ 511 => "Network Authentication Required",
}
STATUS_MESSAGE.values.each {|v| v.freeze }
@@ -175,7 +175,7 @@ class Chef
end
def to_net_http(code, headers, chunked_body)
- body = chunked_body.join('')
+ body = chunked_body.join("")
msg = STATUS_MESSAGE[code] or raise "Cannot determine HTTP status message for code #{code}"
response = Net::HTTPResponse.send(:response_class, code.to_s).new("1.0", code.to_s, msg)
response.instance_variable_set(:@body, body)
diff --git a/lib/chef/http/ssl_policies.rb b/lib/chef/http/ssl_policies.rb
index 9c180c154e..5247d677cc 100644
--- a/lib/chef/http/ssl_policies.rb
+++ b/lib/chef/http/ssl_policies.rb
@@ -21,8 +21,8 @@
# limitations under the License.
#
-require 'openssl'
-require 'chef/util/path_helper'
+require "openssl"
+require "chef/util/path_helper"
class Chef
class HTTP
@@ -110,7 +110,7 @@ class Chef
def add_trusted_cert(cert)
http_client.cert_store.add_cert(cert)
rescue OpenSSL::X509::StoreError => e
- raise e unless e.message == 'cert already in hash table'
+ raise e unless e.message == "cert already in hash table"
end
end
diff --git a/lib/chef/http/validate_content_length.rb b/lib/chef/http/validate_content_length.rb
index 076194e31a..77fb6194ef 100644
--- a/lib/chef/http/validate_content_length.rb
+++ b/lib/chef/http/validate_content_length.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'pp'
-require 'chef/log'
+require "pp"
+require "chef/log"
class Chef
class HTTP
@@ -73,18 +73,18 @@ class Chef
private
def response_content_length(response)
- return nil if response['content-length'].nil?
- if response['content-length'].is_a?(Array)
- response['content-length'].first.to_i
+ return nil if response["content-length"].nil?
+ if response["content-length"].is_a?(Array)
+ response["content-length"].first.to_i
else
- response['content-length'].to_i
+ response["content-length"].to_i
end
end
def validate(http_response, response_length)
content_length = response_content_length(http_response)
- transfer_encoding = http_response['transfer-encoding']
- content_encoding = http_response['content-encoding']
+ transfer_encoding = http_response["transfer-encoding"]
+ content_encoding = http_response["content-encoding"]
if content_length.nil?
Chef::Log.debug "HTTP server did not include a Content-Length header in response, cannot identify truncated downloads."
diff --git a/lib/chef/json_compat.rb b/lib/chef/json_compat.rb
index 5e9f29a60b..74059516ab 100644
--- a/lib/chef/json_compat.rb
+++ b/lib/chef/json_compat.rb
@@ -17,10 +17,10 @@
# Wrapper class for interacting with JSON.
-require 'ffi_yajl'
-require 'chef/exceptions'
+require "ffi_yajl"
+require "chef/exceptions"
# We're requiring this to prevent breaking consumers using Hash.to_json
-require 'json'
+require "json"
class Chef
class JSONCompat
diff --git a/lib/chef/key.rb b/lib/chef/key.rb
index 714dfc3f60..ba5613e35e 100644
--- a/lib/chef/key.rb
+++ b/lib/chef/key.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/json_compat'
-require 'chef/mixin/params_validate'
-require 'chef/exceptions'
-require 'chef/server_api'
+require "chef/json_compat"
+require "chef/mixin/params_validate"
+require "chef/exceptions"
+require "chef/server_api"
class Chef
# Class for interacting with a chef key object. Can be used to create new keys,
@@ -149,9 +149,9 @@ class Chef
end
payload = {"name" => @name}
- payload['public_key'] = @public_key unless @public_key.nil?
- payload['create_key'] = @create_key if @create_key
- payload['expiration_date'] = @expiration_date unless @expiration_date.nil?
+ payload["public_key"] = @public_key unless @public_key.nil?
+ payload["create_key"] = @create_key if @create_key
+ payload["expiration_date"] = @expiration_date unless @expiration_date.nil?
result = chef_rest.post("#{api_base}/#{@actor}/keys", payload)
# append the private key to the current key if the server returned one,
# since the POST endpoint just returns uri and private_key if needed.
@@ -210,11 +210,11 @@ class Chef
else
raise Chef::Exceptions::MissingKeyAttribute, "The hash passed to from_hash does not contain the key 'user' or 'client'. Please pass a hash that defines one of those keys."
end
- key.name key_hash['name'] if key_hash.key?('name')
- key.public_key key_hash['public_key'] if key_hash.key?('public_key')
- key.private_key key_hash['private_key'] if key_hash.key?('private_key')
- key.create_key key_hash['create_key'] if key_hash.key?('create_key')
- key.expiration_date key_hash['expiration_date'] if key_hash.key?('expiration_date')
+ key.name key_hash["name"] if key_hash.key?("name")
+ key.public_key key_hash["public_key"] if key_hash.key?("public_key")
+ key.private_key key_hash["private_key"] if key_hash.key?("private_key")
+ key.create_key key_hash["create_key"] if key_hash.key?("create_key")
+ key.expiration_date key_hash["expiration_date"] if key_hash.key?("expiration_date")
key
end
@@ -252,7 +252,7 @@ class Chef
OpenSSL::ASN1::Integer.new(openssl_key_object.public_key.n),
OpenSSL::ASN1::Integer.new(openssl_key_object.public_key.e),
])
- OpenSSL::Digest::SHA1.hexdigest(data_string.to_der).scan(/../).join(':')
+ OpenSSL::Digest::SHA1.hexdigest(data_string.to_der).scan(/../).join(":")
end
private
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index 34e437c82f..fdc34d1c49 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -17,20 +17,20 @@
# limitations under the License.
#
-require 'forwardable'
-require 'chef/version'
-require 'mixlib/cli'
-require 'chef/workstation_config_loader'
-require 'chef/mixin/convert_to_class_name'
-require 'chef/mixin/path_sanity'
-require 'chef/knife/core/subcommand_loader'
-require 'chef/knife/core/ui'
-require 'chef/local_mode'
-require 'chef/server_api'
-require 'chef/http/authenticator'
-require 'chef/http/http_request'
-require 'chef/http'
-require 'pp'
+require "forwardable"
+require "chef/version"
+require "mixlib/cli"
+require "chef/workstation_config_loader"
+require "chef/mixin/convert_to_class_name"
+require "chef/mixin/path_sanity"
+require "chef/knife/core/subcommand_loader"
+require "chef/knife/core/ui"
+require "chef/local_mode"
+require "chef/server_api"
+require "chef/http/authenticator"
+require "chef/http/http_request"
+require "chef/http"
+require "pp"
class Chef
class Knife
@@ -116,15 +116,15 @@ class Chef
end
def self.subcommand_category
- @category || snake_case_name.split('_').first unless unnamed?
+ @category || snake_case_name.split("_").first unless unnamed?
end
def self.snake_case_name
- convert_to_snake_case(name.split('::').last) unless unnamed?
+ convert_to_snake_case(name.split("::").last) unless unnamed?
end
def self.common_name
- snake_case_name.split('_').join(' ')
+ snake_case_name.split("_").join(" ")
end
# Does this class have a name? (Classes created via Class.new don't)
@@ -201,7 +201,7 @@ class Chef
# config file is read may be lost. If the KNIFE_DEBUG variable is set, we
# setup the logger for debug logging to stderr immediately to catch info
# from early in the setup process.
- if ENV['KNIFE_DEBUG']
+ if ENV["KNIFE_DEBUG"]
Chef::Log.init($stderr)
Chef::Log.level(:debug)
end
@@ -262,7 +262,7 @@ class Chef
end
def self.list_commands(preferred_category=nil)
- category_desc = preferred_category ? preferred_category + " " : ''
+ category_desc = preferred_category ? preferred_category + " " : ""
msg "Available #{category_desc}subcommands: (for details, knife SUB-COMMAND --help)\n\n"
subcommand_loader.list_commands(preferred_category).sort.each do |category, commands|
next if category =~ /deprecated/i
@@ -289,16 +289,16 @@ class Chef
super() # having to call super in initialize is the most annoying anti-pattern :(
@ui = Chef::Knife::UI.new(STDOUT, STDERR, STDIN, config)
- command_name_words = self.class.snake_case_name.split('_')
+ command_name_words = self.class.snake_case_name.split("_")
# Mixlib::CLI ignores the embedded name_args
@name_args = parse_options(argv)
- @name_args.delete(command_name_words.join('-'))
+ @name_args.delete(command_name_words.join("-"))
@name_args.reject! { |name_arg| command_name_words.delete(name_arg) }
# knife node run_list add requires that we have extra logic to handle
# the case that command name words could be joined by an underscore :/
- command_name_words = command_name_words.join('_')
+ command_name_words = command_name_words.join("_")
@name_args.reject! { |name_arg| command_name_words == name_arg }
if config[:help]
@@ -361,7 +361,7 @@ class Chef
Chef::Config[:log_level] = :debug
end
- Chef::Config[:log_level] = :debug if ENV['KNIFE_DEBUG']
+ Chef::Config[:log_level] = :debug if ENV["KNIFE_DEBUG"]
Chef::Config[:node_name] = config[:node_name] if config[:node_name]
Chef::Config[:client_key] = config[:client_key] if config[:client_key]
@@ -504,7 +504,7 @@ class Chef
#--
# TODO: this code belongs in Chef::REST
def format_rest_error(response)
- Array(Chef::JSONCompat.from_json(response.body)["error"]).join('; ')
+ Array(Chef::JSONCompat.from_json(response.body)["error"]).join("; ")
rescue Exception
response.body
end
@@ -553,14 +553,14 @@ class Chef
def rest
@rest ||= begin
- require 'chef/server_api'
+ require "chef/server_api"
Chef::ServerAPI.new(Chef::Config[:chef_server_url])
end
end
def noauth_rest
@rest ||= begin
- require 'chef/http/simple_json'
+ require "chef/http/simple_json"
Chef::HTTP::SimpleJSON.new(Chef::Config[:chef_server_url])
end
end
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index a429c7246b..23ec98e563 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/data_bag_secret_options'
-require 'erubis'
-require 'chef/knife/bootstrap/chef_vault_handler'
-require 'chef/knife/bootstrap/client_builder'
-require 'chef/util/path_helper'
+require "chef/knife"
+require "chef/knife/data_bag_secret_options"
+require "erubis"
+require "chef/knife/bootstrap/chef_vault_handler"
+require "chef/knife/bootstrap/client_builder"
+require "chef/util/path_helper"
class Chef
class Knife
@@ -32,13 +32,13 @@ class Chef
attr_accessor :chef_vault_handler
deps do
- require 'chef/knife/core/bootstrap_context'
- require 'chef/json_compat'
- require 'tempfile'
- require 'highline'
- require 'net/ssh'
- require 'net/ssh/multi'
- require 'chef/knife/ssh'
+ require "chef/knife/core/bootstrap_context"
+ require "chef/json_compat"
+ require "tempfile"
+ require "highline"
+ require "net/ssh"
+ require "net/ssh/multi"
+ require "chef/knife/ssh"
Chef::Knife::Ssh.load_deps
end
@@ -232,15 +232,15 @@ class Chef
: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',
+ :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(/:/)
@@ -282,13 +282,13 @@ class Chef
# @return [String] The DNS or IP that bootstrap will connect to
def server_name
if host_descriptor
- @server_name ||= host_descriptor.split('@').reverse[0]
+ @server_name ||= host_descriptor.split("@").reverse[0]
end
end
def user_name
if host_descriptor
- @user_name ||= host_descriptor.split('@').reverse[1]
+ @user_name ||= host_descriptor.split("@").reverse[1]
end
end
@@ -310,9 +310,9 @@ class Chef
# Otherwise search the template directories until we find the right one
bootstrap_files = []
- bootstrap_files << File.join(File.dirname(__FILE__), 'bootstrap/templates', "#{template}.erb")
+ bootstrap_files << File.join(File.dirname(__FILE__), "bootstrap/templates", "#{template}.erb")
bootstrap_files << File.join(Knife.chef_config_dir, "bootstrap", "#{template}.erb") if Chef::Knife.chef_config_dir
- Chef::Util::PathHelper.home('.chef', 'bootstrap', "#{template}.erb") {|p| bootstrap_files << p}
+ Chef::Util::PathHelper.home(".chef", "bootstrap", "#{template}.erb") {|p| bootstrap_files << p}
bootstrap_files << Gem.find_files(File.join("chef","knife","bootstrap","#{template}.erb"))
bootstrap_files.flatten!
diff --git a/lib/chef/knife/bootstrap/chef_vault_handler.rb b/lib/chef/knife/bootstrap/chef_vault_handler.rb
index 9d0dfec621..6732c0f28d 100644
--- a/lib/chef/knife/bootstrap/chef_vault_handler.rb
+++ b/lib/chef/knife/bootstrap/chef_vault_handler.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/knife/bootstrap'
+require "chef/knife/bootstrap"
class Chef
class Knife
@@ -143,8 +143,8 @@ class Chef
@require_chef_vault ||=
begin
error_message = "Knife bootstrap needs version 2.6.0 or higher of the chef-vault gem to configure chef vault items"
- require 'chef-vault'
- if Gem::Version.new(ChefVault::VERSION) < Gem::Version.new('2.6.0')
+ require "chef-vault"
+ if Gem::Version.new(ChefVault::VERSION) < Gem::Version.new("2.6.0")
raise error_message
end
true
diff --git a/lib/chef/knife/bootstrap/client_builder.rb b/lib/chef/knife/bootstrap/client_builder.rb
index f5a2ff2bb1..a955b759e2 100644
--- a/lib/chef/knife/bootstrap/client_builder.rb
+++ b/lib/chef/knife/bootstrap/client_builder.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/node'
-require 'chef/server_api'
-require 'chef/api_client/registration'
-require 'chef/api_client'
-require 'chef/knife/bootstrap'
-require 'tmpdir'
+require "chef/node"
+require "chef/server_api"
+require "chef/api_client/registration"
+require "chef/api_client"
+require "chef/knife/bootstrap"
+require "tmpdir"
class Chef
class Knife
diff --git a/lib/chef/knife/client_bulk_delete.rb b/lib/chef/knife/client_bulk_delete.rb
index b439e6f995..9ee9a303df 100644
--- a/lib/chef/knife/client_bulk_delete.rb
+++ b/lib/chef/knife/client_bulk_delete.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class ClientBulkDelete < Knife
deps do
- require 'chef/api_client_v1'
- require 'chef/json_compat'
+ require "chef/api_client_v1"
+ require "chef/json_compat"
end
option :delete_validators,
diff --git a/lib/chef/knife/client_create.rb b/lib/chef/knife/client_create.rb
index fa9a1a7e32..43f087e5d0 100644
--- a/lib/chef/knife/client_create.rb
+++ b/lib/chef/knife/client_create.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class ClientCreate < Knife
deps do
- require 'chef/api_client_v1'
- require 'chef/json_compat'
+ require "chef/api_client_v1"
+ require "chef/json_compat"
end
option :file,
diff --git a/lib/chef/knife/client_delete.rb b/lib/chef/knife/client_delete.rb
index a49c0867a8..f94010a4ce 100644
--- a/lib/chef/knife/client_delete.rb
+++ b/lib/chef/knife/client_delete.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class ClientDelete < Knife
deps do
- require 'chef/api_client_v1'
- require 'chef/json_compat'
+ require "chef/api_client_v1"
+ require "chef/json_compat"
end
option :delete_validators,
@@ -43,7 +43,7 @@ class Chef
exit 1
end
- delete_object(Chef::ApiClientV1, @client_name, 'client') {
+ delete_object(Chef::ApiClientV1, @client_name, "client") {
object = Chef::ApiClientV1.load(@client_name)
if object.validator
unless config[:delete_validators]
diff --git a/lib/chef/knife/client_edit.rb b/lib/chef/knife/client_edit.rb
index 5dcd8f212b..df3ede04c9 100644
--- a/lib/chef/knife/client_edit.rb
+++ b/lib/chef/knife/client_edit.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class ClientEdit < Knife
deps do
- require 'chef/api_client_v1'
- require 'chef/json_compat'
+ require "chef/api_client_v1"
+ require "chef/json_compat"
end
banner "knife client edit CLIENT (options)"
diff --git a/lib/chef/knife/client_key_create.rb b/lib/chef/knife/client_key_create.rb
index 3b7e97eb24..bf103678a8 100644
--- a/lib/chef/knife/client_key_create.rb
+++ b/lib/chef/knife/client_key_create.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/key_create_base'
+require "chef/knife"
+require "chef/knife/key_create_base"
class Chef
class Knife
@@ -43,7 +43,7 @@ class Chef
end
def actor_field_name
- 'client'
+ "client"
end
def service_object
@@ -51,7 +51,7 @@ class Chef
end
def actor_missing_error
- 'You must specify a client name'
+ "You must specify a client name"
end
def apply_params!(params)
diff --git a/lib/chef/knife/client_key_delete.rb b/lib/chef/knife/client_key_delete.rb
index 8ecdfe1ec8..c76197a02d 100644
--- a/lib/chef/knife/client_key_delete.rb
+++ b/lib/chef/knife/client_key_delete.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -42,15 +42,15 @@ class Chef
end
def actor_field_name
- 'client'
+ "client"
end
def actor_missing_error
- 'You must specify a client name'
+ "You must specify a client name"
end
def keyname_missing_error
- 'You must specify a key name'
+ "You must specify a key name"
end
def service_object
diff --git a/lib/chef/knife/client_key_edit.rb b/lib/chef/knife/client_key_edit.rb
index 1de45f4ca2..5aa4dc4781 100644
--- a/lib/chef/knife/client_key_edit.rb
+++ b/lib/chef/knife/client_key_edit.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/key_edit_base'
+require "chef/knife"
+require "chef/knife/key_edit_base"
class Chef
class Knife
@@ -30,7 +30,7 @@ class Chef
class ClientKeyEdit < Knife
include Chef::Knife::KeyEditBase
- banner 'knife client key edit CLIENT KEYNAME (options)'
+ banner "knife client key edit CLIENT KEYNAME (options)"
attr_reader :actor
@@ -45,7 +45,7 @@ class Chef
end
def actor_field_name
- 'client'
+ "client"
end
def service_object
@@ -53,11 +53,11 @@ class Chef
end
def actor_missing_error
- 'You must specify a client name'
+ "You must specify a client name"
end
def keyname_missing_error
- 'You must specify a key name'
+ "You must specify a key name"
end
def apply_params!(params)
diff --git a/lib/chef/knife/client_key_list.rb b/lib/chef/knife/client_key_list.rb
index f6f29ae03f..5679cc43e2 100644
--- a/lib/chef/knife/client_key_list.rb
+++ b/lib/chef/knife/client_key_list.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/key_list_base'
+require "chef/knife"
+require "chef/knife/key_list_base"
class Chef
class Knife
@@ -49,7 +49,7 @@ class Chef
end
def actor_missing_error
- 'You must specify a client name'
+ "You must specify a client name"
end
def service_object
diff --git a/lib/chef/knife/client_key_show.rb b/lib/chef/knife/client_key_show.rb
index c39a279000..7ec32dd761 100644
--- a/lib/chef/knife/client_key_show.rb
+++ b/lib/chef/knife/client_key_show.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -46,11 +46,11 @@ class Chef
end
def actor_missing_error
- 'You must specify a client name'
+ "You must specify a client name"
end
def keyname_missing_error
- 'You must specify a key name'
+ "You must specify a key name"
end
def service_object
diff --git a/lib/chef/knife/client_list.rb b/lib/chef/knife/client_list.rb
index d8a3698b6a..d5bfb4600a 100644
--- a/lib/chef/knife/client_list.rb
+++ b/lib/chef/knife/client_list.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class ClientList < Knife
deps do
- require 'chef/api_client_v1'
- require 'chef/json_compat'
+ require "chef/api_client_v1"
+ require "chef/json_compat"
end
banner "knife client list (options)"
diff --git a/lib/chef/knife/client_reregister.rb b/lib/chef/knife/client_reregister.rb
index b94761e718..ac52f41fae 100644
--- a/lib/chef/knife/client_reregister.rb
+++ b/lib/chef/knife/client_reregister.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class ClientReregister < Knife
deps do
- require 'chef/api_client_v1'
- require 'chef/json_compat'
+ require "chef/api_client_v1"
+ require "chef/json_compat"
end
banner "knife client reregister CLIENT (options)"
diff --git a/lib/chef/knife/client_show.rb b/lib/chef/knife/client_show.rb
index bdac3f9758..a41ea4d7ce 100644
--- a/lib/chef/knife/client_show.rb
+++ b/lib/chef/knife/client_show.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -25,8 +25,8 @@ class Chef
include Knife::Core::MultiAttributeReturnOption
deps do
- require 'chef/api_client_v1'
- require 'chef/json_compat'
+ require "chef/api_client_v1"
+ require "chef/json_compat"
end
banner "knife client show CLIENT (options)"
diff --git a/lib/chef/knife/configure.rb b/lib/chef/knife/configure.rb
index 8bb8930aee..f4d539aa13 100644
--- a/lib/chef/knife/configure.rb
+++ b/lib/chef/knife/configure.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -25,7 +25,7 @@ class Chef
attr_reader :chef_repo, :new_client_key, :validation_client_name, :validation_key
deps do
- require 'ohai'
+ require "ohai"
Chef::Knife::ClientCreate.load_deps
Chef::Knife::UserCreate.load_deps
end
@@ -61,7 +61,7 @@ class Chef
def configure_chef
# We are just faking out the system so that you can do this without a key specified
- Chef::Config[:node_name] = 'woot'
+ Chef::Config[:node_name] = "woot"
super
Chef::Config[:node_name] = nil
end
@@ -136,14 +136,14 @@ EOH
@chef_server = config[:chef_server_url] || ask_question("Please enter the chef server URL: ", :default => "https://#{server_name}:443")
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')
+ @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)
end
- @validation_client_name = config[:validation_client_name] || ask_question("Please enter the validation clientname: ", :default => 'chef-validator')
- @validation_key = config[:validation_key] || ask_question("Please enter the location of the validation key: ", :default => '/etc/chef-server/chef-validator.pem')
+ @validation_client_name = config[:validation_client_name] || ask_question("Please enter the validation clientname: ", :default => "chef-validator")
+ @validation_key = config[:validation_key] || ask_question("Please enter the location of the validation key: ", :default => "/etc/chef-server/chef-validator.pem")
@validation_key = File.expand_path(@validation_key)
@chef_repo = config[:repository] || ask_question("Please enter the path to a chef repository (or leave blank): ")
@@ -154,9 +154,9 @@ EOH
def guess_servername
o = Ohai::System.new
o.load_plugins
- o.require_plugin 'os'
- o.require_plugin 'hostname'
- o[:fqdn] || o[:machinename] || o[:hostname] || 'localhost'
+ o.require_plugin "os"
+ o.require_plugin "hostname"
+ o[:fqdn] || o[:machinename] || o[:hostname] || "localhost"
end
def config_file
diff --git a/lib/chef/knife/configure_client.rb b/lib/chef/knife/configure_client.rb
index 838d9a1f58..d1d1b2f3de 100644
--- a/lib/chef/knife/configure_client.rb
+++ b/lib/chef/knife/configure_client.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -34,13 +34,13 @@ class Chef
FileUtils.mkdir_p(@config_dir)
ui.info("Writing client.rb")
File.open(File.join(@config_dir, "client.rb"), "w") do |file|
- file.puts('log_level :info')
- file.puts('log_location STDOUT')
+ file.puts("log_level :info")
+ file.puts("log_location STDOUT")
file.puts("chef_server_url '#{Chef::Config[:chef_server_url]}'")
file.puts("validation_client_name '#{Chef::Config[:validation_client_name]}'")
end
ui.info("Writing validation.pem")
- File.open(File.join(@config_dir, 'validation.pem'), "w") do |validation|
+ File.open(File.join(@config_dir, "validation.pem"), "w") do |validation|
validation.puts(IO.read(Chef::Config[:validation_key]))
end
end
diff --git a/lib/chef/knife/cookbook_bulk_delete.rb b/lib/chef/knife/cookbook_bulk_delete.rb
index ec0d06937f..0a08fd5d46 100644
--- a/lib/chef/knife/cookbook_bulk_delete.rb
+++ b/lib/chef/knife/cookbook_bulk_delete.rb
@@ -17,18 +17,18 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class CookbookBulkDelete < Knife
deps do
- require 'chef/knife/cookbook_delete'
- require 'chef/cookbook_version'
+ require "chef/knife/cookbook_delete"
+ 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_create.rb b/lib/chef/knife/cookbook_create.rb
index 97f6e65d3c..391a9aee85 100644
--- a/lib/chef/knife/cookbook_create.rb
+++ b/lib/chef/knife/cookbook_create.rb
@@ -16,16 +16,16 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class CookbookCreate < Knife
deps do
- require 'chef/json_compat'
- require 'uri'
- require 'fileutils'
+ require "chef/json_compat"
+ require "uri"
+ require "fileutils"
end
banner "knife cookbook create COOKBOOK (options)"
@@ -182,8 +182,8 @@ EOH
def create_changelog(dir, cookbook_name)
msg("** Creating CHANGELOG for cookbook: #{cookbook_name}")
- unless File.exists?(File.join(dir,cookbook_name,'CHANGELOG.md'))
- open(File.join(dir, cookbook_name, 'CHANGELOG.md'),'w') do |file|
+ unless File.exists?(File.join(dir,cookbook_name,"CHANGELOG.md"))
+ open(File.join(dir, cookbook_name, "CHANGELOG.md"),"w") do |file|
file.puts <<-EOH
#{cookbook_name} CHANGELOG
#{'='*"#{cookbook_name} CHANGELOG".length}
diff --git a/lib/chef/knife/cookbook_delete.rb b/lib/chef/knife/cookbook_delete.rb
index 5fe0e9664d..8112ed11f9 100644
--- a/lib/chef/knife/cookbook_delete.rb
+++ b/lib/chef/knife/cookbook_delete.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -25,12 +25,12 @@ class Chef
attr_accessor :cookbook_name, :version
deps do
- require 'chef/cookbook_version'
+ 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)"
@@ -106,7 +106,7 @@ class Chef
end
valid_responses[(available_versions.size + 1).to_s] = :all
question << "#{available_versions.size + 1}. All versions\n\n"
- responses = ask_question(question).split(',').map { |response| response.strip }
+ responses = ask_question(question).split(",").map { |response| response.strip }
if responses.empty?
ui.error("No versions specified, exiting")
diff --git a/lib/chef/knife/cookbook_download.rb b/lib/chef/knife/cookbook_download.rb
index 6ba5fc7d6c..0af5e3b89a 100644
--- a/lib/chef/knife/cookbook_download.rb
+++ b/lib/chef/knife/cookbook_download.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -27,7 +27,7 @@ class Chef
attr_accessor :cookbook_name
deps do
- require 'chef/cookbook_version'
+ require "chef/cookbook_version"
end
banner "knife cookbook download COOKBOOK [VERSION] (options)"
@@ -87,10 +87,10 @@ class Chef
next unless manifest.has_key?(segment)
ui.info("Downloading #{segment}")
manifest[segment].each do |segment_file|
- dest = File.join(basedir, segment_file['path'].gsub('/', File::SEPARATOR))
+ dest = File.join(basedir, segment_file["path"].gsub("/", File::SEPARATOR))
Chef::Log.debug("Downloading #{segment_file['path']} to #{dest}")
FileUtils.mkdir_p(File.dirname(dest))
- tempfile = rest.streaming_request(segment_file['url'])
+ tempfile = rest.streaming_request(segment_file["url"])
FileUtils.mv(tempfile.path, dest)
end
end
diff --git a/lib/chef/knife/cookbook_list.rb b/lib/chef/knife/cookbook_list.rb
index dd78e854da..8b8fb163f9 100644
--- a/lib/chef/knife/cookbook_list.rb
+++ b/lib/chef/knife/cookbook_list.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
diff --git a/lib/chef/knife/cookbook_metadata.rb b/lib/chef/knife/cookbook_metadata.rb
index dfa69ae39f..66cb452d39 100644
--- a/lib/chef/knife/cookbook_metadata.rb
+++ b/lib/chef/knife/cookbook_metadata.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class CookbookMetadata < Knife
deps do
- require 'chef/cookbook_loader'
- require 'chef/cookbook/metadata'
+ require "chef/cookbook_loader"
+ require "chef/cookbook/metadata"
end
banner "knife cookbook metadata COOKBOOK (options)"
@@ -62,7 +62,7 @@ class Chef
def generate_metadata(cookbook)
Array(config[:cookbook_path]).reverse.each do |path|
- file = File.expand_path(File.join(path, cookbook, 'metadata.rb'))
+ file = File.expand_path(File.join(path, cookbook, "metadata.rb"))
if File.exists?(file)
generate_metadata_from_file(cookbook, file)
else
@@ -76,7 +76,7 @@ class Chef
md = Chef::Cookbook::Metadata.new
md.name(cookbook)
md.from_file(file)
- json_file = File.join(File.dirname(file), 'metadata.json')
+ json_file = File.join(File.dirname(file), "metadata.json")
File.open(json_file, "w") do |f|
f.write(Chef::JSONCompat.to_json_pretty(md))
end
@@ -91,7 +91,7 @@ class Chef
end
def validate_metadata_json(path, cookbook)
- json_file = File.join(path, cookbook, 'metadata.json')
+ json_file = File.join(path, cookbook, "metadata.json")
if File.exist?(json_file)
Chef::Cookbook::Metadata.validate_json(IO.read(json_file))
end
diff --git a/lib/chef/knife/cookbook_metadata_from_file.rb b/lib/chef/knife/cookbook_metadata_from_file.rb
index 8e26251d6e..51f3bdbb84 100644
--- a/lib/chef/knife/cookbook_metadata_from_file.rb
+++ b/lib/chef/knife/cookbook_metadata_from_file.rb
@@ -19,14 +19,14 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class CookbookMetadataFromFile < Knife
deps do
- require 'chef/cookbook/metadata'
+ require "chef/cookbook/metadata"
end
banner "knife cookbook metadata from FILE (options)"
diff --git a/lib/chef/knife/cookbook_show.rb b/lib/chef/knife/cookbook_show.rb
index 07f7684c27..2229bd9d0e 100644
--- a/lib/chef/knife/cookbook_show.rb
+++ b/lib/chef/knife/cookbook_show.rb
@@ -16,16 +16,16 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class CookbookShow < Knife
deps do
- require 'chef/json_compat'
- require 'uri'
- require 'chef/cookbook_version'
+ require "chef/json_compat"
+ require "uri"
+ require "chef/cookbook_version"
end
banner "knife cookbook show COOKBOOK [VERSION] [PART] [FILENAME] (options)"
@@ -65,7 +65,7 @@ class Chef
end
cookbook_name, segment, filename = @name_args[0], @name_args[2], @name_args[3]
- cookbook_version = @name_args[1] == 'latest' ? '_latest' : @name_args[1]
+ cookbook_version = @name_args[1] == "latest" ? "_latest" : @name_args[1]
cookbook = rest.get("cookbooks/#{cookbook_name}/#{cookbook_version}")
manifest_entry = cookbook.preferred_manifest_record(node, segment, filename)
@@ -76,11 +76,11 @@ class Chef
pretty_print(temp_file.read)
when 3 # We are showing a specific part of the cookbook
- cookbook_version = @name_args[1] == 'latest' ? '_latest' : @name_args[1]
+ cookbook_version = @name_args[1] == "latest" ? "_latest" : @name_args[1]
result = rest.get("cookbooks/#{@name_args[0]}/#{cookbook_version}")
output(result.manifest[@name_args[2]])
when 2 # We are showing the whole cookbook data
- cookbook_version = @name_args[1] == 'latest' ? '_latest' : @name_args[1]
+ cookbook_version = @name_args[1] == "latest" ? "_latest" : @name_args[1]
output(rest.get("cookbooks/#{@name_args[0]}/#{cookbook_version}"))
when 1 # We are showing the cookbook versions (all of them)
cookbook_name = @name_args[0]
diff --git a/lib/chef/knife/cookbook_site_download.rb b/lib/chef/knife/cookbook_site_download.rb
index 3aedd21ffa..2e66495bb5 100644
--- a/lib/chef/knife/cookbook_site_download.rb
+++ b/lib/chef/knife/cookbook_site_download.rb
@@ -15,14 +15,14 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class CookbookSiteDownload < Knife
deps do
- require 'fileutils'
+ require "fileutils"
end
banner "knife cookbook site download COOKBOOK [VERSION] (options)"
@@ -39,12 +39,12 @@ class Chef
def run
if current_cookbook_deprecated?
- message = 'DEPRECATION: This cookbook has been deprecated. '
+ message = "DEPRECATION: This cookbook has been deprecated. "
message << "It has been replaced by #{replacement_cookbook}."
ui.warn message
unless config[:force]
- ui.warn 'Use --force to force download deprecated cookbook.'
+ ui.warn "Use --force to force download deprecated cookbook."
return
end
end
@@ -53,12 +53,12 @@ class Chef
end
def version
- @version = desired_cookbook_data['version']
+ @version = desired_cookbook_data["version"]
end
private
def cookbooks_api_url
- 'https://supermarket.chef.io/api/v1/cookbooks'
+ "https://supermarket.chef.io/api/v1/cookbooks"
end
def current_cookbook_data
@@ -68,13 +68,13 @@ class Chef
end
def current_cookbook_deprecated?
- current_cookbook_data['deprecated'] == true
+ current_cookbook_data["deprecated"] == true
end
def desired_cookbook_data
@desired_cookbook_data ||= begin
uri = if @name_args.length == 1
- current_cookbook_data['latest_version']
+ current_cookbook_data["latest_version"]
else
specific_cookbook_version_url
end
@@ -98,7 +98,7 @@ class Chef
end
def replacement_cookbook
- replacement = File.basename(current_cookbook_data['replacement'])
+ replacement = File.basename(current_cookbook_data["replacement"])
end
def specific_cookbook_version_url
diff --git a/lib/chef/knife/cookbook_site_install.rb b/lib/chef/knife/cookbook_site_install.rb
index cc68fe7897..cb6eeffc68 100644
--- a/lib/chef/knife/cookbook_site_install.rb
+++ b/lib/chef/knife/cookbook_site_install.rb
@@ -16,18 +16,18 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/exceptions'
-require 'shellwords'
+require "chef/knife"
+require "chef/exceptions"
+require "shellwords"
class Chef
class Knife
class CookbookSiteInstall < Knife
deps do
- require 'chef/mixin/shell_out'
- require 'chef/knife/core/cookbook_scm_repo'
- require 'chef/cookbook/metadata'
+ require "chef/mixin/shell_out"
+ require "chef/knife/core/cookbook_scm_repo"
+ require "chef/cookbook/metadata"
end
banner "knife cookbook site install COOKBOOK [VERSION] (options)"
@@ -156,7 +156,7 @@ class Chef
def convert_path(upstream_file)
# converts a Windows path (C:\foo) to a mingw path (/c/foo)
- if ENV['MSYSTEM'] == 'MINGW32'
+ if ENV["MSYSTEM"] == "MINGW32"
return upstream_file.sub(/^([[:alpha:]]):/, '/\1')
else
return Shellwords.escape upstream_file
diff --git a/lib/chef/knife/cookbook_site_list.rb b/lib/chef/knife/cookbook_site_list.rb
index b5354ed6e6..7d3100dcda 100644
--- a/lib/chef/knife/cookbook_site_list.rb
+++ b/lib/chef/knife/cookbook_site_list.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -33,7 +33,7 @@ class Chef
def run
if config[:with_uri]
cookbooks = Hash.new
- get_cookbook_list.each{ |k,v| cookbooks[k] = v['cookbook'] }
+ get_cookbook_list.each{ |k,v| cookbooks[k] = v["cookbook"] }
ui.output(format_for_display(cookbooks))
else
ui.msg(ui.list(get_cookbook_list.keys.sort, :columns_down))
diff --git a/lib/chef/knife/cookbook_site_search.rb b/lib/chef/knife/cookbook_site_search.rb
index decbf6c2c3..0cade56f7a 100644
--- a/lib/chef/knife/cookbook_site_search.rb
+++ b/lib/chef/knife/cookbook_site_search.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
diff --git a/lib/chef/knife/cookbook_site_share.rb b/lib/chef/knife/cookbook_site_share.rb
index c125c4b939..f926a38722 100644
--- a/lib/chef/knife/cookbook_site_share.rb
+++ b/lib/chef/knife/cookbook_site_share.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/mixin/shell_out'
+require "chef/knife"
+require "chef/mixin/shell_out"
class Chef
class Knife
@@ -26,10 +26,10 @@ class Chef
include Chef::Mixin::ShellOut
deps do
- require 'chef/cookbook_loader'
- require 'chef/cookbook_uploader'
- require 'chef/cookbook_site_streaming_uploader'
- require 'mixlib/shellout'
+ require "chef/cookbook_loader"
+ require "chef/cookbook_uploader"
+ require "chef/cookbook_site_streaming_uploader"
+ require "mixlib/shellout"
end
include Chef::Mixin::ShellOut
@@ -44,8 +44,8 @@ class Chef
:proc => lambda { |o| Chef::Config.cookbook_path = o.split(":") }
option :dry_run,
- :long => '--dry-run',
- :short => '-n',
+ :long => "--dry-run",
+ :short => "-n",
:boolean => true,
:default => false,
:description => "Don't take action, only print what files will be uploaded to Supermarket."
@@ -113,7 +113,7 @@ class Chef
ui.fatal("Received an error from Supermarket: #{data["error_code"]}. On the first time you upload it, you are required to specify the category you want to share this cookbook to.")
exit(1)
else
- data['category']
+ data["category"]
end
rescue => e
ui.fatal("Unable to reach Supermarket: #{e.message}. Increase log verbosity (-VV) for more information.")
@@ -125,7 +125,7 @@ class Chef
def do_upload(cookbook_filename, cookbook_category, user_id, user_secret_filename)
uri = "https://supermarket.chef.io/api/v1/cookbooks"
- category_string = Chef::JSONCompat.to_json({ 'category'=>cookbook_category })
+ 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),
@@ -134,8 +134,8 @@ class Chef
res = Chef::JSONCompat.from_json(http_resp.body)
if http_resp.code.to_i != 201
- if res['error_messages']
- if res['error_messages'][0] =~ /Version already exists/
+ if res["error_messages"]
+ if res["error_messages"][0] =~ /Version already exists/
ui.error "The same version of this cookbook already exists on Supermarket."
exit(1)
else
diff --git a/lib/chef/knife/cookbook_site_show.rb b/lib/chef/knife/cookbook_site_show.rb
index 521a60eb36..01ed6c2346 100644
--- a/lib/chef/knife/cookbook_site_show.rb
+++ b/lib/chef/knife/cookbook_site_show.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
diff --git a/lib/chef/knife/cookbook_site_unshare.rb b/lib/chef/knife/cookbook_site_unshare.rb
index 0c196c328a..bb857b7d1d 100644
--- a/lib/chef/knife/cookbook_site_unshare.rb
+++ b/lib/chef/knife/cookbook_site_unshare.rb
@@ -17,14 +17,14 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class CookbookSiteUnshare < Knife
deps do
- require 'chef/json_compat'
+ require "chef/json_compat"
end
banner "knife cookbook site unshare COOKBOOK"
diff --git a/lib/chef/knife/cookbook_site_vendor.rb b/lib/chef/knife/cookbook_site_vendor.rb
index 82575958bd..9f4399f4cb 100644
--- a/lib/chef/knife/cookbook_site_vendor.rb
+++ b/lib/chef/knife/cookbook_site_vendor.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/cookbook_site_install'
+require "chef/knife"
+require "chef/knife/cookbook_site_install"
class Chef::Knife::CookbookSiteVendor < Chef::Knife::CookbookSiteInstall
@@ -41,6 +41,6 @@ DEPRECATED: please use knife cookbook site install
#{superclass.banner}
B
- category 'deprecated'
+ category "deprecated"
end
diff --git a/lib/chef/knife/cookbook_test.rb b/lib/chef/knife/cookbook_test.rb
index 91e0b55c47..23bb7d8d78 100644
--- a/lib/chef/knife/cookbook_test.rb
+++ b/lib/chef/knife/cookbook_test.rb
@@ -18,15 +18,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class CookbookTest < Knife
deps do
- require 'chef/cookbook_loader'
- require 'chef/cookbook/syntax_check'
+ require "chef/cookbook_loader"
+ require "chef/cookbook/syntax_check"
end
banner "knife cookbook test [COOKBOOKS...] (options)"
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb
index b2acd74b4b..ba52d311ca 100644
--- a/lib/chef/knife/cookbook_upload.rb
+++ b/lib/chef/knife/cookbook_upload.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/cookbook_uploader'
+require "chef/knife"
+require "chef/cookbook_uploader"
class Chef
class Knife
@@ -29,9 +29,9 @@ class Chef
MATCH_CHECKSUM = /[0-9a-f]{32,}/
deps do
- require 'chef/exceptions'
- require 'chef/cookbook_loader'
- require 'chef/cookbook_uploader'
+ require "chef/exceptions"
+ require "chef/cookbook_loader"
+ require "chef/cookbook_uploader"
end
banner "knife cookbook upload [COOKBOOKS...] (options)"
@@ -43,8 +43,8 @@ class Chef
:proc => lambda { |o| o.split(":") }
option :freeze,
- :long => '--freeze',
- :description => 'Freeze this version of the cookbook so that it cannot be overwritten',
+ :long => "--freeze",
+ :description => "Freeze this version of the cookbook so that it cannot be overwritten",
:boolean => true
option :all,
@@ -53,19 +53,19 @@ class Chef
:description => "Upload all cookbooks, rather than just a single cookbook"
option :force,
- :long => '--force',
+ :long => "--force",
:boolean => true,
:description => "Update cookbook versions even if they have been frozen"
option :concurrency,
- :long => '--concurrency NUMBER_OF_THREADS',
+ :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',
+ :short => "-E",
+ :long => "--environment ENVIRONMENT",
:description => "Set ENVIRONMENT's version dependency match the version you're uploading.",
:default => nil
@@ -118,7 +118,7 @@ class Chef
end
ui.info("Uploaded all cookbooks.")
else
- cookbook_path = config[:cookbook_path].respond_to?(:join) ? config[:cookbook_path].join(', ') : config[:cookbook_path]
+ cookbook_path = config[:cookbook_path].respond_to?(:join) ? config[:cookbook_path].join(", ") : config[:cookbook_path]
ui.warn("Could not find any cookbooks in your cookbook path: #{cookbook_path}. Use --cookbook-path to specify the desired path.")
end
else
@@ -287,7 +287,7 @@ WARNING
if @server_side_cookbooks[cookbook_name].nil?
false
else
- versions = @server_side_cookbooks[cookbook_name]['versions'].collect {|versions| versions["version"]}
+ versions = @server_side_cookbooks[cookbook_name]["versions"].collect {|versions| versions["version"]}
Log.debug "Versions of cookbook '#{cookbook_name}' returned by the server: #{versions.join(", ")}"
@server_side_cookbooks[cookbook_name]["versions"].each do |versions_hash|
if Chef::VersionConstraint.new(version).include?(versions_hash["version"])
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb
index c39ae6837d..b0a759dd05 100644
--- a/lib/chef/knife/core/bootstrap_context.rb
+++ b/lib/chef/knife/core/bootstrap_context.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/run_list'
-require 'chef/util/path_helper'
+require "chef/run_list"
+require "chef/util/path_helper"
class Chef
class Knife
@@ -125,9 +125,9 @@ validation_client_name "#{@chef_config[:validation_client_name]}"
def start_chef
# If the user doesn't have a client path configure, let bash use the PATH for what it was designed for
- client_path = @chef_config[:chef_client_path] || 'chef-client'
+ client_path = @chef_config[:chef_client_path] || "chef-client"
s = "#{client_path} -j /etc/chef/first-boot.json"
- s << ' -l debug' if @config[:verbosity] and @config[:verbosity] >= 2
+ s << " -l debug" if @config[:verbosity] and @config[:verbosity] >= 2
s << " -E #{bootstrap_environment}" unless bootstrap_environment.nil?
s << " --no-color" unless @config[:color]
s
diff --git a/lib/chef/knife/core/cookbook_scm_repo.rb b/lib/chef/knife/core/cookbook_scm_repo.rb
index 727cff3153..f10bc969eb 100644
--- a/lib/chef/knife/core/cookbook_scm_repo.rb
+++ b/lib/chef/knife/core/cookbook_scm_repo.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/mixin/shell_out'
+require "chef/mixin/shell_out"
class Chef
class Knife
@@ -34,7 +34,7 @@ class Chef
def initialize(repo_path, ui, opts={})
@repo_path = repo_path
@ui = ui
- @default_branch = 'master'
+ @default_branch = "master"
@use_current_branch = false
apply_opts(opts)
end
@@ -57,7 +57,7 @@ class Chef
ui.info "If this is a new git repo, make sure you have at least one commit before installing cookbooks"
exit 1
end
- cmd = git('status --porcelain')
+ cmd = git("status --porcelain")
if cmd.stdout =~ DIRTY_REPO
ui.error "You have uncommitted changes to your cookbook repo (#{repo_path}):"
ui.msg cmd.stdout
@@ -124,13 +124,13 @@ class Chef
def get_current_branch()
ref = git("symbolic-ref HEAD").stdout
- ref.chomp.split('/')[2]
+ ref.chomp.split("/")[2]
end
private
def git_repo?(directory)
- if File.directory?(File.join(directory, '.git'))
+ if File.directory?(File.join(directory, ".git"))
return true
elsif File.dirname(directory) == directory
return false
@@ -142,9 +142,9 @@ class Chef
def apply_opts(opts)
opts.each do |option, value|
case option.to_s
- when 'default_branch'
+ when "default_branch"
@default_branch = value
- when 'use_current_branch'
+ when "use_current_branch"
@use_current_branch = value
end
end
diff --git a/lib/chef/knife/core/custom_manifest_loader.rb b/lib/chef/knife/core/custom_manifest_loader.rb
index c19e749f32..da3eee4d90 100644
--- a/lib/chef/knife/core/custom_manifest_loader.rb
+++ b/lib/chef/knife/core/custom_manifest_loader.rb
@@ -14,7 +14,7 @@
# limitations under the License.
#
-require 'chef/version'
+require "chef/version"
class Chef
class Knife
class SubcommandLoader
diff --git a/lib/chef/knife/core/gem_glob_loader.rb b/lib/chef/knife/core/gem_glob_loader.rb
index d09131aacb..bc987c907b 100644
--- a/lib/chef/knife/core/gem_glob_loader.rb
+++ b/lib/chef/knife/core/gem_glob_loader.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/version'
-require 'chef/util/path_helper'
+require "chef/version"
+require "chef/util/path_helper"
class Chef
class Knife
class SubcommandLoader
@@ -39,7 +39,7 @@ class Chef
# subcommand loader has been modified to load the plugins by using Kernel.load
# with the absolute path.
def gem_and_builtin_subcommands
- require 'rubygems'
+ require "rubygems"
find_subcommands_via_rubygems
rescue LoadError
find_subcommands_via_dirglob
@@ -47,7 +47,7 @@ class Chef
def find_subcommands_via_dirglob
# The "require paths" of the core knife subcommands bundled with chef
- files = Dir[File.join(Chef::Util::PathHelper.escape_glob(File.expand_path('../../../knife', __FILE__)), '*.rb')]
+ files = Dir[File.join(Chef::Util::PathHelper.escape_glob(File.expand_path("../../../knife", __FILE__)), "*.rb")]
subcommand_files = {}
files.each do |knife_file|
rel_path = knife_file[/#{CHEF_ROOT}#{Regexp.escape(File::SEPARATOR)}(.*)\.rb/,1]
@@ -57,7 +57,7 @@ class Chef
end
def find_subcommands_via_rubygems
- files = find_files_latest_gems 'chef/knife/*.rb'
+ files = find_files_latest_gems "chef/knife/*.rb"
subcommand_files = {}
files.each do |file|
rel_path = file[/(#{Regexp.escape File.join('chef', 'knife', '')}.*)\.rb/, 1]
diff --git a/lib/chef/knife/core/generic_presenter.rb b/lib/chef/knife/core/generic_presenter.rb
index 1b26becfa1..e0c5b5567c 100644
--- a/lib/chef/knife/core/generic_presenter.rb
+++ b/lib/chef/knife/core/generic_presenter.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife/core/text_formatter'
+require "chef/knife/core/text_formatter"
class Chef
class Knife
@@ -80,10 +80,10 @@ class Chef
when :json
Chef::JSONCompat.to_json_pretty(data)
when :yaml
- require 'yaml'
+ require "yaml"
YAML::dump(data)
when :pp
- require 'stringio'
+ require "stringio"
# If you were looking for some attribute and there is only one match
# just dump the attribute value
if config[:attribute] and data.length == 1
@@ -200,14 +200,14 @@ class Chef
if config[:with_uri]
item.inject({}) do |collected, (cookbook, versions)|
collected[cookbook] = Hash.new
- versions['versions'].each do |ver|
- collected[cookbook][ver['version']] = ver['url']
+ versions["versions"].each do |ver|
+ collected[cookbook][ver["version"]] = ver["url"]
end
collected
end
else
versions_by_cookbook = item.inject({}) do |collected, ( cookbook, versions )|
- collected[cookbook] = versions["versions"].map {|v| v['version']}
+ collected[cookbook] = versions["versions"].map {|v| v["version"]}
collected
end
key_length = versions_by_cookbook.empty? ? 0 : versions_by_cookbook.keys.map {|name| name.size }.max + 2
diff --git a/lib/chef/knife/core/hashed_command_loader.rb b/lib/chef/knife/core/hashed_command_loader.rb
index 6eb3635726..fe351e0ea9 100644
--- a/lib/chef/knife/core/hashed_command_loader.rb
+++ b/lib/chef/knife/core/hashed_command_loader.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'chef/version'
+require "chef/version"
class Chef
class Knife
class SubcommandLoader
@@ -24,7 +24,7 @@ class Chef
# for the given command.
#
class HashedCommandLoader < Chef::Knife::SubcommandLoader
- KEY = '_autogenerated_command_paths'
+ KEY = "_autogenerated_command_paths"
attr_accessor :manifest
def initialize(chef_config_dir, plugin_manifest)
@@ -34,8 +34,8 @@ class Chef
def guess_category(args)
category_words = positional_arguments(args)
- category_words.map! { |w| w.split('-') }.flatten!
- find_longest_key(manifest[KEY]["plugins_by_category"], category_words, ' ')
+ category_words.map! { |w| w.split("-") }.flatten!
+ find_longest_key(manifest[KEY]["plugins_by_category"], category_words, " ")
end
def list_commands(pref_category=nil)
diff --git a/lib/chef/knife/core/node_editor.rb b/lib/chef/knife/core/node_editor.rb
index 7b7cb72df9..9896195a97 100644
--- a/lib/chef/knife/core/node_editor.rb
+++ b/lib/chef/knife/core/node_editor.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/json_compat'
-require 'chef/node'
+require "chef/json_compat"
+require "chef/node"
class Chef
class Knife
@@ -104,9 +104,9 @@ class Chef
data = updated_data.dup
unless config[:all_attributes]
- data['automatic'] = node.automatic_attrs
- data['default'] = node.default_attrs
- data['override'] = node.override_attrs
+ data["automatic"] = node.automatic_attrs
+ data["default"] = node.default_attrs
+ data["override"] = node.override_attrs
end
@updated_node = Node.from_hash(data)
diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb
index 5192c53f51..ffd31ed953 100644
--- a/lib/chef/knife/core/node_presenter.rb
+++ b/lib/chef/knife/core/node_presenter.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife/core/text_formatter'
-require 'chef/knife/core/generic_presenter'
+require "chef/knife/core/text_formatter"
+require "chef/knife/core/generic_presenter"
class Chef
class Knife
@@ -32,18 +32,18 @@ class Chef
def self.included(includer)
includer.class_eval do
option :medium_output,
- :short => '-m',
- :long => '--medium',
+ :short => "-m",
+ :long => "--medium",
:boolean => true,
:default => false,
- :description => 'Include normal attributes in the output'
+ :description => "Include normal attributes in the output"
option :long_output,
- :short => '-l',
- :long => '--long',
+ :short => "-l",
+ :long => "--long",
:boolean => true,
:default => false,
- :description => 'Include all attributes in the output'
+ :description => "Include all attributes in the output"
end
end
end
diff --git a/lib/chef/knife/core/object_loader.rb b/lib/chef/knife/core/object_loader.rb
index 97ca381471..69c2428bd4 100644
--- a/lib/chef/knife/core/object_loader.rb
+++ b/lib/chef/knife/core/object_loader.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'ffi_yajl'
-require 'chef/util/path_helper'
-require 'chef/data_bag_item'
+require "ffi_yajl"
+require "chef/util/path_helper"
+require "chef/data_bag_item"
class Chef
class Knife
@@ -71,14 +71,14 @@ class Chef
#
# @api public
def find_all_objects(path)
- path = File.join(Chef::Util::PathHelper.escape_glob(File.expand_path(path)), '*')
- path << '.{json,rb}'
+ path = File.join(Chef::Util::PathHelper.escape_glob(File.expand_path(path)), "*")
+ path << ".{json,rb}"
objects = Dir.glob(path)
objects.map { |o| File.basename(o) }
end
def find_all_object_dirs(path)
- path = File.join(Chef::Util::PathHelper.escape_glob(File.expand_path(path)), '*')
+ path = File.join(Chef::Util::PathHelper.escape_glob(File.expand_path(path)), "*")
objects = Dir.glob(path)
objects.delete_if { |o| !File.directory?(o) }
objects.map { |o| File.basename(o) }
diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb
index 9cf839d3a6..4451835962 100644
--- a/lib/chef/knife/core/status_presenter.rb
+++ b/lib/chef/knife/core/status_presenter.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife/core/text_formatter'
-require 'chef/knife/core/generic_presenter'
+require "chef/knife/core/text_formatter"
+require "chef/knife/core/generic_presenter"
class Chef
class Knife
@@ -32,18 +32,18 @@ class Chef
def self.included(includer)
includer.class_eval do
option :medium_output,
- :short => '-m',
- :long => '--medium',
+ :short => "-m",
+ :long => "--medium",
:boolean => true,
:default => false,
- :description => 'Include normal attributes in the output'
+ :description => "Include normal attributes in the output"
option :long_output,
- :short => '-l',
- :long => '--long',
+ :short => "-l",
+ :long => "--long",
:boolean => true,
:default => false,
- :description => 'Include all attributes in the output'
+ :description => "Include all attributes in the output"
end
end
end
@@ -93,13 +93,13 @@ class Chef
# the volume of output is adjusted accordingly. Uses colors if enabled
# in the ui object.
def summarize(list)
- summarized=''
+ summarized=""
list.each do |data|
node = data
# special case ec2 with their split horizon whatsis.
ip = (node[:ec2] && node[:ec2][:public_ipv4]) || node[:ipaddress]
fqdn = (node[:ec2] && node[:ec2][:public_hostname]) || node[:fqdn]
- name = node['name'] || node.name
+ name = node["name"] || node.name
hours, minutes, _ = time_difference_in_hms(node["ohai_time"])
hours_text = "#{hours} hour#{hours == 1 ? ' ' : 's'}"
@@ -117,20 +117,20 @@ class Chef
end
line_parts = Array.new
- line_parts << @ui.color(text, color) + ' ago' << name
+ line_parts << @ui.color(text, color) + " ago" << name
line_parts << fqdn if fqdn
line_parts << ip if ip
line_parts << run_list if run_list
- if node['platform']
- platform = node['platform']
- if node['platform_version']
+ if node["platform"]
+ platform = node["platform"]
+ if node["platform_version"]
platform << " #{node['platform_version']}"
end
line_parts << platform
end
- summarized=summarized + line_parts.join(', ') + ".\n"
+ summarized=summarized + line_parts.join(", ") + ".\n"
end
summarized
end
diff --git a/lib/chef/knife/core/subcommand_loader.rb b/lib/chef/knife/core/subcommand_loader.rb
index 808e053c40..4a1ed2481a 100644
--- a/lib/chef/knife/core/subcommand_loader.rb
+++ b/lib/chef/knife/core/subcommand_loader.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/version'
-require 'chef/util/path_helper'
-require 'chef/knife/core/gem_glob_loader'
-require 'chef/knife/core/hashed_command_loader'
-require 'chef/knife/core/custom_manifest_loader'
+require "chef/version"
+require "chef/util/path_helper"
+require "chef/knife/core/gem_glob_loader"
+require "chef/knife/core/hashed_command_loader"
+require "chef/knife/core/custom_manifest_loader"
class Chef
class Knife
@@ -75,7 +75,7 @@ class Chef
end
def self.plugin_manifest_path
- Chef::Util::PathHelper.home('.chef', 'plugin_manifest.json')
+ Chef::Util::PathHelper.home(".chef", "plugin_manifest.json")
end
def initialize(chef_config_dir, env = nil)
@@ -117,15 +117,15 @@ class Chef
cmd_words = positional_arguments(args)
load_command(cmd_words)
result = Chef::Knife.subcommands[find_longest_key(Chef::Knife.subcommands,
- cmd_words, '_')]
- result || Chef::Knife.subcommands[args.first.gsub('-', '_')]
+ cmd_words, "_")]
+ result || Chef::Knife.subcommands[args.first.gsub("-", "_")]
end
def guess_category(args)
category_words = positional_arguments(args)
- category_words.map! { |w| w.split('-') }.flatten!
+ category_words.map! { |w| w.split("-") }.flatten!
find_longest_key(Chef::Knife.subcommands_by_category,
- category_words, ' ')
+ category_words, " ")
end
@@ -134,7 +134,7 @@ class Chef
#
def find_subcommands_via_dirglob
# The "require paths" of the core knife subcommands bundled with chef
- files = Dir[File.join(Chef::Util::PathHelper.escape_glob(File.expand_path('../../../knife', __FILE__)), '*.rb')]
+ files = Dir[File.join(Chef::Util::PathHelper.escape_glob(File.expand_path("../../../knife", __FILE__)), "*.rb")]
subcommand_files = {}
files.each do |knife_file|
rel_path = knife_file[/#{CHEF_ROOT}#{Regexp.escape(File::SEPARATOR)}(.*)\.rb/,1]
@@ -163,7 +163,7 @@ Please use Chef::Knife::SubcommandLoader.for_config(chef_config_dir, env)"
# of words and a separator. We find the the longest key in the
# hash composed of the given words joined by the separator.
#
- def find_longest_key(hash, words, sep = '_')
+ def find_longest_key(hash, words, sep = "_")
match = nil
until match || words.empty?
candidate = words.join(sep)
@@ -196,8 +196,8 @@ Please use Chef::Knife::SubcommandLoader.for_config(chef_config_dir, env)"
end
# finally search ~/.chef/plugins/knife/*.rb
- Chef::Util::PathHelper.home('.chef', 'plugins', 'knife') do |p|
- user_specific_files.concat Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(p), '*.rb'))
+ Chef::Util::PathHelper.home(".chef", "plugins", "knife") do |p|
+ user_specific_files.concat Dir.glob(File.join(Chef::Util::PathHelper.escape_glob(p), "*.rb"))
end
user_specific_files
diff --git a/lib/chef/knife/core/text_formatter.rb b/lib/chef/knife/core/text_formatter.rb
index 5afdb6aaa9..6295d42ec2 100644
--- a/lib/chef/knife/core/text_formatter.rb
+++ b/lib/chef/knife/core/text_formatter.rb
@@ -42,7 +42,7 @@ class Chef
end
def text_format(data)
- buffer = ''
+ buffer = ""
if data.respond_to?(:keys)
justify_width = data.keys.map {|k| k.to_s.size }.max.to_i + 1
diff --git a/lib/chef/knife/core/ui.rb b/lib/chef/knife/core/ui.rb
index a54f14afc1..edc51088ec 100644
--- a/lib/chef/knife/core/ui.rb
+++ b/lib/chef/knife/core/ui.rb
@@ -18,10 +18,10 @@
# limitations under the License.
#
-require 'forwardable'
-require 'chef/platform/query_helpers'
-require 'chef/knife/core/generic_presenter'
-require 'tempfile'
+require "forwardable"
+require "chef/platform/query_helpers"
+require "chef/knife/core/generic_presenter"
+require "tempfile"
class Chef
class Knife
@@ -57,7 +57,7 @@ class Chef
def highline
@highline ||= begin
- require 'highline'
+ require "highline"
HighLine.new
end
end
@@ -175,7 +175,7 @@ class Chef
def edit_data(data, parse_output=true)
output = Chef::JSONCompat.to_json_pretty(data)
if (!config[:disable_editing])
- Tempfile.open([ 'knife-edit-', '.json' ]) do |tf|
+ Tempfile.open([ "knife-edit-", ".json" ]) do |tf|
tf.sync = true
tf.puts output
tf.close
@@ -217,11 +217,11 @@ class Chef
def confirmation_instructions(default_choice)
case default_choice
when true
- '? (Y/n) '
+ "? (Y/n) "
when false
- '? (y/N) '
+ "? (y/N) "
else
- '? (Y/N) '
+ "? (Y/N) "
end
end
diff --git a/lib/chef/knife/data_bag_create.rb b/lib/chef/knife/data_bag_create.rb
index 0aa3002b23..afd7a90b7f 100644
--- a/lib/chef/knife/data_bag_create.rb
+++ b/lib/chef/knife/data_bag_create.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/data_bag_secret_options'
+require "chef/knife"
+require "chef/knife/data_bag_secret_options"
class Chef
class Knife
@@ -26,8 +26,8 @@ class Chef
include DataBagSecretOptions
deps do
- require 'chef/data_bag'
- require 'chef/encrypted_data_bag_item'
+ require "chef/data_bag"
+ require "chef/encrypted_data_bag_item"
end
banner "knife data bag create BAG [ITEM] (options)"
diff --git a/lib/chef/knife/data_bag_delete.rb b/lib/chef/knife/data_bag_delete.rb
index a3215d4c54..4f5efd6ed6 100644
--- a/lib/chef/knife/data_bag_delete.rb
+++ b/lib/chef/knife/data_bag_delete.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class DataBagDelete < Knife
deps do
- require 'chef/data_bag'
+ require "chef/data_bag"
end
banner "knife data bag delete BAG [ITEM] (options)"
diff --git a/lib/chef/knife/data_bag_edit.rb b/lib/chef/knife/data_bag_edit.rb
index 88c5669508..5a722dc278 100644
--- a/lib/chef/knife/data_bag_edit.rb
+++ b/lib/chef/knife/data_bag_edit.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/data_bag_secret_options'
+require "chef/knife"
+require "chef/knife/data_bag_secret_options"
class Chef
class Knife
@@ -26,8 +26,8 @@ class Chef
include DataBagSecretOptions
deps do
- require 'chef/data_bag_item'
- require 'chef/encrypted_data_bag_item'
+ require "chef/data_bag_item"
+ require "chef/encrypted_data_bag_item"
end
banner "knife data bag edit BAG ITEM (options)"
diff --git a/lib/chef/knife/data_bag_from_file.rb b/lib/chef/knife/data_bag_from_file.rb
index d1b7daa4a2..617a187b52 100644
--- a/lib/chef/knife/data_bag_from_file.rb
+++ b/lib/chef/knife/data_bag_from_file.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/util/path_helper'
-require 'chef/knife/data_bag_secret_options'
+require "chef/knife"
+require "chef/util/path_helper"
+require "chef/knife/data_bag_secret_options"
class Chef
class Knife
@@ -27,11 +27,11 @@ class Chef
include DataBagSecretOptions
deps do
- require 'chef/data_bag'
- require 'chef/data_bag_item'
- require 'chef/knife/core/object_loader'
- require 'chef/json_compat'
- require 'chef/encrypted_data_bag_item'
+ require "chef/data_bag"
+ require "chef/data_bag_item"
+ require "chef/knife/core/object_loader"
+ require "chef/json_compat"
+ require "chef/encrypted_data_bag_item"
end
banner "knife data bag from file BAG FILE|FOLDER [FILE|FOLDER..] (options)"
diff --git a/lib/chef/knife/data_bag_list.rb b/lib/chef/knife/data_bag_list.rb
index 5e556b60bc..93a28a9b4c 100644
--- a/lib/chef/knife/data_bag_list.rb
+++ b/lib/chef/knife/data_bag_list.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class DataBagList < Knife
deps do
- require 'chef/data_bag'
+ require "chef/data_bag"
end
banner "knife data bag list (options)"
diff --git a/lib/chef/knife/data_bag_secret_options.rb b/lib/chef/knife/data_bag_secret_options.rb
index 766006089e..2a585bda57 100644
--- a/lib/chef/knife/data_bag_secret_options.rb
+++ b/lib/chef/knife/data_bag_secret_options.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'mixlib/cli'
-require 'chef/config'
-require 'chef/encrypted_data_bag_item/check_encrypted'
+require "mixlib/cli"
+require "chef/config"
+require "chef/encrypted_data_bag_item/check_encrypted"
class Chef
class Knife
@@ -65,7 +65,7 @@ class Chef
def read_secret
# Moving the non 'compile-time' requires into here to speed up knife command loading
# IE, if we are not running 'knife data bag *' we don't need to load 'chef/encrypted_data_bag_item'
- require 'chef/encrypted_data_bag_item'
+ require "chef/encrypted_data_bag_item"
if has_cl_secret?
config[:secret]
diff --git a/lib/chef/knife/data_bag_show.rb b/lib/chef/knife/data_bag_show.rb
index 2adafbde79..1b580ed50b 100644
--- a/lib/chef/knife/data_bag_show.rb
+++ b/lib/chef/knife/data_bag_show.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/data_bag_secret_options'
+require "chef/knife"
+require "chef/knife/data_bag_secret_options"
class Chef
class Knife
@@ -26,8 +26,8 @@ class Chef
include DataBagSecretOptions
deps do
- require 'chef/data_bag'
- require 'chef/encrypted_data_bag_item'
+ require "chef/data_bag"
+ require "chef/encrypted_data_bag_item"
end
banner "knife data bag show BAG [ITEM] (options)"
diff --git a/lib/chef/knife/delete.rb b/lib/chef/knife/delete.rb
index 0030c45026..aeb4744873 100644
--- a/lib/chef/knife/delete.rb
+++ b/lib/chef/knife/delete.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/knife'
+require "chef/chef_fs/knife"
class Chef
class Knife
@@ -8,22 +8,22 @@ class Chef
category "path-based"
deps do
- require 'chef/chef_fs/file_system'
+ require "chef/chef_fs/file_system"
end
option :recurse,
- :short => '-r',
- :long => '--[no-]recurse',
+ :short => "-r",
+ :long => "--[no-]recurse",
:boolean => true,
:default => false,
:description => "Delete directories recursively."
option :both,
- :long => '--both',
+ :long => "--both",
:boolean => true,
:default => false,
:description => "Delete both the local and remote copies."
option :local,
- :long => '--local',
+ :long => "--local",
:boolean => true,
:default => false,
:description => "Delete the local copy (leave the remote copy)."
diff --git a/lib/chef/knife/deps.rb b/lib/chef/knife/deps.rb
index 4b23468962..0be83a8bf1 100644
--- a/lib/chef/knife/deps.rb
+++ b/lib/chef/knife/deps.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/knife'
+require "chef/chef_fs/knife"
class Chef
class Knife
@@ -8,20 +8,20 @@ class Chef
category "path-based"
deps do
- require 'chef/chef_fs/file_system'
- require 'chef/run_list'
+ require "chef/chef_fs/file_system"
+ require "chef/run_list"
end
option :recurse,
- :long => '--[no-]recurse',
+ :long => "--[no-]recurse",
:boolean => true,
:description => "List dependencies recursively (default: true). Only works with --tree."
option :tree,
- :long => '--tree',
+ :long => "--tree",
:boolean => true,
:description => "Show dependencies in a visual tree. May show duplicates."
option :remote,
- :long => '--remote',
+ :long => "--remote",
:boolean => true,
:description => "List dependencies on the server instead of the local filesystem"
@@ -73,30 +73,30 @@ class Chef
def get_dependencies(entry)
begin
- if entry.parent && entry.parent.path == '/cookbooks'
+ if entry.parent && entry.parent.path == "/cookbooks"
return entry.chef_object.metadata.dependencies.keys.map { |cookbook| "/cookbooks/#{cookbook}" }
- elsif entry.parent && entry.parent.path == '/nodes'
+ elsif entry.parent && entry.parent.path == "/nodes"
node = Chef::JSONCompat.parse(entry.read)
result = []
- if node['chef_environment'] && node['chef_environment'] != '_default'
+ if node["chef_environment"] && node["chef_environment"] != "_default"
result << "/environments/#{node['chef_environment']}.json"
end
- if node['run_list']
- result += dependencies_from_runlist(node['run_list'])
+ if node["run_list"]
+ result += dependencies_from_runlist(node["run_list"])
end
result
- elsif entry.parent && entry.parent.path == '/roles'
+ elsif entry.parent && entry.parent.path == "/roles"
role = Chef::JSONCompat.parse(entry.read)
result = []
- if role['run_list']
- dependencies_from_runlist(role['run_list']).each do |dependency|
+ if role["run_list"]
+ dependencies_from_runlist(role["run_list"]).each do |dependency|
result << dependency if !result.include?(dependency)
end
end
- if role['env_run_lists']
- role['env_run_lists'].each_pair do |env,run_list|
+ if role["env_run_lists"]
+ role["env_run_lists"].each_pair do |env,run_list|
dependencies_from_runlist(run_list).each do |dependency|
result << dependency if !result.include?(dependency)
end
diff --git a/lib/chef/knife/diff.rb b/lib/chef/knife/diff.rb
index e5eda5228c..580e9e513f 100644
--- a/lib/chef/knife/diff.rb
+++ b/lib/chef/knife/diff.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/knife'
+require "chef/chef_fs/knife"
class Chef
class Knife
@@ -8,33 +8,33 @@ class Chef
category "path-based"
deps do
- require 'chef/chef_fs/command_line'
+ require "chef/chef_fs/command_line"
end
option :recurse,
- :long => '--[no-]recurse',
+ :long => "--[no-]recurse",
:boolean => true,
:default => true,
:description => "List directories recursively."
option :name_only,
- :long => '--name-only',
+ :long => "--name-only",
:boolean => true,
:description => "Only show names of modified files."
option :name_status,
- :long => '--name-status',
+ :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)...[*]]',
+ :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 5a432afd47..f2af0e0152 100644
--- a/lib/chef/knife/download.rb
+++ b/lib/chef/knife/download.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/knife'
+require "chef/chef_fs/knife"
class Chef
class Knife
@@ -8,43 +8,43 @@ class Chef
category "path-based"
deps do
- require 'chef/chef_fs/command_line'
+ require "chef/chef_fs/command_line"
end
option :recurse,
- :long => '--[no-]recurse',
+ :long => "--[no-]recurse",
:boolean => true,
:default => true,
:description => "List directories recursively."
option :purge,
- :long => '--[no-]purge',
+ :long => "--[no-]purge",
:boolean => true,
:default => false,
:description => "Delete matching local files and directories that do not exist remotely."
option :force,
- :long => '--[no-]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)"
option :dry_run,
- :long => '--dry-run',
- :short => '-n',
+ :long => "--dry-run",
+ :short => "-n",
:boolean => true,
:default => false,
:description => "Don't take action, only print what would happen"
option :diff,
- :long => '--[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'
+ :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 7408179ed0..608ce82a8f 100644
--- a/lib/chef/knife/edit.rb
+++ b/lib/chef/knife/edit.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/knife'
+require "chef/chef_fs/knife"
class Chef
class Knife
@@ -8,12 +8,12 @@ class Chef
category "path-based"
deps do
- require 'chef/chef_fs/file_system'
- require 'chef/chef_fs/file_system/not_found_error'
+ require "chef/chef_fs/file_system"
+ require "chef/chef_fs/file_system/not_found_error"
end
option :local,
- :long => '--local',
+ :long => "--local",
:boolean => true,
:description => "Show local files instead of remote"
@@ -51,7 +51,7 @@ class Chef
def edit_text(text, extension)
if (!config[:disable_editing])
- Tempfile.open([ 'knife-edit-', extension ]) do |file|
+ Tempfile.open([ "knife-edit-", extension ]) do |file|
# Write the text to a temporary file
file.write(text)
file.close
diff --git a/lib/chef/knife/environment_compare.rb b/lib/chef/knife/environment_compare.rb
index 54f011f323..a4f99da255 100644
--- a/lib/chef/knife/environment_compare.rb
+++ b/lib/chef/knife/environment_compare.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class EnvironmentCompare < Knife
deps do
- require 'chef/environment'
+ require "chef/environment"
end
banner "knife environment compare [ENVIRONMENT..] (options)"
@@ -60,7 +60,7 @@ class Chef
cookbooks = rest.get("/cookbooks?num_versions=1") if config[:all]
# display matrix view of in the requested format.
- if config[:format] == 'summary'
+ if config[:format] == "summary"
matrix = matrix_output(cookbooks, constraints)
ui.output(matrix)
else
@@ -99,7 +99,7 @@ class Chef
end
def matrix_output(cookbooks, constraints)
- rows = [ '' ]
+ rows = [ "" ]
environments = []
constraints.each { |e,v| environments << e.to_s }
columns = environments.count + 1
diff --git a/lib/chef/knife/environment_create.rb b/lib/chef/knife/environment_create.rb
index 6bc00d52b9..ea69b9b874 100644
--- a/lib/chef/knife/environment_create.rb
+++ b/lib/chef/knife/environment_create.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class EnvironmentCreate < Knife
deps do
- require 'chef/environment'
- require 'chef/json_compat'
+ require "chef/environment"
+ require "chef/json_compat"
end
banner "knife environment create ENVIRONMENT (options)"
diff --git a/lib/chef/knife/environment_delete.rb b/lib/chef/knife/environment_delete.rb
index e17841f805..3cd0d46cd1 100644
--- a/lib/chef/knife/environment_delete.rb
+++ b/lib/chef/knife/environment_delete.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class EnvironmentDelete < Knife
deps do
- require 'chef/environment'
- require 'chef/json_compat'
+ require "chef/environment"
+ require "chef/json_compat"
end
banner "knife environment delete ENVIRONMENT (options)"
diff --git a/lib/chef/knife/environment_edit.rb b/lib/chef/knife/environment_edit.rb
index 54962ac20d..72d774aee4 100644
--- a/lib/chef/knife/environment_edit.rb
+++ b/lib/chef/knife/environment_edit.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class EnvironmentEdit < Knife
deps do
- require 'chef/environment'
- require 'chef/json_compat'
+ require "chef/environment"
+ require "chef/json_compat"
end
banner "knife environment edit ENVIRONMENT (options)"
diff --git a/lib/chef/knife/environment_from_file.rb b/lib/chef/knife/environment_from_file.rb
index 3812024c9c..9b38fc53e0 100644
--- a/lib/chef/knife/environment_from_file.rb
+++ b/lib/chef/knife/environment_from_file.rb
@@ -21,8 +21,8 @@ class Chef
class EnvironmentFromFile < Knife
deps do
- require 'chef/environment'
- require 'chef/knife/core/object_loader'
+ require "chef/environment"
+ require "chef/knife/core/object_loader"
end
banner "knife environment from file FILE [FILE..] (options)"
diff --git a/lib/chef/knife/environment_list.rb b/lib/chef/knife/environment_list.rb
index 4e70818093..801d14b6c2 100644
--- a/lib/chef/knife/environment_list.rb
+++ b/lib/chef/knife/environment_list.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class EnvironmentList < Knife
deps do
- require 'chef/environment'
- require 'chef/json_compat'
+ require "chef/environment"
+ require "chef/json_compat"
end
banner "knife environment list (options)"
diff --git a/lib/chef/knife/environment_show.rb b/lib/chef/knife/environment_show.rb
index 2dd07fe6e9..fe79c3f08d 100644
--- a/lib/chef/knife/environment_show.rb
+++ b/lib/chef/knife/environment_show.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -25,8 +25,8 @@ class Chef
include Knife::Core::MultiAttributeReturnOption
deps do
- require 'chef/environment'
- require 'chef/json_compat'
+ require "chef/environment"
+ require "chef/json_compat"
end
banner "knife environment show ENVIRONMENT (options)"
diff --git a/lib/chef/knife/exec.rb b/lib/chef/knife/exec.rb
index ace4ee2300..7788ae8d85 100644
--- a/lib/chef/knife/exec.rb
+++ b/lib/chef/knife/exec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/util/path_helper'
+require "chef/knife"
+require "chef/util/path_helper"
class Chef::Knife::Exec < Chef::Knife
@@ -35,15 +35,15 @@ class Chef::Knife::Exec < Chef::Knife
:proc => lambda { |o| o.split(":") }
deps do
- require 'chef/shell/ext'
+ require "chef/shell/ext"
end
def run
config[:script_path] ||= Array(Chef::Config[:script_path])
# Default script paths are chef-repo/.chef/scripts and ~/.chef/scripts
- config[:script_path] << File.join(Chef::Knife.chef_config_dir, 'scripts') if Chef::Knife.chef_config_dir
- Chef::Util::PathHelper.home('.chef', 'scripts') { |p| config[:script_path] << p }
+ config[:script_path] << File.join(Chef::Knife.chef_config_dir, "scripts") if Chef::Knife.chef_config_dir
+ Chef::Util::PathHelper.home(".chef", "scripts") { |p| config[:script_path] << p }
scripts = Array(name_args)
context = Object.new
diff --git a/lib/chef/knife/help.rb b/lib/chef/knife/help.rb
index 13fe674704..b8cfab142c 100644
--- a/lib/chef/knife/help.rb
+++ b/lib/chef/knife/help.rb
@@ -40,17 +40,17 @@ class Chef
MOAR_HELP
exit 1
else
- @query = name_args.join('-')
+ @query = name_args.join("-")
end
case @query
- when 'topics', 'list'
+ when "topics", "list"
print_help_topics
exit 1
- when 'intro', 'knife'
- @topic = 'knife'
+ when "intro", "knife"
+ @topic = "knife"
else
@topic = find_manpages_for_query(@query)
end
@@ -67,7 +67,7 @@ MOAR_HELP
def print_help_topics
ui.info "Available help topics are: "
- help_topics.collect {|t| t.gsub(/knife-/, '') }.sort.each do |topic|
+ help_topics.collect {|t| t.gsub(/knife-/, "") }.sort.each do |topic|
ui.msg " #{topic}"
end
end
diff --git a/lib/chef/knife/index_rebuild.rb b/lib/chef/knife/index_rebuild.rb
index 95b0dcaffb..22962c6bec 100644
--- a/lib/chef/knife/index_rebuild.rb
+++ b/lib/chef/knife/index_rebuild.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
diff --git a/lib/chef/knife/key_create.rb b/lib/chef/knife/key_create.rb
index 5ee36e9793..e0946fe88d 100644
--- a/lib/chef/knife/key_create.rb
+++ b/lib/chef/knife/key_create.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/key'
-require 'chef/json_compat'
-require 'chef/exceptions'
+require "chef/key"
+require "chef/json_compat"
+require "chef/exceptions"
class Chef
class Knife
diff --git a/lib/chef/knife/key_delete.rb b/lib/chef/knife/key_delete.rb
index fb996cff17..725296b22b 100644
--- a/lib/chef/knife/key_delete.rb
+++ b/lib/chef/knife/key_delete.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/key'
+require "chef/key"
class Chef
class Knife
diff --git a/lib/chef/knife/key_edit.rb b/lib/chef/knife/key_edit.rb
index 48ae344e6e..e08dd9eb65 100644
--- a/lib/chef/knife/key_edit.rb
+++ b/lib/chef/knife/key_edit.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/key'
-require 'chef/json_compat'
-require 'chef/exceptions'
+require "chef/key"
+require "chef/json_compat"
+require "chef/exceptions"
class Chef
class Knife
diff --git a/lib/chef/knife/key_list.rb b/lib/chef/knife/key_list.rb
index e96a27161f..7a968e85bd 100644
--- a/lib/chef/knife/key_list.rb
+++ b/lib/chef/knife/key_list.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/key'
-require 'chef/json_compat'
-require 'chef/exceptions'
+require "chef/key"
+require "chef/json_compat"
+require "chef/exceptions"
class Chef
class Knife
@@ -64,21 +64,21 @@ EOS
if @config[:with_details]
max_length = 0
keys.each do |key|
- key['name'] = key['name'] + ":"
- max_length = key['name'].length if key['name'].length > max_length
+ key["name"] = key["name"] + ":"
+ max_length = key["name"].length if key["name"].length > max_length
end
keys.each do |key|
- next if !key['expired'] && @config[:only_expired]
- next if key['expired'] && @config[:only_non_expired]
+ next if !key["expired"] && @config[:only_expired]
+ next if key["expired"] && @config[:only_non_expired]
display = "#{colorize(key['name'].ljust(max_length))} #{key['uri']}"
display = "#{display} (expired)" if key["expired"]
display_info(display)
end
else
keys.each do |key|
- next if !key['expired'] && @config[:only_expired]
- next if key['expired'] && @config[:only_non_expired]
- display_info(key['name'])
+ next if !key["expired"] && @config[:only_expired]
+ next if key["expired"] && @config[:only_non_expired]
+ display_info(key["name"])
end
end
end
diff --git a/lib/chef/knife/key_show.rb b/lib/chef/knife/key_show.rb
index 522f7a1a77..4b9ff617ef 100644
--- a/lib/chef/knife/key_show.rb
+++ b/lib/chef/knife/key_show.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/key'
-require 'chef/json_compat'
-require 'chef/exceptions'
+require "chef/key"
+require "chef/json_compat"
+require "chef/exceptions"
class Chef
class Knife
diff --git a/lib/chef/knife/list.rb b/lib/chef/knife/list.rb
index 263b0e7431..3d1583b270 100644
--- a/lib/chef/knife/list.rb
+++ b/lib/chef/knife/list.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/knife'
+require "chef/chef_fs/knife"
class Chef
class Knife
@@ -8,33 +8,33 @@ class Chef
category "path-based"
deps do
- require 'chef/chef_fs/file_system'
- require 'highline'
+ require "chef/chef_fs/file_system"
+ require "highline"
end
option :recursive,
- :short => '-R',
+ :short => "-R",
:boolean => true,
:description => "List directories recursively"
option :bare_directories,
- :short => '-d',
+ :short => "-d",
:boolean => true,
:description => "When directories match the pattern, do not show the directories' children"
option :local,
- :long => '--local',
+ :long => "--local",
:boolean => true,
:description => "List local directory instead of remote"
option :flat,
- :short => '-f',
- :long => '--flat',
+ :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',
+ :short => "-1",
:boolean => true,
:description => "Show only one column of results"
option :trailing_slashes,
- :short => '-p',
+ :short => "-p",
:boolean => true,
:description => "Show trailing slashes after directories"
@@ -130,17 +130,17 @@ class Chef
else
columns = HighLine::SystemExtensions.terminal_size[0]
end
- current_line = ''
+ current_line = ""
results.each do |result|
if current_line.length > 0 && current_line.length + print_space > columns
output current_line.rstrip
- current_line = ''
+ current_line = ""
end
if current_line.length == 0
current_line << indent
end
current_line << result
- current_line << (' ' * (print_space - result.length))
+ current_line << (" " * (print_space - result.length))
end
output current_line.rstrip if current_line.length > 0
end
diff --git a/lib/chef/knife/node_bulk_delete.rb b/lib/chef/knife/node_bulk_delete.rb
index 89b2abe6ae..45291bf033 100644
--- a/lib/chef/knife/node_bulk_delete.rb
+++ b/lib/chef/knife/node_bulk_delete.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class NodeBulkDelete < Knife
deps do
- require 'chef/node'
- require 'chef/json_compat'
+ require "chef/node"
+ require "chef/json_compat"
end
banner "knife node bulk delete REGEX (options)"
diff --git a/lib/chef/knife/node_create.rb b/lib/chef/knife/node_create.rb
index 7f50a30c80..351f407b25 100644
--- a/lib/chef/knife/node_create.rb
+++ b/lib/chef/knife/node_create.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class NodeCreate < Knife
deps do
- require 'chef/node'
- require 'chef/json_compat'
+ require "chef/node"
+ require "chef/json_compat"
end
banner "knife node create NODE (options)"
diff --git a/lib/chef/knife/node_delete.rb b/lib/chef/knife/node_delete.rb
index a645d32035..d9e48f96c4 100644
--- a/lib/chef/knife/node_delete.rb
+++ b/lib/chef/knife/node_delete.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class NodeDelete < Knife
deps do
- require 'chef/node'
- require 'chef/json_compat'
+ require "chef/node"
+ require "chef/json_compat"
end
banner "knife node delete NODE (options)"
diff --git a/lib/chef/knife/node_edit.rb b/lib/chef/knife/node_edit.rb
index 0d6b8fcf6c..fd7637b529 100644
--- a/lib/chef/knife/node_edit.rb
+++ b/lib/chef/knife/node_edit.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -24,9 +24,9 @@ class Chef
class NodeEdit < Knife
deps do
- require 'chef/node'
- require 'chef/json_compat'
- require 'chef/knife/core/node_editor'
+ require "chef/node"
+ require "chef/json_compat"
+ require "chef/knife/core/node_editor"
end
banner "knife node edit NODE (options)"
diff --git a/lib/chef/knife/node_environment_set.rb b/lib/chef/knife/node_environment_set.rb
index da72aeaab8..b91ede56a5 100644
--- a/lib/chef/knife/node_environment_set.rb
+++ b/lib/chef/knife/node_environment_set.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class NodeEnvironmentSet < Knife
deps do
- require 'chef/node'
+ require "chef/node"
end
banner "knife node environment set NODE ENVIRONMENT"
diff --git a/lib/chef/knife/node_from_file.rb b/lib/chef/knife/node_from_file.rb
index 66f2a466fd..3c43c69bbf 100644
--- a/lib/chef/knife/node_from_file.rb
+++ b/lib/chef/knife/node_from_file.rb
@@ -16,16 +16,16 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class NodeFromFile < Knife
deps do
- require 'chef/node'
- require 'chef/json_compat'
- require 'chef/knife/core/object_loader'
+ require "chef/node"
+ require "chef/json_compat"
+ require "chef/knife/core/object_loader"
end
banner "knife node from file FILE (options)"
@@ -36,7 +36,7 @@ class Chef
def run
@name_args.each do |arg|
- updated = loader.load_from('nodes', arg)
+ updated = loader.load_from("nodes", arg)
updated.save
diff --git a/lib/chef/knife/node_list.rb b/lib/chef/knife/node_list.rb
index 3926d101cf..9348341a21 100644
--- a/lib/chef/knife/node_list.rb
+++ b/lib/chef/knife/node_list.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class NodeList < Knife
deps do
- require 'chef/node'
- require 'chef/json_compat'
+ require "chef/node"
+ require "chef/json_compat"
end
banner "knife node list (options)"
diff --git a/lib/chef/knife/node_run_list_add.rb b/lib/chef/knife/node_run_list_add.rb
index 519c280400..ca7e8c9191 100644
--- a/lib/chef/knife/node_run_list_add.rb
+++ b/lib/chef/knife/node_run_list_add.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class NodeRunListAdd < Knife
deps do
- require 'chef/node'
- require 'chef/json_compat'
+ require "chef/node"
+ require "chef/json_compat"
end
banner "knife node run_list add [NODE] [ENTRY[,ENTRY]] (options)"
@@ -44,11 +44,11 @@ class Chef
if @name_args.size > 2
# Check for nested lists and create a single plain one
entries = @name_args[1..-1].map do |entry|
- entry.split(',').map { |e| e.strip }
+ entry.split(",").map { |e| e.strip }
end.flatten
else
# Convert to array and remove the extra spaces
- entries = @name_args[1].split(',').map { |e| e.strip }
+ entries = @name_args[1].split(",").map { |e| e.strip }
end
if config[:after] && config[:before]
diff --git a/lib/chef/knife/node_run_list_remove.rb b/lib/chef/knife/node_run_list_remove.rb
index ef03c176b8..d2bfcf6c9f 100644
--- a/lib/chef/knife/node_run_list_remove.rb
+++ b/lib/chef/knife/node_run_list_remove.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class NodeRunListRemove < Knife
deps do
- require 'chef/node'
- require 'chef/json_compat'
+ require "chef/node"
+ require "chef/json_compat"
end
banner "knife node run_list remove [NODE] [ENTRY[,ENTRY]] (options)"
@@ -35,11 +35,11 @@ class Chef
if @name_args.size > 2
# Check for nested lists and create a single plain one
entries = @name_args[1..-1].map do |entry|
- entry.split(',').map { |e| e.strip }
+ entry.split(",").map { |e| e.strip }
end.flatten
else
# Convert to array and remove the extra spaces
- entries = @name_args[1].split(',').map { |e| e.strip }
+ entries = @name_args[1].split(",").map { |e| e.strip }
end
# iterate over the list of things to remove,
@@ -50,7 +50,7 @@ class Chef
else
ui.warn "#{e} is not in the run list"
unless e =~ /^(recipe|role)\[/
- ui.warn '(did you forget recipe[] or role[] around it?)'
+ ui.warn "(did you forget recipe[] or role[] around it?)"
end
end
end
diff --git a/lib/chef/knife/node_run_list_set.rb b/lib/chef/knife/node_run_list_set.rb
index e327d2acee..8d12c1f5bf 100644
--- a/lib/chef/knife/node_run_list_set.rb
+++ b/lib/chef/knife/node_run_list_set.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class NodeRunListSet < Knife
deps do
- require 'chef/node'
- require 'chef/json_compat'
+ require "chef/node"
+ require "chef/json_compat"
end
banner "knife node run_list set NODE ENTRIES (options)"
@@ -37,11 +37,11 @@ class Chef
elsif @name_args.size > 2
# Check for nested lists and create a single plain one
entries = @name_args[1..-1].map do |entry|
- entry.split(',').map { |e| e.strip }
+ entry.split(",").map { |e| e.strip }
end.flatten
else
# Convert to array and remove the extra spaces
- entries = @name_args[1].split(',').map { |e| e.strip }
+ entries = @name_args[1].split(",").map { |e| e.strip }
end
node = Chef::Node.load(@name_args[0])
diff --git a/lib/chef/knife/node_show.rb b/lib/chef/knife/node_show.rb
index dc47da1e8f..115158e52e 100644
--- a/lib/chef/knife/node_show.rb
+++ b/lib/chef/knife/node_show.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/core/node_presenter'
+require "chef/knife"
+require "chef/knife/core/node_presenter"
class Chef
class Knife
@@ -27,8 +27,8 @@ class Chef
include Knife::Core::MultiAttributeReturnOption
deps do
- require 'chef/node'
- require 'chef/json_compat'
+ require "chef/node"
+ require "chef/json_compat"
end
banner "knife node show NODE (options)"
diff --git a/lib/chef/knife/osc_user_create.rb b/lib/chef/knife/osc_user_create.rb
index 6c3415473f..c5ccbaa13a 100644
--- a/lib/chef/knife/osc_user_create.rb
+++ b/lib/chef/knife/osc_user_create.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
# DEPRECATION NOTE
# This code only remains to support users still operating with
@@ -27,8 +27,8 @@ class Chef
class OscUserCreate < Knife
deps do
- require 'chef/user'
- require 'chef/json_compat'
+ require "chef/user"
+ require "chef/json_compat"
end
option :file,
diff --git a/lib/chef/knife/osc_user_delete.rb b/lib/chef/knife/osc_user_delete.rb
index 5cd4f10413..4c79f5b69d 100644
--- a/lib/chef/knife/osc_user_delete.rb
+++ b/lib/chef/knife/osc_user_delete.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
# DEPRECATION NOTE
# This code only remains to support users still operating with
@@ -28,8 +28,8 @@ class Chef
class OscUserDelete < Knife
deps do
- require 'chef/user'
- require 'chef/json_compat'
+ require "chef/user"
+ require "chef/json_compat"
end
banner "knife osc_user delete USER (options)"
diff --git a/lib/chef/knife/osc_user_edit.rb b/lib/chef/knife/osc_user_edit.rb
index 526475db05..db958a8852 100644
--- a/lib/chef/knife/osc_user_edit.rb
+++ b/lib/chef/knife/osc_user_edit.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
# DEPRECATION NOTE
# This code only remains to support users still operating with
@@ -28,8 +28,8 @@ class Chef
class OscUserEdit < Knife
deps do
- require 'chef/user'
- require 'chef/json_compat'
+ require "chef/user"
+ require "chef/json_compat"
end
banner "knife osc_user edit USER (options)"
diff --git a/lib/chef/knife/osc_user_list.rb b/lib/chef/knife/osc_user_list.rb
index 84fca31899..9c0e3a7c00 100644
--- a/lib/chef/knife/osc_user_list.rb
+++ b/lib/chef/knife/osc_user_list.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
# DEPRECATION NOTE
# This code only remains to support users still operating with
@@ -28,8 +28,8 @@ class Chef
class OscUserList < Knife
deps do
- require 'chef/user'
- require 'chef/json_compat'
+ require "chef/user"
+ require "chef/json_compat"
end
banner "knife osc_user list (options)"
diff --git a/lib/chef/knife/osc_user_reregister.rb b/lib/chef/knife/osc_user_reregister.rb
index 163b286fe0..bd983321f5 100644
--- a/lib/chef/knife/osc_user_reregister.rb
+++ b/lib/chef/knife/osc_user_reregister.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
# DEPRECATION NOTE
# This code only remains to support users still operating with
@@ -28,8 +28,8 @@ class Chef
class OscUserReregister < Knife
deps do
- require 'chef/user'
- require 'chef/json_compat'
+ require "chef/user"
+ require "chef/json_compat"
end
banner "knife osc_user reregister USER (options)"
diff --git a/lib/chef/knife/osc_user_show.rb b/lib/chef/knife/osc_user_show.rb
index cb3a77585a..223fefa5e1 100644
--- a/lib/chef/knife/osc_user_show.rb
+++ b/lib/chef/knife/osc_user_show.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
# DEPRECATION NOTE
# This code only remains to support users still operating with
@@ -30,8 +30,8 @@ class Chef
include Knife::Core::MultiAttributeReturnOption
deps do
- require 'chef/user'
- require 'chef/json_compat'
+ require "chef/user"
+ require "chef/json_compat"
end
banner "knife osc_user show USER (options)"
diff --git a/lib/chef/knife/raw.rb b/lib/chef/knife/raw.rb
index de8742deb9..80fbf97dcc 100644
--- a/lib/chef/knife/raw.rb
+++ b/lib/chef/knife/raw.rb
@@ -1,5 +1,5 @@
-require 'chef/knife'
-require 'chef/http'
+require "chef/knife"
+require "chef/http"
class Chef
class Knife
@@ -7,34 +7,34 @@ class Chef
banner "knife raw REQUEST_PATH"
deps do
- require 'chef/json_compat'
- require 'chef/config'
- require 'chef/http'
- require 'chef/http/authenticator'
- require 'chef/http/cookie_manager'
- require 'chef/http/decompressor'
- require 'chef/http/json_output'
+ require "chef/json_compat"
+ require "chef/config"
+ require "chef/http"
+ require "chef/http/authenticator"
+ require "chef/http/cookie_manager"
+ require "chef/http/decompressor"
+ require "chef/http/json_output"
end
option :method,
- :long => '--method METHOD',
- :short => '-m METHOD',
+ :long => "--method METHOD",
+ :short => "-m METHOD",
:default => "GET",
:description => "Request method (GET, POST, PUT or DELETE). Default: GET"
option :pretty,
- :long => '--[no-]pretty',
+ :long => "--[no-]pretty",
:boolean => true,
:default => true,
:description => "Pretty-print JSON output. Default: true"
option :input,
- :long => '--input FILE',
- :short => '-i FILE',
+ :long => "--input FILE",
+ :short => "-i FILE",
:description => "Name of file to use for PUT or POST"
option :proxy_auth,
- :long => '--proxy-auth',
+ :long => "--proxy-auth",
:boolean => true,
:default => false,
:description => "Use webui proxy authentication. Client key must be the webui key."
@@ -71,10 +71,10 @@ class Chef
begin
method = config[:method].to_sym
- headers = {'Content-Type' => 'application/json'}
+ headers = {"Content-Type" => "application/json"}
if config[:proxy_auth]
- headers['x-ops-request-source'] = 'web'
+ headers["x-ops-request-source"] = "web"
end
if config[:pretty]
@@ -93,7 +93,7 @@ class Chef
exit 1
rescue Net::HTTPServerException => e
ui.error "Server responded with error #{e.response.code} \"#{e.response.message}\""
- ui.error "Error Body: #{e.response.body}" if e.response.body && e.response.body != ''
+ ui.error "Error Body: #{e.response.body}" if e.response.body && e.response.body != ""
exit 1
end
end
diff --git a/lib/chef/knife/recipe_list.rb b/lib/chef/knife/recipe_list.rb
index 46ad619f1d..756069aebe 100644
--- a/lib/chef/knife/recipe_list.rb
+++ b/lib/chef/knife/recipe_list.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef::Knife::RecipeList < Chef::Knife
banner "knife recipe list [PATTERN]"
def run
- recipes = rest.get('cookbooks/_recipes')
+ recipes = rest.get("cookbooks/_recipes")
if pattern = @name_args.first
recipes = recipes.grep(Regexp.new(pattern))
end
diff --git a/lib/chef/knife/rehash.rb b/lib/chef/knife/rehash.rb
index 6f1fd91911..dccf43b4e9 100644
--- a/lib/chef/knife/rehash.rb
+++ b/lib/chef/knife/rehash.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/core/subcommand_loader'
+require "chef/knife"
+require "chef/knife/core/subcommand_loader"
class Chef
class Knife
@@ -44,15 +44,15 @@ class Chef
else
{ Chef::Knife::SubcommandLoader::HashedCommandLoader::KEY => {}}
end
- output[Chef::Knife::SubcommandLoader::HashedCommandLoader::KEY]['plugins_paths'] = Chef::Knife.subcommand_files
- output[Chef::Knife::SubcommandLoader::HashedCommandLoader::KEY]['plugins_by_category'] = Chef::Knife.subcommands_by_category
+ output[Chef::Knife::SubcommandLoader::HashedCommandLoader::KEY]["plugins_paths"] = Chef::Knife.subcommand_files
+ output[Chef::Knife::SubcommandLoader::HashedCommandLoader::KEY]["plugins_by_category"] = Chef::Knife.subcommands_by_category
output
end
def write_hash(data)
- plugin_manifest_dir = File.expand_path('..', Chef::Knife::SubcommandLoader.plugin_manifest_path)
+ plugin_manifest_dir = File.expand_path("..", Chef::Knife::SubcommandLoader.plugin_manifest_path)
FileUtils.mkdir_p(plugin_manifest_dir) unless File.directory?(plugin_manifest_dir)
- File.open(Chef::Knife::SubcommandLoader.plugin_manifest_path, 'w') do |f|
+ File.open(Chef::Knife::SubcommandLoader.plugin_manifest_path, "w") do |f|
f.write(Chef::JSONCompat.to_json_pretty(data))
ui.msg "Knife subcommands are cached in #{Chef::Knife::SubcommandLoader.plugin_manifest_path}. Delete this file to disable the caching."
end
diff --git a/lib/chef/knife/role_bulk_delete.rb b/lib/chef/knife/role_bulk_delete.rb
index 8b24f55846..855881c298 100644
--- a/lib/chef/knife/role_bulk_delete.rb
+++ b/lib/chef/knife/role_bulk_delete.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleBulkDelete < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role bulk delete REGEX (options)"
diff --git a/lib/chef/knife/role_create.rb b/lib/chef/knife/role_create.rb
index e9e363e870..8fef2c43cd 100644
--- a/lib/chef/knife/role_create.rb
+++ b/lib/chef/knife/role_create.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleCreate < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role create ROLE (options)"
diff --git a/lib/chef/knife/role_delete.rb b/lib/chef/knife/role_delete.rb
index b823f37359..b3ff69860e 100644
--- a/lib/chef/knife/role_delete.rb
+++ b/lib/chef/knife/role_delete.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleDelete < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role delete ROLE (options)"
diff --git a/lib/chef/knife/role_edit.rb b/lib/chef/knife/role_edit.rb
index b0580988a0..65086d8c6c 100644
--- a/lib/chef/knife/role_edit.rb
+++ b/lib/chef/knife/role_edit.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleEdit < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role edit ROLE (options)"
diff --git a/lib/chef/knife/role_env_run_list_add.rb b/lib/chef/knife/role_env_run_list_add.rb
index faf84ccfdb..7dccd0d0a2 100644
--- a/lib/chef/knife/role_env_run_list_add.rb
+++ b/lib/chef/knife/role_env_run_list_add.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleEnvRunListAdd < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role env_run_list add [ROLE] [ENVIRONMENT] [ENTRY[,ENTRY]] (options)"
@@ -68,11 +68,11 @@ class Chef
if @name_args.size > 2
# Check for nested lists and create a single plain one
entries = @name_args[2..-1].map do |entry|
- entry.split(',').map { |e| e.strip }
+ entry.split(",").map { |e| e.strip }
end.flatten
else
# Convert to array and remove the extra spaces
- entries = @name_args[2].split(',').map { |e| e.strip }
+ entries = @name_args[2].split(",").map { |e| e.strip }
end
add_to_env_run_list(role, environment, entries, config[:after])
diff --git a/lib/chef/knife/role_env_run_list_clear.rb b/lib/chef/knife/role_env_run_list_clear.rb
index 4304f29a38..9994b45471 100644
--- a/lib/chef/knife/role_env_run_list_clear.rb
+++ b/lib/chef/knife/role_env_run_list_clear.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleEnvRunListClear < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role env_run_list clear [ROLE] [ENVIRONMENT]"
diff --git a/lib/chef/knife/role_env_run_list_remove.rb b/lib/chef/knife/role_env_run_list_remove.rb
index 9ffc3f520e..07dd61de28 100644
--- a/lib/chef/knife/role_env_run_list_remove.rb
+++ b/lib/chef/knife/role_env_run_list_remove.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleEnvRunListRemove < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role env_run_list remove [ROLE] [ENVIRONMENT] [ENTRIES]"
diff --git a/lib/chef/knife/role_env_run_list_replace.rb b/lib/chef/knife/role_env_run_list_replace.rb
index 146d0c4905..9929820594 100644
--- a/lib/chef/knife/role_env_run_list_replace.rb
+++ b/lib/chef/knife/role_env_run_list_replace.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleEnvRunListReplace < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role env_run_list replace [ROLE] [ENVIRONMENT] [OLD_ENTRY] [NEW_ENTRY] "
diff --git a/lib/chef/knife/role_env_run_list_set.rb b/lib/chef/knife/role_env_run_list_set.rb
index a1618516c0..f414ced51c 100644
--- a/lib/chef/knife/role_env_run_list_set.rb
+++ b/lib/chef/knife/role_env_run_list_set.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleEnvRunListSet < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role env_run_list set [ROLE] [ENVIRONMENT] [ENTRIES]"
@@ -52,11 +52,11 @@ class Chef
elsif @name_args.size > 2
# Check for nested lists and create a single plain one
entries = @name_args[2..-1].map do |entry|
- entry.split(',').map { |e| e.strip }
+ entry.split(",").map { |e| e.strip }
end.flatten
else
# Convert to array and remove the extra spaces
- entries = @name_args[2].split(',').map { |e| e.strip }
+ entries = @name_args[2].split(",").map { |e| e.strip }
end
set_env_run_list(role, environment, entries )
diff --git a/lib/chef/knife/role_from_file.rb b/lib/chef/knife/role_from_file.rb
index c80218b753..aacf1211bf 100644
--- a/lib/chef/knife/role_from_file.rb
+++ b/lib/chef/knife/role_from_file.rb
@@ -16,16 +16,16 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleFromFile < Knife
deps do
- require 'chef/role'
- require 'chef/knife/core/object_loader'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/knife/core/object_loader"
+ require "chef/json_compat"
end
banner "knife role from file FILE [FILE..] (options)"
diff --git a/lib/chef/knife/role_list.rb b/lib/chef/knife/role_list.rb
index 0f105b2188..8fa5707eb3 100644
--- a/lib/chef/knife/role_list.rb
+++ b/lib/chef/knife/role_list.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleList < Knife
deps do
- require 'chef/node'
- require 'chef/json_compat'
+ require "chef/node"
+ require "chef/json_compat"
end
banner "knife role list (options)"
diff --git a/lib/chef/knife/role_run_list_add.rb b/lib/chef/knife/role_run_list_add.rb
index c9d7785bb7..c7f6b0afdf 100644
--- a/lib/chef/knife/role_run_list_add.rb
+++ b/lib/chef/knife/role_run_list_add.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleRunListAdd < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role run_list add [ROLE] [ENTRY[,ENTRY]] (options)"
@@ -68,11 +68,11 @@ class Chef
if @name_args.size > 1
# Check for nested lists and create a single plain one
entries = @name_args[1..-1].map do |entry|
- entry.split(',').map { |e| e.strip }
+ entry.split(",").map { |e| e.strip }
end.flatten
else
# Convert to array and remove the extra spaces
- entries = @name_args[1].split(',').map { |e| e.strip }
+ entries = @name_args[1].split(",").map { |e| e.strip }
end
add_to_env_run_list(role, environment, entries, config[:after])
diff --git a/lib/chef/knife/role_run_list_clear.rb b/lib/chef/knife/role_run_list_clear.rb
index ed6225d83d..2041c979b7 100644
--- a/lib/chef/knife/role_run_list_clear.rb
+++ b/lib/chef/knife/role_run_list_clear.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleRunListClear < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role run_list clear [ROLE]"
diff --git a/lib/chef/knife/role_run_list_remove.rb b/lib/chef/knife/role_run_list_remove.rb
index d783b34ab4..655a6aa15f 100644
--- a/lib/chef/knife/role_run_list_remove.rb
+++ b/lib/chef/knife/role_run_list_remove.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleRunListRemove < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role run_list remove [ROLE] [ENTRY]"
diff --git a/lib/chef/knife/role_run_list_replace.rb b/lib/chef/knife/role_run_list_replace.rb
index 1ab94df111..f28b69db25 100644
--- a/lib/chef/knife/role_run_list_replace.rb
+++ b/lib/chef/knife/role_run_list_replace.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleRunListReplace < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role run_list replace [ROLE] [OLD_ENTRY] [NEW_ENTRY] "
diff --git a/lib/chef/knife/role_run_list_set.rb b/lib/chef/knife/role_run_list_set.rb
index b9675c70dd..30702458bc 100644
--- a/lib/chef/knife/role_run_list_set.rb
+++ b/lib/chef/knife/role_run_list_set.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class RoleRunListSet < Knife
deps do
- require 'chef/role'
- require 'chef/json_compat'
+ require "chef/role"
+ require "chef/json_compat"
end
banner "knife role run_list set [ROLE] [ENTRIES]"
@@ -52,11 +52,11 @@ class Chef
elsif @name_args.size > 1
# Check for nested lists and create a single plain one
entries = @name_args[1..-1].map do |entry|
- entry.split(',').map { |e| e.strip }
+ entry.split(",").map { |e| e.strip }
end.flatten
else
# Convert to array and remove the extra spaces
- entries = @name_args[1].split(',').map { |e| e.strip }
+ entries = @name_args[1].split(",").map { |e| e.strip }
end
set_env_run_list(role, environment, entries )
diff --git a/lib/chef/knife/role_show.rb b/lib/chef/knife/role_show.rb
index 159571f281..1f8cba7b08 100644
--- a/lib/chef/knife/role_show.rb
+++ b/lib/chef/knife/role_show.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -25,8 +25,8 @@ class Chef
include Knife::Core::MultiAttributeReturnOption
deps do
- require 'chef/node'
- require 'chef/json_compat'
+ require "chef/node"
+ require "chef/json_compat"
end
banner "knife role show ROLE (options)"
diff --git a/lib/chef/knife/search.rb b/lib/chef/knife/search.rb
index 014fc8dd87..642aaf8eef 100644
--- a/lib/chef/knife/search.rb
+++ b/lib/chef/knife/search.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/core/node_presenter'
+require "chef/knife"
+require "chef/knife/core/node_presenter"
class Chef
class Knife
@@ -26,10 +26,10 @@ class Chef
include Knife::Core::MultiAttributeReturnOption
deps do
- require 'chef/node'
- require 'chef/environment'
- require 'chef/api_client'
- require 'chef/search/query'
+ require "chef/node"
+ require "chef/environment"
+ require "chef/api_client"
+ require "chef/search/query"
end
include Knife::Core::NodeFormattingOptions
@@ -80,7 +80,7 @@ class Chef
read_cli_args
fuzzify_query
- if @type == 'node'
+ if @type == "node"
ui.use_presenter Knife::Core::NodePresenter
end
diff --git a/lib/chef/knife/serve.rb b/lib/chef/knife/serve.rb
index 84918e2ef2..4cb698c968 100644
--- a/lib/chef/knife/serve.rb
+++ b/lib/chef/knife/serve.rb
@@ -1,23 +1,23 @@
-require 'chef/knife'
-require 'chef/local_mode'
+require "chef/knife"
+require "chef/local_mode"
class Chef
class Knife
class Serve < Knife
- banner 'knife serve (options)'
+ banner "knife serve (options)"
option :repo_mode,
- :long => '--repo-mode 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"
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 4684a6ac7e..88a192994e 100644
--- a/lib/chef/knife/show.rb
+++ b/lib/chef/knife/show.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/knife'
+require "chef/chef_fs/knife"
class Chef
class Knife
@@ -8,12 +8,12 @@ class Chef
category "path-based"
deps do
- require 'chef/chef_fs/file_system'
- require 'chef/chef_fs/file_system/not_found_error'
+ require "chef/chef_fs/file_system"
+ require "chef/chef_fs/file_system/not_found_error"
end
option :local,
- :long => '--local',
+ :long => "--local",
:boolean => true,
:description => "Show local files instead of remote"
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 99ae2f426a..bf2f0d4bf0 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -16,23 +16,23 @@
# limitations under the License.
#
-require 'chef/mixin/shell_out'
-require 'chef/knife'
+require "chef/mixin/shell_out"
+require "chef/knife"
class Chef
class Knife
class Ssh < Knife
deps do
- require 'net/ssh'
- require 'net/ssh/multi'
- require 'chef/monkey_patches/net-ssh-multi'
- require 'readline'
- require 'chef/exceptions'
- require 'chef/search/query'
- require 'chef/mixin/command'
- require 'chef/util/path_helper'
- require 'mixlib/shellout'
+ require "net/ssh"
+ require "net/ssh/multi"
+ require "chef/monkey_patches/net-ssh-multi"
+ require "readline"
+ require "chef/exceptions"
+ require "chef/search/query"
+ require "chef/mixin/command"
+ require "chef/util/path_helper"
+ require "mixlib/shellout"
end
include Chef::Mixin::ShellOut
@@ -109,8 +109,8 @@ class Chef
:default => true
option :on_error,
- :short => '-e',
- :long => '--exit-on-error',
+ :short => "-e",
+ :long => "--exit-on-error",
:description => "Immediately exit if an error is encountered",
:boolean => true,
:proc => Proc.new { :raise }
@@ -140,8 +140,8 @@ class Chef
def configure_gateway
config[:ssh_gateway] ||= Chef::Config[:knife][:ssh_gateway]
if config[:ssh_gateway]
- gw_host, gw_user = config[:ssh_gateway].split('@').reverse
- gw_host, gw_port = gw_host.split(':')
+ gw_host, gw_user = config[:ssh_gateway].split("@").reverse
+ gw_host, gw_port = gw_host.split(":")
gw_opts = session_options(gw_host, gw_port, gw_user)
user = gw_opts.delete(:user)
@@ -190,7 +190,7 @@ class Chef
node[:cloud][:public_hostname] &&
!node[:cloud][:public_hostname].empty?
Chef::Log.debug("Using node attribute 'cloud[:public_hostname]' automatically as the ssh target")
- attribute = 'cloud.public_hostname'
+ attribute = "cloud.public_hostname"
else
# falling back to default of fqdn
Chef::Log.debug("Using node attribute 'fqdn' as the ssh target")
@@ -246,7 +246,7 @@ class Chef
opts[:logger] = Chef::Log.logger if Chef::Log.level == :debug
if !config[:host_key_verify]
opts[:paranoid] = false
- opts[:user_known_hosts_file] = '/dev/null'
+ opts[:user_known_hosts_file] = "/dev/null"
end
end
end
@@ -301,7 +301,7 @@ class Chef
exit_status = 0
subsession ||= session
command = fixup_sudo(command)
- command.force_encoding('binary') if command.respond_to?(:force_encoding)
+ command.force_encoding("binary") if command.respond_to?(:force_encoding)
subsession.open_channel do |ch|
ch.request_pty
ch.exec command do |ch, success|
@@ -367,8 +367,8 @@ class Chef
loop do
command = read_line
case command
- when 'quit!'
- puts 'Bye!'
+ when "quit!"
+ puts "Bye!"
break
when /^on (.+?); (.+)$/
raw_list = $1.split(" ")
@@ -386,7 +386,7 @@ class Chef
def screen
tf = Tempfile.new("knife-ssh-screen")
- Chef::Util::PathHelper.home('.screenrc') do |screenrc_path|
+ Chef::Util::PathHelper.home(".screenrc") do |screenrc_path|
if File.exist? screenrc_path
tf.puts("source #{screenrc_path}")
end
@@ -439,7 +439,7 @@ class Chef
def macterm
begin
- require 'appscript'
+ require "appscript"
rescue LoadError
STDERR.puts "You need the rb-appscript gem to use knife ssh macterm. `(sudo) gem install rb-appscript` to install"
raise
@@ -447,7 +447,7 @@ class Chef
Appscript.app("/Applications/Utilities/Terminal.app").windows.first.activate
Appscript.app("System Events").application_processes["Terminal.app"].keystroke("n", :using=>:command_down)
- term = Appscript.app('Terminal')
+ term = Appscript.app("Terminal")
window = term.windows.first.get
(session.servers_for.size - 1).times do |i|
@@ -457,7 +457,7 @@ class Chef
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/ssl_check.rb b/lib/chef/knife/ssl_check.rb
index 38b4d81bb3..8ed18b8a5b 100644
--- a/lib/chef/knife/ssl_check.rb
+++ b/lib/chef/knife/ssl_check.rb
@@ -16,20 +16,20 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/config'
+require "chef/knife"
+require "chef/config"
class Chef
class Knife
class SslCheck < Chef::Knife
deps do
- require 'pp'
- require 'socket'
- require 'uri'
- require 'chef/http/ssl_policies'
- require 'openssl'
- require 'chef/mixin/proxified_socket'
+ require "pp"
+ require "socket"
+ require "uri"
+ require "chef/http/ssl_policies"
+ require "openssl"
+ require "chef/mixin/proxified_socket"
include Chef::Mixin::ProxifiedSocket
end
diff --git a/lib/chef/knife/ssl_fetch.rb b/lib/chef/knife/ssl_fetch.rb
index 0c1ab7ea7b..f20576b917 100644
--- a/lib/chef/knife/ssl_fetch.rb
+++ b/lib/chef/knife/ssl_fetch.rb
@@ -16,19 +16,19 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/config'
+require "chef/knife"
+require "chef/config"
class Chef
class Knife
class SslFetch < Chef::Knife
deps do
- require 'pp'
- require 'socket'
- require 'uri'
- require 'openssl'
- require 'chef/mixin/proxified_socket'
+ require "pp"
+ require "socket"
+ require "uri"
+ require "openssl"
+ require "chef/mixin/proxified_socket"
include Chef::Mixin::ProxifiedSocket
end
@@ -104,7 +104,7 @@ class Chef
# practice.
# https://tools.ietf.org/html/rfc6125#section-6.4.2
def normalize_cn(cn)
- cn.gsub("*", "wildcard").gsub(/[^[:alnum:]\-]/, '_')
+ cn.gsub("*", "wildcard").gsub(/[^[:alnum:]\-]/, "_")
end
def configuration
@@ -147,7 +147,7 @@ TRUST_TRUST
ui.error("The service at the given URI (#{uri}) does not accept SSL connections")
if uri.scheme == "http"
- https_uri = uri.to_s.sub(/^http/, 'https')
+ https_uri = uri.to_s.sub(/^http/, "https")
ui.error("Perhaps you meant to connect to '#{https_uri}'?")
end
exit 1
diff --git a/lib/chef/knife/status.rb b/lib/chef/knife/status.rb
index e649c01ef4..29e7aa4c48 100644
--- a/lib/chef/knife/status.rb
+++ b/lib/chef/knife/status.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/core/status_presenter'
-require 'chef/knife/core/node_presenter'
+require "chef/knife"
+require "chef/knife/core/status_presenter"
+require "chef/knife/core/node_presenter"
class Chef
class Knife
@@ -26,7 +26,7 @@ class Chef
include Knife::Core::NodeFormattingOptions
deps do
- require 'chef/search/query'
+ require "chef/search/query"
end
banner "knife status QUERY (options)"
diff --git a/lib/chef/knife/tag_create.rb b/lib/chef/knife/tag_create.rb
index d3ca95242d..f568134727 100644
--- a/lib/chef/knife/tag_create.rb
+++ b/lib/chef/knife/tag_create.rb
@@ -18,14 +18,14 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class TagCreate < Knife
deps do
- require 'chef/node'
+ require "chef/node"
end
banner "knife tag create NODE TAG ..."
diff --git a/lib/chef/knife/tag_delete.rb b/lib/chef/knife/tag_delete.rb
index 10751db216..4f7e059586 100644
--- a/lib/chef/knife/tag_delete.rb
+++ b/lib/chef/knife/tag_delete.rb
@@ -18,14 +18,14 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class TagDelete < Knife
deps do
- require 'chef/node'
+ require "chef/node"
end
banner "knife tag delete NODE TAG ..."
diff --git a/lib/chef/knife/tag_list.rb b/lib/chef/knife/tag_list.rb
index 499eb8578c..659a6ac77f 100644
--- a/lib/chef/knife/tag_list.rb
+++ b/lib/chef/knife/tag_list.rb
@@ -18,14 +18,14 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class TagList < Knife
deps do
- require 'chef/node'
+ require "chef/node"
end
banner "knife tag list NODE"
diff --git a/lib/chef/knife/upload.rb b/lib/chef/knife/upload.rb
index 8abd22b4dd..90b9a1562b 100644
--- a/lib/chef/knife/upload.rb
+++ b/lib/chef/knife/upload.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/knife'
+require "chef/chef_fs/knife"
class Chef
class Knife
@@ -8,45 +8,45 @@ class Chef
category "path-based"
deps do
- require 'chef/chef_fs/command_line'
+ require "chef/chef_fs/command_line"
end
option :recurse,
- :long => '--[no-]recurse',
+ :long => "--[no-]recurse",
:boolean => true,
:default => true,
:description => "List directories recursively."
option :purge,
- :long => '--[no-]purge',
+ :long => "--[no-]purge",
:boolean => true,
:default => false,
:description => "Delete matching local files and directories that do not exist remotely."
option :force,
- :long => '--[no-]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."
option :freeze,
- :long => '--[no-]freeze',
+ :long => "--[no-]freeze",
:boolean => true,
:default => false,
:description => "Freeze cookbooks that get uploaded."
option :dry_run,
- :long => '--dry-run',
- :short => '-n',
+ :long => "--dry-run",
+ :short => "-n",
:boolean => true,
:default => false,
:description => "Don't take action, only print what would happen"
option :diff,
- :long => '--[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'
+ :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 995573cd03..1fa698634f 100644
--- a/lib/chef/knife/user_create.rb
+++ b/lib/chef/knife/user_create.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/osc_user_create'
+require "chef/knife"
+require "chef/knife/osc_user_create"
class Chef
class Knife
@@ -27,8 +27,8 @@ class Chef
attr_accessor :user_field
deps do
- require 'chef/user_v1'
- require 'chef/json_compat'
+ require "chef/user_v1"
+ require "chef/json_compat"
end
option :file,
diff --git a/lib/chef/knife/user_delete.rb b/lib/chef/knife/user_delete.rb
index 828cd51588..b6ea75c5cd 100644
--- a/lib/chef/knife/user_delete.rb
+++ b/lib/chef/knife/user_delete.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class UserDelete < Knife
deps do
- require 'chef/user_v1'
- require 'chef/json_compat'
+ require "chef/user_v1"
+ require "chef/json_compat"
end
banner "knife user delete USER (options)"
diff --git a/lib/chef/knife/user_edit.rb b/lib/chef/knife/user_edit.rb
index c3a4326ee8..991b5be272 100644
--- a/lib/chef/knife/user_edit.rb
+++ b/lib/chef/knife/user_edit.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class UserEdit < Knife
deps do
- require 'chef/user_v1'
- require 'chef/json_compat'
+ require "chef/user_v1"
+ require "chef/json_compat"
end
banner "knife user edit USER (options)"
diff --git a/lib/chef/knife/user_key_create.rb b/lib/chef/knife/user_key_create.rb
index 5ed699ff5b..e882e34e4d 100644
--- a/lib/chef/knife/user_key_create.rb
+++ b/lib/chef/knife/user_key_create.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/key_create_base'
+require "chef/knife"
+require "chef/knife/key_create_base"
class Chef
class Knife
@@ -30,7 +30,7 @@ class Chef
class UserKeyCreate < Knife
include Chef::Knife::KeyCreateBase
- banner 'knife user key create USER (options)'
+ banner "knife user key create USER (options)"
attr_reader :actor
@@ -45,7 +45,7 @@ class Chef
end
def actor_field_name
- 'user'
+ "user"
end
def service_object
@@ -53,7 +53,7 @@ class Chef
end
def actor_missing_error
- 'You must specify a user name'
+ "You must specify a user name"
end
def apply_params!(params)
diff --git a/lib/chef/knife/user_key_delete.rb b/lib/chef/knife/user_key_delete.rb
index 6db1c9f552..d5063c72ef 100644
--- a/lib/chef/knife/user_key_delete.rb
+++ b/lib/chef/knife/user_key_delete.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -42,15 +42,15 @@ class Chef
end
def actor_field_name
- 'user'
+ "user"
end
def actor_missing_error
- 'You must specify a user name'
+ "You must specify a user name"
end
def keyname_missing_error
- 'You must specify a key name'
+ "You must specify a key name"
end
def service_object
diff --git a/lib/chef/knife/user_key_edit.rb b/lib/chef/knife/user_key_edit.rb
index 0c35332523..9c766c8bea 100644
--- a/lib/chef/knife/user_key_edit.rb
+++ b/lib/chef/knife/user_key_edit.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/key_edit_base'
+require "chef/knife"
+require "chef/knife/key_edit_base"
class Chef
class Knife
@@ -30,7 +30,7 @@ class Chef
class UserKeyEdit < Knife
include Chef::Knife::KeyEditBase
- banner 'knife user key edit USER KEYNAME (options)'
+ banner "knife user key edit USER KEYNAME (options)"
attr_reader :actor
@@ -45,7 +45,7 @@ class Chef
end
def actor_field_name
- 'user'
+ "user"
end
def service_object
@@ -53,11 +53,11 @@ class Chef
end
def actor_missing_error
- 'You must specify a user name'
+ "You must specify a user name"
end
def keyname_missing_error
- 'You must specify a key name'
+ "You must specify a key name"
end
def apply_params!(params)
diff --git a/lib/chef/knife/user_key_list.rb b/lib/chef/knife/user_key_list.rb
index a73f59c86f..9c308c47f8 100644
--- a/lib/chef/knife/user_key_list.rb
+++ b/lib/chef/knife/user_key_list.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/knife/key_list_base'
+require "chef/knife"
+require "chef/knife/key_list_base"
class Chef
class Knife
@@ -49,7 +49,7 @@ class Chef
end
def actor_missing_error
- 'You must specify a user name'
+ "You must specify a user name"
end
def service_object
diff --git a/lib/chef/knife/user_key_show.rb b/lib/chef/knife/user_key_show.rb
index b8453dd28e..b7e3bcb4d7 100644
--- a/lib/chef/knife/user_key_show.rb
+++ b/lib/chef/knife/user_key_show.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -46,11 +46,11 @@ class Chef
end
def actor_missing_error
- 'You must specify a user name'
+ "You must specify a user name"
end
def keyname_missing_error
- 'You must specify a key name'
+ "You must specify a key name"
end
def service_object
diff --git a/lib/chef/knife/user_list.rb b/lib/chef/knife/user_list.rb
index 6a130392b9..44c581dd4a 100644
--- a/lib/chef/knife/user_list.rb
+++ b/lib/chef/knife/user_list.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
# NOTE: only knife user command that is backwards compatible with OSC 11,
# so no deprecation warnings are necessary.
@@ -25,8 +25,8 @@ class Chef
class UserList < Knife
deps do
- require 'chef/user_v1'
- require 'chef/json_compat'
+ require "chef/user_v1"
+ require "chef/json_compat"
end
banner "knife user list (options)"
diff --git a/lib/chef/knife/user_reregister.rb b/lib/chef/knife/user_reregister.rb
index 09fd1cd2d6..8e99ac0906 100644
--- a/lib/chef/knife/user_reregister.rb
+++ b/lib/chef/knife/user_reregister.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
class UserReregister < Knife
deps do
- require 'chef/user_v1'
- require 'chef/json_compat'
+ require "chef/user_v1"
+ require "chef/json_compat"
end
banner "knife user reregister USER (options)"
diff --git a/lib/chef/knife/user_show.rb b/lib/chef/knife/user_show.rb
index 3a2443471a..8ca181644e 100644
--- a/lib/chef/knife/user_show.rb
+++ b/lib/chef/knife/user_show.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/knife'
+require "chef/knife"
class Chef
class Knife
@@ -25,8 +25,8 @@ class Chef
include Knife::Core::MultiAttributeReturnOption
deps do
- require 'chef/user_v1'
- require 'chef/json_compat'
+ require "chef/user_v1"
+ require "chef/json_compat"
end
banner "knife user show USER (options)"
diff --git a/lib/chef/knife/xargs.rb b/lib/chef/knife/xargs.rb
index dd8e848058..f16890cba5 100644
--- a/lib/chef/knife/xargs.rb
+++ b/lib/chef/knife/xargs.rb
@@ -1,4 +1,4 @@
-require 'chef/chef_fs/knife'
+require "chef/chef_fs/knife"
class Chef
class Knife
@@ -8,65 +8,65 @@ class Chef
category "path-based"
deps do
- require 'chef/chef_fs/file_system'
- require 'chef/chef_fs/file_system/not_found_error'
+ require "chef/chef_fs/file_system"
+ require "chef/chef_fs/file_system/not_found_error"
end
# TODO modify to remote-only / local-only pattern (more like delete)
option :local,
- :long => '--local',
+ :long => "--local",
:boolean => true,
:description => "Xargs local files instead of remote"
option :patterns,
- :long => '--pattern [PATTERN]',
- :short => '-p [PATTERN]',
+ :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',
+ :long => "--[no-]diff",
:default => true,
:boolean => true,
:description => "Whether to show a diff when files change (default: true)"
option :dry_run,
- :long => '--dry-run',
+ :long => "--dry-run",
:boolean => true,
:description => "Prevents changes from actually being uploaded to the server."
option :force,
- :long => '--[no-]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)"
option :replace_first,
- :long => '--replace-first REPLACESTR',
- :short => '-J REPLACESTR',
+ :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',
+ :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',
+ :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',
+ :long => "--max-chars LENGTH",
+ :short => "-s LENGTH",
:description => "Maximum size of command line, in characters"
option :verbose_commands,
- :short => '-t',
+ :short => "-t",
:description => "Print command to be run on the command line"
option :null_separator,
- :short => '-0',
+ :short => "-0",
:boolean => true,
:description => "Use the NULL character (\0) as a separator, instead of whitespace"
@@ -151,7 +151,7 @@ class Chef
end
def create_command(files)
- command = name_args.join(' ')
+ command = name_args.join(" ")
# Create the (empty) tempfiles
tempfiles = {}
@@ -167,7 +167,7 @@ class Chef
end
# Create the command
- paths = tempfiles.keys.map { |tempfile| tempfile.path }.join(' ')
+ paths = tempfiles.keys.map { |tempfile| tempfile.path }.join(" ")
if config[:replace_all]
final_command = command.gsub(config[:replace_all], paths)
elsif config[:replace_first]
diff --git a/lib/chef/local_mode.rb b/lib/chef/local_mode.rb
index fbb72cd6cb..53234ec7d5 100644
--- a/lib/chef/local_mode.rb
+++ b/lib/chef/local_mode.rb
@@ -14,10 +14,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/config'
+require "chef/config"
if Chef::Platform.windows?
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.1')
- require 'chef/monkey_patches/webrick-utils'
+ if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.1")
+ require "chef/monkey_patches/webrick-utils"
end
end
@@ -54,14 +54,14 @@ class Chef
if Chef::Config.chef_zero.enabled
destroy_server_connectivity
- require 'chef_zero/server'
- require 'chef/chef_fs/chef_fs_data_store'
- require 'chef/chef_fs/config'
+ require "chef_zero/server"
+ require "chef/chef_fs/chef_fs_data_store"
+ require "chef/chef_fs/config"
@chef_fs = Chef::ChefFS::Config.new.local_fs
@chef_fs.write_pretty_json = true
data_store = Chef::ChefFS::ChefFSDataStore.new(@chef_fs)
- data_store = ChefZero::DataStore::V1ToV2Adapter.new(data_store, 'chef')
+ data_store = ChefZero::DataStore::V1ToV2Adapter.new(data_store, "chef")
server_options = {}
server_options[:data_store] = data_store
server_options[:log_level] = Chef::Log.level
@@ -103,9 +103,9 @@ class Chef
def self.parse_port(port)
if port.is_a?(String)
- parts = port.split(',')
+ parts = port.split(",")
if parts.size == 1
- a,b = parts[0].split('-',2)
+ a,b = parts[0].split("-",2)
if b
a.to_i.upto(b.to_i)
else
diff --git a/lib/chef/log.rb b/lib/chef/log.rb
index 93c0cbbe68..b6efa81cac 100644
--- a/lib/chef/log.rb
+++ b/lib/chef/log.rb
@@ -17,12 +17,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'logger'
-require 'chef/monologger'
-require 'chef/exceptions'
-require 'mixlib/log'
-require 'chef/log/syslog' unless (RUBY_PLATFORM =~ /mswin|mingw|windows/)
-require 'chef/log/winevt'
+require "logger"
+require "chef/monologger"
+require "chef/exceptions"
+require "mixlib/log"
+require "chef/log/syslog" unless (RUBY_PLATFORM =~ /mswin|mingw|windows/)
+require "chef/log/winevt"
class Chef
class Log
diff --git a/lib/chef/log/syslog.rb b/lib/chef/log/syslog.rb
index 0c8190797f..2106130b26 100644
--- a/lib/chef/log/syslog.rb
+++ b/lib/chef/log/syslog.rb
@@ -16,9 +16,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'logger'
-require 'syslog-logger'
-require 'chef/mixin/unformatter'
+require "logger"
+require "syslog-logger"
+require "chef/mixin/unformatter"
class Chef
class Log
@@ -32,7 +32,7 @@ class Chef
attr_accessor :sync, :formatter
- def initialize(program_name = 'chef-client', facility = ::Syslog::LOG_DAEMON, logopts=nil)
+ def initialize(program_name = "chef-client", facility = ::Syslog::LOG_DAEMON, logopts=nil)
super
return if defined? ::Logger::Syslog::SYSLOG
::Logger::Syslog.const_set :SYSLOG, SYSLOG
diff --git a/lib/chef/log/winevt.rb b/lib/chef/log/winevt.rb
index 84ae80b634..53127877e1 100644
--- a/lib/chef/log/winevt.rb
+++ b/lib/chef/log/winevt.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/event_loggers/base'
-require 'chef/platform/query_helpers'
-require 'chef/mixin/unformatter'
+require "chef/event_loggers/base"
+require "chef/platform/query_helpers"
+require "chef/mixin/unformatter"
class Chef
class Log
@@ -36,14 +36,14 @@ class Chef
FATAL_EVENT_ID = 10104
# Since we must install the event logger, this is not really configurable
- SOURCE = 'Chef'
+ SOURCE = "Chef"
include Chef::Mixin::Unformatter
attr_accessor :sync, :formatter, :level
def initialize(eventlog=nil)
- @eventlog = eventlog || ::Win32::EventLog::open('Application')
+ @eventlog = eventlog || ::Win32::EventLog::open("Application")
end
def close
diff --git a/lib/chef/mixin/checksum.rb b/lib/chef/mixin/checksum.rb
index 1d9c99ec7e..f805efae9a 100644
--- a/lib/chef/mixin/checksum.rb
+++ b/lib/chef/mixin/checksum.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'digest/sha2'
-require 'chef/digester'
+require "digest/sha2"
+require "chef/digester"
class Chef
module Mixin
diff --git a/lib/chef/mixin/command.rb b/lib/chef/mixin/command.rb
index d9a9c4f006..ea6e5f19fc 100644
--- a/lib/chef/mixin/command.rb
+++ b/lib/chef/mixin/command.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/exceptions'
-require 'tmpdir'
-require 'fcntl'
-require 'etc'
+require "chef/log"
+require "chef/exceptions"
+require "tmpdir"
+require "fcntl"
+require "etc"
class Chef
module Mixin
@@ -50,11 +50,11 @@ class Chef
# NOTE: run_command is deprecated in favor of using Chef::Shellout which now comes from the mixlib-shellout gem. NOTE #
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'chef/mixin/command/windows'
+ require "chef/mixin/command/windows"
include ::Chef::Mixin::Command::Windows
extend ::Chef::Mixin::Command::Windows
else
- require 'chef/mixin/command/unix'
+ require "chef/mixin/command/unix"
include ::Chef::Mixin::Command::Unix
extend ::Chef::Mixin::Command::Unix
end
diff --git a/lib/chef/mixin/command/unix.rb b/lib/chef/mixin/command/unix.rb
index 2bad4e6bcf..710324caa0 100644
--- a/lib/chef/mixin/command/unix.rb
+++ b/lib/chef/mixin/command/unix.rb
@@ -104,7 +104,7 @@ class Chef
else
Kernel.exec(cmd)
end
- raise 'forty-two'
+ raise "forty-two"
rescue Exception => e
Marshal.dump(e, ps.last)
ps.last.flush
diff --git a/lib/chef/mixin/command/windows.rb b/lib/chef/mixin/command/windows.rb
index 0147d58039..9cd1162234 100644
--- a/lib/chef/mixin/command/windows.rb
+++ b/lib/chef/mixin/command/windows.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require 'open3'
+require "open3"
class Chef
module Mixin
diff --git a/lib/chef/mixin/convert_to_class_name.rb b/lib/chef/mixin/convert_to_class_name.rb
index 14676e5ed4..8ac42cb218 100644
--- a/lib/chef/mixin/convert_to_class_name.rb
+++ b/lib/chef/mixin/convert_to_class_name.rb
@@ -42,7 +42,7 @@ class Chef
def convert_to_snake_case(str, namespace=nil)
str = str.dup
- str.sub!(/^#{namespace}(\:\:)?/, '') if namespace
+ str.sub!(/^#{namespace}(\:\:)?/, "") if namespace
str.gsub!(/[A-Z]/) {|s| "_" + s}
str.downcase!
str.sub!(/^\_/, "")
@@ -51,19 +51,19 @@ class Chef
def normalize_snake_case_name(str)
str = str.dup
- str.gsub!(/[^A-Za-z0-9_]/,'_')
- str.gsub!(/^(_+)?/,'')
+ str.gsub!(/[^A-Za-z0-9_]/,"_")
+ str.gsub!(/^(_+)?/,"")
str
end
def snake_case_basename(str)
with_namespace = convert_to_snake_case(str)
- with_namespace.split("::").last.sub(/^_/, '')
+ with_namespace.split("::").last.sub(/^_/, "")
end
def filename_to_qualified_string(base, filename)
file_base = File.basename(filename, ".rb")
- str = base.to_s + (file_base == 'default' ? '' : "_#{file_base}")
+ str = base.to_s + (file_base == "default" ? "" : "_#{file_base}")
normalize_snake_case_name(str)
end
@@ -91,7 +91,7 @@ class Chef
# NameError is raised when the name is not in CamelCase or the constant is
# unknown.
def constantize(camel_cased_word)
- names = camel_cased_word.split('::')
+ names = camel_cased_word.split("::")
# Trigger a built-in NameError exception including the ill-formed constant in the message.
Object.const_get(camel_cased_word) if names.empty?
diff --git a/lib/chef/mixin/create_path.rb b/lib/chef/mixin/create_path.rb
index 547224dda9..ee0f80448f 100644
--- a/lib/chef/mixin/create_path.rb
+++ b/lib/chef/mixin/create_path.rb
@@ -35,7 +35,7 @@ class Chef
if file_path.kind_of?(String)
file_path = File.expand_path(file_path).split(File::SEPARATOR)
- file_path.shift if file_path[0] == ''
+ file_path.shift if file_path[0] == ""
# Check if path starts with a separator or drive letter (Windows)
unless file_path[0].match("^#{File::SEPARATOR}|^[a-zA-Z]:")
file_path[0] = "#{File::SEPARATOR}#{file_path[0]}"
diff --git a/lib/chef/mixin/enforce_ownership_and_permissions.rb b/lib/chef/mixin/enforce_ownership_and_permissions.rb
index 9c1e4dda93..4dbdef0451 100644
--- a/lib/chef/mixin/enforce_ownership_and_permissions.rb
+++ b/lib/chef/mixin/enforce_ownership_and_permissions.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/file_access_control'
+require "chef/file_access_control"
class Chef
module Mixin
diff --git a/lib/chef/mixin/file_class.rb b/lib/chef/mixin/file_class.rb
index 347ef45ba9..f612cec148 100644
--- a/lib/chef/mixin/file_class.rb
+++ b/lib/chef/mixin/file_class.rb
@@ -24,7 +24,7 @@ class Chef
def file_class
@host_os_file ||= if Chef::Platform.windows?
- require 'chef/win32/file'
+ require "chef/win32/file"
Chef::ReservedNames::Win32::File
else
::File
diff --git a/lib/chef/mixin/homebrew_user.rb b/lib/chef/mixin/homebrew_user.rb
index ab6fb19563..6be3536814 100644
--- a/lib/chef/mixin/homebrew_user.rb
+++ b/lib/chef/mixin/homebrew_user.rb
@@ -22,8 +22,8 @@
# This lives here in Chef::Mixin because Chef's namespacing makes it
# awkward to use modules elsewhere (e.g., chef/provider/package/homebrew/owner)
-require 'chef/mixin/shell_out'
-require 'etc'
+require "chef/mixin/shell_out"
+require "etc"
class Chef
module Mixin
@@ -48,7 +48,7 @@ class Chef
private
def calculate_owner
- default_brew_path = '/usr/local/bin/brew'
+ default_brew_path = "/usr/local/bin/brew"
if ::File.exist?(default_brew_path)
# By default, this follows symlinks which is what we want
owner = ::File.stat(default_brew_path).uid
diff --git a/lib/chef/mixin/language.rb b/lib/chef/mixin/language.rb
index f4df86bdc3..45e96472c6 100644
--- a/lib/chef/mixin/language.rb
+++ b/lib/chef/mixin/language.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/dsl/platform_introspection'
-require 'chef/dsl/data_query'
-require 'chef/mixin/deprecation'
+require "chef/dsl/platform_introspection"
+require "chef/dsl/data_query"
+require "chef/mixin/deprecation"
class Chef
module Mixin
diff --git a/lib/chef/mixin/language_include_attribute.rb b/lib/chef/mixin/language_include_attribute.rb
index 0be2614e41..351ce6ad44 100644
--- a/lib/chef/mixin/language_include_attribute.rb
+++ b/lib/chef/mixin/language_include_attribute.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/dsl/include_attribute'
-require 'chef/mixin/deprecation'
+require "chef/dsl/include_attribute"
+require "chef/mixin/deprecation"
class Chef
module Mixin
diff --git a/lib/chef/mixin/language_include_recipe.rb b/lib/chef/mixin/language_include_recipe.rb
index d85e5c682d..8e608516d9 100644
--- a/lib/chef/mixin/language_include_recipe.rb
+++ b/lib/chef/mixin/language_include_recipe.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/dsl/include_recipe'
-require 'chef/mixin/deprecation'
+require "chef/dsl/include_recipe"
+require "chef/mixin/deprecation"
class Chef
module Mixin
diff --git a/lib/chef/mixin/params_validate.rb b/lib/chef/mixin/params_validate.rb
index e3c7657b1b..841cf9e6a2 100644
--- a/lib/chef/mixin/params_validate.rb
+++ b/lib/chef/mixin/params_validate.rb
@@ -15,9 +15,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/constants'
-require 'chef/property'
-require 'chef/delayed_evaluator'
+require "chef/constants"
+require "chef/property"
+require "chef/delayed_evaluator"
class Chef
module Mixin
diff --git a/lib/chef/mixin/path_sanity.rb b/lib/chef/mixin/path_sanity.rb
index ed857ffd36..00eba5876e 100644
--- a/lib/chef/mixin/path_sanity.rb
+++ b/lib/chef/mixin/path_sanity.rb
@@ -23,7 +23,7 @@ class Chef
def enforce_path_sanity(env=ENV)
if Chef::Config[:enforce_path_sanity]
env["PATH"] = "" if env["PATH"].nil?
- path_separator = Chef::Platform.windows? ? ';' : ':'
+ path_separator = Chef::Platform.windows? ? ";" : ":"
existing_paths = env["PATH"].split(path_separator)
# ensure the Ruby and Gem bindirs are included
# mainly for 'full-stack' Chef installs
@@ -56,7 +56,7 @@ class Chef
end
def ruby_bindir
- RbConfig::CONFIG['bindir']
+ RbConfig::CONFIG["bindir"]
end
def gem_bindir
diff --git a/lib/chef/mixin/powershell_out.rb b/lib/chef/mixin/powershell_out.rb
index 7ec2a5cb40..5e52c56747 100644
--- a/lib/chef/mixin/powershell_out.rb
+++ b/lib/chef/mixin/powershell_out.rb
@@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/mixin/shell_out'
-require 'chef/mixin/windows_architecture_helper'
+require "chef/mixin/shell_out"
+require "chef/mixin/windows_architecture_helper"
class Chef
module Mixin
diff --git a/lib/chef/mixin/powershell_type_coercions.rb b/lib/chef/mixin/powershell_type_coercions.rb
index 3297d6abbb..e068acab6e 100644
--- a/lib/chef/mixin/powershell_type_coercions.rb
+++ b/lib/chef/mixin/powershell_type_coercions.rb
@@ -25,8 +25,8 @@ class Chef
@type_coercions ||= {
Fixnum => { :type => lambda { |x| x.to_s }},
Float => { :type => lambda { |x| x.to_s }},
- FalseClass => { :type => lambda { |x| '$false' }},
- TrueClass => { :type => lambda { |x| '$true' }},
+ FalseClass => { :type => lambda { |x| "$false" }},
+ TrueClass => { :type => lambda { |x| "$true" }},
Hash => {:type => Proc.new { |x| translate_hash(x)}},
Array => {:type => Proc.new { |x| translate_array(x)}},
}
@@ -61,7 +61,7 @@ class Chef
end
def unsafe?(s)
- ["'", '#', '`', '"'].any? do |x|
+ ["'", '#', "`", '"'].any? do |x|
s.include? x
end
end
diff --git a/lib/chef/mixin/properties.rb b/lib/chef/mixin/properties.rb
index 85abe4427e..af4e2c2c09 100644
--- a/lib/chef/mixin/properties.rb
+++ b/lib/chef/mixin/properties.rb
@@ -1,6 +1,6 @@
-require 'chef/delayed_evaluator'
-require 'chef/mixin/params_validate'
-require 'chef/property'
+require "chef/delayed_evaluator"
+require "chef/mixin/params_validate"
+require "chef/property"
class Chef
module Mixin
diff --git a/lib/chef/mixin/provides.rb b/lib/chef/mixin/provides.rb
index 095e273dab..5885752752 100644
--- a/lib/chef/mixin/provides.rb
+++ b/lib/chef/mixin/provides.rb
@@ -1,5 +1,5 @@
-require 'chef/mixin/descendants_tracker'
+require "chef/mixin/descendants_tracker"
class Chef
module Mixin
diff --git a/lib/chef/mixin/proxified_socket.rb b/lib/chef/mixin/proxified_socket.rb
index 3fda0083c3..07a6e49928 100644
--- a/lib/chef/mixin/proxified_socket.rb
+++ b/lib/chef/mixin/proxified_socket.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'proxifier'
+require "proxifier"
class Chef
module Mixin
@@ -25,9 +25,9 @@ class Chef
# make the TCPSocket respect ENV['https_proxy'] or ENV['http_proxy'] if
# they are present
def proxified_socket(host, port)
- proxy = ENV['https_proxy'] || ENV['http_proxy'] || false
+ proxy = ENV["https_proxy"] || ENV["http_proxy"] || false
if proxy
- Proxifier.Proxy(proxy, no_proxy: ENV['no_proxy']).open(host, port)
+ Proxifier.Proxy(proxy, no_proxy: ENV["no_proxy"]).open(host, port)
else
TCPSocket.new(host, port)
end
diff --git a/lib/chef/mixin/recipe_definition_dsl_core.rb b/lib/chef/mixin/recipe_definition_dsl_core.rb
index 704ee162be..c998936b69 100644
--- a/lib/chef/mixin/recipe_definition_dsl_core.rb
+++ b/lib/chef/mixin/recipe_definition_dsl_core.rb
@@ -24,7 +24,7 @@
# This constant (module name) will eventually be deprecated and then removed.
###
-require 'chef/mixin/deprecation'
+require "chef/mixin/deprecation"
class Chef
module Mixin
diff --git a/lib/chef/mixin/shell_out.rb b/lib/chef/mixin/shell_out.rb
index 529023056d..1e6f96d99a 100644
--- a/lib/chef/mixin/shell_out.rb
+++ b/lib/chef/mixin/shell_out.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'mixlib/shellout'
+require "mixlib/shellout"
class Chef
module Mixin
@@ -35,15 +35,15 @@ class Chef
env_key = options.has_key?(:env) ? :env : :environment
options[env_key] ||= {}
options[env_key] = options[env_key].dup
- options[env_key]['LC_ALL'] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?('LC_ALL')
- options[env_key]['LANGUAGE'] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?('LANGUAGE')
- options[env_key]['LANG'] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?('LANG')
+ options[env_key]["LC_ALL"] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?("LC_ALL")
+ options[env_key]["LANGUAGE"] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?("LANGUAGE")
+ options[env_key]["LANG"] ||= Chef::Config[:internal_locale] unless options[env_key].has_key?("LANG")
args << options
else
args << { :environment => {
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
} }
end
@@ -114,4 +114,4 @@ class Chef
end
# Break circular dep
-require 'chef/config'
+require "chef/config"
diff --git a/lib/chef/mixin/template.rb b/lib/chef/mixin/template.rb
index db9a2f6d91..c669dc630b 100644
--- a/lib/chef/mixin/template.rb
+++ b/lib/chef/mixin/template.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'tempfile'
-require 'erubis'
+require "tempfile"
+require "erubis"
class Chef
module Mixin
diff --git a/lib/chef/mixin/uris.rb b/lib/chef/mixin/uris.rb
index 0136b55f6a..e33250dc2d 100644
--- a/lib/chef/mixin/uris.rb
+++ b/lib/chef/mixin/uris.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'uri'
+require "uri"
class Chef
module Mixin
diff --git a/lib/chef/mixin/which.rb b/lib/chef/mixin/which.rb
index 4e1c516386..715b7443dc 100644
--- a/lib/chef/mixin/which.rb
+++ b/lib/chef/mixin/which.rb
@@ -21,11 +21,11 @@ class Chef
def which(cmd, opts = {})
extra_path =
if opts[:extra_path].nil?
- [ '/bin', '/usr/bin', '/sbin', '/usr/sbin' ]
+ [ "/bin", "/usr/bin", "/sbin", "/usr/sbin" ]
else
[ opts[:extra_path] ].flatten
end
- paths = ENV['PATH'].split(File::PATH_SEPARATOR) + extra_path
+ paths = ENV["PATH"].split(File::PATH_SEPARATOR) + extra_path
paths.each do |path|
filename = File.join(path, cmd)
return filename if File.executable?(Chef.path_to(filename))
diff --git a/lib/chef/mixin/wide_string.rb b/lib/chef/mixin/wide_string.rb
index 0c32b76365..46c0f128dc 100644
--- a/lib/chef/mixin/wide_string.rb
+++ b/lib/chef/mixin/wide_string.rb
@@ -31,7 +31,7 @@ class Chef
def utf8_to_wide(ustring)
# ensure it is actually UTF-8
# Ruby likes to mark binary data as ASCII-8BIT
- ustring = (ustring + "").force_encoding('UTF-8') if ustring.respond_to?(:force_encoding) && ustring.encoding.name != "UTF-8"
+ ustring = (ustring + "").force_encoding("UTF-8") if ustring.respond_to?(:force_encoding) && ustring.encoding.name != "UTF-8"
# ensure we have the double-null termination Windows Wide likes
ustring = ustring + "\000\000" if ustring.length == 0 or ustring[-1].chr != "\000"
@@ -39,9 +39,9 @@ class Chef
# encode it all as UTF-16LE AKA Windows Wide Character AKA Windows Unicode
ustring = begin
if ustring.respond_to?(:encode)
- ustring.encode('UTF-16LE')
+ ustring.encode("UTF-16LE")
else
- require 'iconv'
+ require "iconv"
Iconv.conv("UTF-16LE", "UTF-8", ustring)
end
end
@@ -51,14 +51,14 @@ class Chef
def wide_to_utf8(wstring)
# ensure it is actually UTF-16LE
# Ruby likes to mark binary data as ASCII-8BIT
- wstring = wstring.force_encoding('UTF-16LE') if wstring.respond_to?(:force_encoding)
+ wstring = wstring.force_encoding("UTF-16LE") if wstring.respond_to?(:force_encoding)
# encode it all as UTF-8
wstring = begin
if wstring.respond_to?(:encode)
- wstring.encode('UTF-8')
+ wstring.encode("UTF-8")
else
- require 'iconv'
+ require "iconv"
Iconv.conv("UTF-8", "UTF-16LE", wstring)
end
end
diff --git a/lib/chef/mixin/windows_architecture_helper.rb b/lib/chef/mixin/windows_architecture_helper.rb
index 744001f8a2..7ac56ecdaf 100644
--- a/lib/chef/mixin/windows_architecture_helper.rb
+++ b/lib/chef/mixin/windows_architecture_helper.rb
@@ -17,10 +17,10 @@
#
-require 'chef/exceptions'
-require 'chef/platform/query_helpers'
-require 'chef/win32/process' if Chef::Platform.windows?
-require 'chef/win32/system' if Chef::Platform.windows?
+require "chef/exceptions"
+require "chef/platform/query_helpers"
+require "chef/win32/process" if Chef::Platform.windows?
+require "chef/win32/system" if Chef::Platform.windows?
class Chef
module Mixin
@@ -48,11 +48,11 @@ class Chef
def with_os_architecture(node, architecture: nil)
node ||= begin
- os_arch = ENV['PROCESSOR_ARCHITEW6432'] ||
- ENV['PROCESSOR_ARCHITECTURE']
+ os_arch = ENV["PROCESSOR_ARCHITEW6432"] ||
+ ENV["PROCESSOR_ARCHITECTURE"]
Hash.new.tap do |n|
n[:kernel] = Hash.new
- n[:kernel][:machine] = os_arch == 'AMD64' ? :x86_64 : :i386
+ n[:kernel][:machine] = os_arch == "AMD64" ? :x86_64 : :i386
end
end
diff --git a/lib/chef/mixin/windows_env_helper.rb b/lib/chef/mixin/windows_env_helper.rb
index cd12b4254a..98b5dcf893 100644
--- a/lib/chef/mixin/windows_env_helper.rb
+++ b/lib/chef/mixin/windows_env_helper.rb
@@ -17,12 +17,12 @@
#
-require 'chef/exceptions'
-require 'chef/mixin/wide_string'
-require 'chef/platform/query_helpers'
-require 'chef/win32/error' if Chef::Platform.windows?
-require 'chef/win32/api/system' if Chef::Platform.windows?
-require 'chef/win32/api/unicode' if Chef::Platform.windows?
+require "chef/exceptions"
+require "chef/mixin/wide_string"
+require "chef/platform/query_helpers"
+require "chef/win32/error" if Chef::Platform.windows?
+require "chef/win32/api/system" if Chef::Platform.windows?
+require "chef/win32/api/unicode" if Chef::Platform.windows?
class Chef
module Mixin
@@ -44,11 +44,11 @@ class Chef
flags = SMTO_BLOCK | SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG
# for why two calls, see:
# http://stackoverflow.com/questions/4968373/why-doesnt-sendmessagetimeout-update-the-environment-variables
- if ( SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string('Environment').address, flags, 5000, nil) == 0 )
+ if ( SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string("Environment").address, flags, 5000, nil) == 0 )
Chef::ReservedNames::Win32::Error.raise!
end
if ( SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string(
- utf8_to_wide('Environment')
+ utf8_to_wide("Environment")
).address, flags, 5000, nil) == 0 )
Chef::ReservedNames::Win32::Error.raise!
end
diff --git a/lib/chef/mixin/xml_escape.rb b/lib/chef/mixin/xml_escape.rb
index ceb45df3e6..78b0399493 100644
--- a/lib/chef/mixin/xml_escape.rb
+++ b/lib/chef/mixin/xml_escape.rb
@@ -46,10 +46,10 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-require 'chef/log'
+require "chef/log"
begin
- require 'fast_xs'
+ require "fast_xs"
rescue LoadError
Chef::Log.info "The fast_xs gem is not installed, slower pure ruby XML escaping will be used."
end
@@ -93,9 +93,9 @@ class Chef
# http://www.w3.org/TR/REC-xml/#dt-chardata
PREDEFINED = {
- 38 => '&amp;', # ampersand
- 60 => '&lt;', # left angle bracket
- 62 => '&gt;' # right angle bracket
+ 38 => "&amp;", # ampersand
+ 60 => "&lt;", # left angle bracket
+ 62 => "&gt;" # right angle bracket
}
# http://www.w3.org/TR/REC-xml/#charsets
diff --git a/lib/chef/mixins.rb b/lib/chef/mixins.rb
index 17be1622af..7ae7fe659e 100644
--- a/lib/chef/mixins.rb
+++ b/lib/chef/mixins.rb
@@ -1,14 +1,14 @@
-require 'chef/mixin/shell_out'
-require 'chef/mixin/checksum'
-require 'chef/mixin/command'
-require 'chef/mixin/convert_to_class_name'
-require 'chef/mixin/create_path'
-require 'chef/mixin/deep_merge'
-require 'chef/mixin/enforce_ownership_and_permissions'
-require 'chef/mixin/from_file'
-require 'chef/mixin/params_validate'
-require 'chef/mixin/path_sanity'
-require 'chef/mixin/template'
-require 'chef/mixin/securable'
-require 'chef/mixin/xml_escape'
+require "chef/mixin/shell_out"
+require "chef/mixin/checksum"
+require "chef/mixin/command"
+require "chef/mixin/convert_to_class_name"
+require "chef/mixin/create_path"
+require "chef/mixin/deep_merge"
+require "chef/mixin/enforce_ownership_and_permissions"
+require "chef/mixin/from_file"
+require "chef/mixin/params_validate"
+require "chef/mixin/path_sanity"
+require "chef/mixin/template"
+require "chef/mixin/securable"
+require "chef/mixin/xml_escape"
diff --git a/lib/chef/monkey_patches/net-ssh-multi.rb b/lib/chef/monkey_patches/net-ssh-multi.rb
index 0f4dd6655c..0bcb246755 100644
--- a/lib/chef/monkey_patches/net-ssh-multi.rb
+++ b/lib/chef/monkey_patches/net-ssh-multi.rb
@@ -34,11 +34,11 @@
#
# See: https://github.com/net-ssh/net-ssh-multi/pull/4
-require 'net/ssh/multi/version'
+require "net/ssh/multi/version"
if Net::SSH::Multi::Version::STRING == "1.1.0" || Net::SSH::Multi::Version::STRING == "1.2.0"
- require 'net/ssh/multi'
+ require "net/ssh/multi"
module Net
module SSH
diff --git a/lib/chef/monkey_patches/net_http.rb b/lib/chef/monkey_patches/net_http.rb
index 9c8044a9a7..6aad6029c3 100644
--- a/lib/chef/monkey_patches/net_http.rb
+++ b/lib/chef/monkey_patches/net_http.rb
@@ -5,7 +5,7 @@ module ChefNetHTTPExceptionExtensions
attr_accessor :chef_rest_request
end
-require 'net/http'
+require "net/http"
module Net
class HTTPError
include ChefNetHTTPExceptionExtensions
diff --git a/lib/chef/monkey_patches/webrick-utils.rb b/lib/chef/monkey_patches/webrick-utils.rb
index 57f6db54ed..de28eaa3c0 100644
--- a/lib/chef/monkey_patches/webrick-utils.rb
+++ b/lib/chef/monkey_patches/webrick-utils.rb
@@ -1,4 +1,4 @@
-require 'webrick/utils'
+require "webrick/utils"
module WEBrick
module Utils
diff --git a/lib/chef/monkey_patches/win32/registry.rb b/lib/chef/monkey_patches/win32/registry.rb
index 2ce2ac97f1..917746c1e6 100644
--- a/lib/chef/monkey_patches/win32/registry.rb
+++ b/lib/chef/monkey_patches/win32/registry.rb
@@ -15,9 +15,9 @@
# limitations under the License.
#
-require 'chef/win32/api/registry'
-require 'chef/win32/unicode'
-require 'win32/registry'
+require "chef/win32/api/registry"
+require "chef/win32/unicode"
+require "win32/registry"
module Win32
class Registry
@@ -59,7 +59,7 @@ module Win32
when REG_DWORD
data = API.packdw(data.to_i)
when REG_DWORD_BIG_ENDIAN
- data = [data.to_i].pack('N')
+ data = [data.to_i].pack("N")
when REG_QWORD
data = API.packqw(data.to_i)
else
diff --git a/lib/chef/monologger.rb b/lib/chef/monologger.rb
index f7d226f82e..e0ca5c5be6 100644
--- a/lib/chef/monologger.rb
+++ b/lib/chef/monologger.rb
@@ -1,5 +1,5 @@
-require 'logger'
-require 'pp'
+require "logger"
+require "pp"
#== MonoLogger
# A subclass of Ruby's stdlib Logger with all the mutex and logrotation stuff
diff --git a/lib/chef/node.rb b/lib/chef/node.rb
index e2f3ec4fc0..d7b0bf5948 100644
--- a/lib/chef/node.rb
+++ b/lib/chef/node.rb
@@ -18,22 +18,22 @@
# limitations under the License.
#
-require 'forwardable'
-require 'chef/config'
-require 'chef/nil_argument'
-require 'chef/mixin/params_validate'
-require 'chef/mixin/from_file'
-require 'chef/mixin/deep_merge'
-require 'chef/dsl/include_attribute'
-require 'chef/dsl/platform_introspection'
-require 'chef/environment'
-require 'chef/server_api'
-require 'chef/run_list'
-require 'chef/node/attribute'
-require 'chef/mash'
-require 'chef/json_compat'
-require 'chef/search/query'
-require 'chef/whitelist'
+require "forwardable"
+require "chef/config"
+require "chef/nil_argument"
+require "chef/mixin/params_validate"
+require "chef/mixin/from_file"
+require "chef/mixin/deep_merge"
+require "chef/dsl/include_attribute"
+require "chef/dsl/platform_introspection"
+require "chef/environment"
+require "chef/server_api"
+require "chef/run_list"
+require "chef/node/attribute"
+require "chef/mash"
+require "chef/json_compat"
+require "chef/search/query"
+require "chef/whitelist"
class Chef
class Node
@@ -69,7 +69,7 @@ class Chef
@chef_server_rest = chef_server_rest
@name = nil
- @chef_environment = '_default'
+ @chef_environment = "_default"
@primary_runlist = Chef::RunList.new
@override_runlist = Chef::RunList.new
@@ -433,7 +433,7 @@ class Chef
# run_list is mutated? Or perhaps do something smarter like
# on-demand generation of default_attrs and override_attrs,
# invalidated only when run_list is mutated?
- def expand!(data_source = 'server')
+ def expand!(data_source = "server")
expansion = run_list.expand(chef_environment, data_source)
raise Chef::Exceptions::MissingRole, expansion if expansion.errors?
@@ -500,7 +500,7 @@ class Chef
result = {
"name" => name,
"chef_environment" => chef_environment,
- 'json_class' => self.class.name,
+ "json_class" => self.class.name,
"automatic" => attributes.automatic,
"normal" => attributes.normal,
"chef_type" => "node",
@@ -586,7 +586,7 @@ class Chef
def self.find_or_create(node_name)
load(node_name)
rescue Net::HTTPServerException => e
- raise unless e.response.code == '404'
+ raise unless e.response.code == "404"
node = build(node_name)
node.create
end
diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb
index 862a7a2fd9..aa2fcdaa8e 100644
--- a/lib/chef/node/attribute.rb
+++ b/lib/chef/node/attribute.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'chef/node/immutable_collections'
-require 'chef/node/attribute_collections'
-require 'chef/mixin/deep_merge'
-require 'chef/log'
+require "chef/node/immutable_collections"
+require "chef/node/attribute_collections"
+require "chef/mixin/deep_merge"
+require "chef/log"
class Chef
class Node
@@ -482,7 +482,7 @@ class Chef
def inspect
"#<#{self.class} " << (COMPONENTS + [:@merged_attributes, :@properties]).map{|iv|
"#{iv}=#{instance_variable_get(iv).inspect}"
- }.join(', ') << ">"
+ }.join(", ") << ">"
end
def set_unless?
diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb
index 751f9576f6..55b5942a21 100644
--- a/lib/chef/node_map.rb
+++ b/lib/chef/node_map.rb
@@ -128,7 +128,7 @@ class Chef
value = node[attribute]
# Split the blacklist and whitelist
- blacklist, whitelist = filter_values.partition { |v| v.is_a?(String) && v.start_with?('!') }
+ blacklist, whitelist = filter_values.partition { |v| v.is_a?(String) && v.start_with?("!") }
# If any blacklist value matches, we don't match
return false if blacklist.any? { |v| v[1..-1] == value }
@@ -195,8 +195,8 @@ class Chef
# Check for blcacklists ('!windows'). Those always come *after* positive
# whitelists.
- a_negated = Array(a).any? { |f| f.is_a?(String) && f.start_with?('!') }
- b_negated = Array(b).any? { |f| f.is_a?(String) && f.start_with?('!') }
+ a_negated = Array(a).any? { |f| f.is_a?(String) && f.start_with?("!") }
+ b_negated = Array(b).any? { |f| f.is_a?(String) && f.start_with?("!") }
if a_negated != b_negated
return 1 if a_negated
return -1 if b_negated
diff --git a/lib/chef/org.rb b/lib/chef/org.rb
index ff0d2de390..33a986dc3b 100644
--- a/lib/chef/org.rb
+++ b/lib/chef/org.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/json_compat'
-require 'chef/mixin/params_validate'
-require 'chef/server_api'
+require "chef/json_compat"
+require "chef/mixin/params_validate"
+require "chef/server_api"
class Chef
class Org
@@ -27,7 +27,7 @@ class Chef
def initialize(name)
@name = name
- @full_name = ''
+ @full_name = ""
# The Chef API returns the private key of the validator
# client on create
@private_key = nil
@@ -104,7 +104,7 @@ class Chef
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)
@@ -113,10 +113,10 @@ class Chef
# Class methods
def self.from_hash(org_hash)
- org = Chef::Org.new(org_hash['name'])
- org.full_name org_hash['full_name']
- org.private_key org_hash['private_key'] if org_hash.key?('private_key')
- org.guid org_hash['guid'] if org_hash.key?('guid')
+ org = Chef::Org.new(org_hash["name"])
+ org.full_name org_hash["full_name"]
+ org.private_key org_hash["private_key"] if org_hash.key?("private_key")
+ org.guid org_hash["guid"] if org_hash.key?("guid")
org
end
@@ -134,7 +134,7 @@ class Chef
end
def self.list(inflate=false)
- orgs = Chef::ServerAPI.new(Chef::Config[:chef_server_root]).get('organizations')
+ orgs = Chef::ServerAPI.new(Chef::Config[:chef_server_root]).get("organizations")
if inflate
orgs.inject({}) do |org_map, (name, _url)|
org_map[name] = Chef::Org.load(name)
diff --git a/lib/chef/platform.rb b/lib/chef/platform.rb
index 841aa1b46c..e411aa5b92 100644
--- a/lib/chef/platform.rb
+++ b/lib/chef/platform.rb
@@ -17,8 +17,8 @@
#
# Order of these headers is important: query helpers is needed by many things
-require 'chef/platform/query_helpers'
-require 'chef/platform/provider_mapping'
+require "chef/platform/query_helpers"
+require "chef/platform/provider_mapping"
class Chef
class Platform
diff --git a/lib/chef/platform/handler_map.rb b/lib/chef/platform/handler_map.rb
index a9551a344b..48e118d599 100644
--- a/lib/chef/platform/handler_map.rb
+++ b/lib/chef/platform/handler_map.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/node_map'
+require "chef/node_map"
class Chef
class Platform
diff --git a/lib/chef/platform/priority_map.rb b/lib/chef/platform/priority_map.rb
index 0b050deb59..004aa01c16 100644
--- a/lib/chef/platform/priority_map.rb
+++ b/lib/chef/platform/priority_map.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/node_map'
+require "chef/node_map"
class Chef
class Platform
diff --git a/lib/chef/platform/provider_handler_map.rb b/lib/chef/platform/provider_handler_map.rb
index 4549d7994e..ecd1da1f1e 100644
--- a/lib/chef/platform/provider_handler_map.rb
+++ b/lib/chef/platform/provider_handler_map.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'singleton'
-require 'chef/platform/handler_map'
+require "singleton"
+require "chef/platform/handler_map"
class Chef
class Platform
diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb
index a4811ccc33..235fd4d471 100644
--- a/lib/chef/platform/provider_mapping.rb
+++ b/lib/chef/platform/provider_mapping.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/exceptions'
-require 'chef/mixin/params_validate'
-require 'chef/version_constraint/platform'
-require 'chef/provider'
+require "chef/log"
+require "chef/exceptions"
+require "chef/mixin/params_validate"
+require "chef/version_constraint/platform"
+require "chef/provider"
class Chef
class Platform
@@ -197,7 +197,7 @@ class Chef
def resource_matching_provider(platform, version, resource_type)
if resource_type.kind_of?(Chef::Resource)
- class_name = resource_type.class.name ? resource_type.class.name.split('::').last :
+ class_name = resource_type.class.name ? resource_type.class.name.split("::").last :
convert_to_class_name(resource_type.resource_name.to_s)
if Chef::Provider.const_defined?(class_name)
diff --git a/lib/chef/platform/provider_priority_map.rb b/lib/chef/platform/provider_priority_map.rb
index 5599c74c2d..0c8a728618 100644
--- a/lib/chef/platform/provider_priority_map.rb
+++ b/lib/chef/platform/provider_priority_map.rb
@@ -1,5 +1,5 @@
-require 'singleton'
-require 'chef/platform/priority_map'
+require "singleton"
+require "chef/platform/priority_map"
class Chef
class Platform
diff --git a/lib/chef/platform/query_helpers.rb b/lib/chef/platform/query_helpers.rb
index 699e98737c..3abd1a2a8b 100644
--- a/lib/chef/platform/query_helpers.rb
+++ b/lib/chef/platform/query_helpers.rb
@@ -27,18 +27,18 @@ class Chef
def windows_server_2003?
# WMI startup shouldn't be performed unless we're on Windows.
return false unless windows?
- require 'wmi-lite/wmi'
+ require "wmi-lite/wmi"
wmi = WmiLite::Wmi.new
- host = wmi.first_of('Win32_OperatingSystem')
- is_server_2003 = (host['version'] && host['version'].start_with?("5.2"))
+ host = wmi.first_of("Win32_OperatingSystem")
+ is_server_2003 = (host["version"] && host["version"].start_with?("5.2"))
is_server_2003
end
def windows_nano_server?
return false unless windows?
- require 'win32/registry'
+ require "win32/registry"
# This method may be called before ohai runs (e.g., it may be used to
# determine settings in config.rb). Chef::Win32::Registry.new uses
@@ -60,7 +60,7 @@ class Chef
def supports_msi?
return false unless windows?
- require 'win32/registry'
+ require "win32/registry"
key = "System\\CurrentControlSet\\Services\\msiserver"
access = ::Win32::Registry::KEY_QUERY_VALUE
@@ -94,16 +94,16 @@ class Chef
end
def dsc_refresh_mode_disabled?(node)
- require 'chef/util/powershell/cmdlet'
+ require "chef/util/powershell/cmdlet"
cmdlet = Chef::Util::Powershell::Cmdlet.new(node, "Get-DscLocalConfigurationManager", :object)
metadata = cmdlet.run!.return_value
- metadata['RefreshMode'] == 'Disabled'
+ metadata["RefreshMode"] == "Disabled"
end
def supported_powershell_version?(node, version_string)
return false unless node[:languages] && node[:languages][:powershell]
- require 'rubygems'
+ require "rubygems"
Gem::Version.new(node[:languages][:powershell][:version]) >=
Gem::Version.new(version_string)
end
diff --git a/lib/chef/platform/rebooter.rb b/lib/chef/platform/rebooter.rb
index ce357bf993..83d4730075 100644
--- a/lib/chef/platform/rebooter.rb
+++ b/lib/chef/platform/rebooter.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/dsl/reboot_pending'
-require 'chef/log'
-require 'chef/platform'
+require "chef/dsl/reboot_pending"
+require "chef/log"
+require "chef/platform"
class Chef
class Platform
diff --git a/lib/chef/platform/resource_handler_map.rb b/lib/chef/platform/resource_handler_map.rb
index 27a7bb1342..166ee73173 100644
--- a/lib/chef/platform/resource_handler_map.rb
+++ b/lib/chef/platform/resource_handler_map.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'singleton'
-require 'chef/platform/handler_map'
+require "singleton"
+require "chef/platform/handler_map"
class Chef
class Platform
diff --git a/lib/chef/platform/resource_priority_map.rb b/lib/chef/platform/resource_priority_map.rb
index 5cc86fd2e7..1871dcd5c6 100644
--- a/lib/chef/platform/resource_priority_map.rb
+++ b/lib/chef/platform/resource_priority_map.rb
@@ -1,5 +1,5 @@
-require 'singleton'
-require 'chef/platform/priority_map'
+require "singleton"
+require "chef/platform/priority_map"
class Chef
class Platform
diff --git a/lib/chef/platform/service_helpers.rb b/lib/chef/platform/service_helpers.rb
index ae95520e47..09b6acb897 100644
--- a/lib/chef/platform/service_helpers.rb
+++ b/lib/chef/platform/service_helpers.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/chef_class'
+require "chef/chef_class"
class Chef
class Platform
diff --git a/lib/chef/policy_builder.rb b/lib/chef/policy_builder.rb
index 56415dbbd0..34816c44a0 100644
--- a/lib/chef/policy_builder.rb
+++ b/lib/chef/policy_builder.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/policy_builder/expand_node_object'
-require 'chef/policy_builder/policyfile'
-require 'chef/policy_builder/dynamic'
+require "chef/policy_builder/expand_node_object"
+require "chef/policy_builder/policyfile"
+require "chef/policy_builder/dynamic"
class Chef
diff --git a/lib/chef/policy_builder/dynamic.rb b/lib/chef/policy_builder/dynamic.rb
index d4b3df748e..6968aac49f 100644
--- a/lib/chef/policy_builder/dynamic.rb
+++ b/lib/chef/policy_builder/dynamic.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'forwardable'
+require "forwardable"
-require 'chef/log'
-require 'chef/run_context'
-require 'chef/config'
-require 'chef/node'
-require 'chef/exceptions'
+require "chef/log"
+require "chef/run_context"
+require "chef/config"
+require "chef/node"
+require "chef/exceptions"
class Chef
module PolicyBuilder
diff --git a/lib/chef/policy_builder/expand_node_object.rb b/lib/chef/policy_builder/expand_node_object.rb
index 7b56074e5a..6bc5300a35 100644
--- a/lib/chef/policy_builder/expand_node_object.rb
+++ b/lib/chef/policy_builder/expand_node_object.rb
@@ -19,12 +19,12 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/server_api'
-require 'chef/run_context'
-require 'chef/config'
-require 'chef/node'
-require 'chef/chef_class'
+require "chef/log"
+require "chef/server_api"
+require "chef/run_context"
+require "chef/config"
+require "chef/node"
+require "chef/chef_class"
class Chef
module PolicyBuilder
@@ -164,9 +164,9 @@ class Chef
# Expands the node's run list. Stores the run_list_expansion object for later use.
def expand_run_list
@run_list_expansion = if Chef::Config[:solo]
- node.expand!('disk')
+ node.expand!("disk")
else
- node.expand!('server')
+ node.expand!("server")
end
# @run_list_expansion is a RunListExpansion.
@@ -249,7 +249,7 @@ class Chef
def runlist_override_sanity_check!
# Convert to array and remove whitespace
if override_runlist.is_a?(String)
- @override_runlist = override_runlist.split(',').map { |e| e.strip }
+ @override_runlist = override_runlist.split(",").map { |e| e.strip }
end
@override_runlist = [override_runlist].flatten.compact
override_runlist.map! do |item|
diff --git a/lib/chef/policy_builder/policyfile.rb b/lib/chef/policy_builder/policyfile.rb
index 249bebbd98..5c782d88fc 100644
--- a/lib/chef/policy_builder/policyfile.rb
+++ b/lib/chef/policy_builder/policyfile.rb
@@ -19,11 +19,11 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/run_context'
-require 'chef/config'
-require 'chef/node'
-require 'chef/server_api'
+require "chef/log"
+require "chef/run_context"
+require "chef/config"
+require "chef/node"
+require "chef/server_api"
class Chef
module PolicyBuilder
diff --git a/lib/chef/property.rb b/lib/chef/property.rb
index 89e4ffe0e6..8ff4ecc7fc 100644
--- a/lib/chef/property.rb
+++ b/lib/chef/property.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/delayed_evaluator'
-require 'chef/chef_class'
-require 'chef/log'
+require "chef/exceptions"
+require "chef/delayed_evaluator"
+require "chef/chef_class"
+require "chef/log"
class Chef
#
diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb
index 99e02844ac..4d99d316ca 100644
--- a/lib/chef/provider.rb
+++ b/lib/chef/provider.rb
@@ -17,22 +17,22 @@
# limitations under the License.
#
-require 'chef/mixin/from_file'
-require 'chef/mixin/convert_to_class_name'
-require 'chef/mixin/enforce_ownership_and_permissions'
-require 'chef/mixin/why_run'
-require 'chef/mixin/shell_out'
-require 'chef/mixin/powershell_out'
-require 'chef/mixin/provides'
-require 'chef/platform/service_helpers'
-require 'chef/node_map'
-require 'forwardable'
+require "chef/mixin/from_file"
+require "chef/mixin/convert_to_class_name"
+require "chef/mixin/enforce_ownership_and_permissions"
+require "chef/mixin/why_run"
+require "chef/mixin/shell_out"
+require "chef/mixin/powershell_out"
+require "chef/mixin/provides"
+require "chef/platform/service_helpers"
+require "chef/node_map"
+require "forwardable"
class Chef
class Provider
- require 'chef/mixin/why_run'
- require 'chef/mixin/shell_out'
- require 'chef/mixin/provides'
+ require "chef/mixin/why_run"
+ require "chef/mixin/shell_out"
+ require "chef/mixin/provides"
include Chef::Mixin::WhyRun
include Chef::Mixin::ShellOut
include Chef::Mixin::PowershellOut
@@ -217,7 +217,7 @@ class Chef
property_size = modified.map { |p| p.size }.max
modified.map! do |p|
properties_str = if sensitive
- '(suppressed sensitive property)'
+ "(suppressed sensitive property)"
else
"#{new_resource.send(p).inspect} (was #{current_resource.send(p).inspect})"
end
@@ -230,9 +230,9 @@ class Chef
# write down any properties we are setting.
property_size = properties.map { |p| p.size }.max
created = properties.map do |property|
- default = ' (default value)' unless new_resource.property_is_set?(property)
+ default = " (default value)" unless new_resource.property_is_set?(property)
properties_str = if sensitive
- '(suppressed sensitive property)'
+ "(suppressed sensitive property)"
else
new_resource.send(property).inspect
end
@@ -391,7 +391,7 @@ class Chef
end
end
- require 'chef/dsl/recipe'
+ require "chef/dsl/recipe"
include Chef::DSL::Recipe::FullDSL
end
@@ -455,7 +455,7 @@ class Chef
end
# Requiring things at the bottom breaks cycles
-require 'chef/chef_class'
-require 'chef/mixin/why_run'
-require 'chef/resource_collection'
-require 'chef/runner'
+require "chef/chef_class"
+require "chef/mixin/why_run"
+require "chef/resource_collection"
+require "chef/runner"
diff --git a/lib/chef/provider/batch.rb b/lib/chef/provider/batch.rb
index 5f0134443d..63286f91f6 100644
--- a/lib/chef/provider/batch.rb
+++ b/lib/chef/provider/batch.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/windows_script'
+require "chef/provider/windows_script"
class Chef
class Provider
@@ -25,7 +25,7 @@ class Chef
provides :batch, os: "windows"
def initialize (new_resource, run_context)
- super(new_resource, run_context, '.bat')
+ super(new_resource, run_context, ".bat")
end
def command
@@ -37,7 +37,7 @@ class Chef
end
def flags
- @new_resource.flags.nil? ? '/c' : new_resource.flags + ' /c'
+ @new_resource.flags.nil? ? "/c" : new_resource.flags + " /c"
end
end
diff --git a/lib/chef/provider/cookbook_file.rb b/lib/chef/provider/cookbook_file.rb
index b501a9b41d..a537ca5fd5 100644
--- a/lib/chef/provider/cookbook_file.rb
+++ b/lib/chef/provider/cookbook_file.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/file'
-require 'chef/deprecation/provider/cookbook_file'
-require 'chef/deprecation/warnings'
+require "chef/provider/file"
+require "chef/deprecation/provider/cookbook_file"
+require "chef/deprecation/warnings"
class Chef
class Provider
diff --git a/lib/chef/provider/cookbook_file/content.rb b/lib/chef/provider/cookbook_file/content.rb
index 9f49ba885c..97290ff456 100644
--- a/lib/chef/provider/cookbook_file/content.rb
+++ b/lib/chef/provider/cookbook_file/content.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/file_content_management/content_base'
-require 'chef/file_content_management/tempfile'
+require "chef/file_content_management/content_base"
+require "chef/file_content_management/tempfile"
class Chef
class Provider
diff --git a/lib/chef/provider/cron.rb b/lib/chef/provider/cron.rb
index 6d86e336ec..fbd6510121 100644
--- a/lib/chef/provider/cron.rb
+++ b/lib/chef/provider/cron.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/mixin/command'
-require 'chef/provider'
+require "chef/log"
+require "chef/mixin/command"
+require "chef/provider"
class Chef
class Provider
diff --git a/lib/chef/provider/cron/unix.rb b/lib/chef/provider/cron/unix.rb
index 01c61e4253..0c4235df45 100644
--- a/lib/chef/provider/cron/unix.rb
+++ b/lib/chef/provider/cron/unix.rb
@@ -18,9 +18,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/provider'
-require 'chef/provider/cron'
+require "chef/log"
+require "chef/provider"
+require "chef/provider/cron"
class Chef
class Provider
@@ -28,12 +28,12 @@ class Chef
class Unix < Chef::Provider::Cron
include Chef::Mixin::ShellOut
- provides :cron, os: 'solaris2'
+ provides :cron, os: "solaris2"
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
Chef::Log.debug crontab.format_for_exception if status > 0
diff --git a/lib/chef/provider/deploy/revision.rb b/lib/chef/provider/deploy/revision.rb
index 62aa0e87f6..c3b61a564e 100644
--- a/lib/chef/provider/deploy/revision.rb
+++ b/lib/chef/provider/deploy/revision.rb
@@ -19,9 +19,9 @@
# limitations under the License.
#
-require 'chef/provider'
-require 'chef/provider/deploy'
-require 'chef/json_compat'
+require "chef/provider"
+require "chef/provider/deploy"
+require "chef/json_compat"
class Chef
class Provider
diff --git a/lib/chef/provider/directory.rb b/lib/chef/provider/directory.rb
index 8892d3a73d..c9b8b3a844 100644
--- a/lib/chef/provider/directory.rb
+++ b/lib/chef/provider/directory.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/log'
-require 'chef/resource/directory'
-require 'chef/provider'
-require 'chef/provider/file'
-require 'fileutils'
+require "chef/config"
+require "chef/log"
+require "chef/resource/directory"
+require "chef/provider"
+require "chef/provider/file"
+require "fileutils"
class Chef
class Provider
diff --git a/lib/chef/provider/dsc_resource.rb b/lib/chef/provider/dsc_resource.rb
index 3095ff63e0..b2946352fe 100644
--- a/lib/chef/provider/dsc_resource.rb
+++ b/lib/chef/provider/dsc_resource.rb
@@ -15,10 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/util/powershell/cmdlet'
-require 'chef/util/dsc/local_configuration_manager'
-require 'chef/mixin/powershell_type_coercions'
-require 'chef/util/dsc/resource_store'
+require "chef/util/powershell/cmdlet"
+require "chef/util/dsc/local_configuration_manager"
+require "chef/mixin/powershell_type_coercions"
+require "chef/util/dsc/resource_store"
class Chef
class Provider
@@ -61,7 +61,7 @@ class Chef
a.assertion { supports_refresh_mode_enabled? || dsc_refresh_mode_disabled? }
err = ["The LCM must have its RefreshMode set to Disabled for" \
" PowerShell versions before 5.0.10586.0."]
- a.failure_message Chef::Exceptions::ProviderNotFound, err.join(' ')
+ a.failure_message Chef::Exceptions::ProviderNotFound, err.join(" ")
a.whyrun err + ["Assuming a previous resource sets the RefreshMode."]
a.block_action!
end
@@ -109,10 +109,10 @@ class Chef
"Could not find #{dsc_resource_name}. Check to make "\
"sure that it shows up when running Get-DscResource"
when 1
- if found[0]['Module'].nil?
+ if found[0]["Module"].nil?
:none
else
- found[0]['Module']['Name']
+ found[0]["Module"]["Name"]
end
else
raise Chef::Exceptions::MultipleDscResourcesFound, found
@@ -136,7 +136,7 @@ class Chef
def set_resource
result = invoke_resource(:set)
- if return_dsc_resource_result(result, 'RebootRequired')
+ if return_dsc_resource_result(result, "RebootRequired")
create_reboot_resource
end
result.return_value
diff --git a/lib/chef/provider/dsc_script.rb b/lib/chef/provider/dsc_script.rb
index ea47ff22b3..3577c23e7b 100644
--- a/lib/chef/provider/dsc_script.rb
+++ b/lib/chef/provider/dsc_script.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/util/powershell/cmdlet'
-require 'chef/util/dsc/configuration_generator'
-require 'chef/util/dsc/local_configuration_manager'
-require 'chef/util/path_helper'
+require "chef/util/powershell/cmdlet"
+require "chef/util/dsc/configuration_generator"
+require "chef/util/dsc/local_configuration_manager"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -65,12 +65,12 @@ class Chef
def define_resource_requirements
requirements.assert(:run) do |a|
err = [
- 'Could not find PowerShell DSC support on the system',
+ "Could not find PowerShell DSC support on the system",
powershell_info_str,
"Powershell 4.0 or higher was not detected on your system and is required to use the dsc_script resource.",
]
a.assertion { supports_dsc? }
- a.failure_message Chef::Exceptions::ProviderNotFound, err.join(' ')
+ a.failure_message Chef::Exceptions::ProviderNotFound, err.join(" ")
a.whyrun err + ["Assuming a previous resource installs Powershell 4.0 or higher."]
a.block_action!
end
@@ -129,7 +129,7 @@ class Chef
else
# If code is also not provided, we mimic what the other script resources do (execute nothing)
Chef::Log.warn("Neither code or command were provided for dsc_resource[#{@dsc_resource.name}].") unless @dsc_resource.code
- generator.configuration_document_from_script_code(@dsc_resource.code || '', configuration_flags, @dsc_resource.imports, shellout_flags)
+ generator.configuration_document_from_script_code(@dsc_resource.code || "", configuration_flags, @dsc_resource.imports, shellout_flags)
end
end
@@ -138,7 +138,7 @@ class Chef
@dsc_resource.configuration_data_script
elsif @dsc_resource.configuration_data
configuration_data_path = "#{config_directory}/chef_dsc_config_data.psd1"
- ::File.open(configuration_data_path, 'wt') do | script |
+ ::File.open(configuration_data_path, "wt") do | script |
script.write(@dsc_resource.configuration_data)
end
configuration_data_path
@@ -164,7 +164,7 @@ class Chef
@dsc_resources_info.map do |resource|
if resource.changes_state?
# We ignore the last log message because it only contains the time it took, which looks weird
- cleaned_messages = resource.change_log[0..-2].map { |c| c.sub(/^#{Regexp.escape(resource.name)}/, '').strip }
+ cleaned_messages = resource.change_log[0..-2].map { |c| c.sub(/^#{Regexp.escape(resource.name)}/, "").strip }
"converge DSC resource #{resource.name} by #{cleaned_messages.find_all{ |c| c != ''}.join("\n")}"
else
# This is needed because a dsc script can have resources that are both converged and not
@@ -177,7 +177,7 @@ class Chef
if run_context && run_context.node[:languages] && run_context.node[:languages][:powershell]
install_info = "Powershell #{run_context.node[:languages][:powershell][:version]} was found on the system."
else
- install_info = 'Powershell was not found.'
+ install_info = "Powershell was not found."
end
end
end
diff --git a/lib/chef/provider/env.rb b/lib/chef/provider/env.rb
index 654ecf9d6a..e8ac88e8c4 100644
--- a/lib/chef/provider/env.rb
+++ b/lib/chef/provider/env.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider'
-require 'chef/mixin/command'
-require 'chef/resource/env'
+require "chef/provider"
+require "chef/mixin/command"
+require "chef/resource/env"
class Chef
class Provider
diff --git a/lib/chef/provider/env/windows.rb b/lib/chef/provider/env/windows.rb
index 56cebdb888..ec05420471 100644
--- a/lib/chef/provider/env/windows.rb
+++ b/lib/chef/provider/env/windows.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/mixin/windows_env_helper'
+require "chef/mixin/windows_env_helper"
class Chef
class Provider
@@ -36,7 +36,7 @@ class Chef
obj.variablevalue = @new_resource.value
obj.put_
value = @new_resource.value
- value = expand_path(value) if @new_resource.key_name.upcase == 'PATH'
+ value = expand_path(value) if @new_resource.key_name.upcase == "PATH"
ENV[@new_resource.key_name] = value
broadcast_env_change
end
diff --git a/lib/chef/provider/erl_call.rb b/lib/chef/provider/erl_call.rb
index f5855bcce6..dc3a8ea50e 100644
--- a/lib/chef/provider/erl_call.rb
+++ b/lib/chef/provider/erl_call.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/mixin/command'
-require 'chef/provider'
+require "chef/log"
+require "chef/mixin/command"
+require "chef/provider"
class Chef
class Provider
@@ -89,7 +89,7 @@ class Chef
end
# fail if the first 4 characters aren't "{ok,"
- unless stdout_output[0..3].include?('{ok,')
+ unless stdout_output[0..3].include?("{ok,")
raise Chef::Exceptions::ErlCall, stdout_output
end
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb
index 200beb02ad..b291786391 100644
--- a/lib/chef/provider/execute.rb
+++ b/lib/chef/provider/execute.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/provider'
-require 'forwardable'
+require "chef/log"
+require "chef/provider"
+require "forwardable"
class Chef
class Provider
diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb
index 85bc2d98be..a605682718 100644
--- a/lib/chef/provider/file.rb
+++ b/lib/chef/provider/file.rb
@@ -17,22 +17,22 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/log'
-require 'chef/resource/file'
-require 'chef/provider'
-require 'etc'
-require 'fileutils'
-require 'chef/scan_access_control'
-require 'chef/mixin/checksum'
-require 'chef/mixin/file_class'
-require 'chef/mixin/enforce_ownership_and_permissions'
-require 'chef/util/backup'
-require 'chef/util/diff'
-require 'chef/util/selinux'
-require 'chef/deprecation/provider/file'
-require 'chef/deprecation/warnings'
-require 'chef/file_content_management/deploy'
+require "chef/config"
+require "chef/log"
+require "chef/resource/file"
+require "chef/provider"
+require "etc"
+require "fileutils"
+require "chef/scan_access_control"
+require "chef/mixin/checksum"
+require "chef/mixin/file_class"
+require "chef/mixin/enforce_ownership_and_permissions"
+require "chef/util/backup"
+require "chef/util/diff"
+require "chef/util/selinux"
+require "chef/deprecation/provider/file"
+require "chef/deprecation/warnings"
+require "chef/file_content_management/deploy"
# The Tao of File Providers:
# - the content provider must always return a tempfile that we can delete/mv
diff --git a/lib/chef/provider/file/content.rb b/lib/chef/provider/file/content.rb
index f82bc49db4..96dda1bcbc 100644
--- a/lib/chef/provider/file/content.rb
+++ b/lib/chef/provider/file/content.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/file_content_management/content_base'
-require 'chef/file_content_management/tempfile'
+require "chef/file_content_management/content_base"
+require "chef/file_content_management/tempfile"
class Chef
class Provider
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index 8418f22933..07008b98f6 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/log'
-require 'chef/provider'
-require 'fileutils'
+require "chef/exceptions"
+require "chef/log"
+require "chef/provider"
+require "fileutils"
class Chef
class Provider
@@ -105,7 +105,7 @@ class Chef
end
def git_minor_version
- @git_minor_version ||= Gem::Version.new(shell_out!('git --version', run_options).stdout.split.last)
+ @git_minor_version ||= Gem::Version.new(shell_out!("git --version", run_options).stdout.split.last)
end
def existing_git_clone?
@@ -113,14 +113,14 @@ class Chef
end
def target_dir_non_existent_or_empty?
- !::File.exist?(@new_resource.destination) || Dir.entries(@new_resource.destination).sort == ['.','..']
+ !::File.exist?(@new_resource.destination) || Dir.entries(@new_resource.destination).sort == [".",".."]
end
def find_current_revision
Chef::Log.debug("#{@new_resource} finding current git revision")
if ::File.exist?(::File.join(cwd, ".git"))
# 128 is returned when we're not in a git repo. this is fine
- result = shell_out!('git rev-parse HEAD', :cwd => cwd, :returns => [0,128]).stdout.strip
+ result = shell_out!("git rev-parse HEAD", :cwd => cwd, :returns => [0,128]).stdout.strip
end
sha_hash?(result) ? result : nil
end
@@ -141,9 +141,9 @@ class Chef
remote = @new_resource.remote
args = []
- args << "-o #{remote}" unless remote == 'origin'
+ args << "-o #{remote}" unless remote == "origin"
args << "--depth #{@new_resource.depth}" if @new_resource.depth
- args << "--no-single-branch" if @new_resource.depth and git_minor_version >= Gem::Version.new('1.7.10')
+ args << "--no-single-branch" if @new_resource.depth and git_minor_version >= Gem::Version.new("1.7.10")
Chef::Log.info "#{@new_resource} cloning repo #{@new_resource.repository} to #{@new_resource.destination}"
@@ -250,18 +250,18 @@ class Chef
# Using such a degenerate annotated tag would be very
# confusing. We avoid the issue by disallowing the use of
# annotated tags named 'HEAD'.
- if rev_search_pattern != 'HEAD'
- found = find_revision(refs, @new_resource.revision, '^{}')
+ if rev_search_pattern != "HEAD"
+ found = find_revision(refs, @new_resource.revision, "^{}")
else
- found = refs_search(refs, 'HEAD')
+ found = refs_search(refs, "HEAD")
end
found = find_revision(refs, @new_resource.revision) if found.empty?
found.size == 1 ? found.first[0] : nil
end
def find_revision(refs, revision, suffix="")
- found = refs_search(refs, rev_match_pattern('refs/tags/', revision) + suffix)
- found = refs_search(refs, rev_match_pattern('refs/heads/', revision) + suffix) if found.empty?
+ found = refs_search(refs, rev_match_pattern("refs/tags/", revision) + suffix)
+ found = refs_search(refs, rev_match_pattern("refs/heads/", revision) + suffix) if found.empty?
found = refs_search(refs, revision + suffix) if found.empty?
found
end
@@ -275,10 +275,10 @@ class Chef
end
def rev_search_pattern
- if ['', 'HEAD'].include? @new_resource.revision
- 'HEAD'
+ if ["", "HEAD"].include? @new_resource.revision
+ "HEAD"
else
- @new_resource.revision + '*'
+ @new_resource.revision + "*"
end
end
@@ -300,15 +300,15 @@ class Chef
# Certain versions of `git` misbehave if git configuration is
# inaccessible in $HOME. We need to ensure $HOME matches the
# user who is executing `git` not the user running Chef.
- env['HOME'] = begin
- require 'etc'
+ env["HOME"] = begin
+ require "etc"
Etc.getpwnam(@new_resource.user).dir
rescue ArgumentError # user not found
raise Chef::Exceptions::User, "Could not determine HOME for specified user '#{@new_resource.user}' for resource '#{@new_resource.name}'"
end
end
run_opts[:group] = @new_resource.group if @new_resource.group
- env['GIT_SSH'] = @new_resource.ssh_wrapper if @new_resource.ssh_wrapper
+ env["GIT_SSH"] = @new_resource.ssh_wrapper if @new_resource.ssh_wrapper
run_opts[:log_tag] = @new_resource.to_s
run_opts[:timeout] = @new_resource.timeout if @new_resource.timeout
env.merge!(@new_resource.environment) if @new_resource.environment
diff --git a/lib/chef/provider/group.rb b/lib/chef/provider/group.rb
index a1cf92058d..2aa9889b17 100644
--- a/lib/chef/provider/group.rb
+++ b/lib/chef/provider/group.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/provider'
-require 'chef/mixin/shell_out'
-require 'chef/mixin/command'
-require 'etc'
+require "chef/provider"
+require "chef/mixin/shell_out"
+require "chef/mixin/command"
+require "etc"
class Chef
class Provider
diff --git a/lib/chef/provider/group/aix.rb b/lib/chef/provider/group/aix.rb
index d0de538e58..1059208ed8 100644
--- a/lib/chef/provider/group/aix.rb
+++ b/lib/chef/provider/group/aix.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/provider/group/groupadd'
-require 'chef/mixin/shell_out'
+require "chef/provider/group/groupadd"
+require "chef/mixin/shell_out"
class Chef
class Provider
class Group
class Aix < Chef::Provider::Group::Groupadd
- provides :group, platform: 'aix'
+ provides :group, platform: "aix"
def required_binaries
[ "/usr/bin/mkgroup",
diff --git a/lib/chef/provider/group/dscl.rb b/lib/chef/provider/group/dscl.rb
index 9775ac8270..0b39571458 100644
--- a/lib/chef/provider/group/dscl.rb
+++ b/lib/chef/provider/group/dscl.rb
@@ -21,7 +21,7 @@ class Chef
class Group
class Dscl < Chef::Provider::Group
- provides :group, os: 'darwin'
+ provides :group, os: "darwin"
def dscl(*args)
host = "."
@@ -53,14 +53,14 @@ class Chef
if group_info
group_info.each_line do |line|
- key, val = line.split(': ')
+ key, val = line.split(": ")
val.strip! if val
case key.downcase
- when 'primarygroupid'
+ when "primarygroupid"
@new_resource.gid(val) unless @new_resource.gid
@current_resource.gid(val)
- when 'groupmembership'
- @current_resource.members(val.split(' '))
+ when "groupmembership"
+ @current_resource.members(val.split(" "))
end
end
end
diff --git a/lib/chef/provider/group/gpasswd.rb b/lib/chef/provider/group/gpasswd.rb
index 432c524acd..011a9d1e63 100644
--- a/lib/chef/provider/group/gpasswd.rb
+++ b/lib/chef/provider/group/gpasswd.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/group/groupadd'
+require "chef/provider/group/groupadd"
class Chef
class Provider
diff --git a/lib/chef/provider/group/groupadd.rb b/lib/chef/provider/group/groupadd.rb
index b2ca8fd4fe..684df8455e 100644
--- a/lib/chef/provider/group/groupadd.rb
+++ b/lib/chef/provider/group/groupadd.rb
@@ -125,7 +125,7 @@ class Chef
end
def groupadd_options
- opts = ''
+ opts = ""
opts << " -r" if @new_resource.system
opts << " -o" if @new_resource.non_unique
opts
diff --git a/lib/chef/provider/group/groupmod.rb b/lib/chef/provider/group/groupmod.rb
index 82b68b8672..f9299546c8 100644
--- a/lib/chef/provider/group/groupmod.rb
+++ b/lib/chef/provider/group/groupmod.rb
@@ -21,7 +21,7 @@ class Chef
class Group
class Groupmod < Chef::Provider::Group
- provides :group, os: 'netbsd'
+ provides :group, os: "netbsd"
def load_current_resource
super
diff --git a/lib/chef/provider/group/pw.rb b/lib/chef/provider/group/pw.rb
index 5b5c8136f1..e4c129ba9f 100644
--- a/lib/chef/provider/group/pw.rb
+++ b/lib/chef/provider/group/pw.rb
@@ -20,7 +20,7 @@ class Chef
class Provider
class Group
class Pw < Chef::Provider::Group
- provides :group, platform: 'freebsd'
+ provides :group, platform: "freebsd"
def load_current_resource
super
diff --git a/lib/chef/provider/group/suse.rb b/lib/chef/provider/group/suse.rb
index b47ea33e80..42e525169f 100644
--- a/lib/chef/provider/group/suse.rb
+++ b/lib/chef/provider/group/suse.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/provider/group/groupadd'
+require "chef/provider/group/groupadd"
class Chef
class Provider
class Group
class Suse < Chef::Provider::Group::Groupadd
- provides :group, platform: 'opensuse', platform_version: '< 12.3'
- provides :group, platform: 'suse', platform_version: '< 12.0'
+ provides :group, platform: "opensuse", platform_version: "< 12.3"
+ provides :group, platform: "suse", platform_version: "< 12.0"
def load_current_resource
super
diff --git a/lib/chef/provider/group/usermod.rb b/lib/chef/provider/group/usermod.rb
index e3d960280d..51b14234ba 100644
--- a/lib/chef/provider/group/usermod.rb
+++ b/lib/chef/provider/group/usermod.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/group/groupadd'
+require "chef/provider/group/groupadd"
class Chef
class Provider
diff --git a/lib/chef/provider/group/windows.rb b/lib/chef/provider/group/windows.rb
index 46d8afc7f6..a665757df4 100644
--- a/lib/chef/provider/group/windows.rb
+++ b/lib/chef/provider/group/windows.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/user'
+require "chef/provider/user"
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'chef/util/windows/net_group'
+ require "chef/util/windows/net_group"
end
class Chef
@@ -26,7 +26,7 @@ class Chef
class Group
class Windows < Chef::Provider::Group
- provides :group, os: 'windows'
+ provides :group, os: "windows"
def initialize(new_resource,run_context)
super
diff --git a/lib/chef/provider/http_request.rb b/lib/chef/provider/http_request.rb
index dac62bc2f6..62dc0b0a46 100644
--- a/lib/chef/provider/http_request.rb
+++ b/lib/chef/provider/http_request.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'tempfile'
-require 'chef/http/simple'
+require "tempfile"
+require "chef/http/simple"
class Chef
class Provider
diff --git a/lib/chef/provider/ifconfig.rb b/lib/chef/provider/ifconfig.rb
index 9ec2533ac0..95f4b979f5 100644
--- a/lib/chef/provider/ifconfig.rb
+++ b/lib/chef/provider/ifconfig.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/mixin/command'
-require 'chef/mixin/shell_out'
-require 'chef/provider'
-require 'chef/resource/file'
-require 'chef/exceptions'
-require 'erb'
+require "chef/log"
+require "chef/mixin/command"
+require "chef/mixin/shell_out"
+require "chef/provider"
+require "chef/resource/file"
+require "chef/exceptions"
+require "erb"
# Recipe example:
#
@@ -218,7 +218,7 @@ class Chef
end
def loopback_device
- 'lo'
+ "lo"
end
end
end
diff --git a/lib/chef/provider/ifconfig/aix.rb b/lib/chef/provider/ifconfig/aix.rb
index 25c3de3040..4ceb7866db 100644
--- a/lib/chef/provider/ifconfig/aix.rb
+++ b/lib/chef/provider/ifconfig/aix.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/ifconfig'
+require "chef/provider/ifconfig"
class Chef
class Provider
diff --git a/lib/chef/provider/ifconfig/debian.rb b/lib/chef/provider/ifconfig/debian.rb
index 1e6863c8b5..b7e4adc0a3 100644
--- a/lib/chef/provider/ifconfig/debian.rb
+++ b/lib/chef/provider/ifconfig/debian.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/provider/ifconfig'
-require 'chef/util/file_edit'
+require "chef/provider/ifconfig"
+require "chef/util/file_edit"
class Chef
class Provider
class Ifconfig
class Debian < Chef::Provider::Ifconfig
- provides :ifconfig, platform: %w(ubuntu), platform_version: '>= 11.10'
- provides :ifconfig, platform: %w(debian), platform_version: '>= 7.0'
+ provides :ifconfig, platform: %w(ubuntu), platform_version: ">= 11.10"
+ provides :ifconfig, platform: %w(debian), platform_version: ">= 7.0"
INTERFACES_FILE = "/etc/network/interfaces"
INTERFACES_DOT_D_DIR = "/etc/network/interfaces.d"
diff --git a/lib/chef/provider/ifconfig/redhat.rb b/lib/chef/provider/ifconfig/redhat.rb
index ee053d1e52..b0131f8f5a 100644
--- a/lib/chef/provider/ifconfig/redhat.rb
+++ b/lib/chef/provider/ifconfig/redhat.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/ifconfig'
+require "chef/provider/ifconfig"
class Chef
class Provider
diff --git a/lib/chef/provider/link.rb b/lib/chef/provider/link.rb
index a5f9b0bb29..571610aeed 100644
--- a/lib/chef/provider/link.rb
+++ b/lib/chef/provider/link.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/log'
-require 'chef/mixin/file_class'
-require 'chef/resource/link'
-require 'chef/provider'
-require 'chef/scan_access_control'
-require 'chef/util/path_helper'
+require "chef/config"
+require "chef/log"
+require "chef/mixin/file_class"
+require "chef/resource/link"
+require "chef/provider"
+require "chef/scan_access_control"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -75,7 +75,7 @@ class Chef
a.assertion do
if @current_resource.to
@current_resource.link_type == @new_resource.link_type and
- (@current_resource.link_type == :symbolic or @current_resource.to != '')
+ (@current_resource.link_type == :symbolic or @current_resource.to != "")
else
true
end
@@ -86,7 +86,7 @@ class Chef
end
def canonicalize(path)
- Chef::Platform.windows? ? path.gsub('/', '\\') : path
+ Chef::Platform.windows? ? path.gsub("/", '\\') : path
end
def action_create
diff --git a/lib/chef/provider/lwrp_base.rb b/lib/chef/provider/lwrp_base.rb
index 126184a51a..4298a4aa98 100644
--- a/lib/chef/provider/lwrp_base.rb
+++ b/lib/chef/provider/lwrp_base.rb
@@ -18,9 +18,9 @@
# limitations under the License.
#
-require 'chef/provider'
-require 'chef/dsl/recipe'
-require 'chef/dsl/include_recipe'
+require "chef/provider"
+require "chef/dsl/recipe"
+require "chef/dsl/include_recipe"
class Chef
class Provider
diff --git a/lib/chef/provider/mdadm.rb b/lib/chef/provider/mdadm.rb
index 325f1b5977..b55e6abc1a 100644
--- a/lib/chef/provider/mdadm.rb
+++ b/lib/chef/provider/mdadm.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/provider'
+require "chef/log"
+require "chef/provider"
class Chef
class Provider
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb
index dc0382c689..ede36417d1 100644
--- a/lib/chef/provider/mount.rb
+++ b/lib/chef/provider/mount.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/mixin/shell_out'
-require 'chef/provider'
+require "chef/log"
+require "chef/mixin/shell_out"
+require "chef/provider"
class Chef
class Provider
diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb
index 41a2ae1176..577505ac69 100644
--- a/lib/chef/provider/mount/aix.rb
+++ b/lib/chef/provider/mount/aix.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/mount'
+require "chef/provider/mount"
class Chef
class Provider
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index 9ffdf3a557..fe657659ad 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/provider/mount'
-require 'chef/log'
+require "chef/provider/mount"
+require "chef/log"
class Chef
class Provider
diff --git a/lib/chef/provider/mount/solaris.rb b/lib/chef/provider/mount/solaris.rb
index 062696ac53..f61b9e673b 100644
--- a/lib/chef/provider/mount/solaris.rb
+++ b/lib/chef/provider/mount/solaris.rb
@@ -18,9 +18,9 @@
# limitations under the License.
#
-require 'chef/provider/mount'
-require 'chef/log'
-require 'forwardable'
+require "chef/provider/mount"
+require "chef/log"
+require "forwardable"
class Chef
class Provider
@@ -31,7 +31,7 @@ class Chef
extend Forwardable
- VFSTAB = '/etc/vfstab'.freeze
+ VFSTAB = "/etc/vfstab".freeze
def_delegator :@new_resource, :device, :device
def_delegator :@new_resource, :device_type, :device_type
@@ -58,7 +58,7 @@ class Chef
a.whyrun("Assuming device #{device} would have been created")
end
- unless fsck_device == '-'
+ unless fsck_device == "-"
requirements.assert(:mount, :remount) do |a|
a.assertion { ::File.exist?(fsck_device) }
a.failure_message(Chef::Exceptions::Mount, "Device #{fsck_device} does not exist")
@@ -75,7 +75,7 @@ class Chef
def mount_fs
actual_options = options || []
- actual_options.delete('noauto')
+ actual_options.delete("noauto")
command = "mount -F #{fstype}"
command << " -o #{actual_options.join(',')}" unless actual_options.empty?
command << " #{device} #{mount_point}"
@@ -89,8 +89,8 @@ class Chef
def remount_fs
# FIXME: Should remount always do the remount or only if the options change?
actual_options = options || []
- actual_options.delete('noauto')
- mount_options = actual_options.empty? ? '' : ",#{actual_options.join(',')}"
+ actual_options.delete("noauto")
+ mount_options = actual_options.empty? ? "" : ",#{actual_options.join(',')}"
shell_out!("mount -o remount#{mount_options} #{mount_point}")
end
@@ -117,7 +117,7 @@ class Chef
end
def etc_tempfile
- yield Tempfile.open('vfstab', '/etc')
+ yield Tempfile.open("vfstab", "/etc")
end
def mount_options_unchanged?
@@ -129,7 +129,7 @@ class Chef
current_options == new_options &&
current_resource.dump == dump &&
current_resource.pass == pass &&
- current_resource.options.include?('noauto') == !mount_at_boot?
+ current_resource.options.include?("noauto") == !mount_at_boot?
end
def update_current_resource_state
@@ -150,7 +150,7 @@ class Chef
# /dev/dsk/c1t0d0s0 on / type ufs read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=700040 on Tue May 1 11:33:55 2012
def mounted?
mounted = false
- shell_out!('mount -v').stdout.each_line do |line|
+ shell_out!("mount -v").stdout.each_line do |line|
case line
when /^#{device_regex}\s+on\s+#{Regexp.escape(mount_point)}\s+/
Chef::Log.debug("Special device #{device} is mounted as #{mount_point}")
@@ -182,14 +182,14 @@ class Chef
options = Regexp.last_match[4]
# Store the 'mount at boot' column from vfstab as the 'noauto' option
# in current_resource.options (linux style)
- if Regexp.last_match[3] == 'no'
+ if Regexp.last_match[3] == "no"
if options.nil? || options.empty?
- options = 'noauto'
+ options = "noauto"
else
- options += ',noauto'
+ options += ",noauto"
end
end
- pass = (Regexp.last_match[2] == '-') ? 0 : Regexp.last_match[2].to_i
+ pass = (Regexp.last_match[2] == "-") ? 0 : Regexp.last_match[2].to_i
Chef::Log.debug("Found mount #{device} to #{mount_point} in #{VFSTAB}")
next
when /^[-\/\w]+\s+[-\/\w]+\s+#{Regexp.escape(mount_point)}\s+/
@@ -206,12 +206,12 @@ class Chef
end
def mount_at_boot?
- options.nil? || !options.include?('noauto')
+ options.nil? || !options.include?("noauto")
end
def vfstab_write(contents)
etc_tempfile do |f|
- f.write(contents.join(''))
+ f.write(contents.join(""))
f.close
# move, preserving modes of destination file
mover = Chef::FileContentManagement::Deploy.strategy(true)
@@ -222,12 +222,12 @@ class Chef
def vfstab_entry
actual_options = unless options.nil?
tempops = options.dup
- tempops.delete('noauto')
+ tempops.delete("noauto")
tempops
end
- autostr = mount_at_boot? ? 'yes' : 'no'
- passstr = pass == 0 ? '-' : pass
- optstr = (actual_options.nil? || actual_options.empty?) ? '-' : actual_options.join(',')
+ autostr = mount_at_boot? ? "yes" : "no"
+ passstr = pass == 0 ? "-" : pass
+ optstr = (actual_options.nil? || actual_options.empty?) ? "-" : actual_options.join(",")
"\n#{device}\t#{fsck_device}\t#{mount_point}\t#{fstype}\t#{passstr}\t#{autostr}\t#{optstr}\n"
end
@@ -254,7 +254,7 @@ class Chef
def options_remove_noauto(temp_options)
new_options = []
new_options += temp_options.nil? ? [] : temp_options
- new_options.delete('noauto')
+ new_options.delete("noauto")
new_options
end
diff --git a/lib/chef/provider/mount/windows.rb b/lib/chef/provider/mount/windows.rb
index 87873474b3..0cf50d07bf 100644
--- a/lib/chef/provider/mount/windows.rb
+++ b/lib/chef/provider/mount/windows.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/provider/mount'
+require "chef/provider/mount"
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'chef/util/windows/net_use'
- require 'chef/util/windows/volume'
+ require "chef/util/windows/net_use"
+ require "chef/util/windows/volume"
end
class Chef
diff --git a/lib/chef/provider/ohai.rb b/lib/chef/provider/ohai.rb
index b7f4aa704b..6535805013 100644
--- a/lib/chef/provider/ohai.rb
+++ b/lib/chef/provider/ohai.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'ohai'
+require "ohai"
class Chef
class Provider
diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb
index 4b3e512480..071b4b0462 100644
--- a/lib/chef/provider/osx_profile.rb
+++ b/lib/chef/provider/osx_profile.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/provider'
-require 'chef/resource'
-require 'chef/resource/file'
-require 'uuidtools'
+require "chef/log"
+require "chef/provider"
+require "chef/resource"
+require "chef/resource/file"
+require "uuidtools"
class Chef
class Provider
@@ -44,18 +44,18 @@ class Chef
)
@new_profile_hash = get_profile_hash(@new_resource.profile)
- @new_profile_hash['PayloadUUID'] =
+ @new_profile_hash["PayloadUUID"] =
config_uuid(@new_profile_hash) if @new_profile_hash
if @new_profile_hash
- @new_profile_identifier = @new_profile_hash['PayloadIdentifier']
+ @new_profile_identifier = @new_profile_hash["PayloadIdentifier"]
else
@new_profile_identifier = @new_resource.identifier ||
@new_resource.profile_name
end
- current_profile = all_profiles['_computerlevel'].find {
- |item| item['ProfileIdentifier'] ==
+ current_profile = all_profiles["_computerlevel"].find {
+ |item| item["ProfileIdentifier"] ==
@new_profile_identifier
}
@current_resource.profile(current_profile)
@@ -67,14 +67,14 @@ class Chef
if @new_profile_identifier
a.assertion {
!@new_profile_identifier.nil? and
- !@new_profile_identifier.end_with?('.mobileconfig') and
+ !@new_profile_identifier.end_with?(".mobileconfig") and
/^\w+(?:\.\w+)+$/.match(@new_profile_identifier)
}
a.failure_message RuntimeError, "when removing using the identifier attribute, it must match the profile identifier"
else
new_profile_name = @new_resource.profile_name
a.assertion {
- !new_profile_name.end_with?('.mobileconfig') and
+ !new_profile_name.end_with?(".mobileconfig") and
/^\w+(?:\.\w+)+$/.match(new_profile_name)
}
a.failure_message RuntimeError, "When removing by resource name, it must match the profile identifier "
@@ -84,13 +84,13 @@ class Chef
requirements.assert(:install) do |a|
if @new_profile_hash.is_a?(Hash)
a.assertion {
- @new_profile_hash.include?('PayloadIdentifier')
+ @new_profile_hash.include?("PayloadIdentifier")
}
a.failure_message RuntimeError, "The specified profile does not seem to be valid"
end
if @new_profile_hash.is_a?(String)
a.assertion {
- @new_profile_hash.end_with?('.mobileconfig')
+ @new_profile_hash.end_with?(".mobileconfig")
}
a.failure_message RuntimeError, "#{new_profile_hash}' is not a valid profile"
end
@@ -119,7 +119,7 @@ class Chef
def load_profile_hash(new_profile)
# file must exist in cookbook
- if new_profile.end_with?('.mobileconfig')
+ if new_profile.end_with?(".mobileconfig")
unless cookbook_file_available?(new_profile)
error_string = "#{self}: '#{new_profile}' not found in cookbook"
raise Chef::Exceptions::FileNotFound, error_string
@@ -243,8 +243,8 @@ class Chef
if @new_resource.action.include?(:remove)
true
else
- @current_resource.profile['ProfileUUID'] ==
- @new_profile_hash['PayloadUUID']
+ @current_resource.profile["ProfileUUID"] ==
+ @new_profile_hash["PayloadUUID"]
end
end
end
diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb
index 2238dc8654..ba256f6bea 100644
--- a/lib/chef/provider/package.rb
+++ b/lib/chef/provider/package.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/mixin/shell_out'
-require 'chef/mixin/command'
-require 'chef/mixin/subclass_directive'
-require 'chef/log'
-require 'chef/file_cache'
-require 'chef/platform'
+require "chef/mixin/shell_out"
+require "chef/mixin/command"
+require "chef/mixin/subclass_directive"
+require "chef/log"
+require "chef/file_cache"
+require "chef/platform"
class Chef
class Provider
@@ -125,13 +125,13 @@ class Chef
multipackage_api_adapter(package_names_for_targets, versions_for_targets) do |name, version|
upgrade_package(name, version)
end
- log_allow_downgrade = allow_downgrade ? '(allow_downgrade)' : ''
+ log_allow_downgrade = allow_downgrade ? "(allow_downgrade)" : ""
Chef::Log.info("#{@new_resource} upgraded#{log_allow_downgrade} #{package_names_for_targets} to #{versions_for_targets}")
end
end
def upgrade_description
- log_allow_downgrade = allow_downgrade ? '(allow_downgrade)' : ''
+ log_allow_downgrade = allow_downgrade ? "(allow_downgrade)" : ""
description = []
target_version_array.each_with_index do |target_version, i|
next if target_version.nil?
diff --git a/lib/chef/provider/package/aix.rb b/lib/chef/provider/package/aix.rb
index 80860adba0..29e2d1eb94 100644
--- a/lib/chef/provider/package/aix.rb
+++ b/lib/chef/provider/package/aix.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'chef/mixin/get_source_from_package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
diff --git a/lib/chef/provider/package/apt.rb b/lib/chef/provider/package/apt.rb
index e109c9966a..03cbff4d1c 100644
--- a/lib/chef/provider/package/apt.rb
+++ b/lib/chef/provider/package/apt.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
class Chef
class Provider
@@ -48,7 +48,7 @@ class Chef
requirements.assert(:all_actions) do |a|
a.assertion { !@new_resource.source }
- a.failure_message(Chef::Exceptions::Package, 'apt package provider cannot handle source attribute. Use dpkg provider instead')
+ a.failure_message(Chef::Exceptions::Package, "apt package provider cannot handle source attribute. Use dpkg provider instead")
end
end
@@ -67,7 +67,7 @@ class Chef
case line
when /^\s{2}Installed: (.+)$/
installed_version = $1
- if installed_version == '(none)'
+ if installed_version == "(none)"
Chef::Log.debug("#{@new_resource} current version is nil")
installed_version = nil
else
@@ -76,7 +76,7 @@ class Chef
end
when /^\s{2}Candidate: (.+)$/
candidate_version = $1
- if candidate_version == '(none)'
+ if candidate_version == "(none)"
# This may not be an appropriate assumption, but it shouldn't break anything that already worked -- btm
is_virtual_package = true
showpkg = shell_out_with_timeout!("apt-cache showpkg #{pkg}").stdout
@@ -141,7 +141,7 @@ class Chef
version_array = [ version ].flatten
package_name = name_array.zip(version_array).map do |n, v|
is_virtual_package[n] ? n : "#{n}=#{v}"
- end.join(' ')
+ end.join(" ")
run_noninteractive("apt-get -q -y#{expand_options(default_release_options)}#{expand_options(@new_resource.options)} install #{package_name}")
end
@@ -150,12 +150,12 @@ class Chef
end
def remove_package(name, version)
- package_name = [ name ].flatten.join(' ')
+ package_name = [ name ].flatten.join(" ")
run_noninteractive("apt-get -q -y#{expand_options(@new_resource.options)} remove #{package_name}")
end
def purge_package(name, version)
- package_name = [ name ].flatten.join(' ')
+ package_name = [ name ].flatten.join(" ")
run_noninteractive("apt-get -q -y#{expand_options(@new_resource.options)} purge #{package_name}")
end
@@ -165,7 +165,7 @@ class Chef
end
def reconfig_package(name, version)
- package_name = [ name ].flatten.join(' ')
+ package_name = [ name ].flatten.join(" ")
Chef::Log.info("#{@new_resource} reconfiguring")
run_noninteractive("dpkg-reconfigure #{package_name}")
end
diff --git a/lib/chef/provider/package/chocolatey.rb b/lib/chef/provider/package/chocolatey.rb
index 45e2a2fc84..55ac304a79 100644
--- a/lib/chef/provider/package/chocolatey.rb
+++ b/lib/chef/provider/package/chocolatey.rb
@@ -15,9 +15,9 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/resource/chocolatey_package'
-require 'chef/mixin/powershell_out'
+require "chef/provider/package"
+require "chef/resource/chocolatey_package"
+require "chef/mixin/powershell_out"
class Chef
class Provider
@@ -141,8 +141,8 @@ class Chef
powershell_out!(
"[System.Environment]::GetEnvironmentVariable('ChocolateyInstall', 'MACHINE')"
).stdout.chomp,
- 'bin',
- 'choco.exe',
+ "bin",
+ "choco.exe",
)
end
@@ -235,7 +235,7 @@ class Chef
def parse_list_output(*args)
hash = {}
choco_command(*args).stdout.each_line do |line|
- name, version = line.split('|')
+ name, version = line.split("|")
hash[name.downcase] = version.chomp
end
hash
diff --git a/lib/chef/provider/package/dpkg.rb b/lib/chef/provider/package/dpkg.rb
index 0da675e883..bcf7cff4e4 100644
--- a/lib/chef/provider/package/dpkg.rb
+++ b/lib/chef/provider/package/dpkg.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/resource/package'
+require "chef/provider/package"
+require "chef/resource/package"
class Chef
class Provider
diff --git a/lib/chef/provider/package/easy_install.rb b/lib/chef/provider/package/easy_install.rb
index 0b8e3952f7..91bb54999b 100644
--- a/lib/chef/provider/package/easy_install.rb
+++ b/lib/chef/provider/package/easy_install.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
class Chef
class Provider
@@ -51,12 +51,12 @@ class Chef
def easy_install_binary_path
path = @new_resource.easy_install_binary
- path ? path : 'easy_install'
+ path ? path : "easy_install"
end
def python_binary_path
path = @new_resource.python_binary
- path ? path : 'python'
+ path ? path : "python"
end
def module_name
@@ -77,7 +77,7 @@ class Chef
rescue
output = shell_out_with_timeout!("#{python_binary_path} -c \"import sys; print sys.path\"", :returns=>[0,1]).stdout
- output_array = output.gsub(/[\[\]]/,'').split(/\s*,\s*/)
+ output_array = output.gsub(/[\[\]]/,"").split(/\s*,\s*/)
package_path = ""
output_array.each do |entry|
diff --git a/lib/chef/provider/package/freebsd/base.rb b/lib/chef/provider/package/freebsd/base.rb
index 7c032b3787..4957812e99 100644
--- a/lib/chef/provider/package/freebsd/base.rb
+++ b/lib/chef/provider/package/freebsd/base.rb
@@ -19,9 +19,9 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package'
-require 'chef/mixin/get_source_from_package'
+require "chef/resource/package"
+require "chef/provider/package"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
diff --git a/lib/chef/provider/package/freebsd/pkg.rb b/lib/chef/provider/package/freebsd/pkg.rb
index 33a8c2c108..2d13a0d2c1 100644
--- a/lib/chef/provider/package/freebsd/pkg.rb
+++ b/lib/chef/provider/package/freebsd/pkg.rb
@@ -19,8 +19,8 @@
# limitations under the License.
#
-require 'chef/provider/package/freebsd/base'
-require 'chef/util/path_helper'
+require "chef/provider/package/freebsd/base"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -34,14 +34,14 @@ class Chef
case @new_resource.source
when /^http/, /^ftp/
if @new_resource.source =~ /\/$/
- shell_out_with_timeout!("pkg_add -r #{package_name}", :env => { "PACKAGESITE" => @new_resource.source, 'LC_ALL' => nil }).status
+ shell_out_with_timeout!("pkg_add -r #{package_name}", :env => { "PACKAGESITE" => @new_resource.source, "LC_ALL" => nil }).status
else
- shell_out_with_timeout!("pkg_add -r #{package_name}", :env => { "PACKAGEROOT" => @new_resource.source, 'LC_ALL' => nil }).status
+ shell_out_with_timeout!("pkg_add -r #{package_name}", :env => { "PACKAGEROOT" => @new_resource.source, "LC_ALL" => nil }).status
end
Chef::Log.debug("#{@new_resource} installed from: #{@new_resource.source}")
when /^\//
- shell_out_with_timeout!("pkg_add #{file_candidate_version_path}", :env => { "PKG_PATH" => @new_resource.source , 'LC_ALL'=>nil}).status
+ shell_out_with_timeout!("pkg_add #{file_candidate_version_path}", :env => { "PKG_PATH" => @new_resource.source , "LC_ALL"=>nil}).status
Chef::Log.debug("#{@new_resource} installed from: #{@new_resource.source}")
else
diff --git a/lib/chef/provider/package/freebsd/pkgng.rb b/lib/chef/provider/package/freebsd/pkgng.rb
index 2fdc9dda71..2d23620a66 100644
--- a/lib/chef/provider/package/freebsd/pkgng.rb
+++ b/lib/chef/provider/package/freebsd/pkgng.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/package/freebsd/base'
+require "chef/provider/package/freebsd/base"
class Chef
class Provider
@@ -28,17 +28,17 @@ class Chef
unless @current_resource.version
case @new_resource.source
when /^(http|ftp|\/)/
- shell_out_with_timeout!("pkg add#{expand_options(@new_resource.options)} #{@new_resource.source}", :env => { 'LC_ALL' => nil }).status
+ shell_out_with_timeout!("pkg add#{expand_options(@new_resource.options)} #{@new_resource.source}", :env => { "LC_ALL" => nil }).status
Chef::Log.debug("#{@new_resource} installed from: #{@new_resource.source}")
else
- shell_out_with_timeout!("pkg install -y#{expand_options(@new_resource.options)} #{name}", :env => { 'LC_ALL' => nil }).status
+ shell_out_with_timeout!("pkg install -y#{expand_options(@new_resource.options)} #{name}", :env => { "LC_ALL" => nil }).status
end
end
end
def remove_package(name, version)
- options = @new_resource.options && @new_resource.options.sub(repo_regex, '')
+ options = @new_resource.options && @new_resource.options.sub(repo_regex, "")
options && !options.empty? || options = nil
shell_out_with_timeout!("pkg delete -y#{expand_options(options)} #{name}#{version ? '-' + version : ''}", :env => nil).status
end
diff --git a/lib/chef/provider/package/freebsd/port.rb b/lib/chef/provider/package/freebsd/port.rb
index 3fbd002214..89220e38b4 100644
--- a/lib/chef/provider/package/freebsd/port.rb
+++ b/lib/chef/provider/package/freebsd/port.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/package/freebsd/base'
+require "chef/provider/package/freebsd/base"
class Chef
class Provider
diff --git a/lib/chef/provider/package/homebrew.rb b/lib/chef/provider/package/homebrew.rb
index e5c45f0a62..661236a56c 100644
--- a/lib/chef/provider/package/homebrew.rb
+++ b/lib/chef/provider/package/homebrew.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'etc'
-require 'chef/mixin/homebrew_user'
+require "etc"
+require "chef/mixin/homebrew_user"
class Chef
class Provider
@@ -46,7 +46,7 @@ class Chef
def install_package(name, version)
unless current_resource.version == version
- brew('install', new_resource.options, name)
+ brew("install", new_resource.options, name)
end
end
@@ -56,19 +56,19 @@ class Chef
if current_version.nil? or current_version.empty?
install_package(name, version)
elsif current_version != version
- brew('upgrade', new_resource.options, name)
+ brew("upgrade", new_resource.options, name)
end
end
def remove_package(name, version)
if current_resource.version
- brew('uninstall', new_resource.options, name)
+ brew("uninstall", new_resource.options, name)
end
end
# Homebrew doesn't really have a notion of purging, do a "force remove"
def purge_package(name, version)
- new_resource.options((new_resource.options || '') << ' --force').strip
+ new_resource.options((new_resource.options || "") << " --force").strip
remove_package(name, version)
end
@@ -85,7 +85,7 @@ class Chef
#
# https://github.com/Homebrew/homebrew/wiki/Querying-Brew
def brew_info
- @brew_info ||= Chef::JSONCompat.from_json(brew('info', '--json=v1', new_resource.package_name)).first
+ @brew_info ||= Chef::JSONCompat.from_json(brew("info", "--json=v1", new_resource.package_name)).first
end
# Some packages (formula) are "keg only" and aren't linked,
@@ -95,14 +95,14 @@ class Chef
# that brew thinks is linked as the current version.
#
def current_installed_version
- if brew_info['keg_only']
- if brew_info['installed'].empty?
+ if brew_info["keg_only"]
+ if brew_info["installed"].empty?
nil
else
- brew_info['installed'].last['version']
+ brew_info["installed"].last["version"]
end
else
- brew_info['linked_keg']
+ brew_info["linked_keg"]
end
end
@@ -116,7 +116,7 @@ class Chef
#
# https://github.com/Homebrew/homebrew/wiki/Acceptable-Formulae#stable-versions
def candidate_version
- brew_info['versions']['stable']
+ brew_info["versions"]["stable"]
end
private
@@ -127,7 +127,7 @@ class Chef
Chef::Log.debug "Executing '#{command}' as user '#{homebrew_user.name}'"
# FIXME: this 1800 second default timeout should be deprecated
- output = shell_out_with_timeout!(command, :timeout => 1800, :user => homebrew_uid, :environment => { 'HOME' => homebrew_user.dir, 'RUBYOPT' => nil })
+ output = shell_out_with_timeout!(command, :timeout => 1800, :user => homebrew_uid, :environment => { "HOME" => homebrew_user.dir, "RUBYOPT" => nil })
output.stdout.chomp
end
diff --git a/lib/chef/provider/package/ips.rb b/lib/chef/provider/package/ips.rb
index 96c2e711d4..84cb19486f 100644
--- a/lib/chef/provider/package/ips.rb
+++ b/lib/chef/provider/package/ips.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'open3'
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
+require "open3"
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
class Chef
class Provider
@@ -70,7 +70,7 @@ class Chef
normal_command = "pkg#{expand_options(@new_resource.options)} install -q #{package_name}"
command =
if @new_resource.respond_to?(:accept_license) and @new_resource.accept_license
- normal_command.gsub('-q', '-q --accept')
+ normal_command.gsub("-q", "-q --accept")
else
normal_command
end
diff --git a/lib/chef/provider/package/openbsd.rb b/lib/chef/provider/package/openbsd.rb
index 00d9e5941d..539af1c409 100644
--- a/lib/chef/provider/package/openbsd.rb
+++ b/lib/chef/provider/package/openbsd.rb
@@ -20,10 +20,10 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package'
-require 'chef/mixin/get_source_from_package'
-require 'chef/exceptions'
+require "chef/resource/package"
+require "chef/provider/package"
+require "chef/mixin/get_source_from_package"
+require "chef/exceptions"
class Chef
class Provider
@@ -53,7 +53,7 @@ class Chef
# Below are incomplete/missing features for this package provider
requirements.assert(:all_actions) do |a|
a.assertion { !new_resource.source }
- a.failure_message(Chef::Exceptions::Package, 'The openbsd package provider does not support the source attribute')
+ a.failure_message(Chef::Exceptions::Package, "The openbsd package provider does not support the source attribute")
end
requirements.assert(:all_actions) do |a|
a.assertion do
@@ -63,7 +63,7 @@ class Chef
true
end
end
- a.failure_message(Chef::Exceptions::Package, 'The openbsd package provider does not support providing a version and flavor')
+ a.failure_message(Chef::Exceptions::Package, "The openbsd package provider does not support providing a version and flavor")
end
end
@@ -122,12 +122,12 @@ class Chef
end
def version_string(version)
- ver = ''
+ ver = ""
ver += "-#{version}" if version
end
def pkg_path
- ENV['PKG_PATH'] || "http://ftp.OpenBSD.org/pub/#{node.kernel.name}/#{node.kernel.release}/packages/#{node.kernel.machine}/"
+ ENV["PKG_PATH"] || "http://ftp.OpenBSD.org/pub/#{node.kernel.name}/#{node.kernel.release}/packages/#{node.kernel.machine}/"
end
end
diff --git a/lib/chef/provider/package/pacman.rb b/lib/chef/provider/package/pacman.rb
index 275a0c7aa7..6bb2250da5 100644
--- a/lib/chef/provider/package/pacman.rb
+++ b/lib/chef/provider/package/pacman.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
class Chef
class Provider
@@ -59,7 +59,7 @@ class Chef
repos = pacman.scan(/\[(.+)\]/).flatten
end
- package_repos = repos.map {|r| Regexp.escape(r) }.join('|')
+ package_repos = repos.map {|r| Regexp.escape(r) }.join("|")
status = shell_out_with_timeout("pacman -Sl")
status.stdout.each_line do |line|
diff --git a/lib/chef/provider/package/paludis.rb b/lib/chef/provider/package/paludis.rb
index 90f02b80ad..c2b1069e1e 100644
--- a/lib/chef/provider/package/paludis.rb
+++ b/lib/chef/provider/package/paludis.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/resource/package'
+require "chef/provider/package"
+require "chef/resource/package"
class Chef
class Provider
@@ -33,15 +33,15 @@ class Chef
Chef::Log.debug("Checking package status for #{@new_resource.package_name}")
installed = false
- re = Regexp.new('(.*)[[:blank:]](.*)[[:blank:]](.*)$')
+ re = Regexp.new("(.*)[[:blank:]](.*)[[:blank:]](.*)$")
shell_out!("cave -L warning print-ids -M none -m \"#{@new_resource.package_name}\" -f \"%c/%p %v %r\n\"").stdout.each_line do |line|
res = re.match(line)
unless res.nil?
case res[3]
- when 'accounts', 'installed-accounts'
+ when "accounts", "installed-accounts"
next
- when 'installed'
+ when "installed"
installed = true
@current_resource.version(res[2])
else
diff --git a/lib/chef/provider/package/portage.rb b/lib/chef/provider/package/portage.rb
index a0d0b1a441..4a1559637a 100644
--- a/lib/chef/provider/package/portage.rb
+++ b/lib/chef/provider/package/portage.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'chef/util/path_helper'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -48,7 +48,7 @@ class Chef
if versions.size > 1
atoms = versions.map {|v| v.first }.sort
- categories = atoms.map {|v| v.split('/')[0] }.uniq
+ categories = atoms.map {|v| v.split("/")[0] }.uniq
if !category && categories.size > 1
raise Chef::Exceptions::Package, "Multiple packages found for #{@new_resource.package_name}: #{atoms.join(" ")}. Specify a category."
end
@@ -66,7 +66,7 @@ class Chef
txt.each_line do |line|
if line =~ /\*\s+#{PACKAGE_NAME_PATTERN}/
- found_package_name = $&.gsub(/\*/, '').strip
+ found_package_name = $&.gsub(/\*/, "").strip
if package =~ /\// #the category is specified
if found_package_name == package
availables[found_package_name] = nil
diff --git a/lib/chef/provider/package/rpm.rb b/lib/chef/provider/package/rpm.rb
index e3217fdf18..019d26d92e 100644
--- a/lib/chef/provider/package/rpm.rb
+++ b/lib/chef/provider/package/rpm.rb
@@ -15,10 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'chef/mixin/get_source_from_package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb
index 3272624f62..034f526060 100644
--- a/lib/chef/provider/package/rubygems.rb
+++ b/lib/chef/provider/package/rubygems.rb
@@ -17,25 +17,25 @@
# limitations under the License.
#
-require 'uri'
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'chef/mixin/get_source_from_package'
+require "uri"
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "chef/mixin/get_source_from_package"
# Class methods on Gem are defined in rubygems
-require 'rubygems'
+require "rubygems"
# Ruby 1.9's gem_prelude can interact poorly with loading the full rubygems
# explicitly like this. Make sure rubygems/specification is always last in this
# list
-require 'rubygems/version'
-require 'rubygems/dependency'
-require 'rubygems/spec_fetcher'
-require 'rubygems/platform'
-require 'rubygems/package'
-require 'rubygems/dependency_installer'
-require 'rubygems/uninstaller'
-require 'rubygems/specification'
+require "rubygems/version"
+require "rubygems/dependency"
+require "rubygems/spec_fetcher"
+require "rubygems/platform"
+require "rubygems/package"
+require "rubygems/dependency_installer"
+require "rubygems/uninstaller"
+require "rubygems/specification"
class Chef
class Provider
@@ -86,7 +86,7 @@ class Chef
# === Returns
# [Gem::Specification] an array of Gem::Specification objects
def installed_versions(gem_dep)
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.8.0")
gem_specification.find_all_by_name(gem_dep.name, gem_dep.requirement)
else
gem_source_index.search(gem_dep)
@@ -288,7 +288,7 @@ class Chef
end
def gem_source_index
- @source_index ||= Gem::SourceIndex.from_gems_in(*gem_paths.map { |p| p + '/specifications' })
+ @source_index ||= Gem::SourceIndex.from_gems_in(*gem_paths.map { |p| p + "/specifications" })
end
def gem_specification
@@ -320,7 +320,7 @@ class Chef
else
gem_environment = shell_out!("#{@gem_binary_location} env").stdout
if jruby = gem_environment[JRUBY_PLATFORM]
- self.class.platform_cache[@gem_binary_location] = ['ruby', Gem::Platform.new(jruby)]
+ self.class.platform_cache[@gem_binary_location] = ["ruby", Gem::Platform.new(jruby)]
else
self.class.platform_cache[@gem_binary_location] = Gem.platforms
end
@@ -394,11 +394,11 @@ class Chef
end
def is_omnibus?
- if RbConfig::CONFIG['bindir'] =~ %r!/(opscode|chef|chefdk)/embedded/bin!
+ if RbConfig::CONFIG["bindir"] =~ %r!/(opscode|chef|chefdk)/embedded/bin!
Chef::Log.debug("#{@new_resource} detected omnibus installation in #{RbConfig::CONFIG['bindir']}")
# Omnibus installs to a static path because of linking on unix, find it.
true
- elsif RbConfig::CONFIG['bindir'].sub(/^[\w]:/, '') == "/opscode/chef/embedded/bin"
+ elsif RbConfig::CONFIG["bindir"].sub(/^[\w]:/, "") == "/opscode/chef/embedded/bin"
Chef::Log.debug("#{@new_resource} detected omnibus installation in #{RbConfig::CONFIG['bindir']}")
# windows, with the drive letter removed
true
@@ -410,7 +410,7 @@ class Chef
def find_gem_by_path
Chef::Log.debug("#{@new_resource} searching for 'gem' binary in path: #{ENV['PATH']}")
separator = ::File::ALT_SEPARATOR ? ::File::ALT_SEPARATOR : ::File::SEPARATOR
- path_to_first_gem = ENV['PATH'].split(::File::PATH_SEPARATOR).select { |path| ::File.exists?(path + separator + "gem") }.first
+ path_to_first_gem = ENV["PATH"].split(::File::PATH_SEPARATOR).select { |path| ::File.exists?(path + separator + "gem") }.first
raise Chef::Exceptions::FileNotFound, "Unable to find 'gem' binary in path: #{ENV['PATH']}" if path_to_first_gem.nil?
path_to_first_gem + separator + "gem"
end
@@ -456,7 +456,7 @@ class Chef
def all_installed_versions
@all_installed_versions ||= begin
- @gem_env.installed_versions(Gem::Dependency.new(gem_dependency.name, '>= 0'))
+ @gem_env.installed_versions(Gem::Dependency.new(gem_dependency.name, ">= 0"))
end
end
@@ -525,15 +525,15 @@ class Chef
end
def gem_binary_path
- @new_resource.gem_binary || 'gem'
+ @new_resource.gem_binary || "gem"
end
def install_via_gem_command(name, version)
if @new_resource.source =~ /\.gem$/i
name = @new_resource.source
elsif @new_resource.clear_sources
- src = ' --clear-sources'
- src << (@new_resource.source && " --source=#{@new_resource.source}" || '')
+ src = " --clear-sources"
+ src << (@new_resource.source && " --source=#{@new_resource.source}" || "")
else
src = @new_resource.source && " --source=#{@new_resource.source} --source=https://rubygems.org"
end
diff --git a/lib/chef/provider/package/smartos.rb b/lib/chef/provider/package/smartos.rb
index d3d2fa54a1..98264ecd1e 100644
--- a/lib/chef/provider/package/smartos.rb
+++ b/lib/chef/provider/package/smartos.rb
@@ -19,9 +19,9 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/resource/package'
-require 'chef/mixin/get_source_from_package'
+require "chef/provider/package"
+require "chef/resource/package"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
diff --git a/lib/chef/provider/package/solaris.rb b/lib/chef/provider/package/solaris.rb
index 55a34b44dd..8442e57dbb 100644
--- a/lib/chef/provider/package/solaris.rb
+++ b/lib/chef/provider/package/solaris.rb
@@ -15,10 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'chef/mixin/get_source_from_package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
@@ -28,7 +28,7 @@ class Chef
include Chef::Mixin::GetSourceFromPackage
provides :package, platform: "nexentacore"
- provides :package, platform: "solaris2", platform_version: '< 5.11'
+ provides :package, platform: "solaris2", platform_version: "< 5.11"
provides :solaris_package, os: "solaris2"
# def initialize(*args)
diff --git a/lib/chef/provider/package/windows.rb b/lib/chef/provider/package/windows.rb
index f9ff50dcc6..87fadc27cf 100644
--- a/lib/chef/provider/package/windows.rb
+++ b/lib/chef/provider/package/windows.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/mixin/uris'
-require 'chef/resource/windows_package'
-require 'chef/provider/package'
-require 'chef/util/path_helper'
-require 'chef/mixin/checksum'
+require "chef/mixin/uris"
+require "chef/resource/windows_package"
+require "chef/provider/package"
+require "chef/util/path_helper"
+require "chef/mixin/checksum"
class Chef
class Provider
@@ -32,7 +32,7 @@ class Chef
provides :package, os: "windows"
provides :windows_package, os: "windows"
- require 'chef/provider/package/windows/registry_uninstall_entry.rb'
+ require "chef/provider/package/windows/registry_uninstall_entry.rb"
def define_resource_requirements
requirements.assert(:install) do |a|
@@ -60,11 +60,11 @@ class Chef
case installer_type
when :msi
Chef::Log.debug("#{new_resource} is MSI")
- require 'chef/provider/package/windows/msi'
+ require "chef/provider/package/windows/msi"
Chef::Provider::Package::Windows::MSI.new(resource_for_provider, uninstall_registry_entries)
else
Chef::Log.debug("#{new_resource} is EXE with type '#{installer_type}'")
- require 'chef/provider/package/windows/exe'
+ require "chef/provider/package/windows/exe"
Chef::Provider::Package::Windows::Exe.new(resource_for_provider, installer_type, uninstall_registry_entries)
end
end
@@ -88,7 +88,7 @@ class Chef
:msi
else
# search the binary file for installer type
- ::Kernel.open(::File.expand_path(source_location), 'rb') do |io|
+ ::Kernel.open(::File.expand_path(source_location), "rb") do |io|
filesize = io.size
bufsize = 4096 # read 4K buffers
overlap = 16 # bytes to overlap between buffer reads
@@ -112,7 +112,7 @@ class Chef
end
# if file is named 'setup.exe' assume installshield
- if basename == 'setup.exe'
+ if basename == "setup.exe"
:installshield
else
raise Chef::Exceptions::CannotDetermineWindowsInstallerType, "Installer type for Windows Package '#{new_resource.name}' not specified and cannot be determined from file extension '#{file_extension}'"
@@ -151,7 +151,7 @@ class Chef
# @return [String] candidate_version
def candidate_version
- @candidate_version ||= (new_resource.version || 'latest')
+ @candidate_version ||= (new_resource.version || "latest")
end
# @return [Array] current_version(s) as an array
diff --git a/lib/chef/provider/package/windows/exe.rb b/lib/chef/provider/package/windows/exe.rb
index f21106f2ff..e510755281 100644
--- a/lib/chef/provider/package/windows/exe.rb
+++ b/lib/chef/provider/package/windows/exe.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/mixin/shell_out'
+require "chef/mixin/shell_out"
class Chef
class Provider
@@ -101,13 +101,13 @@ class Chef
def unattended_flags
case installer_type
when :installshield
- '/s /sms'
+ "/s /sms"
when :nsis
- '/S /NCRC'
+ "/S /NCRC"
when :inno
- '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART'
+ "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART"
when :wise
- '/s'
+ "/s"
end
end
end
diff --git a/lib/chef/provider/package/windows/msi.rb b/lib/chef/provider/package/windows/msi.rb
index 15b00f46f0..106dc496b6 100644
--- a/lib/chef/provider/package/windows/msi.rb
+++ b/lib/chef/provider/package/windows/msi.rb
@@ -18,8 +18,8 @@
# TODO: Allow @new_resource.source to be a Product Code as a GUID for uninstall / network install
-require 'chef/win32/api/installer' if (RUBY_PLATFORM =~ /mswin|mingw32|windows/) && Chef::Platform.supports_msi?
-require 'chef/mixin/shell_out'
+require "chef/win32/api/installer" if (RUBY_PLATFORM =~ /mswin|mingw32|windows/) && Chef::Platform.supports_msi?
+require "chef/mixin/shell_out"
class Chef
class Provider
diff --git a/lib/chef/provider/package/windows/registry_uninstall_entry.rb b/lib/chef/provider/package/windows/registry_uninstall_entry.rb
index 2c3f6ba093..145f799e05 100644
--- a/lib/chef/provider/package/windows/registry_uninstall_entry.rb
+++ b/lib/chef/provider/package/windows/registry_uninstall_entry.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'win32/registry' if (RUBY_PLATFORM =~ /mswin|mingw32|windows/)
+require "win32/registry" if (RUBY_PLATFORM =~ /mswin|mingw32|windows/)
class Chef
class Provider
@@ -39,7 +39,7 @@ class Chef
reg.each_key do |key, _wtime|
begin
entry = reg.open(key, desired)
- display_name = read_registry_property(entry, 'DisplayName')
+ display_name = read_registry_property(entry, "DisplayName")
if display_name == package_name
entries.push(RegistryUninstallEntry.new(hkey, key, entry))
end
@@ -67,9 +67,9 @@ class Chef
@hive = hive
@key = key
@data = registry_data
- @display_name = RegistryUninstallEntry.read_registry_property(registry_data, 'DisplayName')
- @display_version = RegistryUninstallEntry.read_registry_property(registry_data, 'DisplayVersion')
- @uninstall_string = RegistryUninstallEntry.read_registry_property(registry_data, 'UninstallString')
+ @display_name = RegistryUninstallEntry.read_registry_property(registry_data, "DisplayName")
+ @display_version = RegistryUninstallEntry.read_registry_property(registry_data, "DisplayVersion")
+ @uninstall_string = RegistryUninstallEntry.read_registry_property(registry_data, "UninstallString")
end
attr_reader :hive
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb
index 6258472a65..7b291d5f00 100644
--- a/lib/chef/provider/package/yum.rb
+++ b/lib/chef/provider/package/yum.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/provider/package'
-require 'chef/mixin/which'
-require 'chef/resource/package'
-require 'singleton'
-require 'chef/mixin/get_source_from_package'
+require "chef/config"
+require "chef/provider/package"
+require "chef/mixin/which"
+require "chef/resource/package"
+require "singleton"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
@@ -712,7 +712,7 @@ class Chef
one_line = false
error = nil
- helper = ::File.join(::File.dirname(__FILE__), 'yum-dump.py')
+ helper = ::File.join(::File.dirname(__FILE__), "yum-dump.py")
status = nil
begin
@@ -797,12 +797,12 @@ class Chef
end
def extract_interpreter(file)
- ::File.open(file, 'r', &:readline)[2..-1].strip
+ ::File.open(file, "r", &:readline)[2..-1].strip
end
# dnf based systems have a yum shim that has /bin/bash as the interpreter. Don't use this.
def shabang_or_fallback(interpreter)
- if interpreter == '/bin/bash'
+ if interpreter == "/bin/bash"
Chef::Log.warn("Yum executable interpreter is /bin/bash. Falling back to default python.")
"/usr/bin/python"
else
@@ -811,7 +811,7 @@ class Chef
end
def shabang?(file)
- ::File.open(file, 'r') do |f|
+ ::File.open(file, "r") do |f|
f.read(2) == '#!'
end
rescue Errno::ENOENT
@@ -1245,7 +1245,7 @@ class Chef
as_array(name).zip(as_array(version)).each do |n, v|
idx = package_name_array.index(n)
a = arch_for_name(n)
- s = ''
+ s = ""
unless v == current_version_array[idx]
s = "#{n}-#{v}#{yum_arch(a)}"
repo = @yum.package_repository(n, v, a)
@@ -1253,7 +1253,7 @@ class Chef
pkg_string_bits << s
end
end
- pkg_string = pkg_string_bits.join(' ')
+ pkg_string = pkg_string_bits.join(" ")
Chef::Log.info("#{@new_resource} #{log_method} #{repos.join(' ')}")
yum_command("-d0 -e0 -y#{expand_options(@new_resource.options)} #{method} #{pkg_string}")
else
@@ -1305,12 +1305,12 @@ class Chef
remove_str = as_array(name).zip(as_array(version)).map do |n, v|
a = arch_for_name(n)
"#{[n, v].join('-')}#{yum_arch(a)}"
- end.join(' ')
+ end.join(" ")
else
remove_str = as_array(name).map do |n|
a = arch_for_name(n)
"#{n}#{yum_arch(a)}"
- end.join(' ')
+ end.join(" ")
end
yum_command("-d0 -e0 -y#{expand_options(@new_resource.options)} remove #{remove_str}")
diff --git a/lib/chef/provider/package/zypper.rb b/lib/chef/provider/package/zypper.rb
index 72e8d56154..9b0aaf322a 100644
--- a/lib/chef/provider/package/zypper.rb
+++ b/lib/chef/provider/package/zypper.rb
@@ -19,10 +19,10 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'singleton'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "singleton"
class Chef
class Provider
@@ -38,8 +38,8 @@ class Chef
is_installed=false
is_out_of_date=false
- version=''
- oud_version=''
+ version=""
+ oud_version=""
Chef::Log.debug("#{new_resource} checking zypper")
status = shell_out_with_timeout("zypper --non-interactive info #{new_resource.package_name}")
status.stdout.each_line do |line|
diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb
index a5b0a5dc24..d3b586e75d 100644
--- a/lib/chef/provider/powershell_script.rb
+++ b/lib/chef/provider/powershell_script.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/platform/query_helpers'
-require 'chef/provider/windows_script'
+require "chef/platform/query_helpers"
+require "chef/provider/windows_script"
class Chef
class Provider
@@ -26,7 +26,7 @@ class Chef
provides :powershell_script, os: "windows"
def initialize (new_resource, run_context)
- super(new_resource, run_context, '.ps1')
+ super(new_resource, run_context, ".ps1")
add_exit_status_wrapper
end
@@ -58,10 +58,10 @@ class Chef
end
def flags
- interpreter_flags = [*default_interpreter_flags].join(' ')
+ interpreter_flags = [*default_interpreter_flags].join(" ")
if ! (@new_resource.flags.nil?)
- interpreter_flags = [@new_resource.flags, interpreter_flags].join(' ')
+ interpreter_flags = [@new_resource.flags, interpreter_flags].join(" ")
end
interpreter_flags
@@ -78,8 +78,8 @@ class Chef
end
def validate_script_syntax!
- interpreter_arguments = default_interpreter_flags.join(' ')
- Tempfile.open(['chef_powershell_script-user-code', '.ps1']) do | user_script_file |
+ interpreter_arguments = default_interpreter_flags.join(" ")
+ Tempfile.open(["chef_powershell_script-user-code", ".ps1"]) do | user_script_file |
# Wrap the user's code in a PowerShell script block so that
# it isn't executed. However, syntactically invalid script
# in that block will still trigger a syntax error which is
@@ -122,7 +122,7 @@ EOH
# user input confirmation for files such as PowerShell modules
# downloaded from the Internet. However, 'Bypass' is not supported
# prior to PowerShell 3.0, so the fallback is 'Unrestricted'
- execution_policy = Chef::Platform.supports_powershell_execution_bypass?(run_context.node) ? 'Bypass' : 'Unrestricted'
+ execution_policy = Chef::Platform.supports_powershell_execution_bypass?(run_context.node) ? "Bypass" : "Unrestricted"
[
"-NoLogo",
diff --git a/lib/chef/provider/reboot.rb b/lib/chef/provider/reboot.rb
index ab3177ba65..3f64955d21 100644
--- a/lib/chef/provider/reboot.rb
+++ b/lib/chef/provider/reboot.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/provider'
+require "chef/log"
+require "chef/provider"
class Chef
class Provider
diff --git a/lib/chef/provider/registry_key.rb b/lib/chef/provider/registry_key.rb
index 948fa6c63f..c6a06e0974 100644
--- a/lib/chef/provider/registry_key.rb
+++ b/lib/chef/provider/registry_key.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/log'
-require 'chef/resource/file'
-require 'chef/mixin/checksum'
-require 'chef/provider'
-require 'etc'
-require 'fileutils'
-require 'chef/scan_access_control'
-require 'chef/win32/registry'
+require "chef/config"
+require "chef/log"
+require "chef/resource/file"
+require "chef/mixin/checksum"
+require "chef/provider"
+require "etc"
+require "fileutils"
+require "chef/scan_access_control"
+require "chef/win32/registry"
class Chef
diff --git a/lib/chef/provider/remote_directory.rb b/lib/chef/provider/remote_directory.rb
index 3c1c50b963..02270201cb 100644
--- a/lib/chef/provider/remote_directory.rb
+++ b/lib/chef/provider/remote_directory.rb
@@ -16,17 +16,17 @@
# limitations under the License.
#
-require 'chef/provider/directory'
-require 'chef/resource/file'
-require 'chef/resource/directory'
-require 'chef/resource/cookbook_file'
-require 'chef/mixin/file_class'
-require 'chef/platform/query_helpers'
-require 'chef/util/path_helper'
-require 'chef/deprecation/warnings'
-require 'chef/deprecation/provider/remote_directory'
-
-require 'forwardable'
+require "chef/provider/directory"
+require "chef/resource/file"
+require "chef/resource/directory"
+require "chef/resource/cookbook_file"
+require "chef/mixin/file_class"
+require "chef/platform/query_helpers"
+require "chef/util/path_helper"
+require "chef/deprecation/warnings"
+require "chef/deprecation/provider/remote_directory"
+
+require "forwardable"
class Chef
class Provider
@@ -104,9 +104,9 @@ class Chef
#
def purge_unmanaged_files
if purge
- Dir.glob(::File.join(Chef::Util::PathHelper.escape_glob(path), '**', '*'), ::File::FNM_DOTMATCH).sort!.reverse!.each do |file|
+ Dir.glob(::File.join(Chef::Util::PathHelper.escape_glob(path), "**", "*"), ::File::FNM_DOTMATCH).sort!.reverse!.each do |file|
# skip '.' and '..'
- next if ['.','..'].include?(Pathname.new(file).basename().to_s)
+ next if [".",".."].include?(Pathname.new(file).basename().to_s)
# Clean the path. This is required because of the ::File.join
file = Chef::Util::PathHelper.cleanpath(file)
diff --git a/lib/chef/provider/remote_file.rb b/lib/chef/provider/remote_file.rb
index c4643edc0b..6548300c5d 100644
--- a/lib/chef/provider/remote_file.rb
+++ b/lib/chef/provider/remote_file.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'chef/provider/file'
-require 'chef/deprecation/provider/remote_file'
-require 'chef/deprecation/warnings'
+require "chef/provider/file"
+require "chef/deprecation/provider/remote_file"
+require "chef/deprecation/warnings"
class Chef
class Provider
diff --git a/lib/chef/provider/remote_file/cache_control_data.rb b/lib/chef/provider/remote_file/cache_control_data.rb
index 3f39dac625..85b723ece4 100644
--- a/lib/chef/provider/remote_file/cache_control_data.rb
+++ b/lib/chef/provider/remote_file/cache_control_data.rb
@@ -19,11 +19,11 @@
# limitations under the License.
#
-require 'stringio'
-require 'chef/file_cache'
-require 'chef/json_compat'
-require 'chef/digester'
-require 'chef/exceptions'
+require "stringio"
+require "chef/file_cache"
+require "chef/json_compat"
+require "chef/digester"
+require "chef/exceptions"
class Chef
class Provider
@@ -172,7 +172,7 @@ class Chef
# Scrub and truncate in accordance with the goals of keeping the name
# human-readable but within the bounds of local file system
# path length limits
- uri.gsub(/\W/, '_')[0..63]
+ uri.gsub(/\W/, "_")[0..63]
end
def sanitized_cache_file_basename
diff --git a/lib/chef/provider/remote_file/content.rb b/lib/chef/provider/remote_file/content.rb
index e9d85b4087..02c0cff457 100644
--- a/lib/chef/provider/remote_file/content.rb
+++ b/lib/chef/provider/remote_file/content.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'uri'
-require 'tempfile'
-require 'chef/file_content_management/content_base'
-require 'chef/mixin/uris'
+require "uri"
+require "tempfile"
+require "chef/file_content_management/content_base"
+require "chef/mixin/uris"
class Chef
class Provider
diff --git a/lib/chef/provider/remote_file/ftp.rb b/lib/chef/provider/remote_file/ftp.rb
index 3f78286aa3..a81126f27f 100644
--- a/lib/chef/provider/remote_file/ftp.rb
+++ b/lib/chef/provider/remote_file/ftp.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'uri'
-require 'tempfile'
-require 'net/ftp'
-require 'chef/provider/remote_file'
-require 'chef/file_content_management/tempfile'
+require "uri"
+require "tempfile"
+require "net/ftp"
+require "chef/provider/remote_file"
+require "chef/file_content_management/tempfile"
class Chef
class Provider
@@ -59,7 +59,7 @@ class Chef
if uri.userinfo
URI.unescape(uri.user)
else
- 'anonymous'
+ "anonymous"
end
end
@@ -94,11 +94,11 @@ class Chef
private
def with_proxy_env
- saved_socks_env = ENV['SOCKS_SERVER']
- ENV['SOCKS_SERVER'] = proxy_uri(@uri).to_s
+ saved_socks_env = ENV["SOCKS_SERVER"]
+ ENV["SOCKS_SERVER"] = proxy_uri(@uri).to_s
yield
ensure
- ENV['SOCKS_SERVER'] = saved_socks_env
+ ENV["SOCKS_SERVER"] = saved_socks_env
end
def with_connection
@@ -162,7 +162,7 @@ class Chef
end
def parse_path
- path = uri.path.sub(%r{\A/}, '%2F') # re-encode the beginning slash because uri library decodes it.
+ path = uri.path.sub(%r{\A/}, "%2F") # re-encode the beginning slash because uri library decodes it.
directories = path.split(%r{/}, -1)
directories.each {|d|
d.gsub!(/%([0-9A-Fa-f][0-9A-Fa-f])/) { [$1].pack("H2") }
diff --git a/lib/chef/provider/remote_file/http.rb b/lib/chef/provider/remote_file/http.rb
index e1f1cb2da7..218d7ef223 100644
--- a/lib/chef/provider/remote_file/http.rb
+++ b/lib/chef/provider/remote_file/http.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'chef/http/simple'
-require 'chef/digester'
-require 'chef/provider/remote_file'
-require 'chef/provider/remote_file/cache_control_data'
+require "chef/http/simple"
+require "chef/digester"
+require "chef/provider/remote_file"
+require "chef/provider/remote_file/cache_control_data"
class Chef
class Provider
@@ -87,11 +87,11 @@ class Chef
end
def last_modified_time_from(response)
- response['last_modified'] || response['date']
+ response["last_modified"] || response["date"]
end
def etag_from(response)
- response['etag']
+ response["etag"]
end
def http_client_opts
diff --git a/lib/chef/provider/remote_file/local_file.rb b/lib/chef/provider/remote_file/local_file.rb
index 026206b64e..2e99886a00 100644
--- a/lib/chef/provider/remote_file/local_file.rb
+++ b/lib/chef/provider/remote_file/local_file.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'uri'
-require 'tempfile'
-require 'chef/provider/remote_file'
+require "uri"
+require "tempfile"
+require "chef/provider/remote_file"
class Chef
class Provider
diff --git a/lib/chef/provider/remote_file/network_file.rb b/lib/chef/provider/remote_file/network_file.rb
index 093a388d2a..7c066cb052 100644
--- a/lib/chef/provider/remote_file/network_file.rb
+++ b/lib/chef/provider/remote_file/network_file.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'uri'
-require 'tempfile'
-require 'chef/provider/remote_file'
+require "uri"
+require "tempfile"
+require "chef/provider/remote_file"
class Chef
class Provider
diff --git a/lib/chef/provider/route.rb b/lib/chef/provider/route.rb
index 72a5029a94..4abfd806b9 100644
--- a/lib/chef/provider/route.rb
+++ b/lib/chef/provider/route.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/mixin/command'
-require 'chef/provider'
-require 'ipaddr'
+require "chef/log"
+require "chef/mixin/command"
+require "chef/provider"
+require "ipaddr"
class Chef::Provider::Route < Chef::Provider
include Chef::Mixin::Command
@@ -28,52 +28,52 @@ class Chef::Provider::Route < Chef::Provider
attr_accessor :is_running
- MASK = {'0.0.0.0' => '0',
- '128.0.0.0' => '1',
- '192.0.0.0' => '2',
- '224.0.0.0' => '3',
- '240.0.0.0' => '4',
- '248.0.0.0' => '5',
- '252.0.0.0' => '6',
- '254.0.0.0' => '7',
- '255.0.0.0' => '8',
- '255.128.0.0' => '9',
- '255.192.0.0' => '10',
- '255.224.0.0' => '11',
- '255.240.0.0' => '12',
- '255.248.0.0' => '13',
- '255.252.0.0' => '14',
- '255.254.0.0' => '15',
- '255.255.0.0' => '16',
- '255.255.128.0' => '17',
- '255.255.192.0' => '18',
- '255.255.224.0' => '19',
- '255.255.240.0' => '20',
- '255.255.248.0' => '21',
- '255.255.252.0' => '22',
- '255.255.254.0' => '23',
- '255.255.255.0' => '24',
- '255.255.255.128' => '25',
- '255.255.255.192' => '26',
- '255.255.255.224' => '27',
- '255.255.255.240' => '28',
- '255.255.255.248' => '29',
- '255.255.255.252' => '30',
- '255.255.255.254' => '31',
- '255.255.255.255' => '32' }
+ MASK = {"0.0.0.0" => "0",
+ "128.0.0.0" => "1",
+ "192.0.0.0" => "2",
+ "224.0.0.0" => "3",
+ "240.0.0.0" => "4",
+ "248.0.0.0" => "5",
+ "252.0.0.0" => "6",
+ "254.0.0.0" => "7",
+ "255.0.0.0" => "8",
+ "255.128.0.0" => "9",
+ "255.192.0.0" => "10",
+ "255.224.0.0" => "11",
+ "255.240.0.0" => "12",
+ "255.248.0.0" => "13",
+ "255.252.0.0" => "14",
+ "255.254.0.0" => "15",
+ "255.255.0.0" => "16",
+ "255.255.128.0" => "17",
+ "255.255.192.0" => "18",
+ "255.255.224.0" => "19",
+ "255.255.240.0" => "20",
+ "255.255.248.0" => "21",
+ "255.255.252.0" => "22",
+ "255.255.254.0" => "23",
+ "255.255.255.0" => "24",
+ "255.255.255.128" => "25",
+ "255.255.255.192" => "26",
+ "255.255.255.224" => "27",
+ "255.255.255.240" => "28",
+ "255.255.255.248" => "29",
+ "255.255.255.252" => "30",
+ "255.255.255.254" => "31",
+ "255.255.255.255" => "32" }
def hex2ip(hex_data)
# Cleanup hex data
- hex_ip = hex_data.to_s.downcase.gsub(/[^0-9a-f]/, '')
+ hex_ip = hex_data.to_s.downcase.gsub(/[^0-9a-f]/, "")
# Check hex data format (IP is a 32bit integer, so should be 8 chars long)
return nil if hex_ip.length != hex_data.length || hex_ip.length != 8
# Extract octets from hex data
- octets = hex_ip.scan(/../).reverse.collect { |octet| [octet].pack('H2').unpack("C").first }
+ octets = hex_ip.scan(/../).reverse.collect { |octet| [octet].pack("H2").unpack("C").first }
# Validate IP
- ip = octets.join('.')
+ ip = octets.join(".")
begin
IPAddr.new(ip, Socket::AF_INET).to_s
rescue ArgumentError
@@ -197,7 +197,7 @@ class Chef::Provider::Route < Chef::Provider
end
def generate_command(action)
- common_route_items = ''
+ common_route_items = ""
common_route_items << "/#{MASK[@new_resource.netmask.to_s]}" if @new_resource.netmask
common_route_items << " via #{@new_resource.gateway} " if @new_resource.gateway
@@ -215,7 +215,7 @@ class Chef::Provider::Route < Chef::Provider
end
def config_file_contents(action, options={})
- content = ''
+ content = ""
case action
when :add
content << "#{options[:target]}"
diff --git a/lib/chef/provider/script.rb b/lib/chef/provider/script.rb
index 2f2001dbf9..d95962a15b 100644
--- a/lib/chef/provider/script.rb
+++ b/lib/chef/provider/script.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'tempfile'
-require 'chef/provider/execute'
-require 'forwardable'
+require "tempfile"
+require "chef/provider/execute"
+require "forwardable"
class Chef
class Provider
diff --git a/lib/chef/provider/service.rb b/lib/chef/provider/service.rb
index 311bb1082e..1c0738112a 100644
--- a/lib/chef/provider/service.rb
+++ b/lib/chef/provider/service.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/mixin/command'
-require 'chef/provider'
+require "chef/mixin/command"
+require "chef/provider"
class Chef
class Provider
@@ -192,19 +192,19 @@ class Chef
# Linux
#
- require 'chef/chef_class'
- require 'chef/provider/service/systemd'
- require 'chef/provider/service/insserv'
- require 'chef/provider/service/redhat'
- require 'chef/provider/service/arch'
- require 'chef/provider/service/gentoo'
- require 'chef/provider/service/upstart'
- require 'chef/provider/service/debian'
- require 'chef/provider/service/invokercd'
-
- Chef.set_provider_priority_array :service, [ Systemd, Arch ], platform_family: 'arch'
- Chef.set_provider_priority_array :service, [ Systemd, Gentoo ], platform_family: 'gentoo'
- Chef.set_provider_priority_array :service, [ Systemd, Upstart, Insserv, Debian, Invokercd ], platform_family: 'debian'
+ require "chef/chef_class"
+ require "chef/provider/service/systemd"
+ require "chef/provider/service/insserv"
+ require "chef/provider/service/redhat"
+ require "chef/provider/service/arch"
+ require "chef/provider/service/gentoo"
+ require "chef/provider/service/upstart"
+ require "chef/provider/service/debian"
+ require "chef/provider/service/invokercd"
+
+ Chef.set_provider_priority_array :service, [ Systemd, Arch ], platform_family: "arch"
+ Chef.set_provider_priority_array :service, [ Systemd, Gentoo ], platform_family: "gentoo"
+ Chef.set_provider_priority_array :service, [ Systemd, Upstart, Insserv, Debian, Invokercd ], platform_family: "debian"
Chef.set_provider_priority_array :service, [ Systemd, Insserv, Redhat ], platform_family: %w(rhel fedora suse)
end
end
diff --git a/lib/chef/provider/service/aix.rb b/lib/chef/provider/service/aix.rb
index 0c95ce2c8e..1968f8f3de 100644
--- a/lib/chef/provider/service/aix.rb
+++ b/lib/chef/provider/service/aix.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service'
+require "chef/provider/service"
class Chef
class Provider
@@ -98,7 +98,7 @@ class Chef
@current_resource.running false
else
service = shell_out!("lssrc -s #{@new_resource.service_name}").stdout
- if service.split(' ').last == 'active'
+ if service.split(" ").last == "active"
@current_resource.running true
else
@current_resource.running false
diff --git a/lib/chef/provider/service/aixinit.rb b/lib/chef/provider/service/aixinit.rb
index 19beac79f0..66d85984fa 100644
--- a/lib/chef/provider/service/aixinit.rb
+++ b/lib/chef/provider/service/aixinit.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
+require "chef/provider/service/init"
class Chef
class Provider
@@ -60,14 +60,14 @@ class Chef
Dir.glob(["/etc/rc.d/rc2.d/[SK][0-9][0-9]#{@new_resource.service_name}", "/etc/rc.d/rc2.d/[SK]#{@new_resource.service_name}"]).each { |f| ::File.delete(f)}
if @new_resource.priority.is_a? Integer
- create_symlink(2, 'S', @new_resource.priority)
+ create_symlink(2, "S", @new_resource.priority)
elsif @new_resource.priority.is_a? Hash
@new_resource.priority.each do |level,o|
- create_symlink(level,(o[0] == :start ? 'S' : 'K'),o[1])
+ create_symlink(level,(o[0] == :start ? "S" : "K"),o[1])
end
else
- create_symlink(2, 'S', '')
+ create_symlink(2, "S", "")
end
end
@@ -75,13 +75,13 @@ class Chef
Dir.glob(["/etc/rc.d/rc2.d/[SK][0-9][0-9]#{@new_resource.service_name}", "/etc/rc.d/rc2.d/[SK]#{@new_resource.service_name}"]).each { |f| ::File.delete(f) }
if @new_resource.priority.is_a? Integer
- create_symlink(2, 'K',100 - @new_resource.priority)
+ create_symlink(2, "K",100 - @new_resource.priority)
elsif @new_resource.priority.is_a? Hash
@new_resource.priority.each do |level,o|
- create_symlink(level, 'K', 100 - o[1]) if o[0] == :stop
+ create_symlink(level, "K", 100 - o[1]) if o[0] == :stop
end
else
- create_symlink(2, 'K', '')
+ create_symlink(2, "K", "")
end
end
@@ -98,7 +98,7 @@ class Chef
files.each do |file|
if (RC_D_SCRIPT_NAME =~ file)
- priority[2] = [($1 == "S" ? :start : :stop), ($2.empty? ? '' : $2.to_i)]
+ priority[2] = [($1 == "S" ? :start : :stop), ($2.empty? ? "" : $2.to_i)]
if $1 == "S"
is_enabled = true
end
diff --git a/lib/chef/provider/service/arch.rb b/lib/chef/provider/service/arch.rb
index e7fbcc820c..3e7b9fcaca 100644
--- a/lib/chef/provider/service/arch.rb
+++ b/lib/chef/provider/service/arch.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
+require "chef/provider/service/init"
class Chef::Provider::Service::Arch < Chef::Provider::Service::Init
@@ -50,7 +50,7 @@ class Chef::Provider::Service::Arch < Chef::Provider::Service::Init
def daemons
entries = []
if ::File.read("/etc/rc.conf").match(/DAEMONS=\((.*)\)/m)
- entries += $1.gsub(/\\?[\r\n]/, ' ').gsub(/# *[^ ]+/,' ').split(' ') if $1.length > 0
+ entries += $1.gsub(/\\?[\r\n]/, " ").gsub(/# *[^ ]+/," ").split(" ") if $1.length > 0
end
yield(entries) if block_given?
diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb
index 7d23e4ac77..9d80f5f924 100644
--- a/lib/chef/provider/service/debian.rb
+++ b/lib/chef/provider/service/debian.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
+require "chef/provider/service/init"
class Chef
class Provider
class Service
class Debian < Chef::Provider::Service::Init
- provides :service, platform_family: 'debian' do |node|
+ provides :service, platform_family: "debian" do |node|
Chef::Platform::ServiceHelpers.service_resource_providers.include?(:debian)
end
diff --git a/lib/chef/provider/service/freebsd.rb b/lib/chef/provider/service/freebsd.rb
index 78ca0be235..4aa9eb09f6 100644
--- a/lib/chef/provider/service/freebsd.rb
+++ b/lib/chef/provider/service/freebsd.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/resource/service'
-require 'chef/provider/service/init'
-require 'chef/mixin/command'
+require "chef/resource/service"
+require "chef/provider/service/init"
+require "chef/mixin/command"
class Chef
class Provider
@@ -119,11 +119,11 @@ class Chef
private
def read_rc_conf
- ::File.open("/etc/rc.conf", 'r') { |file| file.readlines }
+ ::File.open("/etc/rc.conf", "r") { |file| file.readlines }
end
def write_rc_conf(lines)
- ::File.open("/etc/rc.conf", 'w') do |file|
+ ::File.open("/etc/rc.conf", "w") do |file|
lines.each { |line| file.puts(line) }
end
end
diff --git a/lib/chef/provider/service/gentoo.rb b/lib/chef/provider/service/gentoo.rb
index 903c55af7a..28fd43a709 100644
--- a/lib/chef/provider/service/gentoo.rb
+++ b/lib/chef/provider/service/gentoo.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
-require 'chef/mixin/command'
-require 'chef/util/path_helper'
+require "chef/provider/service/init"
+require "chef/mixin/command"
+require "chef/util/path_helper"
class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init
diff --git a/lib/chef/provider/service/init.rb b/lib/chef/provider/service/init.rb
index 8fe5b0281f..90c0ec2b34 100644
--- a/lib/chef/provider/service/init.rb
+++ b/lib/chef/provider/service/init.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/service/simple'
-require 'chef/mixin/command'
-require 'chef/platform/service_helpers'
+require "chef/provider/service/simple"
+require "chef/mixin/command"
+require "chef/platform/service_helpers"
class Chef
class Provider
diff --git a/lib/chef/provider/service/insserv.rb b/lib/chef/provider/service/insserv.rb
index dd01f9ab87..87527599b0 100644
--- a/lib/chef/provider/service/insserv.rb
+++ b/lib/chef/provider/service/insserv.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
-require 'chef/util/path_helper'
+require "chef/provider/service/init"
+require "chef/util/path_helper"
class Chef
class Provider
diff --git a/lib/chef/provider/service/invokercd.rb b/lib/chef/provider/service/invokercd.rb
index 2b045e0e60..a48e2ac815 100644
--- a/lib/chef/provider/service/invokercd.rb
+++ b/lib/chef/provider/service/invokercd.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
+require "chef/provider/service/init"
class Chef
class Provider
class Service
class Invokercd < Chef::Provider::Service::Init
- provides :service, platform_family: 'debian', override: true do |node|
+ provides :service, platform_family: "debian", override: true do |node|
Chef::Platform::ServiceHelpers.service_resource_providers.include?(:invokercd)
end
diff --git a/lib/chef/provider/service/macosx.rb b/lib/chef/provider/service/macosx.rb
index 47c74f9425..b939f78b03 100644
--- a/lib/chef/provider/service/macosx.rb
+++ b/lib/chef/provider/service/macosx.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'etc'
-require 'rexml/document'
-require 'chef/resource/service'
-require 'chef/resource/macosx_service'
-require 'chef/provider/service/simple'
-require 'chef/util/path_helper'
+require "etc"
+require "rexml/document"
+require "chef/resource/service"
+require "chef/resource/macosx_service"
+require "chef/provider/service/simple"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -36,14 +36,14 @@ class Chef
/Library/LaunchDaemons
/System/Library/LaunchAgents
/System/Library/LaunchDaemons }
- Chef::Util::PathHelper.home('Library', 'LaunchAgents') { |p| locations << p }
+ Chef::Util::PathHelper.home("Library", "LaunchAgents") { |p| locations << p }
locations
end
PLIST_DIRS = gather_plist_dirs
def this_version_or_newer?(this_version)
- Gem::Version.new(node['platform_version']) >= Gem::Version.new(this_version)
+ Gem::Version.new(node["platform_version"]) >= Gem::Version.new(this_version)
end
def load_current_resource
@@ -53,17 +53,17 @@ class Chef
@plist = @new_resource.plist ? @new_resource.plist : find_service_plist
@service_label = find_service_label
# LauchAgents should be loaded as the console user.
- @console_user = @plist ? @plist.include?('LaunchAgents') : false
+ @console_user = @plist ? @plist.include?("LaunchAgents") : false
@session_type = @new_resource.session_type
if @console_user
@console_user = Etc.getlogin
Chef::Log.debug("#{new_resource} console_user: '#{@console_user}'")
cmd = "su "
- param = this_version_or_newer?('10.10') ? '' : '-l '
+ param = this_version_or_newer?("10.10") ? "" : "-l "
@base_user_cmd = cmd + param + "#{@console_user} -c"
# Default LauchAgent session should be Aqua
- @session_type = 'Aqua' if @session_type.nil?
+ @session_type = "Aqua" if @session_type.nil?
end
Chef::Log.debug("#{new_resource} Plist: '#{@plist}' service_label: '#{@service_label}'")
@@ -161,13 +161,13 @@ class Chef
end
def load_service
- session = @session_type ? "-S #{@session_type} " : ''
- cmd = 'launchctl load -w ' + session + @plist
+ session = @session_type ? "-S #{@session_type} " : ""
+ cmd = "launchctl load -w " + session + @plist
shell_out_as_user(cmd)
end
def unload_service
- cmd = 'launchctl unload -w ' + @plist
+ cmd = "launchctl unload -w " + @plist
shell_out_as_user(cmd)
end
diff --git a/lib/chef/provider/service/openbsd.rb b/lib/chef/provider/service/openbsd.rb
index 36c9e8141e..10d7b21953 100644
--- a/lib/chef/provider/service/openbsd.rb
+++ b/lib/chef/provider/service/openbsd.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/mixin/command'
-require 'chef/mixin/shell_out'
-require 'chef/provider/service/init'
-require 'chef/resource/service'
+require "chef/mixin/command"
+require "chef/mixin/shell_out"
+require "chef/provider/service/init"
+require "chef/resource/service"
class Chef
class Provider
@@ -32,13 +32,13 @@ class Chef
attr_reader :init_command, :rc_conf, :rc_conf_local, :enabled_state_found
- RC_CONF_PATH = '/etc/rc.conf'
- RC_CONF_LOCAL_PATH = '/etc/rc.conf.local'
+ RC_CONF_PATH = "/etc/rc.conf"
+ RC_CONF_LOCAL_PATH = "/etc/rc.conf.local"
def initialize(new_resource, run_context)
super
- @rc_conf = ::File.read(RC_CONF_PATH) rescue ''
- @rc_conf_local = ::File.read(RC_CONF_LOCAL_PATH) rescue ''
+ @rc_conf = ::File.read(RC_CONF_PATH) rescue ""
+ @rc_conf_local = ::File.read(RC_CONF_LOCAL_PATH) rescue ""
@init_command = ::File.exist?(rcd_script_path) ? rcd_script_path : nil
new_resource.status_command("#{default_init_command} check")
end
@@ -82,7 +82,7 @@ class Chef
if !is_enabled?
if is_builtin?
if is_enabled_by_default?
- update_rcl rc_conf_local.sub(/^#{Regexp.escape(builtin_service_enable_variable_name)}=.*/, '')
+ update_rcl rc_conf_local.sub(/^#{Regexp.escape(builtin_service_enable_variable_name)}=.*/, "")
else
# add line with blank string, which means enable
update_rcl rc_conf_local + "\n" + "#{builtin_service_enable_variable_name}=\"\"\n"
@@ -90,7 +90,7 @@ class Chef
else
# add to pkg_scripts, most recent addition goes last
old_services_list = rc_conf_local.match(/^pkg_scripts="(.*)"/)
- old_services_list = old_services_list ? old_services_list[1].split(' ') : []
+ old_services_list = old_services_list ? old_services_list[1].split(" ") : []
new_services_list = old_services_list + [new_resource.service_name]
if rc_conf_local.match(/^pkg_scripts="(.*)"/)
new_rcl = rc_conf_local.sub(/^pkg_scripts="(.*)"/, "pkg_scripts=\"#{new_services_list.join(' ')}\"")
@@ -110,12 +110,12 @@ class Chef
update_rcl rc_conf_local + "\n" + "#{builtin_service_enable_variable_name}=\"NO\"\n"
else
# remove line to disable
- update_rcl rc_conf_local.sub(/^#{Regexp.escape(builtin_service_enable_variable_name)}=.*/, '')
+ update_rcl rc_conf_local.sub(/^#{Regexp.escape(builtin_service_enable_variable_name)}=.*/, "")
end
else
# remove from pkg_scripts
old_list = rc_conf_local.match(/^pkg_scripts="(.*)"/)
- old_list = old_list ? old_list[1].split(' ') : []
+ old_list = old_list ? old_list[1].split(" ") : []
new_list = old_list - [new_resource.service_name]
update_rcl rc_conf_local.sub(/^pkg_scripts="(.*)"/, pkg_scripts="#{new_list.join(' ')}")
end
diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb
index 3ad11a7672..f93cd36348 100644
--- a/lib/chef/provider/service/redhat.rb
+++ b/lib/chef/provider/service/redhat.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
+require "chef/provider/service/init"
class Chef
class Provider
@@ -79,8 +79,8 @@ class Chef
unless run_levels.nil? or run_levels.empty?
all_levels_match = true
chkconfig.stdout.split(/\s+/)[1..-1].each do |level|
- index = level.split(':').first
- status = level.split(':').last
+ index = level.split(":").first
+ status = level.split(":").last
if level =~ CHKCONFIG_ON
@current_run_levels << index.to_i
all_levels_match = false unless run_levels.include?(index.to_i)
diff --git a/lib/chef/provider/service/simple.rb b/lib/chef/provider/service/simple.rb
index bb3d819b3d..a096c9dfc0 100644
--- a/lib/chef/provider/service/simple.rb
+++ b/lib/chef/provider/service/simple.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/service'
-require 'chef/resource/service'
-require 'chef/mixin/command'
+require "chef/provider/service"
+require "chef/resource/service"
+require "chef/mixin/command"
class Chef
class Provider
diff --git a/lib/chef/provider/service/solaris.rb b/lib/chef/provider/service/solaris.rb
index 7040503c6b..c43a25258c 100644
--- a/lib/chef/provider/service/solaris.rb
+++ b/lib/chef/provider/service/solaris.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/service'
-require 'chef/resource/service'
-require 'chef/mixin/command'
+require "chef/provider/service"
+require "chef/resource/service"
+require "chef/mixin/command"
class Chef
class Provider
@@ -96,11 +96,11 @@ class Chef
# check service state
@maintenance = false
- case status['state']
- when 'online'
+ case status["state"]
+ when "online"
@current_resource.enabled(true)
@current_resource.running(true)
- when 'maintenance'
+ when "maintenance"
@maintenance = true
end
diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb
index d41f6248c2..bf4b324dce 100644
--- a/lib/chef/provider/service/systemd.rb
+++ b/lib/chef/provider/service/systemd.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/resource/service'
-require 'chef/provider/service/simple'
-require 'chef/mixin/which'
+require "chef/resource/service"
+require "chef/provider/service/simple"
+require "chef/mixin/which"
class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb
index 8d9adaa3b3..c0f7e020f6 100644
--- a/lib/chef/provider/service/upstart.rb
+++ b/lib/chef/provider/service/upstart.rb
@@ -16,17 +16,17 @@
# limitations under the License.
#
-require 'chef/resource/service'
-require 'chef/provider/service/simple'
-require 'chef/mixin/command'
-require 'chef/util/file_edit'
+require "chef/resource/service"
+require "chef/provider/service/simple"
+require "chef/mixin/command"
+require "chef/util/file_edit"
class Chef
class Provider
class Service
class Upstart < Chef::Provider::Service::Simple
- provides :service, platform_family: 'debian', override: true do |node|
+ provides :service, platform_family: "debian", override: true do |node|
Chef::Platform::ServiceHelpers.service_resource_providers.include?(:upstart)
end
@@ -130,7 +130,7 @@ class Chef
# Get enabled/disabled state by reading job configuration file
if ::File.exists?("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
Chef::Log.debug("#{@new_resource} found #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
- ::File.open("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}",'r') do |file|
+ ::File.open("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}","r") do |file|
while line = file.gets
case line
when /^start on/
diff --git a/lib/chef/provider/service/windows.rb b/lib/chef/provider/service/windows.rb
index fcebeeb6c6..0ae3c5b09f 100644
--- a/lib/chef/provider/service/windows.rb
+++ b/lib/chef/provider/service/windows.rb
@@ -18,10 +18,10 @@
# limitations under the License.
#
-require 'chef/provider/service/simple'
+require "chef/provider/service/simple"
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'chef/win32/error'
- require 'win32/service'
+ require "chef/win32/error"
+ require "win32/service"
end
class Chef::Provider::Service::Windows < Chef::Provider::Service
@@ -32,22 +32,22 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
include Chef::ReservedNames::Win32::API::Error rescue LoadError
#Win32::Service.get_start_type
- AUTO_START = 'auto start'
- MANUAL = 'demand start'
- DISABLED = 'disabled'
+ AUTO_START = "auto start"
+ MANUAL = "demand start"
+ DISABLED = "disabled"
#Win32::Service.get_current_state
- RUNNING = 'running'
- STOPPED = 'stopped'
- CONTINUE_PENDING = 'continue pending'
- PAUSE_PENDING = 'pause pending'
- PAUSED = 'paused'
- START_PENDING = 'start pending'
- STOP_PENDING = 'stop pending'
+ RUNNING = "running"
+ STOPPED = "stopped"
+ CONTINUE_PENDING = "continue pending"
+ PAUSE_PENDING = "pause pending"
+ PAUSED = "paused"
+ START_PENDING = "start pending"
+ STOP_PENDING = "stop pending"
TIMEOUT = 60
- SERVICE_RIGHT = 'SeServiceLogonRight'
+ SERVICE_RIGHT = "SeServiceLogonRight"
def whyrun_supported?
false
@@ -252,11 +252,11 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
# remove characters that make for broken or wonky filenames.
def clean_username_for_path(username)
- username.gsub(/[\/\\. ]+/, '_')
+ username.gsub(/[\/\\. ]+/, "_")
end
def canonicalize_username(username)
- username.sub(/^\.?\\+/, '')
+ username.sub(/^\.?\\+/, "")
end
def current_state
diff --git a/lib/chef/provider/subversion.rb b/lib/chef/provider/subversion.rb
index e3e3d5158a..2cc0da65a0 100644
--- a/lib/chef/provider/subversion.rb
+++ b/lib/chef/provider/subversion.rb
@@ -18,10 +18,10 @@
#TODO subversion and git should both extend from a base SCM provider.
-require 'chef/log'
-require 'chef/provider'
-require 'chef/mixin/command'
-require 'fileutils'
+require "chef/log"
+require "chef/provider"
+require "chef/mixin/command"
+require "fileutils"
class Chef
class Provider
@@ -176,7 +176,7 @@ class Chef
end
attrs
end
- rev = (repo_attrs['Last Changed Rev'] || repo_attrs['Revision'])
+ rev = (repo_attrs["Last Changed Rev"] || repo_attrs["Revision"])
rev.strip! if rev
raise "Could not parse `svn info` data: #{svn_info}" if repo_attrs.empty?
Chef::Log.debug "#{@new_resource} resolved revision #{@new_resource.revision} to #{rev}"
@@ -201,12 +201,12 @@ class Chef
end
def target_dir_non_existent_or_empty?
- !::File.exist?(@new_resource.destination) || Dir.entries(@new_resource.destination).sort == ['.','..']
+ !::File.exist?(@new_resource.destination) || Dir.entries(@new_resource.destination).sort == [".",".."]
end
def svn_binary
@new_resource.svn_binary ||
- (Chef::Platform.windows? ? 'svn.exe' : 'svn')
+ (Chef::Platform.windows? ? "svn.exe" : "svn")
end
def assert_target_directory_valid!
diff --git a/lib/chef/provider/template.rb b/lib/chef/provider/template.rb
index 1e759074b9..7cbfca025f 100644
--- a/lib/chef/provider/template.rb
+++ b/lib/chef/provider/template.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'chef/provider/template_finder'
-require 'chef/provider/file'
-require 'chef/deprecation/provider/template'
-require 'chef/deprecation/warnings'
+require "chef/provider/template_finder"
+require "chef/provider/file"
+require "chef/deprecation/provider/template"
+require "chef/deprecation/warnings"
class Chef
class Provider
diff --git a/lib/chef/provider/template/content.rb b/lib/chef/provider/template/content.rb
index 693b19a8c6..891861de8b 100644
--- a/lib/chef/provider/template/content.rb
+++ b/lib/chef/provider/template/content.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/mixin/template'
-require 'chef/file_content_management/content_base'
+require "chef/mixin/template"
+require "chef/file_content_management/content_base"
class Chef
class Provider
diff --git a/lib/chef/provider/user.rb b/lib/chef/provider/user.rb
index 76aefbf1c8..b819401731 100644
--- a/lib/chef/provider/user.rb
+++ b/lib/chef/provider/user.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider'
-require 'chef/mixin/command'
-require 'etc'
+require "chef/provider"
+require "chef/mixin/command"
+require "etc"
class Chef
class Provider
@@ -71,9 +71,9 @@ class Chef
end
@current_resource.comment(user_info.gecos)
- if @new_resource.password && @current_resource.password == 'x'
+ if @new_resource.password && @current_resource.password == "x"
begin
- require 'shadow'
+ require "shadow"
rescue LoadError
@shadow_lib_ok = false
else
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index 78769ae758..563d56dce7 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'mixlib/shellout'
-require 'chef/provider/user'
-require 'openssl'
-require 'plist'
-require 'chef/util/path_helper'
+require "mixlib/shellout"
+require "chef/provider/user"
+require "openssl"
+require "plist"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -136,14 +136,14 @@ user password using shadow hash.")
if shadow_hash["SALTED-SHA512"]
# Convert the shadow value from Base64 encoding to hex before consuming them
@password_shadow_conversion_algorithm = "SALTED-SHA512"
- current_resource.password(shadow_hash["SALTED-SHA512"].string.unpack('H*').first)
+ current_resource.password(shadow_hash["SALTED-SHA512"].string.unpack("H*").first)
elsif shadow_hash["SALTED-SHA512-PBKDF2"]
@password_shadow_conversion_algorithm = "SALTED-SHA512-PBKDF2"
# Convert the entropy from Base64 encoding to hex before consuming them
- current_resource.password(shadow_hash["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack('H*').first)
+ current_resource.password(shadow_hash["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack("H*").first)
current_resource.iterations(shadow_hash["SALTED-SHA512-PBKDF2"]["iterations"])
# Convert the salt from Base64 encoding to hex before consuming them
- current_resource.salt(shadow_hash["SALTED-SHA512-PBKDF2"]["salt"].string.unpack('H*').first)
+ current_resource.salt(shadow_hash["SALTED-SHA512-PBKDF2"]["salt"].string.unpack("H*").first)
else
raise(Chef::Exceptions::User,"Unknown shadow_hash format: #{shadow_hash.keys.join(' ')}")
end
@@ -213,7 +213,7 @@ user password using shadow hash.")
#
def dscl_set_uid
# XXX: mutates the new resource
- new_resource.uid(get_free_uid) if (new_resource.uid.nil? || new_resource.uid == '')
+ new_resource.uid(get_free_uid) if (new_resource.uid.nil? || new_resource.uid == "")
if uid_used?(new_resource.uid)
raise(Chef::Exceptions::RequestedUIDUnavailable, "uid #{new_resource.uid} is already in use")
@@ -396,7 +396,7 @@ user password using shadow hash.")
# Create a random 4 byte salt
salt = OpenSSL::Random.random_bytes(4)
encoded_password = OpenSSL::Digest::SHA512.hexdigest(salt + new_resource.password)
- hash_value = salt.unpack('H*').first + encoded_password
+ hash_value = salt.unpack("H*").first + encoded_password
end
shadow_info["SALTED-SHA512"] = StringIO.new
@@ -664,7 +664,7 @@ user password using shadow hash.")
result = shell_out("plutil -#{args.join(' ')}")
raise(Chef::Exceptions::PlistUtilCommandFailed,"plutil error: #{result.inspect}") unless result.exitstatus == 0
if result.stdout.encoding == Encoding::ASCII_8BIT
- result.stdout.encode("utf-8", "binary", :undef => :replace, :invalid => :replace, :replace => '?')
+ result.stdout.encode("utf-8", "binary", :undef => :replace, :invalid => :replace, :replace => "?")
else
result.stdout
end
@@ -675,7 +675,7 @@ user password using shadow hash.")
end
def convert_to_binary(string)
- string.unpack('a2'*(string.size/2)).collect { |i| i.hex.chr }.join
+ string.unpack("a2"*(string.size/2)).collect { |i| i.hex.chr }.join
end
def salted_sha512?(string)
@@ -702,7 +702,7 @@ user password using shadow hash.")
current_resource.iterations,
128,
OpenSSL::Digest::SHA512.new,
- ).unpack('H*').first == current_resource.password
+ ).unpack("H*").first == current_resource.password
end
end
diff --git a/lib/chef/provider/user/pw.rb b/lib/chef/provider/user/pw.rb
index e53d647f37..37890bdc1e 100644
--- a/lib/chef/provider/user/pw.rb
+++ b/lib/chef/provider/user/pw.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/user'
+require "chef/provider/user"
class Chef
class Provider
@@ -71,11 +71,11 @@ class Chef
opts = " #{@new_resource.username}"
field_list = {
- 'comment' => "-c",
- 'home' => "-d",
- 'gid' => "-g",
- 'uid' => "-u",
- 'shell' => "-s",
+ "comment" => "-c",
+ "home" => "-d",
+ "gid" => "-g",
+ "uid" => "-u",
+ "shell" => "-s",
}
field_list.sort{ |a,b| a[0] <=> b[0] }.each do |field, option|
field_symbol = field.to_sym
diff --git a/lib/chef/provider/user/solaris.rb b/lib/chef/provider/user/solaris.rb
index c16db22ad4..d9108d4ca4 100644
--- a/lib/chef/provider/user/solaris.rb
+++ b/lib/chef/provider/user/solaris.rb
@@ -18,7 +18,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/provider/user/useradd'
+require "chef/provider/user/useradd"
class Chef
class Provider
@@ -45,14 +45,14 @@ class Chef
end
def check_lock
- shadow_line = shell_out!('getent', 'shadow', new_resource.username).stdout.strip rescue nil
+ shadow_line = shell_out!("getent", "shadow", new_resource.username).stdout.strip rescue nil
# if the command fails we return nil, this can happen if the user
# in question doesn't exist
return nil if shadow_line.nil?
# convert "dave:NP:16507::::::\n" to "NP"
- fields = shadow_line.split(':')
+ fields = shadow_line.split(":")
# '*LK*...' and 'LK' are both considered locked,
# so look for LK at the beginning of the shadow entry
@@ -63,11 +63,11 @@ class Chef
end
def lock_user
- shell_out!('passwd', '-l', new_resource.username)
+ shell_out!("passwd", "-l", new_resource.username)
end
def unlock_user
- shell_out!('passwd', '-u', new_resource.username)
+ shell_out!("passwd", "-u", new_resource.username)
end
private
diff --git a/lib/chef/provider/user/useradd.rb b/lib/chef/provider/user/useradd.rb
index a1b5b3459c..da6606bc14 100644
--- a/lib/chef/provider/user/useradd.rb
+++ b/lib/chef/provider/user/useradd.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'pathname'
-require 'chef/provider/user'
+require "pathname"
+require "chef/provider/user"
class Chef
class Provider
@@ -63,7 +63,7 @@ class Chef
raise Chef::Exceptions::User, "Cannot determine if #{@new_resource} is locked!" if passwd_s.stdout.empty?
- status_line = passwd_s.stdout.split(' ')
+ status_line = passwd_s.stdout.split(" ")
case status_line[1]
when /^P/
@locked = false
@@ -75,11 +75,11 @@ class Chef
unless passwd_s.exitstatus == 0
raise_lock_error = false
- if ['redhat', 'centos'].include?(node[:platform])
- passwd_version_check = shell_out!('rpm -q passwd')
+ if ["redhat", "centos"].include?(node[:platform])
+ passwd_version_check = shell_out!("rpm -q passwd")
passwd_version = passwd_version_check.stdout.chomp
- unless passwd_version == 'passwd-0.73-1'
+ unless passwd_version == "passwd-0.73-1"
raise_lock_error = true
end
else
diff --git a/lib/chef/provider/user/windows.rb b/lib/chef/provider/user/windows.rb
index b0b2d7e956..0851c2272a 100644
--- a/lib/chef/provider/user/windows.rb
+++ b/lib/chef/provider/user/windows.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/provider/user'
-require 'chef/exceptions'
+require "chef/provider/user"
+require "chef/exceptions"
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'chef/util/windows/net_user'
+ require "chef/util/windows/net_user"
end
class Chef
@@ -101,11 +101,11 @@ class Chef
opts = {:name => @new_resource.username}
field_list = {
- 'comment' => 'full_name',
- 'home' => 'home_dir',
- 'uid' => 'user_id',
- 'shell' => 'script_path',
- 'password' => 'password',
+ "comment" => "full_name",
+ "home" => "home_dir",
+ "uid" => "user_id",
+ "shell" => "script_path",
+ "password" => "password",
}
field_list.sort{ |a,b| a[0] <=> b[0] }.each do |field, option|
diff --git a/lib/chef/provider/windows_script.rb b/lib/chef/provider/windows_script.rb
index 62b49bd833..342158fa06 100644
--- a/lib/chef/provider/windows_script.rb
+++ b/lib/chef/provider/windows_script.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/provider/script'
-require 'chef/mixin/windows_architecture_helper'
+require "chef/provider/script"
+require "chef/mixin/windows_architecture_helper"
class Chef
class Provider
@@ -29,7 +29,7 @@ class Chef
include Chef::Mixin::WindowsArchitectureHelper
- def initialize( new_resource, run_context, script_extension='')
+ def initialize( new_resource, run_context, script_extension="")
super( new_resource, run_context )
@script_extension = script_extension
diff --git a/lib/chef/provider_resolver.rb b/lib/chef/provider_resolver.rb
index 82a24fc078..bdf7f58b37 100644
--- a/lib/chef/provider_resolver.rb
+++ b/lib/chef/provider_resolver.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/platform/priority_map'
+require "chef/exceptions"
+require "chef/platform/priority_map"
class Chef
#
diff --git a/lib/chef/providers.rb b/lib/chef/providers.rb
index b4eeabd48d..b024be5b62 100644
--- a/lib/chef/providers.rb
+++ b/lib/chef/providers.rb
@@ -16,125 +16,125 @@
# limitations under the License.
#
-require 'chef/provider/batch'
-require 'chef/provider/breakpoint'
-require 'chef/provider/cookbook_file'
-require 'chef/provider/cron'
-require 'chef/provider/cron/solaris'
-require 'chef/provider/cron/aix'
-require 'chef/provider/deploy'
-require 'chef/provider/directory'
-require 'chef/provider/dsc_script'
-require 'chef/provider/dsc_resource'
-require 'chef/provider/env'
-require 'chef/provider/erl_call'
-require 'chef/provider/execute'
-require 'chef/provider/file'
-require 'chef/provider/git'
-require 'chef/provider/group'
-require 'chef/provider/http_request'
-require 'chef/provider/ifconfig'
-require 'chef/provider/link'
-require 'chef/provider/log'
-require 'chef/provider/ohai'
-require 'chef/provider/mdadm'
-require 'chef/provider/mount'
-require 'chef/provider/package'
-require 'chef/provider/powershell_script'
-require 'chef/provider/osx_profile'
-require 'chef/provider/reboot'
-require 'chef/provider/remote_directory'
-require 'chef/provider/remote_file'
-require 'chef/provider/route'
-require 'chef/provider/ruby_block'
-require 'chef/provider/script'
-require 'chef/provider/service'
-require 'chef/provider/subversion'
-require 'chef/provider/template'
-require 'chef/provider/user'
-require 'chef/provider/whyrun_safe_ruby_block'
+require "chef/provider/batch"
+require "chef/provider/breakpoint"
+require "chef/provider/cookbook_file"
+require "chef/provider/cron"
+require "chef/provider/cron/solaris"
+require "chef/provider/cron/aix"
+require "chef/provider/deploy"
+require "chef/provider/directory"
+require "chef/provider/dsc_script"
+require "chef/provider/dsc_resource"
+require "chef/provider/env"
+require "chef/provider/erl_call"
+require "chef/provider/execute"
+require "chef/provider/file"
+require "chef/provider/git"
+require "chef/provider/group"
+require "chef/provider/http_request"
+require "chef/provider/ifconfig"
+require "chef/provider/link"
+require "chef/provider/log"
+require "chef/provider/ohai"
+require "chef/provider/mdadm"
+require "chef/provider/mount"
+require "chef/provider/package"
+require "chef/provider/powershell_script"
+require "chef/provider/osx_profile"
+require "chef/provider/reboot"
+require "chef/provider/remote_directory"
+require "chef/provider/remote_file"
+require "chef/provider/route"
+require "chef/provider/ruby_block"
+require "chef/provider/script"
+require "chef/provider/service"
+require "chef/provider/subversion"
+require "chef/provider/template"
+require "chef/provider/user"
+require "chef/provider/whyrun_safe_ruby_block"
-require 'chef/provider/env/windows'
+require "chef/provider/env/windows"
-require 'chef/provider/package/apt'
-require 'chef/provider/package/chocolatey'
-require 'chef/provider/package/dpkg'
-require 'chef/provider/package/easy_install'
-require 'chef/provider/package/freebsd/port'
-require 'chef/provider/package/freebsd/pkg'
-require 'chef/provider/package/freebsd/pkgng'
-require 'chef/provider/package/homebrew'
-require 'chef/provider/package/ips'
-require 'chef/provider/package/macports'
-require 'chef/provider/package/openbsd'
-require 'chef/provider/package/pacman'
-require 'chef/provider/package/portage'
-require 'chef/provider/package/paludis'
-require 'chef/provider/package/rpm'
-require 'chef/provider/package/rubygems'
-require 'chef/provider/package/yum'
-require 'chef/provider/package/zypper'
-require 'chef/provider/package/solaris'
-require 'chef/provider/package/smartos'
-require 'chef/provider/package/aix'
+require "chef/provider/package/apt"
+require "chef/provider/package/chocolatey"
+require "chef/provider/package/dpkg"
+require "chef/provider/package/easy_install"
+require "chef/provider/package/freebsd/port"
+require "chef/provider/package/freebsd/pkg"
+require "chef/provider/package/freebsd/pkgng"
+require "chef/provider/package/homebrew"
+require "chef/provider/package/ips"
+require "chef/provider/package/macports"
+require "chef/provider/package/openbsd"
+require "chef/provider/package/pacman"
+require "chef/provider/package/portage"
+require "chef/provider/package/paludis"
+require "chef/provider/package/rpm"
+require "chef/provider/package/rubygems"
+require "chef/provider/package/yum"
+require "chef/provider/package/zypper"
+require "chef/provider/package/solaris"
+require "chef/provider/package/smartos"
+require "chef/provider/package/aix"
-require 'chef/provider/service/arch'
-require 'chef/provider/service/freebsd'
-require 'chef/provider/service/gentoo'
-require 'chef/provider/service/init'
-require 'chef/provider/service/invokercd'
-require 'chef/provider/service/debian'
-require 'chef/provider/service/openbsd'
-require 'chef/provider/service/redhat'
-require 'chef/provider/service/insserv'
-require 'chef/provider/service/simple'
-require 'chef/provider/service/systemd'
-require 'chef/provider/service/upstart'
-require 'chef/provider/service/windows'
-require 'chef/provider/service/solaris'
-require 'chef/provider/service/macosx'
-require 'chef/provider/service/aixinit'
-require 'chef/provider/service/aix'
+require "chef/provider/service/arch"
+require "chef/provider/service/freebsd"
+require "chef/provider/service/gentoo"
+require "chef/provider/service/init"
+require "chef/provider/service/invokercd"
+require "chef/provider/service/debian"
+require "chef/provider/service/openbsd"
+require "chef/provider/service/redhat"
+require "chef/provider/service/insserv"
+require "chef/provider/service/simple"
+require "chef/provider/service/systemd"
+require "chef/provider/service/upstart"
+require "chef/provider/service/windows"
+require "chef/provider/service/solaris"
+require "chef/provider/service/macosx"
+require "chef/provider/service/aixinit"
+require "chef/provider/service/aix"
-require 'chef/provider/user/dscl'
-require 'chef/provider/user/pw'
-require 'chef/provider/user/useradd'
-require 'chef/provider/user/windows'
-require 'chef/provider/user/solaris'
-require 'chef/provider/user/aix'
+require "chef/provider/user/dscl"
+require "chef/provider/user/pw"
+require "chef/provider/user/useradd"
+require "chef/provider/user/windows"
+require "chef/provider/user/solaris"
+require "chef/provider/user/aix"
-require 'chef/provider/group/aix'
-require 'chef/provider/group/dscl'
-require 'chef/provider/group/gpasswd'
-require 'chef/provider/group/groupadd'
-require 'chef/provider/group/groupmod'
-require 'chef/provider/group/pw'
-require 'chef/provider/group/suse'
-require 'chef/provider/group/usermod'
-require 'chef/provider/group/windows'
+require "chef/provider/group/aix"
+require "chef/provider/group/dscl"
+require "chef/provider/group/gpasswd"
+require "chef/provider/group/groupadd"
+require "chef/provider/group/groupmod"
+require "chef/provider/group/pw"
+require "chef/provider/group/suse"
+require "chef/provider/group/usermod"
+require "chef/provider/group/windows"
-require 'chef/provider/mount/mount'
-require 'chef/provider/mount/aix'
-require 'chef/provider/mount/solaris'
-require 'chef/provider/mount/windows'
+require "chef/provider/mount/mount"
+require "chef/provider/mount/aix"
+require "chef/provider/mount/solaris"
+require "chef/provider/mount/windows"
-require 'chef/provider/deploy/revision'
-require 'chef/provider/deploy/timestamped'
+require "chef/provider/deploy/revision"
+require "chef/provider/deploy/timestamped"
-require 'chef/provider/remote_file/ftp'
-require 'chef/provider/remote_file/http'
-require 'chef/provider/remote_file/local_file'
-require 'chef/provider/remote_file/network_file'
-require 'chef/provider/remote_file/fetcher'
+require "chef/provider/remote_file/ftp"
+require "chef/provider/remote_file/http"
+require "chef/provider/remote_file/local_file"
+require "chef/provider/remote_file/network_file"
+require "chef/provider/remote_file/fetcher"
require "chef/provider/lwrp_base"
-require 'chef/provider/registry_key'
+require "chef/provider/registry_key"
-require 'chef/provider/file/content'
-require 'chef/provider/remote_file/content'
-require 'chef/provider/cookbook_file/content'
-require 'chef/provider/template/content'
+require "chef/provider/file/content"
+require "chef/provider/remote_file/content"
+require "chef/provider/cookbook_file/content"
+require "chef/provider/template/content"
-require 'chef/provider/ifconfig/redhat'
-require 'chef/provider/ifconfig/debian'
-require 'chef/provider/ifconfig/aix'
+require "chef/provider/ifconfig/redhat"
+require "chef/provider/ifconfig/debian"
+require "chef/provider/ifconfig/aix"
diff --git a/lib/chef/recipe.rb b/lib/chef/recipe.rb
index 0f9bf2655b..f2717d40bc 100644
--- a/lib/chef/recipe.rb
+++ b/lib/chef/recipe.rb
@@ -18,18 +18,18 @@
#
-require 'chef/dsl/recipe'
-require 'chef/dsl/data_query'
-require 'chef/dsl/platform_introspection'
-require 'chef/dsl/include_recipe'
-require 'chef/dsl/registry_helper'
-require 'chef/dsl/reboot_pending'
-require 'chef/dsl/audit'
-require 'chef/dsl/powershell'
-
-require 'chef/mixin/from_file'
-
-require 'chef/mixin/deprecation'
+require "chef/dsl/recipe"
+require "chef/dsl/data_query"
+require "chef/dsl/platform_introspection"
+require "chef/dsl/include_recipe"
+require "chef/dsl/registry_helper"
+require "chef/dsl/reboot_pending"
+require "chef/dsl/audit"
+require "chef/dsl/powershell"
+
+require "chef/mixin/from_file"
+
+require "chef/mixin/deprecation"
class Chef
# == Chef::Recipe
diff --git a/lib/chef/request_id.rb b/lib/chef/request_id.rb
index 2c7af01879..9037f9f182 100644
--- a/lib/chef/request_id.rb
+++ b/lib/chef/request_id.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'securerandom'
-require 'singleton'
+require "securerandom"
+require "singleton"
class Chef
class RequestID
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index 9da79d38e3..9661f22de3 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -18,32 +18,32 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/dsl/platform_introspection'
-require 'chef/dsl/data_query'
-require 'chef/dsl/registry_helper'
-require 'chef/dsl/reboot_pending'
-require 'chef/dsl/resources'
-require 'chef/mixin/convert_to_class_name'
-require 'chef/guard_interpreter/resource_guard_interpreter'
-require 'chef/resource/conditional'
-require 'chef/resource/conditional_action_not_nothing'
-require 'chef/resource/action_class'
-require 'chef/resource_collection'
-require 'chef/node_map'
-require 'chef/node'
-require 'chef/platform'
-require 'chef/resource/resource_notification'
-require 'chef/provider_resolver'
-require 'chef/resource_resolver'
-require 'chef/provider'
-require 'set'
-
-require 'chef/mixin/deprecation'
-require 'chef/mixin/properties'
-require 'chef/mixin/provides'
-require 'chef/mixin/shell_out'
-require 'chef/mixin/powershell_out'
+require "chef/exceptions"
+require "chef/dsl/platform_introspection"
+require "chef/dsl/data_query"
+require "chef/dsl/registry_helper"
+require "chef/dsl/reboot_pending"
+require "chef/dsl/resources"
+require "chef/mixin/convert_to_class_name"
+require "chef/guard_interpreter/resource_guard_interpreter"
+require "chef/resource/conditional"
+require "chef/resource/conditional_action_not_nothing"
+require "chef/resource/action_class"
+require "chef/resource_collection"
+require "chef/node_map"
+require "chef/node"
+require "chef/platform"
+require "chef/resource/resource_notification"
+require "chef/provider_resolver"
+require "chef/resource_resolver"
+require "chef/provider"
+require "set"
+
+require "chef/mixin/deprecation"
+require "chef/mixin/properties"
+require "chef/mixin/provides"
+require "chef/mixin/shell_out"
+require "chef/mixin/powershell_out"
class Chef
class Resource
@@ -88,7 +88,7 @@ class Chef
# @param name [Object] The name to set, typically a String or Array
# @return [String] The name of this Resource.
#
- property :name, String, coerce: proc { |v| v.is_a?(Array) ? v.join(', ') : v.to_s }, desired_state: false
+ property :name, String, coerce: proc { |v| v.is_a?(Array) ? v.join(", ") : v.to_s }, desired_state: false
#
# The node the current Chef run is using.
@@ -249,11 +249,11 @@ class Chef
resources.each do |resource|
case timing.to_s
- when 'delayed'
+ when "delayed"
notifies_delayed(action, resource)
- when 'immediate', 'immediately'
+ when "immediate", "immediately"
notifies_immediately(action, resource)
- when 'before'
+ when "before"
notifies_before(action, resource)
else
raise ArgumentError, "invalid timing: #{timing} for notifies(#{action}, #{resources.inspect}, #{timing}) resource #{self} "\
@@ -670,11 +670,11 @@ class Chef
safe_ivars = instance_variables.map { |ivar| ivar.to_sym } - FORBIDDEN_IVARS
instance_vars = Hash.new
safe_ivars.each do |iv|
- instance_vars[iv.to_s.sub(/^@/, '')] = instance_variable_get(iv)
+ instance_vars[iv.to_s.sub(/^@/, "")] = instance_variable_get(iv)
end
{
- 'json_class' => self.class.name,
- 'instance_vars' => instance_vars,
+ "json_class" => self.class.name,
+ "instance_vars" => instance_vars,
}
end
@@ -692,7 +692,7 @@ class Chef
end
safe_ivars = instance_variables.map { |ivar| ivar.to_sym } - FORBIDDEN_IVARS
safe_ivars.each do |iv|
- key = iv.to_s.sub(/^@/,'').to_sym
+ key = iv.to_s.sub(/^@/,"").to_sym
next if result.has_key?(key)
result[key] = instance_variable_get(iv)
end
@@ -956,7 +956,7 @@ class Chef
def self.dsl_name
Chef.log_deprecation "Resource.dsl_name is deprecated and will be removed in Chef 13. Use resource_name instead."
if name
- name = self.name.split('::')[-1]
+ name = self.name.split("::")[-1]
convert_to_snake_case(name)
end
end
@@ -1009,7 +1009,7 @@ class Chef
# A::B::BlahDBlah -> blah_d_blah
#
def self.use_automatic_resource_name
- automatic_name = convert_to_snake_case(self.name.split('::')[-1])
+ automatic_name = convert_to_snake_case(self.name.split("::")[-1])
resource_name automatic_name
end
@@ -1574,4 +1574,4 @@ class Chef
end
# Requiring things at the bottom breaks cycles
-require 'chef/chef_class'
+require "chef/chef_class"
diff --git a/lib/chef/resource/action_class.rb b/lib/chef/resource/action_class.rb
index 32652dd72b..cf7327e968 100644
--- a/lib/chef/resource/action_class.rb
+++ b/lib/chef/resource/action_class.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/exceptions'
+require "chef/exceptions"
class Chef
class Resource
diff --git a/lib/chef/resource/apt_package.rb b/lib/chef/resource/apt_package.rb
index b15a86bddf..ab43f02ce3 100644
--- a/lib/chef/resource/apt_package.rb
+++ b/lib/chef/resource/apt_package.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package/apt'
+require "chef/resource/package"
+require "chef/provider/package/apt"
class Chef
class Resource
diff --git a/lib/chef/resource/bash.rb b/lib/chef/resource/bash.rb
index 025687e879..f0233f0b4a 100644
--- a/lib/chef/resource/bash.rb
+++ b/lib/chef/resource/bash.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/script'
-require 'chef/provider/script'
+require "chef/resource/script"
+require "chef/provider/script"
class Chef
class Resource
diff --git a/lib/chef/resource/batch.rb b/lib/chef/resource/batch.rb
index efe3f2205f..057e4596b3 100644
--- a/lib/chef/resource/batch.rb
+++ b/lib/chef/resource/batch.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/windows_script'
+require "chef/resource/windows_script"
class Chef
class Resource
diff --git a/lib/chef/resource/bff_package.rb b/lib/chef/resource/bff_package.rb
index 7c1496a46b..f6ddf3cd8f 100644
--- a/lib/chef/resource/bff_package.rb
+++ b/lib/chef/resource/bff_package.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package/aix'
+require "chef/resource/package"
+require "chef/provider/package/aix"
class Chef
class Resource
diff --git a/lib/chef/resource/breakpoint.rb b/lib/chef/resource/breakpoint.rb
index 69dbc48050..10285ea757 100644
--- a/lib/chef/resource/breakpoint.rb
+++ b/lib/chef/resource/breakpoint.rb
@@ -17,7 +17,7 @@
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb
index b2cd9da101..233ae66026 100644
--- a/lib/chef/resource/chef_gem.rb
+++ b/lib/chef/resource/chef_gem.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/resource/gem_package'
+require "chef/resource/package"
+require "chef/resource/gem_package"
class Chef
class Resource
diff --git a/lib/chef/resource/chocolatey_package.rb b/lib/chef/resource/chocolatey_package.rb
index 57a6bd2357..3ee082349b 100644
--- a/lib/chef/resource/chocolatey_package.rb
+++ b/lib/chef/resource/chocolatey_package.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/package'
+require "chef/resource/package"
class Chef
class Resource
diff --git a/lib/chef/resource/conditional.rb b/lib/chef/resource/conditional.rb
index 35bdae8d69..9e2e635bde 100644
--- a/lib/chef/resource/conditional.rb
+++ b/lib/chef/resource/conditional.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/mixin/shell_out'
-require 'chef/guard_interpreter'
+require "chef/mixin/shell_out"
+require "chef/guard_interpreter"
class Chef
class Resource
diff --git a/lib/chef/resource/cookbook_file.rb b/lib/chef/resource/cookbook_file.rb
index 42f16e6db6..78d98e43f1 100644
--- a/lib/chef/resource/cookbook_file.rb
+++ b/lib/chef/resource/cookbook_file.rb
@@ -18,9 +18,9 @@
# limitations under the License.
#
-require 'chef/resource/file'
-require 'chef/provider/cookbook_file'
-require 'chef/mixin/securable'
+require "chef/resource/file"
+require "chef/provider/cookbook_file"
+require "chef/mixin/securable"
class Chef
class Resource
diff --git a/lib/chef/resource/cron.rb b/lib/chef/resource/cron.rb
index 7a4e3f6988..3ae9409756 100644
--- a/lib/chef/resource/cron.rb
+++ b/lib/chef/resource/cron.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
@@ -123,7 +123,7 @@ class Chef
end
begin
error_message = "You provided '#{arg}' as a weekday, acceptable values are "
- error_message << Provider::Cron::WEEKDAY_SYMBOLS.map {|sym| ":#{sym}"}.join(', ')
+ error_message << Provider::Cron::WEEKDAY_SYMBOLS.map {|sym| ":#{sym}"}.join(", ")
error_message << " and a string in crontab format"
if (arg.is_a?(Symbol) && !Provider::Cron::WEEKDAY_SYMBOLS.include?(arg)) ||
(!arg.is_a?(Symbol) && integerize(arg) > 7) ||
diff --git a/lib/chef/resource/csh.rb b/lib/chef/resource/csh.rb
index d5e9c910b1..fd033b10a0 100644
--- a/lib/chef/resource/csh.rb
+++ b/lib/chef/resource/csh.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/script'
-require 'chef/provider/script'
+require "chef/resource/script"
+require "chef/provider/script"
class Chef
class Resource
diff --git a/lib/chef/resource/deploy.rb b/lib/chef/resource/deploy.rb
index 01300cf512..613d0cba24 100644
--- a/lib/chef/resource/deploy.rb
+++ b/lib/chef/resource/deploy.rb
@@ -63,13 +63,13 @@ class Chef
super
@deploy_to = name
@environment = nil
- @repository_cache = 'cached-copy'
+ @repository_cache = "cached-copy"
@copy_exclude = []
@purge_before_symlink = %w{log tmp/pids public/system}
@create_dirs_before_symlink = %w{tmp public config}
@symlink_before_migrate = {"config/database.yml" => "config/database.yml"}
@symlinks = {"system" => "public/system", "pids" => "tmp/pids", "log" => "log"}
- @revision = 'HEAD'
+ @revision = "HEAD"
@migrate = false
@rollback_on_error = false
@remote = "origin"
diff --git a/lib/chef/resource/directory.rb b/lib/chef/resource/directory.rb
index b16caaf4b8..608471b6a1 100644
--- a/lib/chef/resource/directory.rb
+++ b/lib/chef/resource/directory.rb
@@ -18,9 +18,9 @@
# limitations under the License.
#
-require 'chef/resource'
-require 'chef/provider/directory'
-require 'chef/mixin/securable'
+require "chef/resource"
+require "chef/provider/directory"
+require "chef/mixin/securable"
class Chef
class Resource
diff --git a/lib/chef/resource/dpkg_package.rb b/lib/chef/resource/dpkg_package.rb
index 7d58385c6d..158b66d492 100644
--- a/lib/chef/resource/dpkg_package.rb
+++ b/lib/chef/resource/dpkg_package.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/package'
+require "chef/resource/package"
class Chef
class Resource
diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb
index fabe438555..35bb585a7b 100644
--- a/lib/chef/resource/dsc_resource.rb
+++ b/lib/chef/resource/dsc_resource.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/dsl/powershell'
+require "chef/dsl/powershell"
class Chef
class Resource
diff --git a/lib/chef/resource/dsc_script.rb b/lib/chef/resource/dsc_script.rb
index 944c54ea22..b9b66539ac 100644
--- a/lib/chef/resource/dsc_script.rb
+++ b/lib/chef/resource/dsc_script.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/dsl/powershell'
+require "chef/exceptions"
+require "chef/dsl/powershell"
class Chef
class Resource
@@ -95,7 +95,7 @@ class Chef
if module_name
@imports[module_name] ||= []
if args.length == 0
- @imports[module_name] << '*'
+ @imports[module_name] << "*"
else
@imports[module_name].push(*args)
end
diff --git a/lib/chef/resource/easy_install_package.rb b/lib/chef/resource/easy_install_package.rb
index ea646ecc9f..89761b5735 100644
--- a/lib/chef/resource/easy_install_package.rb
+++ b/lib/chef/resource/easy_install_package.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/package'
+require "chef/resource/package"
class Chef
class Resource
diff --git a/lib/chef/resource/erl_call.rb b/lib/chef/resource/erl_call.rb
index b991fac017..3322d1151a 100644
--- a/lib/chef/resource/erl_call.rb
+++ b/lib/chef/resource/erl_call.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/resource'
-require 'chef/provider/erl_call'
+require "chef/resource"
+require "chef/provider/erl_call"
class Chef
class Resource
diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb
index 19138469f8..fe9a3d5e26 100644
--- a/lib/chef/resource/execute.rb
+++ b/lib/chef/resource/execute.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/resource'
-require 'chef/provider/execute'
+require "chef/resource"
+require "chef/provider/execute"
class Chef
class Resource
diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb
index 31afecc156..0a530e27c9 100644
--- a/lib/chef/resource/file.rb
+++ b/lib/chef/resource/file.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'chef/resource'
-require 'chef/platform/query_helpers'
-require 'chef/mixin/securable'
-require 'chef/resource/file/verification'
+require "chef/resource"
+require "chef/platform/query_helpers"
+require "chef/mixin/securable"
+require "chef/resource/file/verification"
class Chef
class Resource
diff --git a/lib/chef/resource/file/verification.rb b/lib/chef/resource/file/verification.rb
index e7530ce628..1237d09c99 100644
--- a/lib/chef/resource/file/verification.rb
+++ b/lib/chef/resource/file/verification.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/guard_interpreter'
-require 'chef/mixin/descendants_tracker'
+require "chef/exceptions"
+require "chef/guard_interpreter"
+require "chef/mixin/descendants_tracker"
class Chef
class Resource
@@ -109,9 +109,9 @@ class Chef
# First implementation interpolated `file`; docs & RFC claim `path`
# is interpolated. Until `file` can be deprecated, interpolate both.
Chef.log_deprecation(
- '%{file} is deprecated in verify command and will not be '\
- 'supported in Chef 13. Please use %{path} instead.'
- ) if @command.include?('%{file}')
+ "%{file} is deprecated in verify command and will not be "\
+ "supported in Chef 13. Please use %{path} instead."
+ ) if @command.include?("%{file}")
command = @command % {:file => path, :path => path}
interpreter = Chef::GuardInterpreter.for_resource(@parent_resource, command, @command_opts)
interpreter.evaluate
diff --git a/lib/chef/resource/freebsd_package.rb b/lib/chef/resource/freebsd_package.rb
index e656f1c3e3..a64e3204f2 100644
--- a/lib/chef/resource/freebsd_package.rb
+++ b/lib/chef/resource/freebsd_package.rb
@@ -18,11 +18,11 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package/freebsd/port'
-require 'chef/provider/package/freebsd/pkg'
-require 'chef/provider/package/freebsd/pkgng'
-require 'chef/mixin/shell_out'
+require "chef/resource/package"
+require "chef/provider/package/freebsd/port"
+require "chef/provider/package/freebsd/pkg"
+require "chef/provider/package/freebsd/pkgng"
+require "chef/mixin/shell_out"
class Chef
class Resource
diff --git a/lib/chef/resource/gem_package.rb b/lib/chef/resource/gem_package.rb
index e1a089e1f2..a78e5c6ad7 100644
--- a/lib/chef/resource/gem_package.rb
+++ b/lib/chef/resource/gem_package.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/package'
+require "chef/resource/package"
class Chef
class Resource
diff --git a/lib/chef/resource/homebrew_package.rb b/lib/chef/resource/homebrew_package.rb
index e070318c45..705b136dc2 100644
--- a/lib/chef/resource/homebrew_package.rb
+++ b/lib/chef/resource/homebrew_package.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/resource/package'
+require "chef/provider/package"
+require "chef/resource/package"
class Chef
class Resource
diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb
index 73ab64b62e..623d14430b 100644
--- a/lib/chef/resource/http_request.rb
+++ b/lib/chef/resource/http_request.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/resource'
-require 'chef/provider/http_request'
+require "chef/resource"
+require "chef/provider/http_request"
class Chef
class Resource
diff --git a/lib/chef/resource/ifconfig.rb b/lib/chef/resource/ifconfig.rb
index 0587c760b4..79d8e4af4c 100644
--- a/lib/chef/resource/ifconfig.rb
+++ b/lib/chef/resource/ifconfig.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
diff --git a/lib/chef/resource/ips_package.rb b/lib/chef/resource/ips_package.rb
index cee02d52fd..908f458b1e 100644
--- a/lib/chef/resource/ips_package.rb
+++ b/lib/chef/resource/ips_package.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package/ips'
+require "chef/resource/package"
+require "chef/provider/package/ips"
class Chef
class Resource
diff --git a/lib/chef/resource/ksh.rb b/lib/chef/resource/ksh.rb
index b41b717f5f..e41ae51551 100644
--- a/lib/chef/resource/ksh.rb
+++ b/lib/chef/resource/ksh.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/script'
+require "chef/resource/script"
class Chef
class Resource
diff --git a/lib/chef/resource/link.rb b/lib/chef/resource/link.rb
index de8619203a..a067027c1f 100644
--- a/lib/chef/resource/link.rb
+++ b/lib/chef/resource/link.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/resource'
-require 'chef/mixin/securable'
+require "chef/resource"
+require "chef/mixin/securable"
class Chef
class Resource
@@ -92,7 +92,7 @@ class Chef
# sure we are not on such a platform.
if Chef::Platform.windows?
- require 'chef/win32/file'
+ require "chef/win32/file"
begin
Chef::ReservedNames::Win32::File.verify_links_supported!
rescue Chef::Exceptions::Win32APIFunctionNotImplemented => e
diff --git a/lib/chef/resource/log.rb b/lib/chef/resource/log.rb
index 206bbf4867..bf7d21215d 100644
--- a/lib/chef/resource/log.rb
+++ b/lib/chef/resource/log.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/resource'
-require 'chef/provider/log'
+require "chef/resource"
+require "chef/provider/log"
class Chef
class Resource
diff --git a/lib/chef/resource/lwrp_base.rb b/lib/chef/resource/lwrp_base.rb
index e4ef918164..ad586da9e8 100644
--- a/lib/chef/resource/lwrp_base.rb
+++ b/lib/chef/resource/lwrp_base.rb
@@ -18,14 +18,14 @@
# limitations under the License.
#
-require 'chef/resource'
-require 'chef/resource_resolver'
-require 'chef/node'
-require 'chef/log'
-require 'chef/exceptions'
-require 'chef/mixin/convert_to_class_name'
-require 'chef/mixin/from_file'
-require 'chef/mixin/params_validate' # for DelayedEvaluator
+require "chef/resource"
+require "chef/resource_resolver"
+require "chef/node"
+require "chef/log"
+require "chef/exceptions"
+require "chef/mixin/convert_to_class_name"
+require "chef/mixin/from_file"
+require "chef/mixin/params_validate" # for DelayedEvaluator
class Chef
class Resource
diff --git a/lib/chef/resource/macosx_service.rb b/lib/chef/resource/macosx_service.rb
index e581b8746d..e8cdf9c6f4 100644
--- a/lib/chef/resource/macosx_service.rb
+++ b/lib/chef/resource/macosx_service.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/service'
+require "chef/resource/service"
class Chef
class Resource
diff --git a/lib/chef/resource/macports_package.rb b/lib/chef/resource/macports_package.rb
index 61d5ed23c4..3c95c8d05e 100644
--- a/lib/chef/resource/macports_package.rb
+++ b/lib/chef/resource/macports_package.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/package'
+require "chef/resource/package"
class Chef
class Resource
diff --git a/lib/chef/resource/mdadm.rb b/lib/chef/resource/mdadm.rb
index 93430a656f..41123a8c71 100644
--- a/lib/chef/resource/mdadm.rb
+++ b/lib/chef/resource/mdadm.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb
index eefa03a506..31efcb0b16 100644
--- a/lib/chef/resource/mount.rb
+++ b/lib/chef/resource/mount.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
@@ -35,7 +35,7 @@ class Chef
@mount_point = name
@device = nil
@device_type = :device
- @fsck_device = '-'
+ @fsck_device = "-"
@fstype = "auto"
@options = ["defaults"]
@dump = 0
@@ -102,7 +102,7 @@ class Chef
)
if ret.is_a? String
- ret.gsub(/,/, ' ').split(/ /)
+ ret.gsub(/,/, " ").split(/ /)
else
ret
end
diff --git a/lib/chef/resource/openbsd_package.rb b/lib/chef/resource/openbsd_package.rb
index da3a241216..a7b027540f 100644
--- a/lib/chef/resource/openbsd_package.rb
+++ b/lib/chef/resource/openbsd_package.rb
@@ -19,9 +19,9 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package/openbsd'
-require 'chef/mixin/shell_out'
+require "chef/resource/package"
+require "chef/provider/package/openbsd"
+require "chef/mixin/shell_out"
class Chef
class Resource
diff --git a/lib/chef/resource/osx_profile.rb b/lib/chef/resource/osx_profile.rb
index 837ab5400b..57c1d9979c 100644
--- a/lib/chef/resource/osx_profile.rb
+++ b/lib/chef/resource/osx_profile.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
diff --git a/lib/chef/resource/package.rb b/lib/chef/resource/package.rb
index d190479a29..6fd3fcd548 100644
--- a/lib/chef/resource/package.rb
+++ b/lib/chef/resource/package.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
diff --git a/lib/chef/resource/pacman_package.rb b/lib/chef/resource/pacman_package.rb
index 8aabf8be77..1db0a8aac2 100644
--- a/lib/chef/resource/pacman_package.rb
+++ b/lib/chef/resource/pacman_package.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/package'
+require "chef/resource/package"
class Chef
class Resource
diff --git a/lib/chef/resource/paludis_package.rb b/lib/chef/resource/paludis_package.rb
index e93e6288b8..ce25ac93f3 100644
--- a/lib/chef/resource/paludis_package.rb
+++ b/lib/chef/resource/paludis_package.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package/paludis'
+require "chef/resource/package"
+require "chef/provider/package/paludis"
class Chef
class Resource
diff --git a/lib/chef/resource/perl.rb b/lib/chef/resource/perl.rb
index 773eba6571..1874cbea3f 100644
--- a/lib/chef/resource/perl.rb
+++ b/lib/chef/resource/perl.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/script'
-require 'chef/provider/script'
+require "chef/resource/script"
+require "chef/provider/script"
class Chef
class Resource
diff --git a/lib/chef/resource/portage_package.rb b/lib/chef/resource/portage_package.rb
index 2b75f6a651..2bee9e1a90 100644
--- a/lib/chef/resource/portage_package.rb
+++ b/lib/chef/resource/portage_package.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/package'
+require "chef/resource/package"
class Chef
class Resource
diff --git a/lib/chef/resource/powershell_script.rb b/lib/chef/resource/powershell_script.rb
index 1f1171390e..32636edb4f 100644
--- a/lib/chef/resource/powershell_script.rb
+++ b/lib/chef/resource/powershell_script.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/resource/windows_script'
+require "chef/resource/windows_script"
class Chef
class Resource
diff --git a/lib/chef/resource/python.rb b/lib/chef/resource/python.rb
index 432ee46b85..c571a24baf 100644
--- a/lib/chef/resource/python.rb
+++ b/lib/chef/resource/python.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'chef/resource/script'
-require 'chef/provider/script'
+require "chef/resource/script"
+require "chef/provider/script"
class Chef
class Resource
diff --git a/lib/chef/resource/reboot.rb b/lib/chef/resource/reboot.rb
index 401f2f338f..ebbdb58268 100644
--- a/lib/chef/resource/reboot.rb
+++ b/lib/chef/resource/reboot.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource'
+require "chef/resource"
# In using this resource via notifications, it's important to *only* use
# immediate notifications. Delayed notifications produce unintuitive and
diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb
index 2faa5243fb..8bec0721e7 100644
--- a/lib/chef/resource/registry_key.rb
+++ b/lib/chef/resource/registry_key.rb
@@ -15,9 +15,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/provider/registry_key'
-require 'chef/resource'
-require 'chef/digester'
+require "chef/provider/registry_key"
+require "chef/resource"
+require "chef/digester"
class Chef
class Resource
diff --git a/lib/chef/resource/remote_directory.rb b/lib/chef/resource/remote_directory.rb
index 56473c6420..cae8f9c256 100644
--- a/lib/chef/resource/remote_directory.rb
+++ b/lib/chef/resource/remote_directory.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'chef/resource/directory'
-require 'chef/provider/remote_directory'
-require 'chef/mixin/securable'
+require "chef/resource/directory"
+require "chef/provider/remote_directory"
+require "chef/mixin/securable"
class Chef
class Resource
diff --git a/lib/chef/resource/remote_file.rb b/lib/chef/resource/remote_file.rb
index bd0aa5ced7..a722c519b1 100644
--- a/lib/chef/resource/remote_file.rb
+++ b/lib/chef/resource/remote_file.rb
@@ -17,11 +17,11 @@
# limitations under the License.
#
-require 'uri'
-require 'chef/resource/file'
-require 'chef/provider/remote_file'
-require 'chef/mixin/securable'
-require 'chef/mixin/uris'
+require "uri"
+require "chef/resource/file"
+require "chef/provider/remote_file"
+require "chef/mixin/securable"
+require "chef/mixin/uris"
class Chef
class Resource
diff --git a/lib/chef/resource/resource_notification.rb b/lib/chef/resource/resource_notification.rb
index 4fd61ad1f8..e1945ceaee 100644
--- a/lib/chef/resource/resource_notification.rb
+++ b/lib/chef/resource/resource_notification.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
diff --git a/lib/chef/resource/route.rb b/lib/chef/resource/route.rb
index a8c9ebd8fe..5f876f47ec 100644
--- a/lib/chef/resource/route.rb
+++ b/lib/chef/resource/route.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
diff --git a/lib/chef/resource/rpm_package.rb b/lib/chef/resource/rpm_package.rb
index 4f6dc4c0a6..ff4432cee2 100644
--- a/lib/chef/resource/rpm_package.rb
+++ b/lib/chef/resource/rpm_package.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package/rpm'
+require "chef/resource/package"
+require "chef/provider/package/rpm"
class Chef
class Resource
diff --git a/lib/chef/resource/ruby.rb b/lib/chef/resource/ruby.rb
index 3c3909043d..057502df7d 100644
--- a/lib/chef/resource/ruby.rb
+++ b/lib/chef/resource/ruby.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/script'
-require 'chef/provider/script'
+require "chef/resource/script"
+require "chef/provider/script"
class Chef
class Resource
diff --git a/lib/chef/resource/ruby_block.rb b/lib/chef/resource/ruby_block.rb
index f529289b1b..547c90cc65 100644
--- a/lib/chef/resource/ruby_block.rb
+++ b/lib/chef/resource/ruby_block.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/resource'
-require 'chef/provider/ruby_block'
+require "chef/resource"
+require "chef/provider/ruby_block"
class Chef
class Resource
diff --git a/lib/chef/resource/scm.rb b/lib/chef/resource/scm.rb
index b81a3bfb24..380bbdb6f4 100644
--- a/lib/chef/resource/scm.rb
+++ b/lib/chef/resource/scm.rb
@@ -17,7 +17,7 @@
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
diff --git a/lib/chef/resource/script.rb b/lib/chef/resource/script.rb
index 1579b06eba..96f59585e4 100644
--- a/lib/chef/resource/script.rb
+++ b/lib/chef/resource/script.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/resource/execute'
-require 'chef/provider/script'
+require "chef/resource/execute"
+require "chef/provider/script"
class Chef
class Resource
diff --git a/lib/chef/resource/service.rb b/lib/chef/resource/service.rb
index 809eb5f2cb..490ad40f7b 100644
--- a/lib/chef/resource/service.rb
+++ b/lib/chef/resource/service.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
diff --git a/lib/chef/resource/smartos_package.rb b/lib/chef/resource/smartos_package.rb
index 34e704a856..715a60bc96 100644
--- a/lib/chef/resource/smartos_package.rb
+++ b/lib/chef/resource/smartos_package.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package/smartos'
+require "chef/resource/package"
+require "chef/provider/package/smartos"
class Chef
class Resource
diff --git a/lib/chef/resource/solaris_package.rb b/lib/chef/resource/solaris_package.rb
index 4ce38bd098..2e6a4de8b4 100644
--- a/lib/chef/resource/solaris_package.rb
+++ b/lib/chef/resource/solaris_package.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package/solaris'
+require "chef/resource/package"
+require "chef/provider/package/solaris"
class Chef
class Resource
diff --git a/lib/chef/resource/subversion.rb b/lib/chef/resource/subversion.rb
index a6f4cb4897..2bac41a2ff 100644
--- a/lib/chef/resource/subversion.rb
+++ b/lib/chef/resource/subversion.rb
@@ -26,8 +26,8 @@ class Chef
def initialize(name, run_context=nil)
super
- @svn_arguments = '--no-auth-cache'
- @svn_info_args = '--no-auth-cache'
+ @svn_arguments = "--no-auth-cache"
+ @svn_info_args = "--no-auth-cache"
@svn_binary = nil
end
diff --git a/lib/chef/resource/template.rb b/lib/chef/resource/template.rb
index 1d8d690c1a..02b4bcfe69 100644
--- a/lib/chef/resource/template.rb
+++ b/lib/chef/resource/template.rb
@@ -18,9 +18,9 @@
# limitations under the License.
#
-require 'chef/resource/file'
-require 'chef/provider/template'
-require 'chef/mixin/securable'
+require "chef/resource/file"
+require "chef/provider/template"
+require "chef/mixin/securable"
class Chef
class Resource
diff --git a/lib/chef/resource/user.rb b/lib/chef/resource/user.rb
index f9c272170c..bf4b62bcb1 100644
--- a/lib/chef/resource/user.rb
+++ b/lib/chef/resource/user.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource'
+require "chef/resource"
class Chef
class Resource
diff --git a/lib/chef/resource/windows_package.rb b/lib/chef/resource/windows_package.rb
index 7ccf95f653..cee82d3b63 100644
--- a/lib/chef/resource/windows_package.rb
+++ b/lib/chef/resource/windows_package.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/mixin/uris'
-require 'chef/resource/package'
-require 'chef/provider/package/windows'
-require 'chef/win32/error' if RUBY_PLATFORM =~ /mswin|mingw|windows/
+require "chef/mixin/uris"
+require "chef/resource/package"
+require "chef/provider/package/windows"
+require "chef/win32/error" if RUBY_PLATFORM =~ /mswin|mingw|windows/
class Chef
class Resource
@@ -34,7 +34,7 @@ class Chef
def initialize(name, run_context=nil)
super
- @source ||= source(@package_name) if @package_name.downcase.end_with?('.msi')
+ @source ||= source(@package_name) if @package_name.downcase.end_with?(".msi")
end
# Unique to this resource
diff --git a/lib/chef/resource/windows_script.rb b/lib/chef/resource/windows_script.rb
index 8fb9ef9e0d..67ad3c8040 100644
--- a/lib/chef/resource/windows_script.rb
+++ b/lib/chef/resource/windows_script.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/platform/query_helpers'
-require 'chef/resource/script'
-require 'chef/mixin/windows_architecture_helper'
+require "chef/platform/query_helpers"
+require "chef/resource/script"
+require "chef/mixin/windows_architecture_helper"
class Chef
class Resource
diff --git a/lib/chef/resource/windows_service.rb b/lib/chef/resource/windows_service.rb
index f7ec02a294..76ef32514f 100644
--- a/lib/chef/resource/windows_service.rb
+++ b/lib/chef/resource/windows_service.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/service'
+require "chef/resource/service"
class Chef
class Resource
diff --git a/lib/chef/resource/yum_package.rb b/lib/chef/resource/yum_package.rb
index 95ab5ef125..6a7a1035c9 100644
--- a/lib/chef/resource/yum_package.rb
+++ b/lib/chef/resource/yum_package.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package/yum'
+require "chef/resource/package"
+require "chef/provider/package/yum"
class Chef
class Resource
diff --git a/lib/chef/resource/zypper_package.rb b/lib/chef/resource/zypper_package.rb
index c86546eb46..62f8049193 100644
--- a/lib/chef/resource/zypper_package.rb
+++ b/lib/chef/resource/zypper_package.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/resource/package'
+require "chef/resource/package"
class Chef
class Resource
diff --git a/lib/chef/resource_builder.rb b/lib/chef/resource_builder.rb
index 5b2ed4bb3f..bb9e6808e0 100644
--- a/lib/chef/resource_builder.rb
+++ b/lib/chef/resource_builder.rb
@@ -146,6 +146,6 @@ class Chef
end
end
-require 'chef/exceptions'
-require 'chef/resource'
-require 'chef/log'
+require "chef/exceptions"
+require "chef/resource"
+require "chef/log"
diff --git a/lib/chef/resource_collection.rb b/lib/chef/resource_collection.rb
index 4fd6fcad24..9bf79da7fc 100644
--- a/lib/chef/resource_collection.rb
+++ b/lib/chef/resource_collection.rb
@@ -17,11 +17,11 @@
# limitations under the License.
#
-require 'chef/resource_collection/resource_set'
-require 'chef/resource_collection/resource_list'
-require 'chef/resource_collection/resource_collection_serialization'
-require 'chef/log'
-require 'forwardable'
+require "chef/resource_collection/resource_set"
+require "chef/resource_collection/resource_list"
+require "chef/resource_collection/resource_collection_serialization"
+require "chef/log"
+require "forwardable"
##
# ResourceCollection currently handles two tasks:
diff --git a/lib/chef/resource_collection/resource_collection_serialization.rb b/lib/chef/resource_collection/resource_collection_serialization.rb
index 738671e20b..ec3031e2fa 100644
--- a/lib/chef/resource_collection/resource_collection_serialization.rb
+++ b/lib/chef/resource_collection/resource_collection_serialization.rb
@@ -25,8 +25,8 @@ class Chef
instance_vars[iv] = self.instance_variable_get(iv)
end
{
- 'json_class' => self.class.name,
- 'instance_vars' => instance_vars,
+ "json_class" => self.class.name,
+ "instance_vars" => instance_vars,
}
end
diff --git a/lib/chef/resource_collection/resource_list.rb b/lib/chef/resource_collection/resource_list.rb
index a26bd347aa..a3ff276d6c 100644
--- a/lib/chef/resource_collection/resource_list.rb
+++ b/lib/chef/resource_collection/resource_list.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/resource'
-require 'chef/resource_collection/stepable_iterator'
-require 'chef/resource_collection/resource_collection_serialization'
-require 'forwardable'
+require "chef/resource"
+require "chef/resource_collection/stepable_iterator"
+require "chef/resource_collection/resource_collection_serialization"
+require "forwardable"
# This class keeps the list of all known Resources in the order they are to be executed in. It also keeps a pointer
# to the most recently executed resource so we can add resources-to-execute after this point.
diff --git a/lib/chef/resource_collection/resource_set.rb b/lib/chef/resource_collection/resource_set.rb
index 1b39298cb4..4bf78d6f59 100644
--- a/lib/chef/resource_collection/resource_set.rb
+++ b/lib/chef/resource_collection/resource_set.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/resource'
-require 'chef/resource_collection/resource_collection_serialization'
+require "chef/resource"
+require "chef/resource_collection/resource_collection_serialization"
class Chef
class ResourceCollection
diff --git a/lib/chef/resource_definition.rb b/lib/chef/resource_definition.rb
index 43350dda2b..1d76d99c4f 100644
--- a/lib/chef/resource_definition.rb
+++ b/lib/chef/resource_definition.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/mixin/from_file'
-require 'chef/mixin/params_validate'
+require "chef/mixin/from_file"
+require "chef/mixin/params_validate"
class Chef
class ResourceDefinition
diff --git a/lib/chef/resource_definition_list.rb b/lib/chef/resource_definition_list.rb
index 55014090d4..be13dc1263 100644
--- a/lib/chef/resource_definition_list.rb
+++ b/lib/chef/resource_definition_list.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/mixin/from_file'
-require 'chef/resource_definition'
+require "chef/mixin/from_file"
+require "chef/resource_definition"
class Chef
class ResourceDefinitionList
diff --git a/lib/chef/resource_reporter.rb b/lib/chef/resource_reporter.rb
index e2c71f7bd5..69d0a288ac 100644
--- a/lib/chef/resource_reporter.rb
+++ b/lib/chef/resource_reporter.rb
@@ -19,9 +19,9 @@
# limitations under the License.
#
-require 'uri'
-require 'securerandom'
-require 'chef/event_dispatch/base'
+require "uri"
+require "securerandom"
+require "chef/event_dispatch/base"
class Chef
class ResourceReporter < EventDispatch::Base
@@ -97,7 +97,7 @@ class Chef
attr_reader :run_id
attr_reader :error_descriptions
- PROTOCOL_VERSION = '0.1.0'
+ PROTOCOL_VERSION = "0.1.0"
def initialize(rest_client)
if Chef::Config[:enable_reporting] && !Chef::Config[:why_run]
@@ -232,7 +232,7 @@ class Chef
Chef::Log.debug("Sending compressed run data...")
# Since we're posting compressed data we can not directly call post which expects JSON
begin
- @rest_client.raw_request(:POST, resource_history_url, headers({'Content-Encoding' => 'gzip'}), compressed_data)
+ @rest_client.raw_request(:POST, resource_history_url, headers({"Content-Encoding" => "gzip"}), compressed_data)
rescue StandardError => e
if e.respond_to? :response
Chef::FileCache.store("failed-reporting-data.json", Chef::JSONCompat.to_json_pretty(run_data), 0640)
@@ -247,7 +247,7 @@ class Chef
end
def headers(additional_headers = {})
- options = {'X-Ops-Reporting-Protocol-Version' => PROTOCOL_VERSION}
+ options = {"X-Ops-Reporting-Protocol-Version" => PROTOCOL_VERSION}
options.merge(additional_headers)
end
diff --git a/lib/chef/resource_resolver.rb b/lib/chef/resource_resolver.rb
index 67cf134c62..d3440439a9 100644
--- a/lib/chef/resource_resolver.rb
+++ b/lib/chef/resource_resolver.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/platform/resource_priority_map'
-require 'chef/mixin/convert_to_class_name'
+require "chef/exceptions"
+require "chef/platform/resource_priority_map"
+require "chef/mixin/convert_to_class_name"
class Chef
class ResourceResolver
diff --git a/lib/chef/resources.rb b/lib/chef/resources.rb
index cc5b9be8c6..dc1b195d25 100644
--- a/lib/chef/resources.rb
+++ b/lib/chef/resources.rb
@@ -16,71 +16,71 @@
# limitations under the License.
#
-require 'chef/resource/apt_package'
-require 'chef/resource/bash'
-require 'chef/resource/batch'
-require 'chef/resource/breakpoint'
-require 'chef/resource/cookbook_file'
-require 'chef/resource/chef_gem'
-require 'chef/resource/chocolatey_package'
-require 'chef/resource/cron'
-require 'chef/resource/csh'
-require 'chef/resource/deploy'
-require 'chef/resource/deploy_revision'
-require 'chef/resource/directory'
-require 'chef/resource/dpkg_package'
-require 'chef/resource/dsc_script'
-require 'chef/resource/dsc_resource'
-require 'chef/resource/easy_install_package'
-require 'chef/resource/env'
-require 'chef/resource/erl_call'
-require 'chef/resource/execute'
-require 'chef/resource/file'
-require 'chef/resource/freebsd_package'
-require 'chef/resource/ips_package'
-require 'chef/resource/gem_package'
-require 'chef/resource/git'
-require 'chef/resource/group'
-require 'chef/resource/http_request'
-require 'chef/resource/homebrew_package'
-require 'chef/resource/ifconfig'
-require 'chef/resource/ksh'
-require 'chef/resource/link'
-require 'chef/resource/log'
-require 'chef/resource/macports_package'
-require 'chef/resource/mdadm'
-require 'chef/resource/mount'
-require 'chef/resource/ohai'
-require 'chef/resource/openbsd_package'
-require 'chef/resource/package'
-require 'chef/resource/pacman_package'
-require 'chef/resource/paludis_package'
-require 'chef/resource/perl'
-require 'chef/resource/portage_package'
-require 'chef/resource/powershell_script'
-require 'chef/resource/osx_profile'
-require 'chef/resource/python'
-require 'chef/resource/reboot'
-require 'chef/resource/registry_key'
-require 'chef/resource/remote_directory'
-require 'chef/resource/remote_file'
-require 'chef/resource/rpm_package'
-require 'chef/resource/solaris_package'
-require 'chef/resource/route'
-require 'chef/resource/ruby'
-require 'chef/resource/ruby_block'
-require 'chef/resource/scm'
-require 'chef/resource/script'
-require 'chef/resource/service'
-require 'chef/resource/windows_service'
-require 'chef/resource/subversion'
-require 'chef/resource/smartos_package'
-require 'chef/resource/template'
-require 'chef/resource/timestamped_deploy'
-require 'chef/resource/user'
-require 'chef/resource/whyrun_safe_ruby_block'
-require 'chef/resource/windows_package'
-require 'chef/resource/yum_package'
-require 'chef/resource/lwrp_base'
-require 'chef/resource/bff_package'
-require 'chef/resource/zypper_package'
+require "chef/resource/apt_package"
+require "chef/resource/bash"
+require "chef/resource/batch"
+require "chef/resource/breakpoint"
+require "chef/resource/cookbook_file"
+require "chef/resource/chef_gem"
+require "chef/resource/chocolatey_package"
+require "chef/resource/cron"
+require "chef/resource/csh"
+require "chef/resource/deploy"
+require "chef/resource/deploy_revision"
+require "chef/resource/directory"
+require "chef/resource/dpkg_package"
+require "chef/resource/dsc_script"
+require "chef/resource/dsc_resource"
+require "chef/resource/easy_install_package"
+require "chef/resource/env"
+require "chef/resource/erl_call"
+require "chef/resource/execute"
+require "chef/resource/file"
+require "chef/resource/freebsd_package"
+require "chef/resource/ips_package"
+require "chef/resource/gem_package"
+require "chef/resource/git"
+require "chef/resource/group"
+require "chef/resource/http_request"
+require "chef/resource/homebrew_package"
+require "chef/resource/ifconfig"
+require "chef/resource/ksh"
+require "chef/resource/link"
+require "chef/resource/log"
+require "chef/resource/macports_package"
+require "chef/resource/mdadm"
+require "chef/resource/mount"
+require "chef/resource/ohai"
+require "chef/resource/openbsd_package"
+require "chef/resource/package"
+require "chef/resource/pacman_package"
+require "chef/resource/paludis_package"
+require "chef/resource/perl"
+require "chef/resource/portage_package"
+require "chef/resource/powershell_script"
+require "chef/resource/osx_profile"
+require "chef/resource/python"
+require "chef/resource/reboot"
+require "chef/resource/registry_key"
+require "chef/resource/remote_directory"
+require "chef/resource/remote_file"
+require "chef/resource/rpm_package"
+require "chef/resource/solaris_package"
+require "chef/resource/route"
+require "chef/resource/ruby"
+require "chef/resource/ruby_block"
+require "chef/resource/scm"
+require "chef/resource/script"
+require "chef/resource/service"
+require "chef/resource/windows_service"
+require "chef/resource/subversion"
+require "chef/resource/smartos_package"
+require "chef/resource/template"
+require "chef/resource/timestamped_deploy"
+require "chef/resource/user"
+require "chef/resource/whyrun_safe_ruby_block"
+require "chef/resource/windows_package"
+require "chef/resource/yum_package"
+require "chef/resource/lwrp_base"
+require "chef/resource/bff_package"
+require "chef/resource/zypper_package"
diff --git a/lib/chef/rest.rb b/lib/chef/rest.rb
index 4106a01077..96a563e034 100644
--- a/lib/chef/rest.rb
+++ b/lib/chef/rest.rb
@@ -20,23 +20,23 @@
# limitations under the License.
#
-require 'tempfile'
-require 'chef/http'
+require "tempfile"
+require "chef/http"
class Chef
class HTTP; end
class REST < HTTP; end
end
-require 'chef/http/authenticator'
-require 'chef/http/decompressor'
-require 'chef/http/json_input'
-require 'chef/http/json_to_model_output'
-require 'chef/http/cookie_manager'
-require 'chef/http/validate_content_length'
-require 'chef/config'
-require 'chef/exceptions'
-require 'chef/platform/query_helpers'
-require 'chef/http/remote_request_id'
+require "chef/http/authenticator"
+require "chef/http/decompressor"
+require "chef/http/json_input"
+require "chef/http/json_to_model_output"
+require "chef/http/cookie_manager"
+require "chef/http/validate_content_length"
+require "chef/config"
+require "chef/exceptions"
+require "chef/platform/query_helpers"
+require "chef/http/remote_request_id"
class Chef
diff --git a/lib/chef/role.rb b/lib/chef/role.rb
index d1854ed44d..fa76129af2 100644
--- a/lib/chef/role.rb
+++ b/lib/chef/role.rb
@@ -18,14 +18,14 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/mixin/params_validate'
-require 'chef/mixin/from_file'
-require 'chef/run_list'
-require 'chef/mash'
-require 'chef/json_compat'
-require 'chef/server_api'
-require 'chef/search/query'
+require "chef/config"
+require "chef/mixin/params_validate"
+require "chef/mixin/from_file"
+require "chef/run_list"
+require "chef/mash"
+require "chef/json_compat"
+require "chef/server_api"
+require "chef/search/query"
class Chef
class Role
@@ -37,8 +37,8 @@ class Chef
# Create a new Chef::Role object.
def initialize(chef_server_rest: nil)
- @name = ''
- @description = ''
+ @name = ""
+ @description = ""
@default_attributes = Mash.new
@override_attributes = Mash.new
@env_run_lists = {"_default" => Chef::RunList.new}
@@ -88,7 +88,7 @@ class Chef
end
def active_run_list_for(environment)
- @env_run_lists.has_key?(environment) ? environment : '_default'
+ @env_run_lists.has_key?(environment) ? environment : "_default"
end
# Per environment run lists
@@ -139,7 +139,7 @@ class Chef
result = {
"name" => @name,
"description" => @description,
- 'json_class' => self.class.name,
+ "json_class" => self.class.name,
"default_attributes" => @default_attributes,
"override_attributes" => @override_attributes,
"chef_type" => "role",
diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb
index 6e02f47ff1..b5659c8a25 100644
--- a/lib/chef/run_context.rb
+++ b/lib/chef/run_context.rb
@@ -17,15 +17,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/resource_collection'
-require 'chef/cookbook_version'
-require 'chef/node'
-require 'chef/role'
-require 'chef/log'
-require 'chef/recipe'
-require 'chef/run_context/cookbook_compiler'
-require 'chef/event_dispatch/events_output_stream'
-require 'forwardable'
+require "chef/resource_collection"
+require "chef/cookbook_version"
+require "chef/node"
+require "chef/role"
+require "chef/log"
+require "chef/recipe"
+require "chef/run_context/cookbook_compiler"
+require "chef/event_dispatch/events_output_stream"
+require "forwardable"
class Chef
@@ -349,7 +349,7 @@ ERROR_MESSAGE
end
Chef::Log.debug("Loading recipe file #{recipe_file}")
- recipe = Chef::Recipe.new('@recipe_files', recipe_file, self)
+ recipe = Chef::Recipe.new("@recipe_files", recipe_file, self)
recipe.from_file(recipe_file)
recipe
end
diff --git a/lib/chef/run_context/cookbook_compiler.rb b/lib/chef/run_context/cookbook_compiler.rb
index abe5afa7ae..22dcef29df 100644
--- a/lib/chef/run_context/cookbook_compiler.rb
+++ b/lib/chef/run_context/cookbook_compiler.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'set'
-require 'chef/log'
-require 'chef/recipe'
-require 'chef/resource/lwrp_base'
-require 'chef/provider/lwrp_base'
-require 'chef/resource_definition_list'
+require "set"
+require "chef/log"
+require "chef/recipe"
+require "chef/resource/lwrp_base"
+require "chef/provider/lwrp_base"
+require "chef/resource_definition_list"
class Chef
class RunContext
diff --git a/lib/chef/run_list.rb b/lib/chef/run_list.rb
index 01e32ffc98..b04dcb6d74 100644
--- a/lib/chef/run_list.rb
+++ b/lib/chef/run_list.rb
@@ -19,10 +19,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/run_list/run_list_item'
-require 'chef/run_list/run_list_expansion'
-require 'chef/run_list/versioned_recipe_list'
-require 'chef/mixin/params_validate'
+require "chef/run_list/run_list_item"
+require "chef/run_list/run_list_expansion"
+require "chef/run_list/versioned_recipe_list"
+require "chef/mixin/params_validate"
class Chef
class RunList
@@ -138,7 +138,7 @@ class Chef
# Expands this run_list: recursively expand roles into their included
# recipes.
# Returns a RunListExpansion object.
- def expand(environment, data_source='server', expansion_opts={})
+ def expand(environment, data_source="server", expansion_opts={})
expansion = expansion_for_data_source(environment, data_source, expansion_opts)
expansion.expand
expansion
@@ -155,9 +155,9 @@ class Chef
def expansion_for_data_source(environment, data_source, opts={})
case data_source.to_s
- when 'disk'
+ when "disk"
RunListExpansionFromDisk.new(environment, @run_list_items)
- when 'server'
+ when "server"
RunListExpansionFromAPI.new(environment, @run_list_items, opts[:rest])
end
end
diff --git a/lib/chef/run_list/run_list_expansion.rb b/lib/chef/run_list/run_list_expansion.rb
index 2f2d170446..fa3b6730b3 100644
--- a/lib/chef/run_list/run_list_expansion.rb
+++ b/lib/chef/run_list/run_list_expansion.rb
@@ -16,13 +16,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/mash'
+require "chef/mash"
-require 'chef/mixin/deep_merge'
+require "chef/mixin/deep_merge"
-require 'chef/role'
-require 'chef/server_api'
-require 'chef/json_compat'
+require "chef/role"
+require "chef/server_api"
+require "chef/json_compat"
class Chef
class RunList
@@ -149,7 +149,7 @@ class Chef
def to_hash
seen_items = {:recipe => {}, :role => {}}
- {:id => @environment, :run_list => convert_run_list_trace('top level', seen_items)}
+ {:id => @environment, :run_list => convert_run_list_trace("top level", seen_items)}
end
private
@@ -186,7 +186,7 @@ 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]
diff --git a/lib/chef/run_list/run_list_item.rb b/lib/chef/run_list/run_list_item.rb
index 43bb239754..c6ab17bdeb 100644
--- a/lib/chef/run_list/run_list_item.rb
+++ b/lib/chef/run_list/run_list_item.rb
@@ -31,10 +31,10 @@ class Chef
case item
when Hash
assert_hash_is_valid_run_list_item!(item)
- @type = (item['type'] || item[:type]).to_sym
- @name = item['name'] || item[:name]
- if (item.has_key?('version') || item.has_key?(:version))
- @version = item['version'] || item[:version]
+ @type = (item["type"] || item[:type]).to_sym
+ @name = item["name"] || item[:name]
+ if (item.has_key?("version") || item.has_key?(:version))
+ @version = item["version"] || item[:version]
end
when String
if match = QUALIFIED_RECIPE.match(item)
@@ -89,7 +89,7 @@ class Chef
end
def assert_hash_is_valid_run_list_item!(item)
- unless (item.key?('type')|| item.key?(:type)) && (item.key?('name') || item.key?(:name))
+ unless (item.key?("type")|| item.key?(:type)) && (item.key?("name") || item.key?(:name))
raise ArgumentError, "Initializing a #{self.class} from a hash requires that it have a 'type' and 'name' key"
end
end
diff --git a/lib/chef/run_list/versioned_recipe_list.rb b/lib/chef/run_list/versioned_recipe_list.rb
index 514685b72d..b6a2a8402f 100644
--- a/lib/chef/run_list/versioned_recipe_list.rb
+++ b/lib/chef/run_list/versioned_recipe_list.rb
@@ -15,8 +15,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/version_class'
-require 'chef/version_constraint'
+require "chef/version_class"
+require "chef/version_constraint"
# Why does this class exist?
# Why did we not just modify RunList/RunListItem?
@@ -70,7 +70,7 @@ class Chef
# @return [Array] Array of strings with fully-qualified recipe names
def with_fully_qualified_names_and_version_constraints
self.map do |recipe_name|
- qualified_recipe = if recipe_name.include?('::')
+ qualified_recipe = if recipe_name.include?("::")
recipe_name
else
"#{recipe_name}::default"
@@ -90,7 +90,7 @@ class Chef
# @return [Array] Array of strings with fully-qualified and unexpanded recipe names
def with_duplicate_names
self.map do |recipe_name|
- if recipe_name.include?('::')
+ if recipe_name.include?("::")
recipe_name
else
[recipe_name, "#{recipe_name}::default"]
diff --git a/lib/chef/run_lock.rb b/lib/chef/run_lock.rb
index 9e0952bdcb..42b99440bc 100644
--- a/lib/chef/run_lock.rb
+++ b/lib/chef/run_lock.rb
@@ -15,14 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/mixin/create_path'
-require 'fcntl'
+require "chef/mixin/create_path"
+require "fcntl"
if Chef::Platform.windows?
- require 'chef/win32/mutex'
+ require "chef/win32/mutex"
end
-require 'chef/config'
-require 'chef/exceptions'
-require 'timeout'
+require "chef/config"
+require "chef/exceptions"
+require "timeout"
class Chef
@@ -132,7 +132,7 @@ class Chef
def create_lock
# ensure the runlock_file path exists
create_path(File.dirname(runlock_file))
- @runlock = File.open(runlock_file,'a+')
+ @runlock = File.open(runlock_file,"a+")
end
# @api private solely for race condition tests
@@ -143,7 +143,7 @@ class Chef
# If we support FD_CLOEXEC, then use it.
# NB: ruby-2.0.0-p195 sets FD_CLOEXEC by default, but not
# ruby-1.8.7/1.9.3
- if Fcntl.const_defined?('F_SETFD') && Fcntl.const_defined?('FD_CLOEXEC')
+ if Fcntl.const_defined?("F_SETFD") && Fcntl.const_defined?("FD_CLOEXEC")
runlock.fcntl(Fcntl::F_SETFD, runlock.fcntl(Fcntl::F_GETFD, 0) | Fcntl::FD_CLOEXEC)
end
# Flock will return 0 if it can acquire the lock otherwise it
diff --git a/lib/chef/runner.rb b/lib/chef/runner.rb
index 61b68e2375..04252b1087 100644
--- a/lib/chef/runner.rb
+++ b/lib/chef/runner.rb
@@ -18,10 +18,10 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/mixin/params_validate'
-require 'chef/node'
-require 'chef/resource_collection'
+require "chef/exceptions"
+require "chef/mixin/params_validate"
+require "chef/node"
+require "chef/resource_collection"
class Chef
# == Chef::Runner
diff --git a/lib/chef/search/query.rb b/lib/chef/search/query.rb
index c5c6bc6ce0..06be3fafe9 100644
--- a/lib/chef/search/query.rb
+++ b/lib/chef/search/query.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/exceptions'
-require 'chef/server_api'
+require "chef/config"
+require "chef/exceptions"
+require "chef/server_api"
-require 'uri'
+require "uri"
class Chef
class Search
@@ -40,7 +40,7 @@ class Chef
# Backwards compatability for cookbooks.
# This can be removed in Chef > 12.
- def partial_search(type, query='*:*', *args, &block)
+ def partial_search(type, query="*:*", *args, &block)
Chef::Log.warn(<<-WARNDEP)
DEPRECATED: The 'partial_search' API is deprecated and will be removed in
future releases. Please use 'search' with a :filter_result argument to get
@@ -80,7 +80,7 @@ WARNDEP
# an example of the returned json may be:
# {"ip_address":"127.0.0.1", "ruby_version": "1.9.3"}
#
- def search(type, query='*:*', *args, &block)
+ def search(type, query="*:*", *args, &block)
validate_type(type)
args_h = hashify_args(*args)
@@ -146,25 +146,25 @@ WARNDEP
qstr
end
- def call_rest_service(type, query:'*:*', rows:nil, start:0, sort:'X_CHEF_id_CHEF_X asc', filter_result:nil)
+ def call_rest_service(type, query:"*:*", rows:nil, start:0, sort:"X_CHEF_id_CHEF_X asc", filter_result:nil)
query_string = create_query_string(type, query, rows, start, sort)
if filter_result
response = rest.post(query_string, filter_result)
# response returns rows in the format of
# { "url" => url_to_node, "data" => filter_result_hash }
- response['rows'].map! { |row| row['data'] }
+ response["rows"].map! { |row| row["data"] }
else
response = rest.get(query_string)
- response['rows'].map! do |row|
+ response["rows"].map! do |row|
case type.to_s
- when 'node'
+ when "node"
Chef::Node.from_hash(row)
- when 'role'
+ when "role"
Chef::Role.from_hash(row)
- when 'environment'
+ when "environment"
Chef::Environment.from_hash(row)
- when 'client'
+ when "client"
Chef::ApiClient.from_hash(row)
else
Chef::DataBagItem.from_hash(row)
diff --git a/lib/chef/server_api.rb b/lib/chef/server_api.rb
index 6c864d53fb..b7e460fa6e 100644
--- a/lib/chef/server_api.rb
+++ b/lib/chef/server_api.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/http'
-require 'chef/http/authenticator'
-require 'chef/http/cookie_manager'
-require 'chef/http/decompressor'
-require 'chef/http/json_input'
-require 'chef/http/json_output'
-require 'chef/http/remote_request_id'
-require 'chef/http/validate_content_length'
+require "chef/http"
+require "chef/http/authenticator"
+require "chef/http/cookie_manager"
+require "chef/http/decompressor"
+require "chef/http/json_input"
+require "chef/http/json_output"
+require "chef/http/remote_request_id"
+require "chef/http/validate_content_length"
class Chef
class ServerAPI < Chef::HTTP
@@ -69,4 +69,4 @@ class Chef
end
end
-require 'chef/config'
+require "chef/config"
diff --git a/lib/chef/shell.rb b/lib/chef/shell.rb
index 3a68785ce9..f5a5f5af10 100644
--- a/lib/chef/shell.rb
+++ b/lib/chef/shell.rb
@@ -15,21 +15,21 @@
# limitations under the License.
#
-require 'singleton'
-require 'pp'
-require 'etc'
-require 'mixlib/cli'
-
-require 'chef'
-require 'chef/version'
-require 'chef/client'
-require 'chef/config'
-require 'chef/config_fetcher'
-
-require 'chef/shell/shell_session'
-require 'chef/shell/ext'
-require 'chef/json_compat'
-require 'chef/util/path_helper'
+require "singleton"
+require "pp"
+require "etc"
+require "mixlib/cli"
+
+require "chef"
+require "chef/version"
+require "chef/client"
+require "chef/config"
+require "chef/config_fetcher"
+
+require "chef/shell/shell_session"
+require "chef/shell/ext"
+require "chef/json_compat"
+require "chef/util/path_helper"
# = Shell
# Shell is Chef in an IRB session. Shell can interact with a Chef server via the
@@ -180,7 +180,7 @@ module Shell
end
def self.editor
- @editor || Chef::Config[:editor] || ENV['EDITOR']
+ @editor || Chef::Config[:editor] || ENV["EDITOR"]
end
class Options
@@ -216,7 +216,7 @@ FOOTER
option :log_level,
:short => "-l LOG_LEVEL",
- :long => '--log-level 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 }
@@ -264,7 +264,7 @@ FOOTER
: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) }}
+ :proc => lambda { |items| items.split(",").map { |item| Chef::RunList::RunListItem.new(item) }}
def self.print_help
instance = new
@@ -296,19 +296,19 @@ FOOTER
private
def config_file_for_shell_mode(environment)
- dot_chef_dir = Chef::Util::PathHelper.home('.chef')
+ dot_chef_dir = Chef::Util::PathHelper.home(".chef")
if config[:config_file]
config[:config_file]
elsif environment
Shell.env = environment
- config_file_to_try = ::File.join(dot_chef_dir, environment, 'chef_shell.rb')
+ config_file_to_try = ::File.join(dot_chef_dir, environment, "chef_shell.rb")
unless ::File.exist?(config_file_to_try)
puts "could not find chef-shell config for environment #{environment} at #{config_file_to_try}"
exit 1
end
config_file_to_try
- elsif dot_chef_dir && ::File.exist?(File.join(dot_chef_dir, 'chef_shell.rb'))
- File.join(dot_chef_dir, 'chef_shell.rb')
+ elsif dot_chef_dir && ::File.exist?(File.join(dot_chef_dir, "chef_shell.rb"))
+ File.join(dot_chef_dir, "chef_shell.rb")
elsif config[:solo]
Chef::Config.platform_specific_path("/etc/chef/solo.rb")
elsif config[:client]
diff --git a/lib/chef/shell/ext.rb b/lib/chef/shell/ext.rb
index dd1d0195c7..86efaae35a 100644
--- a/lib/chef/shell/ext.rb
+++ b/lib/chef/shell/ext.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'tempfile'
-require 'chef/recipe'
-require 'fileutils'
-require 'chef/dsl/platform_introspection'
-require 'chef/version'
-require 'chef/shell/shell_session'
-require 'chef/shell/model_wrapper'
-require 'chef/server_api'
-require 'chef/json_compat'
+require "tempfile"
+require "chef/recipe"
+require "fileutils"
+require "chef/dsl/platform_introspection"
+require "chef/version"
+require "chef/shell/shell_session"
+require "chef/shell/model_wrapper"
+require "chef/server_api"
+require "chef/json_compat"
module Shell
module Extensions
diff --git a/lib/chef/shell/model_wrapper.rb b/lib/chef/shell/model_wrapper.rb
index 7ee39de7eb..7d1324d62e 100644
--- a/lib/chef/shell/model_wrapper.rb
+++ b/lib/chef/shell/model_wrapper.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/mixin/convert_to_class_name'
-require 'chef/mixin/language'
+require "chef/mixin/convert_to_class_name"
+require "chef/mixin/language"
module Shell
class ModelWrapper
diff --git a/lib/chef/shell/shell_session.rb b/lib/chef/shell/shell_session.rb
index 7b3939da69..beea923aef 100644
--- a/lib/chef/shell/shell_session.rb
+++ b/lib/chef/shell/shell_session.rb
@@ -18,16 +18,16 @@
# limitations under the License.
#
-require 'chef/recipe'
-require 'chef/run_context'
-require 'chef/config'
-require 'chef/client'
-require 'chef/cookbook/cookbook_collection'
-require 'chef/cookbook_loader'
-require 'chef/run_list/run_list_expansion'
-require 'chef/formatters/base'
-require 'chef/formatters/doc'
-require 'chef/formatters/minimal'
+require "chef/recipe"
+require "chef/run_context"
+require "chef/config"
+require "chef/client"
+require "chef/cookbook/cookbook_collection"
+require "chef/cookbook_loader"
+require "chef/run_list/run_list_expansion"
+require "chef/formatters/base"
+require "chef/formatters/doc"
+require "chef/formatters/minimal"
module Shell
class ShellSession
@@ -235,7 +235,7 @@ module Shell
# Run the very smallest amount of ohai we can get away with and still
# hope to have things work. Otherwise we're not very good doppelgangers
def run_ohai
- @ohai.require_plugin('os')
+ @ohai.require_plugin("os")
end
# DoppelGanger implementation of build_node. preserves as many of the node's
@@ -245,7 +245,7 @@ module Shell
@node = Chef::Node.find_or_create(node_name)
ohai_data = @ohai.data.merge(@node.automatic_attrs)
@node.consume_external_attrs(ohai_data,nil)
- @run_list_expansion = @node.expand!('server')
+ @run_list_expansion = @node.expand!("server")
@expanded_run_list_with_versions = @run_list_expansion.recipes.with_version_constraints_strings
Chef::Log.info("Run List is [#{@node.run_list}]")
Chef::Log.info("Run List expands to [#{@expanded_run_list_with_versions.join(', ')}]")
diff --git a/lib/chef/shell_out.rb b/lib/chef/shell_out.rb
index 3febe366bd..bf6018df52 100644
--- a/lib/chef/shell_out.rb
+++ b/lib/chef/shell_out.rb
@@ -1,4 +1,4 @@
-require 'mixlib/shellout'
+require "mixlib/shellout"
class Chef
class ShellOut < Mixlib::ShellOut
diff --git a/lib/chef/tasks/chef_repo.rake b/lib/chef/tasks/chef_repo.rake
index 14a5bcc0c1..977f8eb67c 100644
--- a/lib/chef/tasks/chef_repo.rake
+++ b/lib/chef/tasks/chef_repo.rake
@@ -16,8 +16,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-TOPDIR = '.'
-require 'rake'
+TOPDIR = "."
+require "rake"
desc "By default, print deprecation notice"
task :default do
@@ -27,37 +27,37 @@ end
desc "Install the latest copy of the repository on this Chef Server"
task :install do
puts deprecation_notice
- puts 'The `install` rake task, which included the `update`, `roles`, and'
- puts '`upload_cookbooks` rake tasks is replaced by the `knife upload`'
+ puts "The `install` rake task, which included the `update`, `roles`, and"
+ puts "`upload_cookbooks` rake tasks is replaced by the `knife upload`"
puts 'sub-command. The notion of "installing" the chef-repo to the Chef'
- puts 'Server. Previously the `install` task would manage server and'
- puts 'client configuration. This will not work at all on Chef Server 11+'
- puts 'and client configuration should be managed with the `chef-client`'
- puts 'cookbook.'
+ puts "Server. Previously the `install` task would manage server and"
+ puts "client configuration. This will not work at all on Chef Server 11+"
+ puts "and client configuration should be managed with the `chef-client`"
+ puts "cookbook."
end
desc "Update your repository from source control"
task :update do
puts deprecation_notice
- puts 'The `update` rake task previously updated the chef-repo from'
- puts 'the detected version control system, either svn or git. However,'
- puts 'it has not been recommended for users for years. Most users in'
- puts 'the community use `git`, so the Subversion functionality is not'
- puts 'required, and `git pull` is sufficient for many workflows. The'
- puts 'world of git workflows is rather different now than it was when'
- puts 'this rake task was created.'
+ puts "The `update` rake task previously updated the chef-repo from"
+ puts "the detected version control system, either svn or git. However,"
+ puts "it has not been recommended for users for years. Most users in"
+ puts "the community use `git`, so the Subversion functionality is not"
+ puts "required, and `git pull` is sufficient for many workflows. The"
+ puts "world of git workflows is rather different now than it was when"
+ puts "this rake task was created."
end
desc "Create a new cookbook (with COOKBOOK=name, optional CB_PREFIX=site-)"
task :new_cookbook do
- cb = ENV['COOKBOOK'] || 'my_cookbook_name'
+ cb = ENV["COOKBOOK"] || "my_cookbook_name"
puts deprecation_notice
- puts 'The `new_cookbook` rake task is replaced by the ChefDK cookbook'
- puts 'generator. To generate a new cookbook run:'
+ puts "The `new_cookbook` rake task is replaced by the ChefDK cookbook"
+ puts "generator. To generate a new cookbook run:"
puts
puts "chef generate cookbook #{ENV['COOKBOOK']}"
puts
- puts 'Or, if you are not using ChefDK, use `knife cookbook create`:'
+ puts "Or, if you are not using ChefDK, use `knife cookbook create`:"
puts
puts "knife cookbook create #{ENV['COOKBOOK']}"
end
@@ -65,46 +65,46 @@ end
desc "Create a new self-signed SSL certificate for FQDN=foo.example.com"
task :ssl_cert do
puts deprecation_notice
- puts 'The `ssl_cert` rake task is superseded by using the CHEF-maintained'
+ puts "The `ssl_cert` rake task is superseded by using the CHEF-maintained"
puts '`openssl` cookbook\'s `openssl_x509` resource which can generate'
- puts 'self-signed certificate chains as convergent resources.'
+ puts "self-signed certificate chains as convergent resources."
puts
- puts 'https://supermarket.getchef.com/cookbooks/openssl'
+ puts "https://supermarket.getchef.com/cookbooks/openssl"
end
desc "Build cookbook metadata.json from metadata.rb"
task :metadata do
puts deprecation_notice
- puts 'The `metadata` rake task is not recommended. Cookbook'
- puts '`metadata.json` is automatically generated from `metadata.rb`'
- puts 'by `knife` when uploading cookbooks to the Chef Server.'
+ puts "The `metadata` rake task is not recommended. Cookbook"
+ puts "`metadata.json` is automatically generated from `metadata.rb`"
+ puts "by `knife` when uploading cookbooks to the Chef Server."
end
desc "Update roles"
task :roles do
puts deprecation_notice
- puts 'The `roles` rake task is not recommended. If you are using Ruby'
- puts 'role files (roles/*.rb), you can upload them all with:'
+ puts "The `roles` rake task is not recommended. If you are using Ruby"
+ puts "role files (roles/*.rb), you can upload them all with:"
puts
- puts 'knife role from file roles/*'
+ puts "knife role from file roles/*"
puts
- puts 'If you are using JSON role files (roles/*.json), you can upload'
- puts 'them all with:'
+ puts "If you are using JSON role files (roles/*.json), you can upload"
+ puts "them all with:"
puts
- puts 'knife upload roles/*.json'
+ puts "knife upload roles/*.json"
end
desc "Update a specific role"
task :role do
puts deprecation_notice
- puts 'The `role` rake task is not recommended. If you are using Ruby'
- puts 'role files, you can upload a single role with:'
+ puts "The `role` rake task is not recommended. If you are using Ruby"
+ puts "role files, you can upload a single role with:"
puts
- puts 'knife role from file rolename.rb'
+ puts "knife role from file rolename.rb"
puts
- puts 'If you are using JSON role files, you can upload a single role with'
+ puts "If you are using JSON role files, you can upload a single role with"
puts
- puts 'knife upload roles/rolename.json'
+ puts "knife upload roles/rolename.json"
end
desc "Upload all cookbooks"
@@ -122,18 +122,18 @@ end
desc "Test all cookbooks"
task :test_cookbooks do
puts deprecation_notice
- puts 'The `test_cookbooks` rake task is no longer recommended. Previously'
- puts 'it only performed a syntax check, and did no other kind of testing,'
- puts 'and the Chef Community has a rich ecosystem of testing tools for'
- puts 'various purposes:'
+ puts "The `test_cookbooks` rake task is no longer recommended. Previously"
+ puts "it only performed a syntax check, and did no other kind of testing,"
+ puts "and the Chef Community has a rich ecosystem of testing tools for"
+ puts "various purposes:"
puts
- puts '- knife cookbook test will perform a syntax check, as this task did'
- puts ' before.'
- puts '- rubocop and foodcritic will perform lint checking for Ruby and'
- puts ' Chef cookbook style according to community standards.'
- puts '- ChefSpec will perform unit testing'
- puts '- Test Kitchen will perform convergence and post-convergence'
- puts ' testing on virtual machines.'
+ puts "- knife cookbook test will perform a syntax check, as this task did"
+ puts " before."
+ puts "- rubocop and foodcritic will perform lint checking for Ruby and"
+ puts " Chef cookbook style according to community standards."
+ puts "- ChefSpec will perform unit testing"
+ puts "- Test Kitchen will perform convergence and post-convergence"
+ puts " testing on virtual machines."
end
desc "Test a single cookbook"
@@ -143,19 +143,19 @@ namespace :databag do
desc "Upload a single databag"
task :upload do
puts deprecation_notice
- puts 'The `data_bags:upload` task is not recommended. You should use'
- puts 'the `knife upload` sub-command for uploading data bag items.'
+ puts "The `data_bags:upload` task is not recommended. You should use"
+ puts "the `knife upload` sub-command for uploading data bag items."
puts
- puts 'knife upload data_bags/bagname/itemname.json'
+ puts "knife upload data_bags/bagname/itemname.json"
end
desc "Upload all databags"
task :upload_all do
puts deprecation_notice
- puts 'The `data_bags:upload_all` task is not recommended. You should'
- puts 'use the `knife upload` sub-command for uploading data bag items.'
+ puts "The `data_bags:upload_all` task is not recommended. You should"
+ puts "use the `knife upload` sub-command for uploading data bag items."
puts
- puts 'knife upload data_bags/*'
+ puts "knife upload data_bags/*"
end
desc "Create a databag"
diff --git a/lib/chef/user.rb b/lib/chef/user.rb
index 0944bc05c8..37a104a537 100644
--- a/lib/chef/user.rb
+++ b/lib/chef/user.rb
@@ -15,13 +15,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/config'
-require 'chef/mixin/params_validate'
-require 'chef/mixin/from_file'
-require 'chef/mash'
-require 'chef/json_compat'
-require 'chef/search/query'
-require 'chef/server_api'
+require "chef/config"
+require "chef/mixin/params_validate"
+require "chef/mixin/from_file"
+require "chef/mash"
+require "chef/json_compat"
+require "chef/search/query"
+require "chef/server_api"
# TODO
# DEPRECATION NOTE
@@ -41,7 +41,7 @@ class Chef
include Chef::Mixin::ParamsValidate
def initialize
- @name = ''
+ @name = ""
@public_key = nil
@private_key = nil
@password = nil
@@ -142,11 +142,11 @@ class Chef
def self.from_hash(user_hash)
user = Chef::User.new
- user.name user_hash['name']
- user.private_key user_hash['private_key'] if user_hash.key?('private_key')
- user.password user_hash['password'] if user_hash.key?('password')
- user.public_key user_hash['public_key']
- user.admin user_hash['admin']
+ user.name user_hash["name"]
+ user.private_key user_hash["private_key"] if user_hash.key?("private_key")
+ user.password user_hash["password"] if user_hash.key?("password")
+ user.public_key user_hash["public_key"]
+ user.admin user_hash["admin"]
user
end
@@ -159,7 +159,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
@@ -187,7 +187,7 @@ class Chef
def self.transform_ohc_list_response(response)
new_response = Hash.new
response.each do |u|
- name = u['user']['username']
+ name = u["user"]["username"]
new_response[name] = Chef::Config[:chef_server_url] + "/users/#{name}"
end
new_response
diff --git a/lib/chef/user_v1.rb b/lib/chef/user_v1.rb
index 033c71548c..133087a089 100644
--- a/lib/chef/user_v1.rb
+++ b/lib/chef/user_v1.rb
@@ -15,15 +15,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/config'
-require 'chef/mixin/params_validate'
-require 'chef/mixin/from_file'
-require 'chef/mash'
-require 'chef/json_compat'
-require 'chef/search/query'
-require 'chef/mixin/api_version_request_handling'
-require 'chef/exceptions'
-require 'chef/server_api'
+require "chef/config"
+require "chef/mixin/params_validate"
+require "chef/mixin/from_file"
+require "chef/mash"
+require "chef/json_compat"
+require "chef/search/query"
+require "chef/mixin/api_version_request_handling"
+require "chef/exceptions"
+require "chef/server_api"
# OSC 11 BACKWARDS COMPATIBILITY NOTE (remove after OSC 11 support ends)
#
@@ -155,12 +155,12 @@ class Chef
new_user = chef_root_rest_v1.post("users", payload)
# get the private_key out of the chef_key hash if it exists
- if new_user['chef_key']
- if new_user['chef_key']['private_key']
- new_user['private_key'] = new_user['chef_key']['private_key']
+ if new_user["chef_key"]
+ if new_user["chef_key"]["private_key"]
+ new_user["private_key"] = new_user["chef_key"]["private_key"]
end
- new_user['public_key'] = new_user['chef_key']['public_key']
- new_user.delete('chef_key')
+ new_user["public_key"] = new_user["chef_key"]["public_key"]
+ new_user.delete("chef_key")
end
rescue Net::HTTPServerException => e
# rescue API V0 if 406 and the server supports V0
@@ -259,16 +259,16 @@ class Chef
def self.from_hash(user_hash)
user = Chef::UserV1.new
- user.username user_hash['username']
- user.display_name user_hash['display_name'] if user_hash.key?('display_name')
- user.first_name user_hash['first_name'] if user_hash.key?('first_name')
- user.middle_name user_hash['middle_name'] if user_hash.key?('middle_name')
- user.last_name user_hash['last_name'] if user_hash.key?('last_name')
- user.email user_hash['email'] if user_hash.key?('email')
- user.password user_hash['password'] if user_hash.key?('password')
- user.public_key user_hash['public_key'] if user_hash.key?('public_key')
- user.private_key user_hash['private_key'] if user_hash.key?('private_key')
- user.create_key user_hash['create_key'] if user_hash.key?('create_key')
+ user.username user_hash["username"]
+ user.display_name user_hash["display_name"] if user_hash.key?("display_name")
+ user.first_name user_hash["first_name"] if user_hash.key?("first_name")
+ user.middle_name user_hash["middle_name"] if user_hash.key?("middle_name")
+ user.last_name user_hash["last_name"] if user_hash.key?("last_name")
+ user.email user_hash["email"] if user_hash.key?("email")
+ user.password user_hash["password"] if user_hash.key?("password")
+ user.public_key user_hash["public_key"] if user_hash.key?("public_key")
+ user.private_key user_hash["private_key"] if user_hash.key?("private_key")
+ user.create_key user_hash["create_key"] if user_hash.key?("create_key")
user
end
@@ -281,7 +281,7 @@ class Chef
end
def self.list(inflate=false)
- response = Chef::ServerAPI.new(Chef::Config[:chef_server_url]).get('users')
+ response = Chef::ServerAPI.new(Chef::Config[:chef_server_url]).get("users")
users = if response.is_a?(Array)
# EC 11 / CS 12 V0, V1
# GET /organizations/<org>/users
@@ -317,7 +317,7 @@ class Chef
def self.transform_list_response(response)
new_response = Hash.new
response.each do |u|
- name = u['user']['username']
+ name = u["user"]["username"]
new_response[name] = Chef::Config[:chef_server_url] + "/users/#{name}"
end
new_response
diff --git a/lib/chef/util/backup.rb b/lib/chef/util/backup.rb
index 6c95cedad7..2142869e36 100644
--- a/lib/chef/util/backup.rb
+++ b/lib/chef/util/backup.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/util/path_helper'
+require "chef/util/path_helper"
class Chef
class Util
@@ -49,7 +49,7 @@ class Chef
def backup_filename
@backup_filename ||= begin
time = Time.now
- nanoseconds = sprintf("%6f", time.to_f).split('.')[1]
+ nanoseconds = sprintf("%6f", time.to_f).split(".")[1]
savetime = time.strftime("%Y%m%d%H%M%S.#{nanoseconds}")
backup_filename = "#{path}.chef-#{savetime}"
backup_filename = backup_filename.sub(/^([A-Za-z]:)/, "") #strip drive letter on Windows
diff --git a/lib/chef/util/diff.rb b/lib/chef/util/diff.rb
index b8336b5135..3b42f576c0 100644
--- a/lib/chef/util/diff.rb
+++ b/lib/chef/util/diff.rb
@@ -40,8 +40,8 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OF OTHER DEALINGS IN THE
# SOFTWARE.
-require 'diff/lcs'
-require 'diff/lcs/hunk'
+require "diff/lcs"
+require "diff/lcs/hunk"
class Chef
class Util
@@ -97,9 +97,9 @@ class Chef
return "No differences encountered\n" if diff_data.empty?
# write diff header (standard unified format)
- ft = File.stat(old_file).mtime.localtime.strftime('%Y-%m-%d %H:%M:%S.%N %z')
+ ft = File.stat(old_file).mtime.localtime.strftime("%Y-%m-%d %H:%M:%S.%N %z")
diff_str << "--- #{old_file}\t#{ft}\n"
- ft = File.stat(new_file).mtime.localtime.strftime('%Y-%m-%d %H:%M:%S.%N %z')
+ ft = File.stat(new_file).mtime.localtime.strftime("%Y-%m-%d %H:%M:%S.%N %z")
diff_str << "+++ #{new_file}\t#{ft}\n"
# loop over diff hunks. if a hunk overlaps with the last hunk,
@@ -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 2041278e4a..e2c09aeea8 100644
--- a/lib/chef/util/dsc/configuration_generator.rb
+++ b/lib/chef/util/dsc/configuration_generator.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/util/powershell/cmdlet'
+require "chef/util/powershell/cmdlet"
class Chef::Util::DSC
class ConfigurationGenerator
@@ -27,9 +27,9 @@ class Chef::Util::DSC
def configuration_document_from_script_code(code, configuration_flags, imports, shellout_flags)
Chef::Log.debug("DSC: DSC code:\n '#{code}'")
- generated_script_path = write_document_generation_script(code, 'chef_dsc', imports)
+ generated_script_path = write_document_generation_script(code, "chef_dsc", imports)
begin
- configuration_document_from_script_path(generated_script_path, 'chef_dsc', configuration_flags, shellout_flags)
+ configuration_document_from_script_path(generated_script_path, "chef_dsc", configuration_flags, shellout_flags)
ensure
::FileUtils.rm(generated_script_path)
end
@@ -97,7 +97,7 @@ Configuration '#{configuration_name}'
def generate_import_resource_statements(imports)
if imports
imports.map do |resource_module, resources|
- if resources.length == 0 || resources.include?('*')
+ if resources.length == 0 || resources.include?("*")
"Import-DscResource -ModuleName #{resource_module}"
else
"Import-DscResource -ModuleName #{resource_module} -Name #{resources.join(',')}"
@@ -114,7 +114,7 @@ Configuration '#{configuration_name}'
def write_document_generation_script(code, configuration_name, imports)
script_path = "#{@config_directory}/chef_dsc_config.ps1"
- ::File.open(script_path, 'wt') do | script |
+ ::File.open(script_path, "wt") do | script |
script.write(configuration_code(code, configuration_name, imports))
end
script_path
@@ -131,7 +131,7 @@ Configuration '#{configuration_name}'
end
def get_configuration_document(document_path)
- ::File.open(document_path, 'rb') do | file |
+ ::File.open(document_path, "rb") do | file |
file.read
end
end
diff --git a/lib/chef/util/dsc/lcm_output_parser.rb b/lib/chef/util/dsc/lcm_output_parser.rb
index 754fde3e8b..ac847adffa 100644
--- a/lib/chef/util/dsc/lcm_output_parser.rb
+++ b/lib/chef/util/dsc/lcm_output_parser.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/util/dsc/resource_info'
-require 'chef/exceptions'
+require "chef/log"
+require "chef/util/dsc/resource_info"
+require "chef/exceptions"
class Chef
class Util
@@ -109,7 +109,7 @@ class Chef
# What If: [machinename]: LCM: [op_action op_type] message
# extract op_action, op_type, and message
operation, info = match.captures
- op_action, op_type = operation.strip.split(' ').map {|m| m.downcase.to_sym}
+ op_action, op_type = operation.strip.split(" ").map {|m| m.downcase.to_sym}
else
op_action = op_type = :info
if match = line.match(/^.*?:.*?: \s+(.*)/)
diff --git a/lib/chef/util/dsc/local_configuration_manager.rb b/lib/chef/util/dsc/local_configuration_manager.rb
index f8398341e5..deaa83ef09 100644
--- a/lib/chef/util/dsc/local_configuration_manager.rb
+++ b/lib/chef/util/dsc/local_configuration_manager.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/util/powershell/cmdlet'
-require 'chef/util/dsc/lcm_output_parser'
+require "chef/util/powershell/cmdlet"
+require "chef/util/dsc/lcm_output_parser"
class Chef::Util::DSC
class LocalConfigurationManager
@@ -47,7 +47,7 @@ class Chef::Util::DSC
def run_configuration_cmdlet(configuration_document, apply_configuration, shellout_flags)
Chef::Log.debug("DSC: Calling DSC Local Config Manager to #{apply_configuration ? "set" : "test"} configuration document.")
- test_only_parameters = ! apply_configuration ? '-whatif; if (! $?) { exit 1 }' : ''
+ test_only_parameters = ! apply_configuration ? "-whatif; if (! $?) { exit 1 }" : ""
start_operation_timing
command_code = lcm_command_code(@configuration_path, test_only_parameters)
@@ -90,7 +90,7 @@ EOH
end
def whatif_not_supported?(what_if_exception_output)
- !! (what_if_exception_output.gsub(/[\r\n]+/, '').gsub(/\s+/, ' ') =~ /A parameter cannot be found that matches parameter name 'Whatif'/i)
+ !! (what_if_exception_output.gsub(/[\r\n]+/, "").gsub(/\s+/, " ") =~ /A parameter cannot be found that matches parameter name 'Whatif'/i)
end
def dsc_module_import_failure?(what_if_output)
@@ -105,13 +105,13 @@ EOH
Parser::parse(what_if_output)
rescue Chef::Exceptions::LCMParser => e
Chef::Log::warn("Could not parse LCM output: #{e}")
- [Chef::Util::DSC::ResourceInfo.new('Unknown DSC Resources', true, ['Unknown changes because LCM output was not parsable.'])]
+ [Chef::Util::DSC::ResourceInfo.new("Unknown DSC Resources", true, ["Unknown changes because LCM output was not parsable."])]
end
end
def save_configuration_document(configuration_document)
::FileUtils.mkdir_p(@configuration_path)
- ::File.open(configuration_document_path, 'wb') do | file |
+ ::File.open(configuration_document_path, "wb") do | file |
file.write(configuration_document)
end
end
@@ -121,7 +121,7 @@ EOH
end
def configuration_document_path
- File.join(@configuration_path,'..mof')
+ File.join(@configuration_path,"..mof")
end
def clear_execution_time
diff --git a/lib/chef/util/dsc/resource_store.rb b/lib/chef/util/dsc/resource_store.rb
index fdcecc2b3c..761ade9989 100644
--- a/lib/chef/util/dsc/resource_store.rb
+++ b/lib/chef/util/dsc/resource_store.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/util/powershell/cmdlet'
-require 'chef/util/powershell/cmdlet_result'
-require 'chef/exceptions'
+require "chef/util/powershell/cmdlet"
+require "chef/util/powershell/cmdlet_result"
+require "chef/exceptions"
class Chef
class Util
@@ -53,7 +53,7 @@ class DSC
def add_resource(new_r)
count = resources.count do |r|
- r['ResourceType'].casecmp(new_r['ResourceType']) == 0
+ r["ResourceType"].casecmp(new_r["ResourceType"]) == 0
end
if count == 0
resources << new_r
@@ -72,9 +72,9 @@ class DSC
def find_resources(name, module_name, rs)
found = rs.find_all do |r|
- name_matches = r['Name'].casecmp(name) == 0
+ name_matches = r["Name"].casecmp(name) == 0
if name_matches
- module_name == nil || (r['Module'] and r['Module']['Name'].casecmp(module_name) == 0)
+ module_name == nil || (r["Module"] and r["Module"]["Name"].casecmp(module_name) == 0)
else
false
end
@@ -84,7 +84,7 @@ class DSC
# Returns a list of dsc resources
def query_resources
- cmdlet = Chef::Util::Powershell::Cmdlet.new(nil, 'get-dscresource',
+ cmdlet = Chef::Util::Powershell::Cmdlet.new(nil, "get-dscresource",
:object)
result = cmdlet.run
result.return_value
diff --git a/lib/chef/util/file_edit.rb b/lib/chef/util/file_edit.rb
index 4d2a9c03eb..d321764a0a 100644
--- a/lib/chef/util/file_edit.rb
+++ b/lib/chef/util/file_edit.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/util/editor'
-require 'fileutils'
+require "chef/util/editor"
+require "fileutils"
class Chef
class Util
@@ -61,7 +61,7 @@ class Chef
#search the file line by line and match each line with the given regex
#if matched, delete the match (all occurrences) from the line
def search_file_delete(regex)
- search_file_replace(regex, '')
+ search_file_replace(regex, "")
end
#search the file line by line and match each line with the given regex
diff --git a/lib/chef/util/path_helper.rb b/lib/chef/util/path_helper.rb
index 9ebc9319b8..4a079d3419 100644
--- a/lib/chef/util/path_helper.rb
+++ b/lib/chef/util/path_helper.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef-config/path_helper'
+require "chef-config/path_helper"
class Chef
class Util
diff --git a/lib/chef/util/powershell/cmdlet.rb b/lib/chef/util/powershell/cmdlet.rb
index 7eab098c83..6d9bd67afa 100644
--- a/lib/chef/util/powershell/cmdlet.rb
+++ b/lib/chef/util/powershell/cmdlet.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'mixlib/shellout'
-require 'chef/mixin/windows_architecture_helper'
-require 'chef/util/powershell/cmdlet_result'
+require "mixlib/shellout"
+require "chef/mixin/windows_architecture_helper"
+require "chef/util/powershell/cmdlet_result"
class Chef
class Util
@@ -48,11 +48,11 @@ class Powershell
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(' ')
+ arguments_string = arguments.join(" ")
switches_string = command_switches_string(switches)
@@ -119,7 +119,7 @@ class Powershell
validate_switch_name!(switch_name)
- switch_argument = ''
+ switch_argument = ""
switch_present = true
case switch_value
@@ -136,10 +136,10 @@ class Powershell
raise ArgumentError, "Invalid argument type `#{switch_value.class}` specified for PowerShell switch `:#{switch_name}`. Arguments to PowerShell must be of type `String`, `Numeric`, `Float`, `FalseClass`, or `TrueClass`"
end
- switch_present ? ["-#{switch_name.to_s.downcase}", switch_argument].join(' ').strip : ''
+ switch_present ? ["-#{switch_name.to_s.downcase}", switch_argument].join(" ").strip : ""
end
- command_switches.join(' ')
+ command_switches.join(" ")
end
class CmdletStream
@@ -154,8 +154,8 @@ class Powershell
def read
if File.exist? @filename
- File.open(@filename, 'rb:bom|UTF-16LE') do |f|
- f.read.encode('UTF-8')
+ File.open(@filename, "rb:bom|UTF-16LE") do |f|
+ f.read.encode("UTF-8")
end
end
end
diff --git a/lib/chef/util/powershell/cmdlet_result.rb b/lib/chef/util/powershell/cmdlet_result.rb
index f1fdd968b1..531636a4ff 100644
--- a/lib/chef/util/powershell/cmdlet_result.rb
+++ b/lib/chef/util/powershell/cmdlet_result.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/json_compat'
+require "chef/json_compat"
class Chef
class Util
diff --git a/lib/chef/util/powershell/ps_credential.rb b/lib/chef/util/powershell/ps_credential.rb
index 2fc0650e5f..660ef32472 100644
--- a/lib/chef/util/powershell/ps_credential.rb
+++ b/lib/chef/util/powershell/ps_credential.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/crypto' if Chef::Platform.windows?
+require "chef/win32/crypto" if Chef::Platform.windows?
class Chef::Util::Powershell
class PSCredential
diff --git a/lib/chef/util/selinux.rb b/lib/chef/util/selinux.rb
index 778da042e3..f9fbe82922 100644
--- a/lib/chef/util/selinux.rb
+++ b/lib/chef/util/selinux.rb
@@ -20,8 +20,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/mixin/shell_out'
-require 'chef/mixin/which'
+require "chef/mixin/shell_out"
+require "chef/mixin/which"
class Chef
class Util
diff --git a/lib/chef/util/threaded_job_queue.rb b/lib/chef/util/threaded_job_queue.rb
index 824cd0a3c4..d01ecd81a6 100644
--- a/lib/chef/util/threaded_job_queue.rb
+++ b/lib/chef/util/threaded_job_queue.rb
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'thread'
+require "thread"
class Chef
class Util
diff --git a/lib/chef/util/windows/net_group.rb b/lib/chef/util/windows/net_group.rb
index 2085747eb9..5f6bc6a03b 100644
--- a/lib/chef/util/windows/net_group.rb
+++ b/lib/chef/util/windows/net_group.rb
@@ -1,85 +1,85 @@
-#
-# Author:: Doug MacEachern (<dougm@vmware.com>)
-# Copyright:: Copyright (c) 2010 VMware, Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require 'chef/util/windows'
-require 'chef/win32/net'
-
-#wrapper around a subset of the NetGroup* APIs.
-class Chef::Util::Windows::NetGroup
-
- private
-
- def groupname
- @groupname
- end
-
- public
-
- def initialize(groupname)
- @groupname = groupname
- end
-
- def local_get_members
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_get_members(nil, groupname)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
- end
-
- def local_add
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_add(nil, groupname)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
- end
-
- def local_set_members(members)
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_set_members(nil, groupname, members)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
- end
-
- def local_add_members(members)
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_add_members(nil, groupname, members)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
- end
-
- def local_delete_members(members)
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_del_members(nil, groupname, members)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
-
- end
-
- def local_delete
- begin
- Chef::ReservedNames::Win32::NetUser::net_local_group_del(nil, groupname)
- rescue Chef::Exceptions::Win32NetAPIError => e
- raise ArgumentError, e.msg
- end
- end
-end
+#
+# Author:: Doug MacEachern (<dougm@vmware.com>)
+# Copyright:: Copyright (c) 2010 VMware, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require "chef/util/windows"
+require "chef/win32/net"
+
+#wrapper around a subset of the NetGroup* APIs.
+class Chef::Util::Windows::NetGroup
+
+ private
+
+ def groupname
+ @groupname
+ end
+
+ public
+
+ def initialize(groupname)
+ @groupname = groupname
+ end
+
+ def local_get_members
+ begin
+ Chef::ReservedNames::Win32::NetUser::net_local_group_get_members(nil, groupname)
+ rescue Chef::Exceptions::Win32NetAPIError => e
+ raise ArgumentError, e.msg
+ end
+ end
+
+ def local_add
+ begin
+ Chef::ReservedNames::Win32::NetUser::net_local_group_add(nil, groupname)
+ rescue Chef::Exceptions::Win32NetAPIError => e
+ raise ArgumentError, e.msg
+ end
+ end
+
+ def local_set_members(members)
+ begin
+ Chef::ReservedNames::Win32::NetUser::net_local_group_set_members(nil, groupname, members)
+ rescue Chef::Exceptions::Win32NetAPIError => e
+ raise ArgumentError, e.msg
+ end
+ end
+
+ def local_add_members(members)
+ begin
+ Chef::ReservedNames::Win32::NetUser::net_local_group_add_members(nil, groupname, members)
+ rescue Chef::Exceptions::Win32NetAPIError => e
+ raise ArgumentError, e.msg
+ end
+ end
+
+ def local_delete_members(members)
+ begin
+ Chef::ReservedNames::Win32::NetUser::net_local_group_del_members(nil, groupname, members)
+ rescue Chef::Exceptions::Win32NetAPIError => e
+ raise ArgumentError, e.msg
+ end
+
+ end
+
+ def local_delete
+ begin
+ Chef::ReservedNames::Win32::NetUser::net_local_group_del(nil, groupname)
+ rescue Chef::Exceptions::Win32NetAPIError => e
+ raise ArgumentError, e.msg
+ end
+ end
+end
diff --git a/lib/chef/util/windows/net_use.rb b/lib/chef/util/windows/net_use.rb
index b94576e702..e70df6e42b 100644
--- a/lib/chef/util/windows/net_use.rb
+++ b/lib/chef/util/windows/net_use.rb
@@ -20,8 +20,8 @@
#see also: WNetAddConnection2 and WNetAddConnection3
#see also cmd.exe: net use /?
-require 'chef/util/windows'
-require 'chef/win32/net'
+require "chef/util/windows"
+require "chef/win32/net"
class Chef::Util::Windows::NetUse < Chef::Util::Windows
def initialize(localname)
@@ -53,7 +53,7 @@ class Chef::Util::Windows::NetUse < Chef::Util::Windows
def from_use_info_struct(ui2_hash)
ui2_hash.inject({}) do |memo, (k,v)|
- memo[k.to_s.sub('ui2_', '').to_sym] = v
+ memo[k.to_s.sub("ui2_", "").to_sym] = v
memo
end
end
diff --git a/lib/chef/util/windows/net_user.rb b/lib/chef/util/windows/net_user.rb
index 4ce051228a..b8e9b63571 100644
--- a/lib/chef/util/windows/net_user.rb
+++ b/lib/chef/util/windows/net_user.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/util/windows'
-require 'chef/exceptions'
-require 'chef/win32/net'
-require 'chef/win32/security'
+require "chef/util/windows"
+require "chef/exceptions"
+require "chef/win32/net"
+require "chef/win32/security"
#wrapper around a subset of the NetUser* APIs.
#nothing Chef specific, but not complete enough to be its own gem, so util for now.
diff --git a/lib/chef/util/windows/volume.rb b/lib/chef/util/windows/volume.rb
index 6e45594ba6..7b24ec37aa 100644
--- a/lib/chef/util/windows/volume.rb
+++ b/lib/chef/util/windows/volume.rb
@@ -18,8 +18,8 @@
#simple wrapper around Volume APIs. might be possible with WMI, but possibly more complex.
-require 'chef/win32/api/file'
-require 'chef/util/windows'
+require "chef/win32/api/file"
+require "chef/util/windows"
class Chef::Util::Windows::Volume < Chef::Util::Windows
attr_reader :mount_point
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index 3eb7d49365..0a7b5f66e0 100644
--- a/lib/chef/version.rb
+++ b/lib/chef/version.rb
@@ -21,7 +21,7 @@
class Chef
CHEF_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__)))
- VERSION = '12.6.0'
+ VERSION = "12.6.0"
end
#
diff --git a/lib/chef/version/platform.rb b/lib/chef/version/platform.rb
index d9028b5d15..f8d5b1ce35 100644
--- a/lib/chef/version/platform.rb
+++ b/lib/chef/version/platform.rb
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/version_class'
+require "chef/version_class"
class Chef
class Version
diff --git a/lib/chef/version_constraint.rb b/lib/chef/version_constraint.rb
index ba2169c8cb..f30512c3cf 100644
--- a/lib/chef/version_constraint.rb
+++ b/lib/chef/version_constraint.rb
@@ -14,7 +14,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/version_class'
+require "chef/version_class"
class Chef
class VersionConstraint
@@ -67,9 +67,9 @@ class Chef
def do_op(other_version)
if STANDARD_OPS.include? @op
other_version.send(@op.to_sym, @version)
- elsif @op == '='
+ elsif @op == "="
other_version == @version
- elsif @op == '~>'
+ elsif @op == "~>"
if @missing_patch_level
(other_version.major == @version.major &&
other_version.minor >= @version.minor)
@@ -106,7 +106,7 @@ class Chef
@op = $1
@raw_version = $2
@version = self.class::VERSION_CLASS.new(@raw_version)
- if @raw_version.split('.').size <= 2
+ if @raw_version.split(".").size <= 2
@missing_patch_level = true
end
else
diff --git a/lib/chef/version_constraint/platform.rb b/lib/chef/version_constraint/platform.rb
index ada4f29b70..423ae4f0c5 100644
--- a/lib/chef/version_constraint/platform.rb
+++ b/lib/chef/version_constraint/platform.rb
@@ -13,8 +13,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/version_constraint'
-require 'chef/version/platform'
+require "chef/version_constraint"
+require "chef/version/platform"
class Chef
class VersionConstraint
diff --git a/lib/chef/whitelist.rb b/lib/chef/whitelist.rb
index 3682f7187e..ca4be38d7f 100644
--- a/lib/chef/whitelist.rb
+++ b/lib/chef/whitelist.rb
@@ -1,5 +1,5 @@
-require 'chef/exceptions'
+require "chef/exceptions"
class Chef
class Whitelist
diff --git a/lib/chef/win32/api.rb b/lib/chef/win32/api.rb
index de3381c5ba..63f7dbdab7 100644
--- a/lib/chef/win32/api.rb
+++ b/lib/chef/win32/api.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'ffi'
-require 'chef/reserved_names'
-require 'chef/exceptions'
+require "ffi"
+require "chef/reserved_names"
+require "chef/exceptions"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/api/crypto.rb b/lib/chef/win32/api/crypto.rb
index cf32287a17..9cf8387433 100644
--- a/lib/chef/win32/api/crypto.rb
+++ b/lib/chef/win32/api/crypto.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/api'
+require "chef/win32/api"
class Chef
module ReservedNames::Win32
@@ -28,7 +28,7 @@ class Chef
# Win32 API Bindings
###############################################
- ffi_lib 'Crypt32'
+ ffi_lib "Crypt32"
CRYPTPROTECT_UI_FORBIDDEN = 0x1
CRYPTPROTECT_LOCAL_MACHINE = 0x4
diff --git a/lib/chef/win32/api/error.rb b/lib/chef/win32/api/error.rb
index d1f9a309fe..0ea3633202 100644
--- a/lib/chef/win32/api/error.rb
+++ b/lib/chef/win32/api/error.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/api'
+require "chef/win32/api"
class Chef
module ReservedNames::Win32
@@ -877,7 +877,7 @@ class Chef
# Win32 API Bindings
###############################################
- ffi_lib 'kernel32', 'user32'
+ ffi_lib "kernel32", "user32"
=begin
DWORD WINAPI FormatMessage(
diff --git a/lib/chef/win32/api/file.rb b/lib/chef/win32/api/file.rb
index 3618d125a1..51ae3b47c7 100644
--- a/lib/chef/win32/api/file.rb
+++ b/lib/chef/win32/api/file.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'chef/win32/api'
-require 'chef/win32/api/security'
-require 'chef/win32/api/system'
-require 'chef/win32/unicode'
+require "chef/win32/api"
+require "chef/win32/api/security"
+require "chef/win32/api/system"
+require "chef/win32/unicode"
class Chef
module ReservedNames::Win32
@@ -182,7 +182,7 @@ class Chef
# Win32 API Bindings
###############################################
- ffi_lib 'kernel32', 'version'
+ ffi_lib "kernel32", "version"
# Does not map directly to a win32 struct
# see https://msdn.microsoft.com/en-us/library/windows/desktop/ms647464(v=vs.85).aspx
diff --git a/lib/chef/win32/api/installer.rb b/lib/chef/win32/api/installer.rb
index b4851eccf1..20d021b9ab 100644
--- a/lib/chef/win32/api/installer.rb
+++ b/lib/chef/win32/api/installer.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/win32/api'
-require 'chef/win32/error'
-require 'pathname'
+require "chef/exceptions"
+require "chef/win32/api"
+require "chef/win32/error"
+require "pathname"
class Chef
module ReservedNames::Win32
@@ -37,7 +37,7 @@ class Chef
# Win32 API Bindings
###############################################
- ffi_lib 'msi'
+ ffi_lib "msi"
=begin
UINT MsiOpenPackage(
diff --git a/lib/chef/win32/api/memory.rb b/lib/chef/win32/api/memory.rb
index abd1191718..2c3e305f08 100644
--- a/lib/chef/win32/api/memory.rb
+++ b/lib/chef/win32/api/memory.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/api'
+require "chef/win32/api"
class Chef
module ReservedNames::Win32
@@ -48,7 +48,7 @@ class Chef
# Win32 API Bindings
###############################################
- ffi_lib 'kernel32'
+ ffi_lib "kernel32"
=begin
HLOCAL WINAPI LocalAlloc(
diff --git a/lib/chef/win32/api/net.rb b/lib/chef/win32/api/net.rb
index 7a578a3833..a3710bdaf5 100644
--- a/lib/chef/win32/api/net.rb
+++ b/lib/chef/win32/api/net.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/win32/api'
-require 'chef/win32/unicode'
+require "chef/win32/api"
+require "chef/win32/unicode"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/api/process.rb b/lib/chef/win32/api/process.rb
index 217880b737..6c4e567f74 100644
--- a/lib/chef/win32/api/process.rb
+++ b/lib/chef/win32/api/process.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/api'
+require "chef/win32/api"
class Chef
module ReservedNames::Win32
@@ -28,7 +28,7 @@ class Chef
# Win32 API Bindings
###############################################
- ffi_lib 'kernel32'
+ ffi_lib "kernel32"
safe_attach_function :GetCurrentProcess, [], :HANDLE
safe_attach_function :GetProcessHandleCount, [ :HANDLE, :LPDWORD ], :BOOL
diff --git a/lib/chef/win32/api/psapi.rb b/lib/chef/win32/api/psapi.rb
index 3a5df3f179..347396b50a 100644
--- a/lib/chef/win32/api/psapi.rb
+++ b/lib/chef/win32/api/psapi.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/api'
+require "chef/win32/api"
class Chef
module ReservedNames::Win32
@@ -41,7 +41,7 @@ class Chef
:PeakPagefileUsage, :SIZE_T
end
- ffi_lib 'psapi'
+ ffi_lib "psapi"
safe_attach_function :GetProcessMemoryInfo, [ :HANDLE, :pointer, :DWORD ], :BOOL
diff --git a/lib/chef/win32/api/registry.rb b/lib/chef/win32/api/registry.rb
index cbbf6b66bb..d01700f159 100644
--- a/lib/chef/win32/api/registry.rb
+++ b/lib/chef/win32/api/registry.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/api'
+require "chef/win32/api"
class Chef
module ReservedNames::Win32
@@ -28,7 +28,7 @@ class Chef
# Win32 API Bindings
###############################################
- ffi_lib 'advapi32'
+ ffi_lib "advapi32"
# LONG WINAPI RegDeleteKeyEx(
# _In_ HKEY hKey,
diff --git a/lib/chef/win32/api/security.rb b/lib/chef/win32/api/security.rb
index 06fdf650f4..13b86fb670 100644
--- a/lib/chef/win32/api/security.rb
+++ b/lib/chef/win32/api/security.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/api'
+require "chef/win32/api"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/api/synchronization.rb b/lib/chef/win32/api/synchronization.rb
index 9c148d7e2b..b541e5aaf3 100644
--- a/lib/chef/win32/api/synchronization.rb
+++ b/lib/chef/win32/api/synchronization.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/api'
+require "chef/win32/api"
class Chef
module ReservedNames::Win32
@@ -24,7 +24,7 @@ class Chef
module Synchronization
extend Chef::ReservedNames::Win32::API
- ffi_lib 'kernel32'
+ ffi_lib "kernel32"
# Constant synchronization functions use to indicate wait
# forever.
diff --git a/lib/chef/win32/api/system.rb b/lib/chef/win32/api/system.rb
index a485f89708..218a9b95e7 100644
--- a/lib/chef/win32/api/system.rb
+++ b/lib/chef/win32/api/system.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/api'
+require "chef/win32/api"
class Chef
module ReservedNames::Win32
@@ -132,7 +132,7 @@ class Chef
# Win32 API Bindings
###############################################
- ffi_lib 'kernel32', 'user32'
+ ffi_lib "kernel32", "user32"
class OSVERSIONINFOEX < FFI::Struct
layout :dw_os_version_info_size, :DWORD,
diff --git a/lib/chef/win32/api/unicode.rb b/lib/chef/win32/api/unicode.rb
index 2a9166aa99..29cdfba5fd 100644
--- a/lib/chef/win32/api/unicode.rb
+++ b/lib/chef/win32/api/unicode.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/api'
+require "chef/win32/api"
class Chef
module ReservedNames::Win32
@@ -92,7 +92,7 @@ class Chef
# Win32 API Bindings
###############################################
- ffi_lib 'kernel32', 'advapi32'
+ ffi_lib "kernel32", "advapi32"
=begin
BOOL IsTextUnicode(
diff --git a/lib/chef/win32/crypto.rb b/lib/chef/win32/crypto.rb
index e9c1da954b..8804872ee1 100644
--- a/lib/chef/win32/crypto.rb
+++ b/lib/chef/win32/crypto.rb
@@ -1,50 +1,50 @@
-#
-# Author:: Jay Mundrawala (<jdm@chef.io>)
-# Copyright:: Copyright 2015 Chef Software, Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require 'chef/win32/error'
-require 'chef/win32/api/memory'
-require 'chef/win32/api/crypto'
-require 'chef/win32/unicode'
-require 'digest'
-
-class Chef
- module ReservedNames::Win32
- class Crypto
- include Chef::ReservedNames::Win32::API::Crypto
- extend Chef::ReservedNames::Win32::API::Crypto
-
- def self.encrypt(str, &block)
- data_blob = CRYPT_INTEGER_BLOB.new
- unless CryptProtectData(CRYPT_INTEGER_BLOB.new(str.to_wstring), nil, nil, nil, nil, CRYPTPROTECT_LOCAL_MACHINE, data_blob)
- Chef::ReservedNames::Win32::Error.raise!
- end
- bytes = data_blob[:pbData].get_bytes(0, data_blob[:cbData])
- if block
- block.call(bytes)
- else
- Digest.hexencode(bytes)
- end
- ensure
- unless data_blob[:pbData].null?
- Chef::ReservedNames::Win32::Memory.local_free(data_blob[:pbData])
- end
- end
-
- end
- end
-end
+#
+# Author:: Jay Mundrawala (<jdm@chef.io>)
+# Copyright:: Copyright 2015 Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require "chef/win32/error"
+require "chef/win32/api/memory"
+require "chef/win32/api/crypto"
+require "chef/win32/unicode"
+require "digest"
+
+class Chef
+ module ReservedNames::Win32
+ class Crypto
+ include Chef::ReservedNames::Win32::API::Crypto
+ extend Chef::ReservedNames::Win32::API::Crypto
+
+ def self.encrypt(str, &block)
+ data_blob = CRYPT_INTEGER_BLOB.new
+ unless CryptProtectData(CRYPT_INTEGER_BLOB.new(str.to_wstring), nil, nil, nil, nil, CRYPTPROTECT_LOCAL_MACHINE, data_blob)
+ Chef::ReservedNames::Win32::Error.raise!
+ end
+ bytes = data_blob[:pbData].get_bytes(0, data_blob[:cbData])
+ if block
+ block.call(bytes)
+ else
+ Digest.hexencode(bytes)
+ end
+ ensure
+ unless data_blob[:pbData].null?
+ Chef::ReservedNames::Win32::Memory.local_free(data_blob[:pbData])
+ end
+ end
+
+ end
+ end
+end
diff --git a/lib/chef/win32/error.rb b/lib/chef/win32/error.rb
index c638773d2a..75b65854a9 100644
--- a/lib/chef/win32/error.rb
+++ b/lib/chef/win32/error.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/win32/api/error'
-require 'chef/win32/memory'
-require 'chef/win32/unicode'
-require 'chef/exceptions'
+require "chef/win32/api/error"
+require "chef/win32/memory"
+require "chef/win32/unicode"
+require "chef/exceptions"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/eventlog.rb b/lib/chef/win32/eventlog.rb
index 24af2da0d6..a056900101 100644
--- a/lib/chef/win32/eventlog.rb
+++ b/lib/chef/win32/eventlog.rb
@@ -25,7 +25,7 @@ if Chef::Platform::windows? and not Chef::Platform::windows_server_2003?
end
end
- require 'win32/eventlog'
+ require "win32/eventlog"
Chef::Win32EventLogLoaded = true
end
end
diff --git a/lib/chef/win32/file.rb b/lib/chef/win32/file.rb
index abfad91fdb..3279e22ecf 100644
--- a/lib/chef/win32/file.rb
+++ b/lib/chef/win32/file.rb
@@ -17,11 +17,11 @@
# limitations under the License.
#
-require 'chef/mixin/wide_string'
-require 'chef/win32/api/file'
-require 'chef/win32/api/security'
-require 'chef/win32/error'
-require 'chef/win32/unicode'
+require "chef/mixin/wide_string"
+require "chef/win32/api/file"
+require "chef/win32/api/security"
+require "chef/win32/error"
+require "chef/win32/unicode"
class Chef
module ReservedNames::Win32
@@ -214,5 +214,5 @@ class Chef
end
end
-require 'chef/win32/file/info'
-require 'chef/win32/file/version_info'
+require "chef/win32/file/info"
+require "chef/win32/file/version_info"
diff --git a/lib/chef/win32/file/info.rb b/lib/chef/win32/file/info.rb
index 0f07428106..70d04df9b8 100644
--- a/lib/chef/win32/file/info.rb
+++ b/lib/chef/win32/file/info.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/file'
+require "chef/win32/file"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/file/version_info.rb b/lib/chef/win32/file/version_info.rb
index 30e9604ad1..bd7ed511a5 100644
--- a/lib/chef/win32/file/version_info.rb
+++ b/lib/chef/win32/file/version_info.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/file'
+require "chef/win32/file"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/handle.rb b/lib/chef/win32/handle.rb
index 21a8fdf339..66a06f45ad 100644
--- a/lib/chef/win32/handle.rb
+++ b/lib/chef/win32/handle.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/win32/api/process'
-require 'chef/win32/api/psapi'
-require 'chef/win32/api/system'
-require 'chef/win32/error'
+require "chef/win32/api/process"
+require "chef/win32/api/psapi"
+require "chef/win32/api/system"
+require "chef/win32/error"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/memory.rb b/lib/chef/win32/memory.rb
index 8a61d27ef0..9c52b59b68 100644
--- a/lib/chef/win32/memory.rb
+++ b/lib/chef/win32/memory.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/win32/error'
-require 'chef/win32/api/memory'
+require "chef/win32/error"
+require "chef/win32/api/memory"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/mutex.rb b/lib/chef/win32/mutex.rb
index 0d8eba1b3c..b7b9f8fd51 100644
--- a/lib/chef/win32/mutex.rb
+++ b/lib/chef/win32/mutex.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/win32/api/synchronization'
-require 'chef/win32/unicode'
+require "chef/win32/api/synchronization"
+require "chef/win32/unicode"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/net.rb b/lib/chef/win32/net.rb
index 9e4f90b1b7..c3c57e7009 100644
--- a/lib/chef/win32/net.rb
+++ b/lib/chef/win32/net.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/win32/api/net'
-require 'chef/win32/error'
-require 'chef/mixin/wide_string'
+require "chef/win32/api/net"
+require "chef/win32/error"
+require "chef/mixin/wide_string"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/process.rb b/lib/chef/win32/process.rb
index 767d4f390c..9df686cc5f 100644
--- a/lib/chef/win32/process.rb
+++ b/lib/chef/win32/process.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/win32/api/process'
-require 'chef/win32/api/psapi'
-require 'chef/win32/error'
-require 'chef/win32/handle'
-require 'ffi'
+require "chef/win32/api/process"
+require "chef/win32/api/psapi"
+require "chef/win32/error"
+require "chef/win32/handle"
+require "ffi"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/registry.rb b/lib/chef/win32/registry.rb
index af8de59d0f..e55539167a 100644
--- a/lib/chef/win32/registry.rb
+++ b/lib/chef/win32/registry.rb
@@ -16,15 +16,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/reserved_names'
-require 'chef/win32/api'
-require 'chef/mixin/wide_string'
+require "chef/reserved_names"
+require "chef/win32/api"
+require "chef/mixin/wide_string"
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'chef/monkey_patches/win32/registry'
- require 'chef/win32/api/registry'
- require 'win32/registry'
- require 'win32/api'
+ require "chef/monkey_patches/win32/registry"
+ require "chef/win32/api/registry"
+ require "win32/registry"
+ require "win32/api"
end
class Chef
diff --git a/lib/chef/win32/security.rb b/lib/chef/win32/security.rb
index 38694c9fec..31128ad083 100644
--- a/lib/chef/win32/security.rb
+++ b/lib/chef/win32/security.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/win32/api/security'
-require 'chef/win32/error'
-require 'chef/win32/memory'
-require 'chef/win32/process'
-require 'chef/win32/unicode'
-require 'chef/win32/security/token'
-require 'chef/mixin/wide_string'
+require "chef/win32/api/security"
+require "chef/win32/error"
+require "chef/win32/memory"
+require "chef/win32/process"
+require "chef/win32/unicode"
+require "chef/win32/security/token"
+require "chef/mixin/wide_string"
class Chef
module ReservedNames::Win32
@@ -659,8 +659,8 @@ class Chef
end
end
-require 'chef/win32/security/ace'
-require 'chef/win32/security/acl'
-require 'chef/win32/security/securable_object'
-require 'chef/win32/security/security_descriptor'
-require 'chef/win32/security/sid'
+require "chef/win32/security/ace"
+require "chef/win32/security/acl"
+require "chef/win32/security/securable_object"
+require "chef/win32/security/security_descriptor"
+require "chef/win32/security/sid"
diff --git a/lib/chef/win32/security/ace.rb b/lib/chef/win32/security/ace.rb
index 1f54b1cafb..f23db2abcc 100644
--- a/lib/chef/win32/security/ace.rb
+++ b/lib/chef/win32/security/ace.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/win32/security'
-require 'chef/win32/security/sid'
-require 'chef/win32/memory'
+require "chef/win32/security"
+require "chef/win32/security/sid"
+require "chef/win32/memory"
-require 'ffi'
+require "ffi"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/security/acl.rb b/lib/chef/win32/security/acl.rb
index e129d5c9a0..aecf17ad1c 100644
--- a/lib/chef/win32/security/acl.rb
+++ b/lib/chef/win32/security/acl.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/win32/security'
-require 'chef/win32/security/ace'
-require 'ffi'
+require "chef/win32/security"
+require "chef/win32/security/ace"
+require "ffi"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/security/securable_object.rb b/lib/chef/win32/security/securable_object.rb
index 00655c9bab..73d4a695e0 100644
--- a/lib/chef/win32/security/securable_object.rb
+++ b/lib/chef/win32/security/securable_object.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/win32/security'
-require 'chef/win32/security/acl'
-require 'chef/win32/security/sid'
+require "chef/win32/security"
+require "chef/win32/security/acl"
+require "chef/win32/security/sid"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/security/security_descriptor.rb b/lib/chef/win32/security/security_descriptor.rb
index 658e9104b4..87ef90ecd5 100644
--- a/lib/chef/win32/security/security_descriptor.rb
+++ b/lib/chef/win32/security/security_descriptor.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/win32/security'
-require 'chef/win32/security/acl'
-require 'chef/win32/security/sid'
+require "chef/win32/security"
+require "chef/win32/security/acl"
+require "chef/win32/security/sid"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/security/sid.rb b/lib/chef/win32/security/sid.rb
index f8bd934876..5e7edf2733 100644
--- a/lib/chef/win32/security/sid.rb
+++ b/lib/chef/win32/security/sid.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/win32/security'
-require 'chef/win32/api/net'
-require 'chef/win32/api/error'
+require "chef/win32/security"
+require "chef/win32/api/net"
+require "chef/win32/api/error"
-require 'wmi-lite/wmi'
+require "wmi-lite/wmi"
class Chef
module ReservedNames::Win32
@@ -78,115 +78,115 @@ class Chef
# Well-known SIDs
def self.Null
- SID.from_string_sid('S-1-0')
+ SID.from_string_sid("S-1-0")
end
def self.Nobody
- SID.from_string_sid('S-1-0-0')
+ SID.from_string_sid("S-1-0-0")
end
def self.World
- SID.from_string_sid('S-1-1')
+ SID.from_string_sid("S-1-1")
end
def self.Everyone
- SID.from_string_sid('S-1-1-0')
+ SID.from_string_sid("S-1-1-0")
end
def self.Local
- SID.from_string_sid('S-1-2')
+ SID.from_string_sid("S-1-2")
end
def self.Creator
- SID.from_string_sid('S-1-3')
+ SID.from_string_sid("S-1-3")
end
def self.CreatorOwner
- SID.from_string_sid('S-1-3-0')
+ SID.from_string_sid("S-1-3-0")
end
def self.CreatorGroup
- SID.from_string_sid('S-1-3-1')
+ SID.from_string_sid("S-1-3-1")
end
def self.CreatorOwnerServer
- SID.from_string_sid('S-1-3-2')
+ SID.from_string_sid("S-1-3-2")
end
def self.CreatorGroupServer
- SID.from_string_sid('S-1-3-3')
+ SID.from_string_sid("S-1-3-3")
end
def self.NonUnique
- SID.from_string_sid('S-1-4')
+ SID.from_string_sid("S-1-4")
end
def self.Nt
- SID.from_string_sid('S-1-5')
+ SID.from_string_sid("S-1-5")
end
def self.Dialup
- SID.from_string_sid('S-1-5-1')
+ SID.from_string_sid("S-1-5-1")
end
def self.Network
- SID.from_string_sid('S-1-5-2')
+ SID.from_string_sid("S-1-5-2")
end
def self.Batch
- SID.from_string_sid('S-1-5-3')
+ SID.from_string_sid("S-1-5-3")
end
def self.Interactive
- SID.from_string_sid('S-1-5-4')
+ SID.from_string_sid("S-1-5-4")
end
def self.Service
- SID.from_string_sid('S-1-5-6')
+ SID.from_string_sid("S-1-5-6")
end
def self.Anonymous
- SID.from_string_sid('S-1-5-7')
+ SID.from_string_sid("S-1-5-7")
end
def self.Proxy
- SID.from_string_sid('S-1-5-8')
+ SID.from_string_sid("S-1-5-8")
end
def self.EnterpriseDomainControllers
- SID.from_string_sid('S-1-5-9')
+ SID.from_string_sid("S-1-5-9")
end
def self.PrincipalSelf
- SID.from_string_sid('S-1-5-10')
+ SID.from_string_sid("S-1-5-10")
end
def self.AuthenticatedUsers
- SID.from_string_sid('S-1-5-11')
+ SID.from_string_sid("S-1-5-11")
end
def self.RestrictedCode
- SID.from_string_sid('S-1-5-12')
+ SID.from_string_sid("S-1-5-12")
end
def self.TerminalServerUsers
- SID.from_string_sid('S-1-5-13')
+ SID.from_string_sid("S-1-5-13")
end
def self.LocalSystem
- SID.from_string_sid('S-1-5-18')
+ SID.from_string_sid("S-1-5-18")
end
def self.NtLocal
- SID.from_string_sid('S-1-5-19')
+ SID.from_string_sid("S-1-5-19")
end
def self.NtNetwork
- SID.from_string_sid('S-1-5-20')
+ SID.from_string_sid("S-1-5-20")
end
def self.BuiltinAdministrators
- SID.from_string_sid('S-1-5-32-544')
+ SID.from_string_sid("S-1-5-32-544")
end
def self.BuiltinUsers
- SID.from_string_sid('S-1-5-32-545')
+ SID.from_string_sid("S-1-5-32-545")
end
def self.Guests
- SID.from_string_sid('S-1-5-32-546')
+ SID.from_string_sid("S-1-5-32-546")
end
def self.PowerUsers
- SID.from_string_sid('S-1-5-32-547')
+ SID.from_string_sid("S-1-5-32-547")
end
def self.AccountOperators
- SID.from_string_sid('S-1-5-32-548')
+ SID.from_string_sid("S-1-5-32-548")
end
def self.ServerOperators
- SID.from_string_sid('S-1-5-32-549')
+ SID.from_string_sid("S-1-5-32-549")
end
def self.PrintOperators
- SID.from_string_sid('S-1-5-32-550')
+ SID.from_string_sid("S-1-5-32-550")
end
def self.BackupOperators
- SID.from_string_sid('S-1-5-32-551')
+ SID.from_string_sid("S-1-5-32-551")
end
def self.Replicators
- SID.from_string_sid('S-1-5-32-552')
+ SID.from_string_sid("S-1-5-32-552")
end
def self.Administrators
- SID.from_string_sid('S-1-5-32-544')
+ SID.from_string_sid("S-1-5-32-544")
end
def self.None
diff --git a/lib/chef/win32/security/token.rb b/lib/chef/win32/security/token.rb
index 8d4e54ad8c..3184bc449a 100644
--- a/lib/chef/win32/security/token.rb
+++ b/lib/chef/win32/security/token.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/win32/security'
-require 'chef/win32/api/security'
-require 'chef/win32/unicode'
-require 'ffi'
+require "chef/win32/security"
+require "chef/win32/api/security"
+require "chef/win32/unicode"
+require "ffi"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/system.rb b/lib/chef/win32/system.rb
index cdd063f174..e91285568c 100755
--- a/lib/chef/win32/system.rb
+++ b/lib/chef/win32/system.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/win32/api/system'
-require 'chef/win32/error'
-require 'ffi'
+require "chef/win32/api/system"
+require "chef/win32/error"
+require "ffi"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/unicode.rb b/lib/chef/win32/unicode.rb
index d63b9790b9..da38e92cdd 100644
--- a/lib/chef/win32/unicode.rb
+++ b/lib/chef/win32/unicode.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'chef/mixin/wide_string'
-require 'chef/win32/api/unicode'
+require "chef/mixin/wide_string"
+require "chef/win32/api/unicode"
class Chef
module ReservedNames::Win32
diff --git a/lib/chef/win32/version.rb b/lib/chef/win32/version.rb
index ca715dd604..85a71491df 100644
--- a/lib/chef/win32/version.rb
+++ b/lib/chef/win32/version.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/win32/api'
-require 'chef/win32/api/system'
-require 'wmi-lite/wmi'
+require "chef/win32/api"
+require "chef/win32/api/system"
+require "wmi-lite/wmi"
class Chef
module ReservedNames::Win32
@@ -123,13 +123,13 @@ class Chef
# http://msdn.microsoft.com/en-us/library/windows/desktop/ms724439(v=vs.85).aspx
wmi = WmiLite::Wmi.new
- os_info = wmi.first_of('Win32_OperatingSystem')
- os_version = os_info['version']
+ os_info = wmi.first_of("Win32_OperatingSystem")
+ os_version = os_info["version"]
# The operating system version is a string in the following form
# that can be split into components based on the '.' delimiter:
# MajorVersionNumber.MinorVersionNumber.BuildNumber
- os_version.split('.').collect { | version_string | version_string.to_i }
+ os_version.split(".").collect { | version_string | version_string.to_i }
end
def get_version_ex
diff --git a/lib/chef/workstation_config_loader.rb b/lib/chef/workstation_config_loader.rb
index 8398c5d616..89080c1777 100644
--- a/lib/chef/workstation_config_loader.rb
+++ b/lib/chef/workstation_config_loader.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef-config/workstation_config_loader'
+require "chef-config/workstation_config_loader"
class Chef
WorkstationConfigLoader = ChefConfig::WorkstationConfigLoader
diff --git a/omnibus/Berksfile b/omnibus/Berksfile
index 72dcf108fe..614c6da643 100644
--- a/omnibus/Berksfile
+++ b/omnibus/Berksfile
@@ -1,12 +1,12 @@
-source 'https://supermarket.chef.io'
+source "https://supermarket.chef.io"
-cookbook 'omnibus'
+cookbook "omnibus"
# Uncomment to use the latest version of the Omnibus cookbook from GitHub
# cookbook 'omnibus', github: 'opscode-cookbooks/omnibus'
group :integration do
- cookbook 'apt', '~> 2.3'
- cookbook 'freebsd', '~> 0.1'
- cookbook 'yum-epel', '~> 0.3'
+ cookbook "apt", "~> 2.3"
+ cookbook "freebsd", "~> 0.1"
+ cookbook "yum-epel", "~> 0.3"
end
diff --git a/omnibus/Gemfile b/omnibus/Gemfile
index ad415d576a..12001d1c17 100644
--- a/omnibus/Gemfile
+++ b/omnibus/Gemfile
@@ -1,7 +1,7 @@
-source 'https://rubygems.org'
+source "https://rubygems.org"
-gem 'omnibus', github: 'chef/omnibus'
-gem 'omnibus-software', github: 'chef/omnibus-software'
+gem "omnibus", github: "chef/omnibus"
+gem "omnibus-software", github: "chef/omnibus-software"
# This development group is installed by default when you run `bundle install`,
# but if you are using Omnibus in a CI-based infrastructure, you do not need
@@ -9,10 +9,10 @@ gem 'omnibus-software', github: 'chef/omnibus-software'
# by running `bundle install --without development` to speed up build times.
group :development do
# Use Berkshelf for resolving cookbook dependencies
- gem 'berkshelf', '~> 3.0'
+ gem "berkshelf", "~> 3.0"
# Use Test Kitchen with Vagrant for converging the build environment
- gem 'test-kitchen', '~> 1.4.0'
- gem 'kitchen-vagrant', '~> 0.19.0'
- gem 'winrm-transport', '~> 1.0'
+ gem "test-kitchen", "~> 1.4.0"
+ gem "kitchen-vagrant", "~> 0.19.0"
+ gem "winrm-transport", "~> 1.0"
end
diff --git a/omnibus/config/projects/angrychef.rb b/omnibus/config/projects/angrychef.rb
index c585c73040..e89dd80fab 100644
--- a/omnibus/config/projects/angrychef.rb
+++ b/omnibus/config/projects/angrychef.rb
@@ -19,7 +19,7 @@
# test machines. As such this project definition is just a thin wrapper around
# `config/project/chef.rb`.
#
-chef_project_contents = IO.read(File.expand_path('../chef.rb', __FILE__))
+chef_project_contents = IO.read(File.expand_path("../chef.rb", __FILE__))
self.instance_eval chef_project_contents
name "angrychef"
diff --git a/omnibus/config/projects/chef-fips.rb b/omnibus/config/projects/chef-fips.rb
index 32bbbc9c48..fbb28fa5cc 100644
--- a/omnibus/config/projects/chef-fips.rb
+++ b/omnibus/config/projects/chef-fips.rb
@@ -18,7 +18,7 @@
# This is the chef client build with FIPS mode enabled.
# It's a stub for now and produces identical results
#
-chef_project_contents = IO.read(File.expand_path('../chef.rb', __FILE__))
+chef_project_contents = IO.read(File.expand_path("../chef.rb", __FILE__))
self.instance_eval chef_project_contents
name "chef-fips"
diff --git a/omnibus/config/projects/chef.rb b/omnibus/config/projects/chef.rb
index b8b121e0d2..a615069c9d 100644
--- a/omnibus/config/projects/chef.rb
+++ b/omnibus/config/projects/chef.rb
@@ -20,7 +20,7 @@ maintainer "Chef Software, Inc. <maintainers@chef.io>"
homepage "https://www.chef.io"
build_iteration 1
-build_version '12.6.0'
+build_version "12.6.0"
if windows?
# NOTE: Ruby DevKit fundamentally CANNOT be installed into "Program Files"
@@ -53,8 +53,8 @@ else
end
# Chef Release version pinning
-override :chef, version: 'local_source'
-override :ohai, version: 'master'
+override :chef, version: "local_source"
+override :ohai, version: "master"
dependency "preparation"
@@ -64,7 +64,7 @@ dependency "version-manifest"
dependency "openssl-customization"
package :rpm do
- signing_passphrase ENV['OMNIBUS_RPM_SIGNING_PASSPHRASE']
+ signing_passphrase ENV["OMNIBUS_RPM_SIGNING_PASSPHRASE"]
end
proj_to_work_around_cleanroom = self
@@ -79,7 +79,7 @@ project_location_dir = name
package :msi do
fast_msi true
upgrade_code msi_upgrade_code
- wix_candle_extension 'WixUtilExtension'
+ wix_candle_extension "WixUtilExtension"
signing_identity "F74E1A68005E8A9C465C3D2FF7B41F3988F0EA09", machine_store: true
parameters ChefLogDllPath: windows_safe_path(gem_path("chef-[0-9]*-mingw32/ext/win32-eventlog/chef-log.dll")),
ProjectLocationDir: project_location_dir
diff --git a/omnibus/omnibus.rb b/omnibus/omnibus.rb
index 3afa2ad84e..663235d340 100644
--- a/omnibus/omnibus.rb
+++ b/omnibus/omnibus.rb
@@ -26,8 +26,8 @@
# Windows architecture defaults - set to x86 unless otherwise specified.
# ------------------------------
-windows_arch %w{x86 x64}.include?((ENV['OMNIBUS_WINDOWS_ARCH'] || '').downcase) ?
- ENV['OMNIBUS_WINDOWS_ARCH'].downcase.to_sym : :x86
+windows_arch %w{x86 x64}.include?((ENV["OMNIBUS_WINDOWS_ARCH"] || "").downcase) ?
+ ENV["OMNIBUS_WINDOWS_ARCH"].downcase.to_sym : :x86
# Disable git caching
# ------------------------------
@@ -36,9 +36,9 @@ windows_arch %w{x86 x64}.include?((ENV['OMNIBUS_WINDOWS_ARCH'] || '').downcase
# Enable S3 asset caching
# ------------------------------
use_s3_caching true
-s3_access_key ENV['AWS_ACCESS_KEY_ID']
-s3_secret_key ENV['AWS_SECRET_ACCESS_KEY']
-s3_bucket 'opscode-omnibus-cache'
+s3_access_key ENV["AWS_ACCESS_KEY_ID"]
+s3_secret_key ENV["AWS_SECRET_ACCESS_KEY"]
+s3_bucket "opscode-omnibus-cache"
build_retries 3
fetcher_retries 3
diff --git a/spec/functional/application_spec.rb b/spec/functional/application_spec.rb
index 4d24549696..c21a892b54 100644
--- a/spec/functional/application_spec.rb
+++ b/spec/functional/application_spec.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "chef/mixin/shell_out"
describe Chef::Application do
include Chef::Mixin::ShellOut
diff --git a/spec/functional/audit/rspec_formatter_spec.rb b/spec/functional/audit/rspec_formatter_spec.rb
index 009374db68..b6b7cd7c78 100644
--- a/spec/functional/audit/rspec_formatter_spec.rb
+++ b/spec/functional/audit/rspec_formatter_spec.rb
@@ -18,12 +18,12 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'rspec/core/sandbox'
-require 'chef/audit/runner'
-require 'rspec/support/spec/in_sub_process'
-require 'rspec/support/spec/stderr_splitter'
-require 'chef/audit/rspec_formatter'
+require "spec_helper"
+require "rspec/core/sandbox"
+require "chef/audit/runner"
+require "rspec/support/spec/in_sub_process"
+require "rspec/support/spec/stderr_splitter"
+require "chef/audit/rspec_formatter"
describe Chef::Audit::RspecFormatter do
include RSpec::Support::InSubProcess
diff --git a/spec/functional/audit/runner_spec.rb b/spec/functional/audit/runner_spec.rb
index 4f7f27150c..64c361655d 100644
--- a/spec/functional/audit/runner_spec.rb
+++ b/spec/functional/audit/runner_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'rspec/core/sandbox'
-require 'chef/audit/runner'
-require 'rspec/support/spec/in_sub_process'
-require 'rspec/support/spec/stderr_splitter'
-require 'tempfile'
+require "spec_helper"
+require "rspec/core/sandbox"
+require "chef/audit/runner"
+require "rspec/support/spec/in_sub_process"
+require "rspec/support/spec/stderr_splitter"
+require "tempfile"
##
# This functional test ensures that our runner can be setup to not interfere with existing RSpec
diff --git a/spec/functional/dsl/reboot_pending_spec.rb b/spec/functional/dsl/reboot_pending_spec.rb
index 1d11f38dbc..966f8b58c5 100644
--- a/spec/functional/dsl/reboot_pending_spec.rb
+++ b/spec/functional/dsl/reboot_pending_spec.rb
@@ -47,19 +47,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
+ 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
@@ -69,7 +69,7 @@ describe Chef::DSL::RebootPending, :windows_only do
let(:original_set) { registry.key_exists?(reg_key) }
it "returns true if the registry key exists" do
- skip 'found existing registry key' if original_set
+ skip "found existing registry key" if original_set
pending "Permissions are limited to 'TrustedInstaller' by default"
registry.create_key(reg_key, false)
@@ -88,7 +88,7 @@ describe Chef::DSL::RebootPending, :windows_only do
let(:original_set) { registry.key_exists?(reg_key) }
it "returns true if the registry key exists" do
- skip 'found existing registry key' if original_set
+ skip "found existing registry key" if original_set
registry.create_key(reg_key, false)
expect(recipe.reboot_pending?).to be_truthy
@@ -103,7 +103,7 @@ describe Chef::DSL::RebootPending, :windows_only do
describe "when there is nothing to indicate a reboot is pending" do
it "should return false" do
- skip 'reboot pending' if @any_flag.any? { |_,v| v == true }
+ skip "reboot pending" if @any_flag.any? { |_,v| v == true }
expect(recipe.reboot_pending?).to be_falsey
end
end
diff --git a/spec/functional/dsl/registry_helper_spec.rb b/spec/functional/dsl/registry_helper_spec.rb
index df5b09f1f6..20efade913 100644
--- a/spec/functional/dsl/registry_helper_spec.rb
+++ b/spec/functional/dsl/registry_helper_spec.rb
@@ -25,8 +25,8 @@ describe Chef::Resource::RegistryKey, :windows_only do
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root"
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch"
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root', Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg['RootType1', Win32::Registry::REG_SZ] = 'fibrous'
- reg.write('Roots', Win32::Registry::REG_MULTI_SZ, ["strong roots", "healthy tree"])
+ reg["RootType1", Win32::Registry::REG_SZ] = "fibrous"
+ reg.write("Roots", Win32::Registry::REG_MULTI_SZ, ["strong roots", "healthy tree"])
end
events = Chef::EventDispatch::Dispatcher.new
diff --git a/spec/functional/event_loggers/windows_eventlog_spec.rb b/spec/functional/event_loggers/windows_eventlog_spec.rb
index 0723e7b984..cfab3763e1 100644
--- a/spec/functional/event_loggers/windows_eventlog_spec.rb
+++ b/spec/functional/event_loggers/windows_eventlog_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'securerandom'
-require 'chef/event_loggers/windows_eventlog'
+require "spec_helper"
+require "securerandom"
+require "chef/event_loggers/windows_eventlog"
if Chef::Platform.windows? and not Chef::Platform::windows_server_2003?
- require 'win32/eventlog'
+ require "win32/eventlog"
include Win32
end
@@ -31,45 +31,45 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only, :not_supported_o
let(:logger) { Chef::EventLoggers::WindowsEventLogger.new }
let(:flags) { nil }
let(:node) { nil }
- let(:run_status) { double('Run Status', {run_id: run_id, elapsed_time: elapsed_time }) }
+ let(:run_status) { double("Run Status", {run_id: run_id, elapsed_time: elapsed_time }) }
let(:event_log) { EventLog.new("Application") }
let!(:offset) { event_log.read_last_event.record_number }
- let(:mock_exception) { double('Exception', {message: SecureRandom.uuid, backtrace:[SecureRandom.uuid, SecureRandom.uuid]})}
+ let(:mock_exception) { double("Exception", {message: SecureRandom.uuid, backtrace:[SecureRandom.uuid, SecureRandom.uuid]})}
- it 'is available' do
+ it "is available" do
expect(Chef::EventLoggers::WindowsEventLogger.available?).to be_truthy
end
- it 'writes run_start event with event_id 10000 and contains version' do
+ it "writes run_start event with event_id 10000 and contains version" do
logger.run_start(version)
- expect(event_log.read(flags, offset).any? { |e| e.source == 'Chef' && e.event_id == 10000 &&
+ expect(event_log.read(flags, offset).any? { |e| e.source == "Chef" && e.event_id == 10000 &&
e.string_inserts[0].include?(version)}).to be_truthy
end
- it 'writes run_started event with event_id 10001 and contains the run_id' do
+ it "writes run_started event with event_id 10001 and contains the run_id" do
logger.run_started(run_status)
- expect(event_log.read(flags, offset).any? { |e| e.source == 'Chef' && e.event_id == 10001 &&
+ expect(event_log.read(flags, offset).any? { |e| e.source == "Chef" && e.event_id == 10001 &&
e.string_inserts[0].include?(run_id)}).to be_truthy
end
- it 'writes run_completed event with event_id 10002 and contains the run_id and elapsed time' do
+ it "writes run_completed event with event_id 10002 and contains the run_id and elapsed time" do
logger.run_started(run_status)
logger.run_completed(node)
- expect(event_log.read(flags, offset).any? { |e| e.source == 'Chef' && e.event_id == 10002 &&
+ expect(event_log.read(flags, offset).any? { |e| e.source == "Chef" && e.event_id == 10002 &&
e.string_inserts[0].include?(run_id) &&
e.string_inserts[1].include?(elapsed_time.to_s)
}).to be_truthy
end
- it 'writes run_failed event with event_id 10003 and contains the run_id, elapsed time, and exception info' do
+ it "writes run_failed event with event_id 10003 and contains the run_id, elapsed time, and exception info" do
logger.run_started(run_status)
logger.run_failed(mock_exception)
expect(event_log.read(flags, offset).any? do |e|
- e.source == 'Chef' && e.event_id == 10003 &&
+ e.source == "Chef" && e.event_id == 10003 &&
e.string_inserts[0].include?(run_id) &&
e.string_inserts[1].include?(elapsed_time.to_s) &&
e.string_inserts[2].include?(mock_exception.class.name) &&
@@ -79,11 +79,11 @@ describe Chef::EventLoggers::WindowsEventLogger, :windows_only, :not_supported_o
end).to be_truthy
end
- it 'writes run_failed event with event_id 10003 even when run_status is not set' do
+ it "writes run_failed event with event_id 10003 even when run_status is not set" do
logger.run_failed(mock_exception)
expect(event_log.read(flags, offset).any? do |e|
- e.source == 'Chef' && e.event_id == 10003 &&
+ e.source == "Chef" && e.event_id == 10003 &&
e.string_inserts[0].include?("UNKNOWN") &&
e.string_inserts[1].include?("UNKNOWN") &&
e.string_inserts[2].include?(mock_exception.class.name) &&
diff --git a/spec/functional/file_content_management/deploy_strategies_spec.rb b/spec/functional/file_content_management/deploy_strategies_spec.rb
index 793da28ef9..b11c3d5abf 100644
--- a/spec/functional/file_content_management/deploy_strategies_spec.rb
+++ b/spec/functional/file_content_management/deploy_strategies_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
shared_examples_for "a content deploy strategy" do
diff --git a/spec/functional/http/simple_spec.rb b/spec/functional/http/simple_spec.rb
index 36468b4eba..7b395cba30 100644
--- a/spec/functional/http/simple_spec.rb
+++ b/spec/functional/http/simple_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tiny_server'
-require 'support/shared/functional/http'
+require "spec_helper"
+require "tiny_server"
+require "support/shared/functional/http"
describe Chef::HTTP::Simple do
include ChefHTTPShared
@@ -84,14 +84,14 @@ describe Chef::HTTP::Simple do
context "when Chef::Log.level = :debug" do
before do
Chef::Log.level = :debug
- @debug_log = ''
+ @debug_log = ""
allow(Chef::Log).to receive(:debug) { |str| @debug_log << str }
end
- let(:source) { 'http://localhost:9000' }
+ let(:source) { "http://localhost:9000" }
it "Logs the request and response for 200's but not the body" do
- http_client.get('http://localhost:9000/nyan_cat.png')
+ http_client.get("http://localhost:9000/nyan_cat.png")
expect(@debug_log).to match(/200/)
expect(@debug_log).to match(/HTTP Request Header Data/)
expect(@debug_log).to match(/HTTP Status and Header Data/)
@@ -101,7 +101,7 @@ describe Chef::HTTP::Simple do
end
it "Logs the request and response for 200 POST, but not the body" do
- http_client.post('http://localhost:9000/posty', 'hithere')
+ http_client.post("http://localhost:9000/posty", "hithere")
expect(@debug_log).to match(/200/)
expect(@debug_log).to match(/HTTP Request Header Data/)
expect(@debug_log).to match(/HTTP Status and Header Data/)
@@ -113,7 +113,7 @@ describe Chef::HTTP::Simple do
it "Logs the request and response and bodies for 400 response" do
expect do
- http_client.get('http://localhost:9000/bad_request')
+ http_client.get("http://localhost:9000/bad_request")
end.to raise_error(Net::HTTPServerException)
expect(@debug_log).to match(/400/)
expect(@debug_log).to match(/HTTP Request Header Data/)
@@ -126,7 +126,7 @@ describe Chef::HTTP::Simple do
it "Logs the request and response and bodies for 400 POST response" do
expect do
- http_client.post('http://localhost:9000/bad_request', 'hithere')
+ http_client.post("http://localhost:9000/bad_request", "hithere")
end.to raise_error(Net::HTTPServerException)
expect(@debug_log).to match(/400/)
expect(@debug_log).to match(/HTTP Request Header Data/)
diff --git a/spec/functional/knife/configure_spec.rb b/spec/functional/knife/configure_spec.rb
index 3bef18a0aa..4c02f15200 100644
--- a/spec/functional/knife/configure_spec.rb
+++ b/spec/functional/knife/configure_spec.rb
@@ -16,23 +16,23 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/knife/configure'
-require 'ohai'
+require "chef/knife/configure"
+require "ohai"
describe "knife configure" do
let (:ohai) do
o = Ohai::System.new
o.load_plugins
- o.require_plugin 'os'
- o.require_plugin 'hostname'
+ o.require_plugin "os"
+ o.require_plugin "hostname"
o
end
it "loads the fqdn from Ohai" do
knife_configure = Chef::Knife::Configure.new
- hostname_guess = ohai[:fqdn] || ohai[:machinename] || ohai[:hostname] || 'localhost'
+ hostname_guess = ohai[:fqdn] || ohai[:machinename] || ohai[:hostname] || "localhost"
expect(knife_configure.guess_servername).to eql(hostname_guess)
end
end
diff --git a/spec/functional/knife/cookbook_delete_spec.rb b/spec/functional/knife/cookbook_delete_spec.rb
index bffad8cbed..9b847ba2da 100644
--- a/spec/functional/knife/cookbook_delete_spec.rb
+++ b/spec/functional/knife/cookbook_delete_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tiny_server'
+require "spec_helper"
+require "tiny_server"
describe Chef::Knife::CookbookDelete do
before(:all) do
@@ -32,7 +32,7 @@ describe Chef::Knife::CookbookDelete do
Chef::Config[:node_name] = nil
Chef::Config[:client_key] = nil
- Chef::Config[:chef_server_url] = 'http://localhost:9000'
+ Chef::Config[:chef_server_url] = "http://localhost:9000"
end
after(:all) do
@@ -44,7 +44,7 @@ describe Chef::Knife::CookbookDelete do
before do
@knife.name_args = %w{no-such-cookbook}
- @api.get("/cookbooks/no-such-cookbook", 404, Chef::JSONCompat.to_json({'error'=>'dear Tim, no. -Sent from my iPad'}))
+ @api.get("/cookbooks/no-such-cookbook", 404, Chef::JSONCompat.to_json({"error"=>"dear Tim, no. -Sent from my iPad"}))
end
around do |ex|
@@ -71,7 +71,7 @@ describe Chef::Knife::CookbookDelete do
context "when there is only one version of a cookbook" do
before do
@knife.name_args = %w{obsolete-cookbook}
- @cookbook_list = {'obsolete-cookbook' => { 'versions' => ['version' => '1.0.0']} }
+ @cookbook_list = {"obsolete-cookbook" => { "versions" => ["version" => "1.0.0"]} }
@api.get("/cookbooks/obsolete-cookbook", 200, Chef::JSONCompat.to_json(@cookbook_list))
end
@@ -112,9 +112,9 @@ describe Chef::Knife::CookbookDelete do
context "when there are several versions of a cookbook" do
before do
@knife.name_args = %w{obsolete-cookbook}
- versions = ['1.0.0', '1.1.0', '1.2.0']
- with_version = lambda { |version| { 'version' => version } }
- @cookbook_list = {'obsolete-cookbook' => { 'versions' => versions.map(&with_version) } }
+ versions = ["1.0.0", "1.1.0", "1.2.0"]
+ with_version = lambda { |version| { "version" => version } }
+ @cookbook_list = {"obsolete-cookbook" => { "versions" => versions.map(&with_version) } }
@api.get("/cookbooks/obsolete-cookbook", 200, Chef::JSONCompat.to_json(@cookbook_list))
end
diff --git a/spec/functional/knife/exec_spec.rb b/spec/functional/knife/exec_spec.rb
index 6262094a9f..9fa0bcc83a 100644
--- a/spec/functional/knife/exec_spec.rb
+++ b/spec/functional/knife/exec_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tiny_server'
+require "spec_helper"
+require "tiny_server"
describe Chef::Knife::Exec do
before(:all) do
@@ -32,7 +32,7 @@ describe Chef::Knife::Exec do
Chef::Config[:node_name] = nil
Chef::Config[:client_key] = nil
- Chef::Config[:chef_server_url] = 'http://localhost:9000'
+ Chef::Config[:chef_server_url] = "http://localhost:9000"
$output = StringIO.new
end
diff --git a/spec/functional/knife/smoke_test.rb b/spec/functional/knife/smoke_test.rb
index b718bc50e0..77ee4a88fb 100644
--- a/spec/functional/knife/smoke_test.rb
+++ b/spec/functional/knife/smoke_test.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe "knife smoke tests" do
diff --git a/spec/functional/knife/ssh_spec.rb b/spec/functional/knife/ssh_spec.rb
index 0844a0aa85..56ba2ecfa2 100644
--- a/spec/functional/knife/ssh_spec.rb
+++ b/spec/functional/knife/ssh_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tiny_server'
+require "spec_helper"
+require "tiny_server"
describe Chef::Knife::Ssh do
@@ -50,7 +50,7 @@ describe Chef::Knife::Ssh do
describe "identity file" do
context "when knife[:ssh_identity_file] is set" do
before do
- setup_knife(['*:*', 'uptime'])
+ setup_knife(["*:*", "uptime"])
Chef::Config[:knife][:ssh_identity_file] = "~/.ssh/aws.rsa"
end
@@ -62,7 +62,7 @@ describe Chef::Knife::Ssh do
context "when knife[:ssh_identity_file] is set and frozen" do
before do
- setup_knife(['*:*', 'uptime'])
+ setup_knife(["*:*", "uptime"])
Chef::Config[:knife][:ssh_identity_file] = "~/.ssh/aws.rsa".freeze
end
@@ -74,7 +74,7 @@ describe Chef::Knife::Ssh do
context "when -i is provided" do
before do
- setup_knife(['-i ~/.ssh/aws.rsa', '*:*', 'uptime'])
+ setup_knife(["-i ~/.ssh/aws.rsa", "*:*", "uptime"])
Chef::Config[:knife][:ssh_identity_file] = nil
end
@@ -92,7 +92,7 @@ describe Chef::Knife::Ssh do
context "when knife[:ssh_identity_file] is not provided]" do
before do
- setup_knife(['*:*', 'uptime'])
+ setup_knife(["*:*", "uptime"])
Chef::Config[:knife][:ssh_identity_file] = nil
end
@@ -106,7 +106,7 @@ describe Chef::Knife::Ssh do
describe "port" do
context "when -p 31337 is provided" do
before do
- setup_knife(['-p 31337', '*:*', 'uptime'])
+ setup_knife(["-p 31337", "*:*", "uptime"])
end
it "uses the ssh_port" do
@@ -119,7 +119,7 @@ describe Chef::Knife::Ssh do
describe "user" do
context "when knife[:ssh_user] is set" do
before do
- setup_knife(['*:*', 'uptime'])
+ setup_knife(["*:*", "uptime"])
Chef::Config[:knife][:ssh_user] = "ubuntu"
end
@@ -131,7 +131,7 @@ describe Chef::Knife::Ssh do
context "when knife[:ssh_user] is set and frozen" do
before do
- setup_knife(['*:*', 'uptime'])
+ setup_knife(["*:*", "uptime"])
Chef::Config[:knife][:ssh_user] = "ubuntu".freeze
end
@@ -143,7 +143,7 @@ describe Chef::Knife::Ssh do
context "when -x is provided" do
before do
- setup_knife(['-x ubuntu', '*:*', 'uptime'])
+ setup_knife(["-x ubuntu", "*:*", "uptime"])
Chef::Config[:knife][:ssh_user] = nil
end
@@ -161,7 +161,7 @@ describe Chef::Knife::Ssh do
context "when knife[:ssh_user] is not provided]" do
before do
- setup_knife(['*:*', 'uptime'])
+ setup_knife(["*:*", "uptime"])
Chef::Config[:knife][:ssh_user] = nil
end
@@ -175,7 +175,7 @@ describe Chef::Knife::Ssh do
describe "attribute" do
context "when knife[:ssh_attribute] is set" do
before do
- setup_knife(['*:*', 'uptime'])
+ setup_knife(["*:*", "uptime"])
Chef::Config[:knife][:ssh_attribute] = "ec2.public_hostname"
end
@@ -187,7 +187,7 @@ describe Chef::Knife::Ssh do
context "when knife[:ssh_attribute] is not provided]" do
before do
- setup_knife(['*:*', 'uptime'])
+ setup_knife(["*:*", "uptime"])
Chef::Config[:knife][:ssh_attribute] = nil
end
@@ -199,7 +199,7 @@ describe Chef::Knife::Ssh do
context "when -a ec2.public_ipv4 is provided" do
before do
- setup_knife(['-a ec2.public_hostname', '*:*', 'uptime'])
+ setup_knife(["-a ec2.public_hostname", "*:*", "uptime"])
Chef::Config[:knife][:ssh_attribute] = nil
end
@@ -212,7 +212,7 @@ describe Chef::Knife::Ssh do
# This is the setting imported from knife.rb
Chef::Config[:knife][:ssh_attribute] = "fqdn"
# Then we run knife with the -a flag, which sets the above variable
- setup_knife(['-a ec2.public_hostname', '*:*', 'uptime'])
+ setup_knife(["-a ec2.public_hostname", "*:*", "uptime"])
@knife.run
expect(@knife.config[:attribute]).to eq("ec2.public_hostname")
end
@@ -222,7 +222,7 @@ describe Chef::Knife::Ssh do
describe "gateway" do
context "when knife[:ssh_gateway] is set" do
before do
- setup_knife(['*:*', 'uptime'])
+ setup_knife(["*:*", "uptime"])
Chef::Config[:knife][:ssh_gateway] = "user@ec2.public_hostname"
end
@@ -235,7 +235,7 @@ describe Chef::Knife::Ssh do
context "when -G user@ec2.public_hostname is provided" do
before do
- setup_knife(['-G user@ec2.public_hostname', '*:*', 'uptime'])
+ setup_knife(["-G user@ec2.public_hostname", "*:*", "uptime"])
Chef::Config[:knife][:ssh_gateway] = nil
end
@@ -248,7 +248,7 @@ describe Chef::Knife::Ssh do
context "when the gateway requires a password" do
before do
- setup_knife(['-G user@ec2.public_hostname', '*:*', 'uptime'])
+ setup_knife(["-G user@ec2.public_hostname", "*:*", "uptime"])
Chef::Config[:knife][:ssh_gateway] = nil
allow(@knife.session).to receive(:via) do |host, user, options|
raise Net::SSH::AuthenticationFailed unless options[:password]
@@ -274,7 +274,7 @@ describe Chef::Knife::Ssh do
Chef::Config[:node_name] = nil
Chef::Config[:client_key] = nil
- Chef::Config[:chef_server_url] = 'http://localhost:9000'
+ Chef::Config[:chef_server_url] = "http://localhost:9000"
@api.get("/search/node?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0", 200) {
%({"total":1, "start":0, "rows":[{"name":"i-xxxxxxxx", "json_class":"Chef::Node", "automatic":{"fqdn":"the.fqdn", "ec2":{"public_hostname":"the_public_hostname"}},"recipes":[]}]})
diff --git a/spec/functional/mixin/powershell_out_spec.rb b/spec/functional/mixin/powershell_out_spec.rb
index 9cc8aeed7e..9d966c0b55 100644
--- a/spec/functional/mixin/powershell_out_spec.rb
+++ b/spec/functional/mixin/powershell_out_spec.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/powershell_out'
+require "spec_helper"
+require "chef/mixin/powershell_out"
describe Chef::Mixin::PowershellOut, windows_only: true do
include Chef::Mixin::PowershellOut
diff --git a/spec/functional/mixin/shell_out_spec.rb b/spec/functional/mixin/shell_out_spec.rb
index 8f8b54414a..3c05eec8aa 100644
--- a/spec/functional/mixin/shell_out_spec.rb
+++ b/spec/functional/mixin/shell_out_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Mixin::ShellOut do
include Chef::Mixin::ShellOut
@@ -24,24 +24,24 @@ describe Chef::Mixin::ShellOut do
describe "when environment['LC_ALL'] is not set" do
it "should use the default shell_out setting" do
cmd = if windows?
- shell_out_with_systems_locale('echo %LC_ALL%')
+ shell_out_with_systems_locale("echo %LC_ALL%")
else
- shell_out_with_systems_locale('echo $LC_ALL')
+ shell_out_with_systems_locale("echo $LC_ALL")
end
- expect(cmd.stdout.chomp).to match_environment_variable('LC_ALL')
+ expect(cmd.stdout.chomp).to match_environment_variable("LC_ALL")
end
end
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'
+ expect(cmd.stdout.chomp).to eq "POSIX"
end
end
end
diff --git a/spec/functional/notifications_spec.rb b/spec/functional/notifications_spec.rb
index d448ea175d..ec6e514836 100644
--- a/spec/functional/notifications_spec.rb
+++ b/spec/functional/notifications_spec.rb
@@ -1,5 +1,5 @@
-require 'spec_helper'
-require 'chef/recipe'
+require "spec_helper"
+require "chef/recipe"
# The goal of these tests is to make sure that loading resources from a file creates the necessary notifications.
diff --git a/spec/functional/provider/remote_file/cache_control_data_spec.rb b/spec/functional/provider/remote_file/cache_control_data_spec.rb
index 41f228ae3c..5b31f64f64 100755
--- a/spec/functional/provider/remote_file/cache_control_data_spec.rb
+++ b/spec/functional/provider/remote_file/cache_control_data_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'uri'
+require "spec_helper"
+require "uri"
describe Chef::Provider::RemoteFile::CacheControlData do
@@ -75,7 +75,7 @@ describe Chef::Provider::RemoteFile::CacheControlData do
# file system API's on both Windows and Unix systems.
context "when the length of the uri exceeds the path length limits for the local file system" do
let(:uri_exceeds_file_system_limit) do
- URI.parse("http://www.bing.com/" + ('0' * 1024))
+ URI.parse("http://www.bing.com/" + ("0" * 1024))
end
let(:uri) { uri_exceeds_file_system_limit }
diff --git a/spec/functional/provider/whyrun_safe_ruby_block_spec.rb b/spec/functional/provider/whyrun_safe_ruby_block_spec.rb
index 2b582feb05..529f5da884 100644
--- a/spec/functional/provider/whyrun_safe_ruby_block_spec.rb
+++ b/spec/functional/provider/whyrun_safe_ruby_block_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::WhyrunSafeRubyBlock do
let(:node) { Chef::Node.new }
diff --git a/spec/functional/rebooter_spec.rb b/spec/functional/rebooter_spec.rb
index 79f3a49010..da104c0304 100644
--- a/spec/functional/rebooter_spec.rb
+++ b/spec/functional/rebooter_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Platform::Rebooter do
@@ -68,7 +68,7 @@ describe Chef::Platform::Rebooter do
run_context.cancel_reboot
end
- shared_context 'test a reboot method' do
+ shared_context "test a reboot method" do
def test_rebooter_method(method_sym, is_windows, expected_reboot_str)
allow(ChefConfig).to receive(:windows?).and_return(is_windows)
expect(rebooter).to receive(:shell_out!).once.with(expected_reboot_str)
@@ -78,25 +78,25 @@ describe Chef::Platform::Rebooter do
end
describe 'when using #reboot_if_needed!' do
- include_context 'test a reboot method'
+ include_context "test a reboot method"
- it 'should produce the correct string on Windows' do
+ it "should produce the correct string on Windows" do
test_rebooter_method(:reboot_if_needed!, true, expected[:windows])
end
- it 'should produce the correct (Linux-specific) string on non-Windows' do
+ it "should produce the correct (Linux-specific) string on non-Windows" do
test_rebooter_method(:reboot_if_needed!, false, expected[:linux])
end
end
describe 'when using #reboot!' do
- include_context 'test a reboot method'
+ include_context "test a reboot method"
- it 'should produce the correct string on Windows' do
+ it "should produce the correct string on Windows" do
test_rebooter_method(:reboot!, true, expected[:windows])
end
- it 'should produce the correct (Linux-specific) string on non-Windows' do
+ it "should produce the correct (Linux-specific) string on non-Windows" do
test_rebooter_method(:reboot!, false, expected[:linux])
end
end
diff --git a/spec/functional/resource/aix_service_spec.rb b/spec/functional/resource/aix_service_spec.rb
index 604c04dad7..e249bd9bc0 100755
--- a/spec/functional/resource/aix_service_spec.rb
+++ b/spec/functional/resource/aix_service_spec.rb
@@ -17,24 +17,24 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
shared_examples "src service" do
include Chef::Mixin::ShellOut
def service_should_be_started
- expect(shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(' ').last).to eq("active")
+ expect(shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(" ").last).to eq("active")
end
def service_should_be_stopped
- expect(shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(' ').last).to eq("inoperative")
+ expect(shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(" ").last).to eq("inoperative")
end
def get_service_pid
- args = shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(' ')
+ args = shell_out!("lssrc -a | grep #{new_resource.service_name}").stdout.split(" ")
if args.length == 3
args[1]
else
diff --git a/spec/functional/resource/aixinit_service_spec.rb b/spec/functional/resource/aixinit_service_spec.rb
index 3e19a16af0..6b87725c34 100755
--- a/spec/functional/resource/aixinit_service_spec.rb
+++ b/spec/functional/resource/aixinit_service_spec.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
-require 'fileutils'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
+require "fileutils"
describe Chef::Resource::Service, :requires_root, :aix_only do
@@ -130,7 +130,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
context "when the service doesn't set a priority" do
it "creates symlink with status S" do
new_resource.run_action(:enable)
- valide_symlinks(["/etc/rc.d/rc2.d/Schefinittest"],2,'S')
+ valide_symlinks(["/etc/rc.d/rc2.d/Schefinittest"],2,"S")
end
end
@@ -141,7 +141,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
it "creates a symlink with status S and a priority" do
new_resource.run_action(:enable)
- valide_symlinks(["/etc/rc.d/rc2.d/S75chefinittest"], 2,'S',75)
+ valide_symlinks(["/etc/rc.d/rc2.d/S75chefinittest"], 2,"S",75)
end
end
@@ -153,7 +153,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
it "create symlink with status start (S) or stop (K) and a priority " do
new_resource.run_action(:enable)
- valide_symlinks(["/etc/rc.d/rc2.d/S20chefinittest", "/etc/rc.d/rc3.d/K10chefinittest"], 2,'S',new_resource.priority)
+ valide_symlinks(["/etc/rc.d/rc2.d/S20chefinittest", "/etc/rc.d/rc3.d/K10chefinittest"], 2,"S",new_resource.priority)
end
end
end
@@ -171,7 +171,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
it "creates symlink with status K" do
new_resource.run_action(:disable)
- valide_symlinks(["/etc/rc.d/rc2.d/Kchefinittest"], 2,'K')
+ valide_symlinks(["/etc/rc.d/rc2.d/Kchefinittest"], 2,"K")
end
end
@@ -187,7 +187,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
it "creates a symlink with status K and a priority" do
new_resource.run_action(:disable)
- valide_symlinks(["/etc/rc.d/rc2.d/K25chefinittest"], 2,'K',25)
+ valide_symlinks(["/etc/rc.d/rc2.d/K25chefinittest"], 2,"K",25)
end
end
@@ -204,7 +204,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
it "create symlink with status stop (K) and a priority " do
new_resource.run_action(:disable)
- valide_symlinks(["/etc/rc.d/rc2.d/K80chefinittest"], 2,'K',80)
+ valide_symlinks(["/etc/rc.d/rc2.d/K80chefinittest"], 2,"K",80)
end
end
end
diff --git a/spec/functional/resource/bash_spec.rb b/spec/functional/resource/bash_spec.rb
index 209ec4a12f..0edc415ac1 100644
--- a/spec/functional/resource/bash_spec.rb
+++ b/spec/functional/resource/bash_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
+require "spec_helper"
+require "functional/resource/base"
describe Chef::Resource::Bash, :unix_only do
let(:code) { "echo hello" }
@@ -28,7 +28,7 @@ describe Chef::Resource::Bash, :unix_only do
}
describe "when setting the command attribute" do
- let (:command) { 'wizard racket' }
+ let (:command) { "wizard racket" }
# in Chef-12 the `command` attribute is largely useless, but does set the identity attribute
# so that notifications need to target the value of the command. it will not run the `command`
@@ -81,7 +81,7 @@ describe Chef::Resource::Bash, :unix_only do
end
it "times out when a timeout is set on the resource" do
- resource.code 'sleep 600'
+ resource.code "sleep 600"
resource.timeout 0.1
expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::CommandTimeout)
end
diff --git a/spec/functional/resource/batch_spec.rb b/spec/functional/resource/batch_spec.rb
index 39133fd40b..09d51e8eec 100644
--- a/spec/functional/resource/batch_spec.rb
+++ b/spec/functional/resource/batch_spec.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::WindowsScript::Batch, :windows_only do
include_context Chef::Resource::WindowsScript
- let(:output_command) { ' > ' }
+ let(:output_command) { " > " }
- let (:architecture_command) { '@echo %PROCESSOR_ARCHITECTURE%' }
+ let (:architecture_command) { "@echo %PROCESSOR_ARCHITECTURE%" }
it_behaves_like "a Windows script running on Windows"
diff --git a/spec/functional/resource/bff_spec.rb b/spec/functional/resource/bff_spec.rb
index b969254b6b..a8083b049e 100644
--- a/spec/functional/resource/bff_spec.rb
+++ b/spec/functional/resource/bff_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+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
@@ -43,7 +43,7 @@ describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform
before(:all) do
@pkg_name = "PkgA.rte"
@pkg_path = "/tmp/PkgA.1.0.0.0.bff"
- FileUtils.cp 'spec/functional/assets/PkgA.1.0.0.0.bff' , @pkg_path
+ FileUtils.cp "spec/functional/assets/PkgA.1.0.0.0.bff" , @pkg_path
end
after(:all) do
@@ -78,7 +78,7 @@ describe Chef::Resource::BffPackage, :requires_root, :external => ohai[:platform
before(:each) do
shell_out("installp -aYF -d #{@pkg_path} #{@pkg_name}")
@pkg_path = "/tmp/PkgA.2.0.0.0.bff"
- FileUtils.cp 'spec/functional/assets/PkgA.2.0.0.0.bff' , @pkg_path
+ FileUtils.cp "spec/functional/assets/PkgA.2.0.0.0.bff" , @pkg_path
end
it "should upgrade package" do
diff --git a/spec/functional/resource/cookbook_file_spec.rb b/spec/functional/resource/cookbook_file_spec.rb
index 6d4c5b4a8f..e91737572b 100644
--- a/spec/functional/resource/cookbook_file_spec.rb
+++ b/spec/functional/resource/cookbook_file_spec.rb
@@ -16,16 +16,16 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::CookbookFile do
include_context Chef::Resource::File
- let(:file_base) { 'cookbook_file_spec' }
- let(:source) { 'java.response' }
- let(:cookbook_name) { 'java' }
+ let(:file_base) { "cookbook_file_spec" }
+ let(:source) { "java.response" }
+ let(:cookbook_name) { "java" }
let(:expected_content) do
- content = File.open(File.join(CHEF_SPEC_DATA, 'cookbooks', 'java', 'files', 'default', 'java.response'), "rb") do |f|
+ content = File.open(File.join(CHEF_SPEC_DATA, "cookbooks", "java", "files", "default", "java.response"), "rb") do |f|
f.read
end
content.force_encoding(Encoding::BINARY) if content.respond_to?(:force_encoding)
@@ -39,7 +39,7 @@ describe Chef::Resource::CookbookFile do
def create_resource
# set up cookbook collection for this run to use, based on our
# spec data.
- cookbook_repo = File.expand_path(File.join(CHEF_SPEC_DATA, 'cookbooks'))
+ cookbook_repo = File.expand_path(File.join(CHEF_SPEC_DATA, "cookbooks"))
Chef::Cookbook::FileVendor.fetch_from_disk(cookbook_repo)
loader = Chef::CookbookLoader.new(cookbook_repo)
loader.load_cookbooks
@@ -66,7 +66,7 @@ describe Chef::Resource::CookbookFile do
# implementation
# stages files in temp.
context "targets a file outside of the system temp directory" do
- let(:windows_non_temp_dir) { File.join(ENV['systemdrive'], make_tmpname(file_base, "non-temp")) }
+ let(:windows_non_temp_dir) { File.join(ENV["systemdrive"], make_tmpname(file_base, "non-temp")) }
let(:path) { File.join(windows_non_temp_dir, make_tmpname(file_base)) }
before do
diff --git a/spec/functional/resource/cron_spec.rb b/spec/functional/resource/cron_spec.rb
index ed30756583..ac13f934ff 100644
--- a/spec/functional/resource/cron_spec.rb
+++ b/spec/functional/resource/cron_spec.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
describe Chef::Resource::Cron, :requires_root, :unix_only do
@@ -55,17 +55,17 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do
# Actual tests
let(:new_resource) do
new_resource = Chef::Resource::Cron.new("Chef functional test cron", run_context)
- new_resource.user 'root'
+ new_resource.user "root"
# @hourly is not supported on solaris, aix
if ohai[:platform] == "solaris" || ohai[:platform] == "solaris2" || ohai[:platform] == "aix"
new_resource.minute "0 * * * *"
else
- new_resource.minute '@hourly'
+ new_resource.minute "@hourly"
end
- new_resource.hour ''
- new_resource.day ''
- new_resource.month ''
- new_resource.weekday ''
+ new_resource.hour ""
+ new_resource.day ""
+ new_resource.month ""
+ new_resource.weekday ""
new_resource.command "/bin/true"
new_resource
end
@@ -107,7 +107,7 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do
exclude_solaris = ["solaris", "opensolaris", "solaris2", "omnios"].include?(ohai[:platform])
describe "create action with various attributes", :external => exclude_solaris do
def create_and_validate_with_attribute(resource, attribute, value)
- if ohai[:platform] == 'aix'
+ 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./)
else
resource.run_action(:create)
@@ -117,7 +117,7 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do
end
def cron_attribute_should_exists(cron_name, attribute, value)
- return if ['aix', 'solaris'].include?(ohai[:platform])
+ return if ["aix", "solaris"].include?(ohai[:platform])
# Test if the attribute exists on newly created cron
cron_should_exists(cron_name, "")
expect(shell_out("crontab -l -u #{new_resource.user} | grep \"#{attribute.upcase}=#{value}\"").exitstatus).to eq(0)
diff --git a/spec/functional/resource/deploy_revision_spec.rb b/spec/functional/resource/deploy_revision_spec.rb
index 4bce309a51..8b888ddf6a 100644
--- a/spec/functional/resource/deploy_revision_spec.rb
+++ b/spec/functional/resource/deploy_revision_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tmpdir'
+require "spec_helper"
+require "tmpdir"
# Deploy relies heavily on symlinks, so it doesn't work on windows.
describe Chef::Resource::DeployRevision, :unix_only => true do
diff --git a/spec/functional/resource/directory_spec.rb b/spec/functional/resource/directory_spec.rb
index 88a810964f..2097ad02b7 100644
--- a/spec/functional/resource/directory_spec.rb
+++ b/spec/functional/resource/directory_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Directory do
include_context Chef::Resource::Directory
diff --git a/spec/functional/resource/dpkg_package_spec.rb b/spec/functional/resource/dpkg_package_spec.rb
index aebe2475a5..ebfb1e3ffb 100644
--- a/spec/functional/resource/dpkg_package_spec.rb
+++ b/spec/functional/resource/dpkg_package_spec.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "chef/mixin/shell_out"
describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch: "x86_64" do
include Chef::Mixin::ShellOut
@@ -61,7 +61,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
it "installs a package when given only the filename as a name argument (no source)" do
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
+ shell_out!("dpkg -s chef-integration-test")
end
it "installs a package when given the name and a source argument" do
@@ -69,7 +69,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
+ shell_out!("dpkg -s chef-integration-test")
end
it "installs a package when given a different name and a source argument" do
@@ -77,7 +77,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
+ shell_out!("dpkg -s chef-integration-test")
end
it "installs a package when given a path as a package_name and no source" do
@@ -85,7 +85,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.package_name test1_0
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
+ shell_out!("dpkg -s chef-integration-test")
end
it "raises an error when the name is not a path and the source is not given" do
@@ -109,15 +109,15 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
shell_out!("dpkg -i #{test1_0}")
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
+ shell_out!("dpkg -s chef-integration-test")
end
it "should handle a multipackage install" do
set_dpkg_package_name [ test1_0, test2_0 ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
- shell_out!('dpkg -s chef-integration-test2')
+ shell_out!("dpkg -s chef-integration-test")
+ shell_out!("dpkg -s chef-integration-test2")
end
it "should not update multipackages that are up-to-date" do
@@ -125,8 +125,8 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ test1_0, test2_0 ]
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
- shell_out!('dpkg -s chef-integration-test2')
+ shell_out!("dpkg -s chef-integration-test")
+ shell_out!("dpkg -s chef-integration-test2")
end
it "should install the second if the first is installed" do
@@ -134,8 +134,8 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ test1_0, test2_0 ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
- shell_out!('dpkg -s chef-integration-test2')
+ shell_out!("dpkg -s chef-integration-test")
+ shell_out!("dpkg -s chef-integration-test2")
end
it "should install the first if the second is installed" do
@@ -143,8 +143,8 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ test1_0, test2_0 ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test')
- shell_out!('dpkg -s chef-integration-test2')
+ shell_out!("dpkg -s chef-integration-test")
+ shell_out!("dpkg -s chef-integration-test2")
end
end
@@ -191,13 +191,13 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
shell_out!("dpkg -i #{test1_0}")
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should do nothing if the package is not installed when the name is a source" do
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should remove a package that is installed when the name is the package name and source is nil" do
@@ -205,14 +205,14 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name "chef-integration-test"
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should do nothing if the package is not installed when the name is the package name and the source is nil" do
set_dpkg_package_name "chef-integration-test"
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should remove a package that is installed when the name is changed but the source is a package" do
@@ -221,7 +221,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should do nothing if the package is not installed when the name is changed but the source is a package" do
@@ -229,7 +229,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should remove a package if the name is a file that does not exist, but the source exists" do
@@ -239,7 +239,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should do nothing if the package is not installed when the name is a file that does not exist, but the source exists" do
@@ -249,7 +249,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source test1_0
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should remove a package if the package_name is correct, but the source does not exist" do
@@ -259,7 +259,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source File.join(test1_0, "make.it.fail")
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should do nothing if the package_name is correct, but the source does not exist, and the package is not installed" do
@@ -268,7 +268,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
dpkg_package.source File.join(test1_0, "make.it.fail")
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
+ should_be_purged_or_removed("chef-integration-test")
end
it "should remove both packages when called with two" do
@@ -276,8 +276,8 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
- should_be_purged_or_removed('chef-integration-test2', action)
+ should_be_purged_or_removed("chef-integration-test")
+ should_be_purged_or_removed("chef-integration-test2", action)
end
it "should remove a package when only the first one is installed" do
@@ -285,8 +285,8 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
- should_be_purged_or_removed('chef-integration-test2')
+ should_be_purged_or_removed("chef-integration-test")
+ should_be_purged_or_removed("chef-integration-test2")
end
it "should remove a package when only the second one is installed" do
@@ -294,16 +294,16 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
- should_be_purged_or_removed('chef-integration-test2', action)
+ should_be_purged_or_removed("chef-integration-test")
+ should_be_purged_or_removed("chef-integration-test2", action)
end
it "should do nothing when both packages are not installed" do
set_dpkg_package_name [ "chef-integration-test", "chef-integration-test2" ]
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test')
- should_be_purged_or_removed('chef-integration-test2')
+ should_be_purged_or_removed("chef-integration-test")
+ should_be_purged_or_removed("chef-integration-test2")
end
end
@@ -318,7 +318,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name "chef-integration-test2"
dpkg_package.run_action(action)
expect(dpkg_package).not_to be_updated_by_last_action
- shell_out!('dpkg -s chef-integration-test2') # its still 'installed'
+ shell_out!("dpkg -s chef-integration-test2") # its still 'installed'
end
end
@@ -333,7 +333,7 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
set_dpkg_package_name "chef-integration-test2"
dpkg_package.run_action(action)
expect(dpkg_package).to be_updated_by_last_action
- should_be_purged_or_removed('chef-integration-test2', action)
+ should_be_purged_or_removed("chef-integration-test2", action)
end
end
end
diff --git a/spec/functional/resource/dsc_resource_spec.rb b/spec/functional/resource/dsc_resource_spec.rb
index 24503f1ec7..07c0bf5eb9 100644
--- a/spec/functional/resource/dsc_resource_spec.rb
+++ b/spec/functional/resource/dsc_resource_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
before(:all) do
@ohai = Ohai::System.new
- @ohai.all_plugins(['platform', 'os', 'languages/powershell'])
+ @ohai.all_plugins(["platform", "os", "languages/powershell"])
end
let(:event_dispatch) { Chef::EventDispatch::Dispatcher.new }
@@ -38,25 +38,25 @@ describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
Chef::Resource::DscResource.new("dsc_resource_test", run_context)
}
- context 'when Powershell does not support Invoke-DscResource'
- context 'when Powershell supports Invoke-DscResource' do
+ context "when Powershell does not support Invoke-DscResource"
+ context "when Powershell supports Invoke-DscResource" do
before do
if !Chef::Platform.supports_dsc_invoke_resource?(node)
- skip 'Requires Powershell >= 5.0.10018.0'
+ skip "Requires Powershell >= 5.0.10018.0"
elsif !Chef::Platform.dsc_refresh_mode_disabled?(node)
- skip 'Requires LCM RefreshMode is Disabled'
+ skip "Requires LCM RefreshMode is Disabled"
end
end
- context 'with an invalid dsc resource' do
- it 'raises an exception if the resource is not found' do
- new_resource.resource 'thisdoesnotexist'
+ context "with an invalid dsc resource" do
+ it "raises an exception if the resource is not found" do
+ new_resource.resource "thisdoesnotexist"
expect { new_resource.run_action(:run) }.to raise_error(
Chef::Exceptions::ResourceNotFound)
end
end
- context 'with a valid dsc resource' do
- let(:tmp_file_name) { Dir::Tmpname.create('tmpfile') {} }
+ context "with a valid dsc resource" do
+ let(:tmp_file_name) { Dir::Tmpname.create("tmpfile") {} }
let(:test_text) { "'\"!@#$%^&*)(}{][\u2713~n"}
before do
@@ -69,16 +69,16 @@ describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
File.delete(tmp_file_name) if File.exists? tmp_file_name
end
- it 'converges the resource if it is not converged' do
+ it "converges the resource if it is not converged" do
new_resource.run_action(:run)
- contents = File.open(tmp_file_name, 'rb:bom|UTF-16LE') do |f|
- f.read.encode('UTF-8')
+ contents = File.open(tmp_file_name, "rb:bom|UTF-16LE") do |f|
+ f.read.encode("UTF-8")
end
expect(contents).to eq(test_text)
expect(new_resource).to be_updated
end
- it 'does not converge the resource if it is already converged' do
+ it "does not converge the resource if it is already converged" do
new_resource.run_action(:run)
expect(new_resource).to be_updated
reresource =
diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb
index 2e0830e02e..67fa30d815 100644
--- a/spec/functional/resource/dsc_script_spec.rb
+++ b/spec/functional/resource/dsc_script_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/shell_out'
-require 'chef/mixin/windows_architecture_helper'
-require 'support/shared/integration/integration_helper'
+require "spec_helper"
+require "chef/mixin/shell_out"
+require "chef/mixin/windows_architecture_helper"
+require "support/shared/integration/integration_helper"
describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
include Chef::Mixin::WindowsArchitectureHelper
@@ -35,10 +35,10 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
def create_config_script_from_code(code, configuration_name, data = false)
script_code = data ? code : "Configuration '#{configuration_name}'\n{\n\t#{code}\n}\n"
- data_suffix = data ? '_config_data' : ''
- extension = data ? 'psd1' : 'ps1'
+ data_suffix = data ? "_config_data" : ""
+ extension = data ? "psd1" : "ps1"
script_path = "#{@temp_dir}/dsc_functional_test#{data_suffix}.#{extension}"
- ::File.open(script_path, 'wt') do | script |
+ ::File.open(script_path, "wt") do | script |
script.write(script_code)
end
script_path
@@ -61,28 +61,28 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
end
end
- let(:dsc_env_variable) { 'chefenvtest' }
- let(:dsc_env_value1) { 'value1' }
- let(:env_value2) { 'value2' }
+ let(:dsc_env_variable) { "chefenvtest" }
+ let(:dsc_env_value1) { "value1" }
+ let(:env_value2) { "value2" }
let(:dsc_test_run_context) {
node = Chef::Node.new
- node.automatic['platform'] = 'windows'
- node.automatic['platform_version'] = '6.1'
- node.automatic['kernel'][:machine] = :x86_64 # Only 64-bit architecture is supported
- node.automatic[:languages][:powershell][:version] = '4.0'
+ node.automatic["platform"] = "windows"
+ node.automatic["platform_version"] = "6.1"
+ node.automatic["kernel"][:machine] = :x86_64 # Only 64-bit architecture is supported
+ node.automatic[:languages][:powershell][:version] = "4.0"
empty_events = Chef::EventDispatch::Dispatcher.new
Chef::RunContext.new(node, {}, empty_events)
}
- let(:dsc_test_resource_name) { 'DSCTest' }
+ let(:dsc_test_resource_name) { "DSCTest" }
let(:dsc_test_resource_base) {
Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context)
}
let(:test_registry_key) { 'HKEY_LOCAL_MACHINE\Software\Chef\Spec\Functional\Resource\dsc_script_spec' }
- let(:test_registry_value) { 'Registration' }
- let(:test_registry_data1) { 'LL927' }
- let(:test_registry_data2) { 'LL928' }
- let(:reg_key_name_param_name) { 'testregkeyname' }
- let(:reg_key_value_param_name) { 'testregvaluename' }
+ let(:test_registry_value) { "Registration" }
+ let(:test_registry_data1) { "LL927" }
+ let(:test_registry_data2) { "LL928" }
+ let(:reg_key_name_param_name) { "testregkeyname" }
+ let(:reg_key_value_param_name) { "testregvaluename" }
let(:registry_embedded_parameters) { "$#{reg_key_name_param_name} = '#{test_registry_key}';$#{reg_key_value_param_name} = '#{test_registry_value}'"}
let(:dsc_reg_code) { <<-EOH
#{registry_embedded_parameters}
@@ -103,15 +103,15 @@ EOH
EOH
}
- let(:dsc_user_prefix) { 'dsc' }
- let(:dsc_user_suffix) { 'chefx' }
+ let(:dsc_user_prefix) { "dsc" }
+ let(:dsc_user_suffix) { "chefx" }
let(:dsc_user) {"#{dsc_user_prefix}_usr_#{dsc_user_suffix}" }
- let(:dsc_user_prefix_env_var_name) { 'dsc_user_env_prefix' }
- let(:dsc_user_suffix_env_var_name) { 'dsc_user_env_suffix' }
+ let(:dsc_user_prefix_env_var_name) { "dsc_user_env_prefix" }
+ let(:dsc_user_suffix_env_var_name) { "dsc_user_env_suffix" }
let(:dsc_user_prefix_env_code) { "$env:#{dsc_user_prefix_env_var_name}"}
let(:dsc_user_suffix_env_code) { "$env:#{dsc_user_suffix_env_var_name}"}
- let(:dsc_user_prefix_param_name) { 'dsc_user_prefix_param' }
- let(:dsc_user_suffix_param_name) { 'dsc_user_suffix_param' }
+ let(:dsc_user_prefix_param_name) { "dsc_user_prefix_param" }
+ let(:dsc_user_suffix_param_name) { "dsc_user_suffix_param" }
let(:dsc_user_prefix_param_code) { "$#{dsc_user_prefix_param_name}"}
let(:dsc_user_suffix_param_code) { "$#{dsc_user_suffix_param_name}"}
let(:dsc_user_env_code) { "\"$(#{dsc_user_prefix_env_code})_usr_$(#{dsc_user_suffix_env_code})\""}
@@ -129,7 +129,7 @@ EOH
EOH
}
- let(:config_param_section) { '' }
+ let(:config_param_section) { "" }
let(:dsc_user_code) { "'#{dsc_user}'" }
let(:dsc_user_prefix_code) { dsc_user_prefix }
let(:dsc_user_suffix_code) { dsc_user_suffix }
@@ -170,10 +170,10 @@ EOH
EOH
}
- let(:dsc_environment_env_var_name) { 'dsc_test_cwd' }
+ let(:dsc_environment_env_var_name) { "dsc_test_cwd" }
let(:dsc_environment_no_fail_not_etc_directory) { "#{ENV['systemroot']}\\system32" }
let(:dsc_environment_fail_etc_directory) { "#{ENV['systemroot']}\\system32\\drivers\\etc" }
- let(:exception_message_signature) { 'LL927-LL928' }
+ let(:exception_message_signature) { "LL927-LL928" }
let(:dsc_environment_config) {<<-EOH
if (($pwd.path -eq '#{dsc_environment_fail_etc_directory}') -and (test-path('#{dsc_environment_fail_etc_directory}')))
{
@@ -214,19 +214,19 @@ EOH
test_key_resource.run_action(:delete_key)
end
- shared_examples_for 'a dsc_script resource with specified PowerShell configuration code' do
+ shared_examples_for "a dsc_script resource with specified PowerShell configuration code" do
let(:test_registry_data) { test_registry_data1 }
- it 'should create a registry key with a specific registry value and data' do
+ it "should create a registry key with a specific registry value and data" do
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)
end
- it_should_behave_like 'a dsc_script resource with configuration affected by cwd'
+ it_should_behave_like "a dsc_script resource with configuration affected by cwd"
end
- shared_examples_for 'a dsc_script resource with configuration affected by cwd' do
+ shared_examples_for "a dsc_script resource with configuration affected by cwd" do
after(:each) do
removal_resource = Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context)
removal_resource.code <<-EOH
@@ -239,14 +239,14 @@ EOH
removal_resource.run_action(:run)
end
- describe 'when the DSC configuration contains code that raises an exception if cwd has a specific value' do
+ describe "when the DSC configuration contains code that raises an exception if cwd has a specific value" do
let(:dsc_code) { dsc_environment_config }
- it 'should not raise an exception if the cwd is not etc' do
+ it "should not raise an exception if the cwd is not etc" do
dsc_test_resource.cwd(dsc_environment_no_fail_not_etc_directory)
expect {dsc_test_resource.run_action(:run)}.not_to raise_error
end
- it 'should raise an exception if the cwd is etc' do
+ it "should raise an exception if the cwd is etc" do
dsc_test_resource.cwd(dsc_environment_fail_etc_directory)
expect {dsc_test_resource.run_action(:run)}.to raise_error(Chef::Exceptions::PowershellCmdletException)
begin
@@ -258,14 +258,14 @@ EOH
end
end
- shared_examples_for 'a parameterized DSC configuration script' do
+ shared_examples_for "a parameterized DSC configuration script" do
let(:dsc_user_prefix_code) { dsc_user_prefix_env_code }
let(:dsc_user_suffix_code) { dsc_user_suffix_env_code }
- it_behaves_like 'a dsc_script with configuration that uses environment variables'
+ it_behaves_like "a dsc_script with configuration that uses environment variables"
end
- shared_examples_for 'a dsc_script without configuration data that takes parameters' do
- context 'when configuration data is not specified' do
+ shared_examples_for "a dsc_script without configuration data that takes parameters" do
+ context "when configuration data is not specified" do
before(:each) do
test_key_resource = Chef::Resource::RegistryKey.new(test_registry_key, dsc_test_run_context)
@@ -282,19 +282,19 @@ EOH
let(:test_registry_data) { test_registry_data1 }
let(:dsc_parameterized_env_param_value) { "val" + Random::rand.to_s }
- it 'should have a default value of nil for the configuration_data attribute' do
+ it "should have a default value of nil for the configuration_data attribute" do
expect(dsc_test_resource.configuration_data).to eql(nil)
end
- it 'should have a default value of nil for the configuration_data_path attribute' do
+ it "should have a default value of nil for the configuration_data_path attribute" do
expect(dsc_test_resource.configuration_data_script).to eql(nil)
end
let(:dsc_test_resource) { dsc_resource_from_path }
- let(:registry_embedded_parameters) { '' }
+ let(:registry_embedded_parameters) { "" }
let(:dsc_code) { dsc_reg_script }
- it 'should set a registry key according to parameters passed to the configuration' do
+ it "should set a registry key according to parameters passed to the configuration" do
dsc_test_resource.configuration_name(config_name_value)
dsc_test_resource.flags({:"#{reg_key_name_param_name}" => test_registry_key, :"#{reg_key_value_param_name}" => test_registry_value})
expect(dsc_test_resource.registry_key_exists?(test_registry_key)).to eq(false)
@@ -305,20 +305,20 @@ EOH
end
end
- shared_examples_for 'a dsc_script with configuration data' do
- let(:configuration_data_attribute) { 'configuration_data' }
- it_behaves_like 'a dsc_script with configuration data set via an attribute'
+ shared_examples_for "a dsc_script with configuration data" do
+ let(:configuration_data_attribute) { "configuration_data" }
+ it_behaves_like "a dsc_script with configuration data set via an attribute"
- let(:configuration_data_attribute) { 'configuration_data_script' }
- it_behaves_like 'a dsc_script with configuration data set via an attribute'
+ let(:configuration_data_attribute) { "configuration_data_script" }
+ it_behaves_like "a dsc_script with configuration data set via an attribute"
end
- shared_examples_for 'a dsc_script with configuration data set via an attribute' do
- it 'should run a configuration script that creates a user' do
+ shared_examples_for "a dsc_script with configuration data set via an attribute" do
+ it "should run a configuration script that creates a user" do
config_data_value = dsc_user_config_data
dsc_test_resource.configuration_name(config_name_value)
- if configuration_data_attribute == 'configuration_data_script'
- config_data_value = create_config_script_from_code(dsc_user_config_data, '', true)
+ if configuration_data_attribute == "configuration_data_script"
+ config_data_value = create_config_script_from_code(dsc_user_config_data, "", true)
end
dsc_test_resource.environment({dsc_user_prefix_env_var_name => dsc_user_prefix,
dsc_user_suffix_env_var_name => dsc_user_suffix})
@@ -330,57 +330,57 @@ EOH
end
end
- shared_examples_for 'a dsc_script with configuration data that takes parameters' do
+ shared_examples_for "a dsc_script with configuration data that takes parameters" do
let(:dsc_user_code) { dsc_user_param_code }
let(:config_param_section) { config_params }
let(:config_flags) {{:"#{dsc_user_prefix_param_name}" => "#{dsc_user_prefix}", :"#{dsc_user_suffix_param_name}" => "#{dsc_user_suffix}"}}
- it 'does not directly contain the user name' do
+ it "does not directly contain the user name" do
configuration_script_content = ::File.open(dsc_test_resource.command) do | file |
file.read
end
expect(configuration_script_content.include?(dsc_user)).to be(false)
end
- it_behaves_like 'a dsc_script with configuration data'
+ it_behaves_like "a dsc_script with configuration data"
end
- shared_examples_for 'a dsc_script with configuration data that uses environment variables' do
+ shared_examples_for "a dsc_script with configuration data that uses environment variables" do
let(:dsc_user_code) { dsc_user_env_code }
- it 'does not directly contain the user name' do
+ it "does not directly contain the user name" do
configuration_script_content = ::File.open(dsc_test_resource.command) do | file |
file.read
end
expect(configuration_script_content.include?(dsc_user)).to be(false)
end
- it_behaves_like 'a dsc_script with configuration data'
+ it_behaves_like "a dsc_script with configuration data"
end
- context 'when supplying configuration through the configuration attribute' do
+ context "when supplying configuration through the configuration attribute" do
let(:dsc_test_resource) { dsc_resource_from_code }
- it_behaves_like 'a dsc_script resource with specified PowerShell configuration code'
+ it_behaves_like "a dsc_script resource with specified PowerShell configuration code"
end
- context 'when supplying configuration using the path attribute' do
+ context "when supplying configuration using the path attribute" do
let(:dsc_test_resource) { dsc_resource_from_path }
- it_behaves_like 'a dsc_script resource with specified PowerShell configuration code'
+ it_behaves_like "a dsc_script resource with specified PowerShell configuration code"
end
- context 'when running a configuration that manages users' do
+ context "when running a configuration that manages users" do
before(:each) do
delete_user(dsc_user)
end
let(:dsc_code) { dsc_user_resources_code }
- let(:config_name_value) { 'DSCTestConfig' }
+ let(:config_name_value) { "DSCTestConfig" }
let(:dsc_test_resource) { dsc_resource_from_path }
- it_behaves_like 'a dsc_script with configuration data'
- it_behaves_like 'a dsc_script with configuration data that uses environment variables'
- it_behaves_like 'a dsc_script with configuration data that takes parameters'
- it_behaves_like 'a dsc_script without configuration data that takes parameters'
+ it_behaves_like "a dsc_script with configuration data"
+ it_behaves_like "a dsc_script with configuration data that uses environment variables"
+ it_behaves_like "a dsc_script with configuration data that takes parameters"
+ it_behaves_like "a dsc_script without configuration data that takes parameters"
end
- context 'when using ps_credential' do
+ context "when using ps_credential" do
include IntegrationSupport
before(:each) do
@@ -393,7 +393,7 @@ EOH
let(:configuration_data_path) { 'C:\\configurationdata.psd1' }
let(:self_signed_cert_path) do
- File.join(CHEF_SPEC_DATA, 'dsc_lcm.pfx')
+ File.join(CHEF_SPEC_DATA, "dsc_lcm.pfx")
end
let(:dsc_configuration_script) do
@@ -440,7 +440,7 @@ $ConfigurationData | out-file '#{configuration_data_path}' -force
end
let(:powershell_script_resource) do
- Chef::Resource::PowershellScript.new('configure-lcm', dsc_test_run_context).tap do |r|
+ Chef::Resource::PowershellScript.new("configure-lcm", dsc_test_run_context).tap do |r|
r.code(dsc_configuration_script)
r.architecture(:x86_64)
end
@@ -460,7 +460,7 @@ EOF
end
end
- it 'allows the use of ps_credential' do
+ it "allows the use of ps_credential" do
expect(user_exists?(dsc_user)).to eq(false)
powershell_script_resource.run_action(:run)
expect(File).to exist(configuration_data_path)
diff --git a/spec/functional/resource/env_spec.rb b/spec/functional/resource/env_spec.rb
index b9dcd7b33a..60322e91a9 100755
--- a/spec/functional/resource/env_spec.rb
+++ b/spec/functional/resource/env_spec.rb
@@ -16,27 +16,27 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Env, :windows_only do
- context 'when running on Windows' do
- let(:chef_env_test_lower_case) { 'chefenvtest' }
- let(:chef_env_test_mixed_case) { 'chefENVtest' }
- let(:env_dne_key) { 'env_dne_key' }
- let(:env_value1) { 'value1' }
- let(:env_value2) { 'value2' }
-
- let(:env_value_expandable) { '%SystemRoot%' }
+ context "when running on Windows" do
+ let(:chef_env_test_lower_case) { "chefenvtest" }
+ let(:chef_env_test_mixed_case) { "chefENVtest" }
+ let(:env_dne_key) { "env_dne_key" }
+ let(:env_value1) { "value1" }
+ let(:env_value2) { "value2" }
+
+ let(:env_value_expandable) { "%SystemRoot%" }
let(:test_run_context) {
node = Chef::Node.new
- node.default['os'] = 'windows'
- node.default['platform'] = 'windows'
- node.default['platform_version'] = '6.1'
+ node.default["os"] = "windows"
+ node.default["platform"] = "windows"
+ node.default["platform_version"] = "6.1"
empty_events = Chef::EventDispatch::Dispatcher.new
Chef::RunContext.new(node, {}, empty_events)
}
let(:test_resource) {
- Chef::Resource::Env.new('unknown', test_run_context)
+ Chef::Resource::Env.new("unknown", test_run_context)
}
before(:each) do
@@ -47,7 +47,7 @@ describe Chef::Resource::Env, :windows_only do
end
context "when the create action is invoked" do
- it 'should create an environment variable for action create' do
+ it "should create an environment variable for action create" do
expect(ENV[chef_env_test_lower_case]).to eq(nil)
test_resource.key_name(chef_env_test_lower_case)
test_resource.value(env_value1)
@@ -76,7 +76,7 @@ describe Chef::Resource::Env, :windows_only do
expect(ENV[chef_env_test_lower_case]).to eq(env_value2)
end
- it 'should not expand environment variables if the variable is not PATH' do
+ it "should not expand environment variables if the variable is not PATH" do
expect(ENV[chef_env_test_lower_case]).to eq(nil)
test_resource.key_name(chef_env_test_lower_case)
test_resource.value(env_value_expandable)
@@ -115,7 +115,7 @@ describe Chef::Resource::Env, :windows_only do
expect(ENV[chef_env_test_lower_case]).to eq(env_value2)
end
- it 'should not expand environment variables if the variable is not PATH' do
+ it "should not expand environment variables if the variable is not PATH" do
test_resource.key_name(chef_env_test_lower_case)
test_resource.value(env_value1)
test_resource.run_action(:create)
@@ -125,27 +125,27 @@ describe Chef::Resource::Env, :windows_only do
expect(ENV[chef_env_test_lower_case]).to eq(env_value_expandable)
end
- context 'when using PATH' do
+ context "when using PATH" do
let(:random_name) { Time.now.to_i }
let(:env_val) { "#{env_value_expandable}_#{random_name}"}
- let!(:path_before) { test_resource.provider_for_action(test_resource.action).env_value('PATH') || '' }
- let!(:env_path_before) { ENV['PATH'] }
+ let!(:path_before) { test_resource.provider_for_action(test_resource.action).env_value("PATH") || "" }
+ let!(:env_path_before) { ENV["PATH"] }
- it 'should expand PATH' do
+ it "should expand PATH" do
expect(path_before).not_to include(env_val)
- test_resource.key_name('PATH')
+ test_resource.key_name("PATH")
test_resource.value("#{path_before};#{env_val}")
test_resource.run_action(:create)
- expect(ENV['PATH']).not_to include(env_val)
- expect(ENV['PATH']).to include("#{random_name}")
+ expect(ENV["PATH"]).not_to include(env_val)
+ expect(ENV["PATH"]).to include("#{random_name}")
end
after(:each) do
# cleanup so we don't flood the path
- test_resource.key_name('PATH')
+ test_resource.key_name("PATH")
test_resource.value(path_before)
test_resource.run_action(:create)
- ENV['PATH'] = env_path_before
+ ENV["PATH"] = env_path_before
end
end
diff --git a/spec/functional/resource/execute_spec.rb b/spec/functional/resource/execute_spec.rb
index 9369a8050d..74daf75b08 100644
--- a/spec/functional/resource/execute_spec.rb
+++ b/spec/functional/resource/execute_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'timeout'
+require "spec_helper"
+require "functional/resource/base"
+require "timeout"
describe Chef::Resource::Execute do
let(:resource) {
@@ -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 861bc65363..7ddd487e2a 100644
--- a/spec/functional/resource/file_spec.rb
+++ b/spec/functional/resource/file_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tmpdir'
+require "spec_helper"
+require "tmpdir"
describe Chef::Resource::File do
include_context Chef::Resource::File
@@ -102,9 +102,9 @@ describe Chef::Resource::File do
end
it "only stores the number of requested backups" do
- resource_without_content.content('foo')
+ resource_without_content.content("foo")
resource_without_content.run_action(:create)
- resource_without_content.content('bar')
+ resource_without_content.content("bar")
resource_without_content.run_action(:create)
expect(Dir.glob(backup_glob).length).to eq(1)
end
diff --git a/spec/functional/resource/git_spec.rb b/spec/functional/resource/git_spec.rb
index 9d3b82f19e..35da2506e5 100644
--- a/spec/functional/resource/git_spec.rb
+++ b/spec/functional/resource/git_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/shell_out'
-require 'tmpdir'
-require 'shellwords'
+require "spec_helper"
+require "chef/mixin/shell_out"
+require "tmpdir"
+require "shellwords"
# Deploy relies heavily on symlinks, so it doesn't work on windows.
describe Chef::Resource::Git do
@@ -129,10 +129,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
@@ -140,7 +140,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)
@@ -166,14 +166,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
@@ -184,7 +184,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
@@ -193,13 +193,13 @@ E
let(:basic_git_resource) do
Chef::Resource::Git.new(deploy_directory, run_context).tap do |r|
r.repository origin_repo
- r.revision 'HEAD'
+ r.revision "HEAD"
end
end
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
@@ -214,7 +214,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
@@ -228,7 +228,7 @@ E
let(:basic_git_resource) do
Chef::Resource::Git.new(deploy_directory, run_context).tap do |r|
r.repository origin_repo
- r.revision 'HEAD'
+ r.revision "HEAD"
end
end
@@ -241,7 +241,7 @@ 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',
+ head_rev = shell_out!("git rev-parse HEAD",
:cwd => deploy_directory,
:returns => [0]).stdout.strip
expect(head_rev).to eq(rev_head)
@@ -249,7 +249,7 @@ E
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',
+ head_rev = shell_out!("git rev-parse HEAD",
:cwd => deploy_directory,
:returns => [0]).stdout.strip
expect(head_rev).to eq(rev_head)
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb
index 0862b8e15f..418dad431d 100644
--- a/spec/functional/resource/group_spec.rb
+++ b/spec/functional/resource/group_spec.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
# Chef::Resource::Group are turned off on Mac OS X 10.6 due to caching
# issues around Etc.getgrnam() not picking up the group membership
@@ -79,8 +79,8 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte
def windows_domain_user?(user_name)
domain, user = user_name.split('\\')
- if user && domain != '.'
- computer_name = ENV['computername']
+ if user && domain != "."
+ computer_name = ENV["computername"]
domain.downcase != computer_name.downcase
end
end
@@ -378,7 +378,7 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
describe "when running on Windows", :windows_only do
describe "when members are Active Directory domain identities", :windows_domain_joined_only do
- let(:computer_domain) { ohai[:kernel]['cs_info']['domain'].split('.')[0] }
+ let(:computer_domain) { ohai[:kernel]["cs_info"]["domain"].split(".")[0] }
let(:spec_members){ ["#{computer_domain}\\Domain Admins", "#{computer_domain}\\Domain Users", "#{computer_domain}\\Domain Computers"] }
include_examples "correct group management"
@@ -415,7 +415,7 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" }
describe "running on windows", :windows_only do
describe "when members are Windows domain identities", :windows_domain_joined_only do
- let(:computer_domain) { ohai[:kernel]['cs_info']['domain'].split('.')[0] }
+ let(:computer_domain) { ohai[:kernel]["cs_info"]["domain"].split(".")[0] }
let(:spec_members){ ["#{computer_domain}\\Domain Admins", "#{computer_domain}\\Domain Users", "#{computer_domain}\\Domain Computers"] }
include_examples "correct group management"
diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb
index 4733b05f35..6b40fbc2e2 100644
--- a/spec/functional/resource/ifconfig_spec.rb
+++ b/spec/functional/resource/ifconfig_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "functional/resource/base"
+require "chef/mixin/shell_out"
# run this test only for following platforms.
-include_flag = !(['ubuntu', 'centos', 'aix'].include?(ohai[:platform]))
+include_flag = !(["ubuntu", "centos", "aix"].include?(ohai[:platform]))
describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => include_flag do
# This test does not work in travis because there is no eth0
@@ -28,7 +28,7 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
include Chef::Mixin::ShellOut
let(:new_resource) do
- new_resource = Chef::Resource::Ifconfig.new('10.10.0.1', run_context)
+ new_resource = Chef::Resource::Ifconfig.new("10.10.0.1", run_context)
new_resource
end
@@ -45,9 +45,9 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
# use loopback interface for tests
case ohai[:platform]
when "aix"
- 'lo0'
+ "lo0"
else
- 'lo'
+ "lo"
end
end
@@ -55,9 +55,9 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
def en0_interface_for_test
case ohai[:platform]
when "aix"
- 'en0'
+ "en0"
else
- 'eth0'
+ "eth0"
end
end
@@ -107,14 +107,14 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in
# Actual tests
describe "#load_current_resource" do
- it 'should load given interface' do
+ it "should load given interface" do
new_resource.device lo_interface_for_test
expect(current_resource.device).to eql(lo_interface_for_test)
expect(current_resource.inet_addr).to match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)
end
end
- exclude_test = ohai[:platform] != 'ubuntu'
+ exclude_test = ohai[:platform] != "ubuntu"
describe "#action_add", :external => exclude_test do
after do
new_resource.run_action(:delete)
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb
index 6b214f0b16..4840713667 100644
--- a/spec/functional/resource/link_spec.rb
+++ b/spec/functional/resource/link_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if windows?
- require 'chef/win32/file' #probably need this in spec_helper
+ require "chef/win32/file" #probably need this in spec_helper
end
describe Chef::Resource::Link do
@@ -31,7 +31,7 @@ describe Chef::Resource::Link do
# different file deployment strategies more completely.
let(:test_file_dir) do
if windows?
- File.join(ENV['systemdrive'], "test-dir")
+ File.join(ENV["systemdrive"], "test-dir")
else
File.join(CHEF_SPEC_DATA, "test-dir")
end
@@ -73,7 +73,7 @@ describe Chef::Resource::Link do
end
def canonicalize(path)
- windows? ? path.gsub('/', '\\') : path
+ windows? ? path.gsub("/", '\\') : path
end
def symlink(a, b)
@@ -121,142 +121,142 @@ describe Chef::Resource::Link do
end
describe "when supported on platform", :not_supported_on_win2k3 do
- shared_examples_for 'delete errors out' do
- it 'delete errors out' do
+ shared_examples_for "delete errors out" do
+ it "delete errors out" do
expect { resource.run_action(:delete) }.to raise_error(Chef::Exceptions::Link)
expect(File.exist?(target_file) || symlink?(target_file)).to be_truthy
end
end
- shared_context 'delete is noop' do
- describe 'the :delete action' do
+ shared_context "delete is noop" do
+ describe "the :delete action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:delete)
end
- it 'leaves the file deleted' do
+ it "leaves the file deleted" do
expect(File.exist?(target_file)).to be_falsey
expect(symlink?(target_file)).to be_falsey
end
- it 'does not mark the resource updated' do
+ it "does not mark the resource updated" do
expect(resource).not_to be_updated
end
- it 'does not log that it deleted' do
+ it "does not log that it deleted" do
expect(@info.include?("link[#{target_file}] deleted")).to be_falsey
end
end
end
- shared_context 'delete succeeds' do
- describe 'the :delete action' do
+ shared_context "delete succeeds" do
+ describe "the :delete action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:delete)
end
- it 'deletes the file' do
+ it "deletes the file" do
expect(File.exist?(target_file)).to be_falsey
expect(symlink?(target_file)).to be_falsey
end
- it 'marks the resource updated' do
+ it "marks the resource updated" do
expect(resource).to be_updated
end
- it 'logs that it deleted' do
+ it "logs that it deleted" do
expect(@info.include?("link[#{target_file}] deleted")).to be_truthy
end
end
end
- shared_context 'create symbolic link succeeds' do
- describe 'the :create action' do
+ shared_context "create symbolic link succeeds" do
+ describe "the :create action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:create)
end
- it 'links to the target file' do
+ it "links to the target file" do
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(to))
end
- it 'marks the resource updated' do
+ it "marks the resource updated" do
expect(resource).to be_updated
end
- it 'logs that it created' do
+ it "logs that it created" do
expect(@info.include?("link[#{target_file}] created")).to be_truthy
end
end
end
- shared_context 'create symbolic link is noop' do
- describe 'the :create action' do
+ shared_context "create symbolic link is noop" do
+ describe "the :create action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:create)
end
- it 'leaves the file linked' do
+ it "leaves the file linked" do
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(to))
end
- it 'does not mark the resource updated' do
+ it "does not mark the resource updated" do
expect(resource).not_to be_updated
end
- it 'does not log that it created' do
+ it "does not log that it created" do
expect(@info.include?("link[#{target_file}] created")).to be_falsey
end
end
end
- shared_context 'create hard link succeeds' do
- describe 'the :create action' do
+ shared_context "create hard link succeeds" do
+ describe "the :create action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:create)
end
- it 'preserves the hard link' do
+ it "preserves the hard link" do
expect(File.exists?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
# Writing to one hardlinked file should cause both
# to have the new value.
expect(IO.read(to)).to eq(IO.read(target_file))
- File.open(to, "w") { |file| file.write('wowzers') }
- expect(IO.read(target_file)).to eq('wowzers')
+ File.open(to, "w") { |file| file.write("wowzers") }
+ expect(IO.read(target_file)).to eq("wowzers")
end
- it 'marks the resource updated' do
+ it "marks the resource updated" do
expect(resource).to be_updated
end
- it 'logs that it created' do
+ it "logs that it created" do
expect(@info.include?("link[#{target_file}] created")).to be_truthy
end
end
end
- shared_context 'create hard link is noop' do
- describe 'the :create action' do
+ shared_context "create hard link is noop" do
+ describe "the :create action" do
before(:each) do
@info = []
allow(Chef::Log).to receive(:info) { |msg| @info << msg }
resource.run_action(:create)
end
- it 'links to the target file' do
+ it "links to the target file" do
expect(File.exists?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
# Writing to one hardlinked file should cause both
# to have the new value.
expect(IO.read(to)).to eq(IO.read(target_file))
- File.open(to, "w") { |file| file.write('wowzers') }
- expect(IO.read(target_file)).to eq('wowzers')
+ File.open(to, "w") { |file| file.write("wowzers") }
+ expect(IO.read(target_file)).to eq("wowzers")
end
- it 'does not mark the resource updated' do
+ it "does not mark the resource updated" do
expect(resource).not_to be_updated
end
- it 'does not log that it created' do
+ it "does not log that it created" do
expect(@info.include?("link[#{target_file}] created")).to be_falsey
end
end
@@ -264,34 +264,34 @@ describe Chef::Resource::Link do
context "is symbolic" do
- context 'when the link destination is a file' do
+ context "when the link destination is a file" do
before(:each) do
File.open(to, "w") do |file|
- file.write('woohoo')
+ file.write("woohoo")
end
end
- context 'and the link does not yet exist' do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ context "and the link does not yet exist" do
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
- context 'and the link already exists and is a symbolic link' do
- context 'pointing at the target' do
+ context "and the link already exists and is a symbolic link" do
+ context "pointing at the target" do
before(:each) do
symlink(to, target_file)
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(to))
end
- include_context 'create symbolic link is noop'
- include_context 'delete succeeds'
- it 'the :delete action does not delete the target file' do
+ include_context "create symbolic link is noop"
+ include_context "delete succeeds"
+ it "the :delete action does not delete the target file" do
resource.run_action(:delete)
expect(File.exists?(to)).to be_truthy
end
end
- context 'pointing somewhere else' do
+ context "pointing somewhere else" do
before(:each) do
- @other_target = File.join(test_file_dir, make_tmpname('other_spec'))
- File.open(@other_target, 'w') { |file| file.write('eek') }
+ @other_target = File.join(test_file_dir, make_tmpname("other_spec"))
+ File.open(@other_target, "w") { |file| file.write("eek") }
symlink(@other_target, target_file)
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(@other_target))
@@ -299,45 +299,45 @@ describe Chef::Resource::Link do
after(:each) do
File.delete(@other_target)
end
- include_context 'create symbolic link succeeds'
- include_context 'delete succeeds'
- it 'the :delete action does not delete the target file' do
+ include_context "create symbolic link succeeds"
+ include_context "delete succeeds"
+ it "the :delete action does not delete the target file" do
resource.run_action(:delete)
expect(File.exists?(to)).to be_truthy
end
end
- context 'pointing nowhere' do
+ context "pointing nowhere" do
before(:each) do
- nonexistent = File.join(test_file_dir, make_tmpname('nonexistent_spec'))
+ nonexistent = File.join(test_file_dir, make_tmpname("nonexistent_spec"))
symlink(nonexistent, target_file)
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(nonexistent))
end
- include_context 'create symbolic link succeeds'
- include_context 'delete succeeds'
+ include_context "create symbolic link succeeds"
+ include_context "delete succeeds"
end
end
- context 'and the link already exists and is a hard link to the file' do
+ context "and the link already exists and is a hard link to the file" do
before(:each) do
link(to, target_file)
expect(File.exists?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
end
- include_context 'create symbolic link succeeds'
- it_behaves_like 'delete errors out'
+ include_context "create symbolic link succeeds"
+ it_behaves_like "delete errors out"
end
- context 'and the link already exists and is a file' do
+ context "and the link already exists and is a file" do
before(:each) do
- File.open(target_file, 'w') { |file| file.write('eek') }
+ File.open(target_file, "w") { |file| file.write("eek") }
end
- include_context 'create symbolic link succeeds'
- it_behaves_like 'delete errors out'
+ include_context "create symbolic link succeeds"
+ it_behaves_like "delete errors out"
end
- context 'and the link already exists and is a directory' do
+ context "and the link already exists and is a directory" do
before(:each) do
Dir.mkdir(target_file)
end
- it 'create errors out' do
+ it "create errors out" do
if windows?
expect { resource.run_action(:create) }.to raise_error(Errno::EACCES)
elsif os_x? or solaris? or freebsd? or aix?
@@ -346,10 +346,10 @@ describe Chef::Resource::Link do
expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR)
end
end
- it_behaves_like 'delete errors out'
+ it_behaves_like "delete errors out"
end
- it_behaves_like 'a securable resource without existing target' do
+ it_behaves_like "a securable resource without existing target" do
let(:path) { target_file }
def allowed_acl(sid, expected_perms)
[ ACE.access_allowed(sid, expected_perms[:specific]) ]
@@ -366,27 +366,27 @@ describe Chef::Resource::Link do
end
end
end
- context 'when the link destination is a directory' do
+ context "when the link destination is a directory" do
before(:each) do
Dir.mkdir(to)
end
# On Windows, readlink fails to open the link. FILE_FLAG_OPEN_REPARSE_POINT
# might help, from http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx
- context 'and the link does not yet exist' do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ context "and the link does not yet exist" do
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
- context 'and the link already exists and points to a different directory' do
+ context "and the link already exists and points to a different directory" do
before(:each) do
other_dir = File.join(test_file_dir, make_tmpname("other_dir"))
Dir.mkdir(other_dir)
symlink(other_dir, target_file)
end
- include_context 'create symbolic link succeeds'
+ include_context "create symbolic link succeeds"
end
end
context "when the link destination is a symbolic link" do
- context 'to a file that exists' do
+ context "to a file that exists" do
before(:each) do
@other_target = File.join(test_file_dir, make_tmpname("other_spec"))
File.open(@other_target, "w") { |file| file.write("eek") }
@@ -397,32 +397,32 @@ describe Chef::Resource::Link do
after(:each) do
File.delete(@other_target)
end
- context 'and the link does not yet exist' do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ context "and the link does not yet exist" do
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
end
- context 'to a file that does not exist' do
+ context "to a file that does not exist" do
before(:each) do
@other_target = File.join(test_file_dir, make_tmpname("other_spec"))
symlink(@other_target, to)
expect(symlink?(to)).to be_truthy
expect(readlink(to)).to eq(canonicalize(@other_target))
end
- context 'and the link does not yet exist' do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ context "and the link does not yet exist" do
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
end
end
context "when the link destination does not exist" do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
{
- '../' => 'with a relative link destination',
- '' => 'with a bare filename for the link destination',
+ "../" => "with a relative link destination",
+ "" => "with a bare filename for the link destination",
}.each do |prefix, desc|
context desc do
let(:to) { "#{prefix}#{File.basename(absolute_to)}" }
@@ -430,27 +430,27 @@ describe Chef::Resource::Link do
before(:each) do
resource.to(to)
end
- context 'when the link does not yet exist' do
- include_context 'create symbolic link succeeds'
- include_context 'delete is noop'
+ context "when the link does not yet exist" do
+ include_context "create symbolic link succeeds"
+ include_context "delete is noop"
end
- context 'when the link already exists and points at the target' do
+ context "when the link already exists and points at the target" do
before(:each) do
symlink(to, target_file)
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(to))
end
- include_context 'create symbolic link is noop'
- include_context 'delete succeeds'
+ include_context "create symbolic link is noop"
+ include_context "delete succeeds"
end
- context 'when the link already exists and points at the target with an absolute path' do
+ context "when the link already exists and points at the target with an absolute path" do
before(:each) do
symlink(absolute_to, target_file)
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(absolute_to))
end
- include_context 'create symbolic link succeeds'
- include_context 'delete succeeds'
+ include_context "create symbolic link succeeds"
+ include_context "delete succeeds"
end
end
end
@@ -464,12 +464,12 @@ describe Chef::Resource::Link do
context "when the link destination is a file" do
before(:each) do
File.open(to, "w") do |file|
- file.write('woohoo')
+ file.write("woohoo")
end
end
context "and the link does not yet exist" do
- include_context 'create hard link succeeds'
- include_context 'delete is noop'
+ include_context "create hard link succeeds"
+ include_context "delete is noop"
end
context "and the link already exists and is a symbolic link pointing at the same file" do
before(:each) do
@@ -477,34 +477,34 @@ describe Chef::Resource::Link do
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(to))
end
- include_context 'create hard link succeeds'
- it_behaves_like 'delete errors out'
+ include_context "create hard link succeeds"
+ it_behaves_like "delete errors out"
end
- context 'and the link already exists and is a hard link to the file' do
+ context "and the link already exists and is a hard link to the file" do
before(:each) do
link(to, target_file)
expect(File.exists?(target_file)).to be_truthy
expect(symlink?(target_file)).to be_falsey
end
- include_context 'create hard link is noop'
- include_context 'delete succeeds'
- it 'the :delete action does not delete the target file' do
+ include_context "create hard link is noop"
+ include_context "delete succeeds"
+ it "the :delete action does not delete the target file" do
resource.run_action(:delete)
expect(File.exists?(to)).to be_truthy
end
end
context "and the link already exists and is a file" do
before(:each) do
- File.open(target_file, 'w') { |file| file.write('tomfoolery') }
+ File.open(target_file, "w") { |file| file.write("tomfoolery") }
end
- include_context 'create hard link succeeds'
- it_behaves_like 'delete errors out'
+ include_context "create hard link succeeds"
+ it_behaves_like "delete errors out"
end
context "and the link already exists and is a directory" do
before(:each) do
Dir.mkdir(target_file)
end
- it 'errors out' do
+ it "errors out" do
if windows?
expect { resource.run_action(:create) }.to raise_error(Errno::EACCES)
elsif os_x? or solaris? or freebsd? or aix?
@@ -513,18 +513,18 @@ describe Chef::Resource::Link do
expect { resource.run_action(:create) }.to raise_error(Errno::EISDIR)
end
end
- it_behaves_like 'delete errors out'
+ it_behaves_like "delete errors out"
end
context "and specifies security attributes" do
before(:each) do
- resource.owner(windows? ? 'Guest' : 'nobody')
+ resource.owner(windows? ? "Guest" : "nobody")
end
- it 'ignores them' do
+ it "ignores them" do
resource.run_action(:create)
if windows?
expect(Chef::ReservedNames::Win32::Security.get_named_security_info(target_file).owner).not_to eq(SID.Guest)
else
- expect(File.lstat(target_file).uid).not_to eq(Etc.getpwnam('nobody').uid)
+ expect(File.lstat(target_file).uid).not_to eq(Etc.getpwnam("nobody").uid)
end
end
end
@@ -533,15 +533,15 @@ describe Chef::Resource::Link do
before(:each) do
Dir.mkdir(to)
end
- context 'and the link does not yet exist' do
- it 'create errors out' do
+ context "and the link does not yet exist" do
+ it "create errors out" do
expect { resource.run_action(:create) }.to raise_error(windows? ? Chef::Exceptions::Win32APIError : Errno::EPERM)
end
- include_context 'delete is noop'
+ include_context "delete is noop"
end
end
context "when the link destination is a symbolic link" do
- context 'to a real file' do
+ context "to a real file" do
before(:each) do
@other_target = File.join(test_file_dir, make_tmpname("other_spec"))
File.open(@other_target, "w") { |file| file.write("eek") }
@@ -552,28 +552,28 @@ describe Chef::Resource::Link do
after(:each) do
File.delete(@other_target)
end
- context 'and the link does not yet exist' do
- it 'links to the target file' do
- skip('OS X/FreeBSD/AIX symlink? and readlink working on hard links to symlinks') if (os_x? or freebsd? or aix?)
+ context "and the link does not yet exist" do
+ it "links to the target file" do
+ skip("OS X/FreeBSD/AIX symlink? and readlink working on hard links to symlinks") if (os_x? or freebsd? or aix?)
resource.run_action(:create)
expect(File.exists?(target_file)).to be_truthy
# OS X gets angry about this sort of link. Bug in OS X, IMO.
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(@other_target))
end
- include_context 'delete is noop'
+ include_context "delete is noop"
end
end
- context 'to a nonexistent file' do
+ context "to a nonexistent file" do
before(:each) do
@other_target = File.join(test_file_dir, make_tmpname("other_spec"))
symlink(@other_target, to)
expect(symlink?(to)).to be_truthy
expect(readlink(to)).to eq(canonicalize(@other_target))
end
- context 'and the link does not yet exist' do
- it 'links to the target file' do
- skip('OS X/FreeBSD/AIX fails to create hardlinks to broken symlinks') if (os_x? or freebsd? or aix?)
+ context "and the link does not yet exist" do
+ it "links to the target file" do
+ skip("OS X/FreeBSD/AIX fails to create hardlinks to broken symlinks") if (os_x? or freebsd? or aix?)
resource.run_action(:create)
# Windows and Unix have different definitions of exists? here, and that's OK.
if windows?
@@ -584,17 +584,17 @@ describe Chef::Resource::Link do
expect(symlink?(target_file)).to be_truthy
expect(readlink(target_file)).to eq(canonicalize(@other_target))
end
- include_context 'delete is noop'
+ include_context "delete is noop"
end
end
end
context "when the link destination does not exist" do
- context 'and the link does not yet exist' do
- it 'create errors out' do
+ context "and the link does not yet exist" do
+ it "create errors out" do
expect { resource.run_action(:create) }.to raise_error(Errno::ENOENT)
end
- include_context 'delete is noop'
+ include_context "delete is noop"
end
end
end
diff --git a/spec/functional/resource/mount_spec.rb b/spec/functional/resource/mount_spec.rb
index 4e9e8c3bdc..7f919439c9 100644
--- a/spec/functional/resource/mount_spec.rb
+++ b/spec/functional/resource/mount_spec.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
-require 'tmpdir'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
+require "tmpdir"
# run this test only for following platforms.
-include_flag = !(['ubuntu', 'centos', 'aix', 'solaris2'].include?(ohai[:platform]))
+include_flag = !(["ubuntu", "centos", "aix", "solaris2"].include?(ohai[:platform]))
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
@@ -79,9 +79,9 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => inclu
def unix_mount_config_file
case ohai[:platform]
- when 'aix'
+ when "aix"
mount_config = "/etc/filesystems"
- when 'solaris2'
+ when "solaris2"
mount_config = "/etc/vfstab"
else
mount_config = "/etc/fstab"
@@ -90,7 +90,7 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => inclu
def mount_should_be_enabled(mount_point, device)
case ohai[:platform]
- when 'aix'
+ when "aix"
expect(shell_out("cat #{unix_mount_config_file} | grep \"#{mount_point}:\" ").exitstatus).to eq(0)
else
expect(shell_out("cat #{unix_mount_config_file} | grep \"#{mount_point}\" | grep \"#{device}\" ").exitstatus).to eq(0)
@@ -106,7 +106,7 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => inclu
new_resource.device @device
new_resource.name @mount_point
new_resource.fstype @fstype
- new_resource.options "log=NULL" if ohai[:platform] == 'aix'
+ new_resource.options "log=NULL" if ohai[:platform] == "aix"
new_resource
end
@@ -163,10 +163,10 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => inclu
mount_should_exist(new_resource.mount_point, new_resource.device)
new_resource.supports[:remount] = true
- new_resource.options "rw" if ohai[:platform] == 'aix'
+ new_resource.options "rw" if ohai[:platform] == "aix"
new_resource.run_action(:remount)
- mount_should_exist(new_resource.mount_point, new_resource.device, nil, (ohai[:platform] == 'aix') ? new_resource.options : nil)
+ mount_should_exist(new_resource.mount_point, new_resource.device, nil, (ohai[:platform] == "aix") ? new_resource.options : nil)
end
end
diff --git a/spec/functional/resource/ohai_spec.rb b/spec/functional/resource/ohai_spec.rb
index da47b9e140..8b93f22613 100644
--- a/spec/functional/resource/ohai_spec.rb
+++ b/spec/functional/resource/ohai_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Ohai do
let(:ohai) {
diff --git a/spec/functional/resource/package_spec.rb b/spec/functional/resource/package_spec.rb
index 00120afc29..459e21586e 100644
--- a/spec/functional/resource/package_spec.rb
+++ b/spec/functional/resource/package_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'webrick'
+require "spec_helper"
+require "webrick"
module AptServer
def enable_testing_apt_source
@@ -239,7 +239,7 @@ describe Chef::Resource::Package, metadata do
it "does not update the package configuration" do
package_resource.run_action(:install)
cmd = shell_out!("debconf-show chef-integration-test")
- expect(cmd.stdout).to include('chef-integration-test/sample-var: INVALID')
+ expect(cmd.stdout).to include("chef-integration-test/sample-var: INVALID")
expect(package_resource).to be_updated_by_last_action
end
@@ -276,7 +276,7 @@ describe Chef::Resource::Package, 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
diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb
index d7e5b9888b..ac4660e1cc 100644
--- a/spec/functional/resource/powershell_script_spec.rb
+++ b/spec/functional/resource/powershell_script_spec.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/platform/query_helpers'
-require 'spec_helper'
+require "chef/platform/query_helpers"
+require "spec_helper"
describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
include_context Chef::Resource::WindowsScript
- let (:architecture_command) { 'echo $env:PROCESSOR_ARCHITECTURE' }
- let (:output_command) { ' | out-file -encoding ASCII ' }
+ let (:architecture_command) { "echo $env:PROCESSOR_ARCHITECTURE" }
+ let (:output_command) { " | out-file -encoding ASCII " }
it_behaves_like "a Windows script running on Windows"
@@ -59,7 +59,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns the exit status 27 for a powershell script that exits with 27" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- file = Tempfile.new(['foo', '.ps1'])
+ file = Tempfile.new(["foo", ".ps1"])
begin
file.write "exit 27"
file.close
@@ -79,7 +79,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
# Versions of PowerShell prior to 4.0 return a 16-bit unsigned value --
# PowerShell 4.0 and later versions return a 32-bit signed value.
- file = Tempfile.new(['foo', '.ps1'])
+ file = Tempfile.new(["foo", ".ps1"])
begin
file.write "exit #{negative_exit_status}"
file.close
@@ -114,7 +114,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
end
it "returns 0 if the last command was a cmdlet that succeeded and was preceded by a non-cmdlet Windows binary that failed" do
- resource.code([windows_process_exit_code_not_found_content, cmdlet_exit_code_success_content].join(';'))
+ resource.code([windows_process_exit_code_not_found_content, cmdlet_exit_code_success_content].join(";"))
resource.returns(0)
resource.run_action(:run)
end
@@ -130,7 +130,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns 1 if the last command was a cmdlet that failed and was preceded by a successfully executed non-cmdlet Windows binary" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code([windows_process_exit_code_success_content, cmdlet_exit_code_not_found_content].join(';'))
+ resource.code([windows_process_exit_code_success_content, cmdlet_exit_code_not_found_content].join(";"))
resource.returns(1)
expect { resource.run_action(:run) }.not_to raise_error
end
@@ -138,7 +138,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "raises a Mixlib::ShellOut::ShellCommandFailed error if the script is not syntactically correct" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code('if({)')
+ resource.code("if({)")
resource.returns(0)
expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
end
@@ -148,7 +148,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
# The error is a false-positive.
skip "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code('if({)')
+ resource.code("if({)")
resource.returns(1)
expect { resource.run_action(:run) }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
end
@@ -164,7 +164,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns 1 if the last command was a cmdlet that failed and was preceded by an unsuccessfully executed non-cmdlet Windows binary" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code([arbitrary_nonzero_process_exit_code_content,cmdlet_exit_code_not_found_content].join(';'))
+ resource.code([arbitrary_nonzero_process_exit_code_content,cmdlet_exit_code_not_found_content].join(";"))
resource.returns(arbitrary_nonzero_process_exit_code)
resource.run_action(:run)
end
@@ -172,7 +172,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns 0 if the last command was a non-cmdlet Windows binary that succeeded and was preceded by a failed cmdlet" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(';'))
+ resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(";"))
resource.returns(arbitrary_nonzero_process_exit_code)
resource.run_action(:run)
end
@@ -180,7 +180,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns a specific error code if the last command was a non-cmdlet Windows binary that failed and was preceded by cmdlet that succeeded" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(';'))
+ resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(";"))
resource.returns(arbitrary_nonzero_process_exit_code)
resource.run_action(:run)
end
@@ -188,7 +188,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
it "returns a specific error code if the last command was a non-cmdlet Windows binary that failed and was preceded by cmdlet that failed" do
pending "powershell.exe always exits with 0 on nano" if Chef::Platform.windows_nano_server?
- resource.code([cmdlet_exit_code_not_found_content, arbitrary_nonzero_process_exit_code_content].join(';'))
+ resource.code([cmdlet_exit_code_not_found_content, arbitrary_nonzero_process_exit_code_content].join(";"))
resource.returns(arbitrary_nonzero_process_exit_code)
resource.run_action(:run)
end
@@ -226,9 +226,9 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
resource.returns(0)
resource.run_action(:run)
- is_64_bit = (ENV['PROCESSOR_ARCHITECTURE'] == 'AMD64') || (ENV['PROCESSOR_ARCHITEW6432'] == 'AMD64')
+ is_64_bit = (ENV["PROCESSOR_ARCHITECTURE"] == "AMD64") || (ENV["PROCESSOR_ARCHITEW6432"] == "AMD64")
- detected_64_bit = source_contains_case_insensitive_content?( get_script_output, 'AMD64' )
+ detected_64_bit = source_contains_case_insensitive_content?( get_script_output, "AMD64" )
expect(is_64_bit).to eq(detected_64_bit)
end
@@ -280,7 +280,7 @@ configuration LCM
resource.returns(0)
resource.run_action(:run)
- expect(source_contains_case_insensitive_content?( get_script_output, 'x86' )).to eq(true)
+ expect(source_contains_case_insensitive_content?( get_script_output, "x86" )).to eq(true)
end
context "when running on a 64-bit version of Windows", :windows64_only do
@@ -290,7 +290,7 @@ configuration LCM
resource.returns(0)
resource.run_action(:run)
- expect(source_contains_case_insensitive_content?( get_script_output, 'AMD64' )).to eq(true)
+ expect(source_contains_case_insensitive_content?( get_script_output, "AMD64" )).to eq(true)
end
end
@@ -311,7 +311,7 @@ configuration LCM
resource.returns(0)
resource.run_action(:run)
- expect(source_contains_case_insensitive_content?( get_script_output, 'AMD64' )).to eq(true)
+ expect(source_contains_case_insensitive_content?( get_script_output, "AMD64" )).to eq(true)
end
it "executes a script with a 32-bit process if :i386 arch is specified", :not_supported_on_nano do
@@ -320,7 +320,7 @@ configuration LCM
resource.returns(0)
resource.run_action(:run)
- expect(source_contains_case_insensitive_content?( get_script_output, 'x86' )).to eq(true)
+ expect(source_contains_case_insensitive_content?( get_script_output, "x86" )).to eq(true)
end
it "raises an error when executing a script with a 32-bit process on Windows Nano Server", :windows_nano_only do
diff --git a/spec/functional/resource/reboot_spec.rb b/spec/functional/resource/reboot_spec.rb
index da3775ef20..8647ae23a4 100644
--- a/spec/functional/resource/reboot_spec.rb
+++ b/spec/functional/resource/reboot_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Reboot do
@@ -42,7 +42,7 @@ describe Chef::Resource::Reboot do
create_resource
end
- shared_context 'testing run context modification' do
+ shared_context "testing run context modification" do
def test_reboot_action(resource)
reboot_info = resource.run_context.reboot_info
expect(reboot_info.keys.sort).to eq([:delay_mins, :reason, :requested_by, :timestamp])
@@ -55,8 +55,8 @@ describe Chef::Resource::Reboot do
end
# the currently defined behavior for multiple calls to this resource is "last one wins."
- describe 'the request_reboot_on_successful_run action' do
- include_context 'testing run context modification'
+ describe "the request_reboot_on_successful_run action" do
+ include_context "testing run context modification"
before do
resource.run_action(:request_reboot)
@@ -66,19 +66,19 @@ describe Chef::Resource::Reboot do
resource.run_context.cancel_reboot
end
- it 'should have modified the run context correctly' do
+ it "should have modified the run context correctly" do
test_reboot_action(resource)
end
end
- describe 'the reboot_interrupt_run action' do
- include_context 'testing run context modification'
+ describe "the reboot_interrupt_run action" do
+ include_context "testing run context modification"
after do
resource.run_context.cancel_reboot
end
- it 'should have modified the run context correctly' do
+ it "should have modified the run context correctly" do
# this doesn't actually test the flow of Chef::Client#do_run, unfortunately.
expect {
resource.run_action(:reboot_now)
@@ -94,7 +94,7 @@ describe Chef::Resource::Reboot do
resource.run_action(:cancel)
end
- it 'should have cleared the reboot request' do
+ it "should have cleared the reboot request" do
# arguably we shouldn't be querying RunContext's internal data directly.
expect(resource.run_context.reboot_info).to eq({})
expect(resource.run_context.reboot_requested?).to be_falsey
diff --git a/spec/functional/resource/registry_spec.rb b/spec/functional/resource/registry_spec.rb
index c0682fefc8..ec54e8253a 100644
--- a/spec/functional/resource/registry_spec.rb
+++ b/spec/functional/resource/registry_spec.rb
@@ -43,8 +43,8 @@ end
describe Chef::Resource::RegistryKey, :windows_only, :broken => true do
# parent and key must be single keys, not paths
- let(:parent) { 'Opscode' }
- let(:child) { 'Whatever' }
+ let(:parent) { "Opscode" }
+ let(:child) { "Whatever" }
let(:key_parent) { "SOFTWARE\\" + parent }
let(:key_child) { "SOFTWARE\\" + parent + "\\" + child }
# must be under HKLM\SOFTWARE for WOW64 redirection to work
diff --git a/spec/functional/resource/remote_directory_spec.rb b/spec/functional/resource/remote_directory_spec.rb
index 669ee60831..3537432203 100644
--- a/spec/functional/resource/remote_directory_spec.rb
+++ b/spec/functional/resource/remote_directory_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::RemoteDirectory do
include_context Chef::Resource::Directory
@@ -36,14 +36,14 @@ describe Chef::Resource::RemoteDirectory do
resource = Chef::Resource::RemoteDirectory.new(path, run_context)
resource.source "remotedir"
- resource.cookbook('openldap')
+ resource.cookbook("openldap")
resource
end
def create_extraneous_files
- FileUtils.mkdir_p(File.join(path, 'remotesubdir'))
- @existing1 = File.join(path, 'marked_for_death.txt')
- @existing2 = File.join(path, 'remotesubdir', 'marked_for_death_again.txt')
+ FileUtils.mkdir_p(File.join(path, "remotesubdir"))
+ @existing1 = File.join(path, "marked_for_death.txt")
+ @existing2 = File.join(path, "remotesubdir", "marked_for_death_again.txt")
FileUtils.touch(@existing1)
FileUtils.touch(@existing2)
end
@@ -59,12 +59,12 @@ describe Chef::Resource::RemoteDirectory do
# See spec/data/cookbooks/openldap/files/default
let(:expected_files) do
[
- File.join(path, 'remote_dir_file1.txt'),
- File.join(path, 'remote_dir_file2.txt'),
- File.join(path, 'remotesubdir', 'remote_subdir_file1.txt'),
- File.join(path, 'remotesubdir', 'remote_subdir_file2.txt'),
- File.join(path, 'remotesubdir', '.a_dotfile'),
- File.join(path, '.a_dotdir', '.a_dotfile_in_a_dotdir'),
+ File.join(path, "remote_dir_file1.txt"),
+ File.join(path, "remote_dir_file2.txt"),
+ File.join(path, "remotesubdir", "remote_subdir_file1.txt"),
+ File.join(path, "remotesubdir", "remote_subdir_file2.txt"),
+ File.join(path, "remotesubdir", ".a_dotfile"),
+ File.join(path, ".a_dotdir", ".a_dotfile_in_a_dotdir"),
]
end
@@ -133,11 +133,11 @@ describe Chef::Resource::RemoteDirectory do
end
it "leaves modifications alone" do
- FileUtils.mkdir_p(File.join(path, 'remotesubdir'))
- modified_file = File.join(path, 'remote_dir_file1.txt')
- modified_subdir_file = File.join(path, 'remotesubdir', 'remote_subdir_file1.txt')
- File.open(modified_file, 'a') {|f| f.puts "santa is real"}
- File.open(modified_subdir_file, 'a') {|f| f.puts "so is rudolph"}
+ FileUtils.mkdir_p(File.join(path, "remotesubdir"))
+ modified_file = File.join(path, "remote_dir_file1.txt")
+ modified_subdir_file = File.join(path, "remotesubdir", "remote_subdir_file1.txt")
+ File.open(modified_file, "a") {|f| f.puts "santa is real"}
+ File.open(modified_subdir_file, "a") {|f| f.puts "so is rudolph"}
modified_file_checksum = sha256_checksum(modified_file)
modified_subdir_file_checksum = sha256_checksum(modified_subdir_file)
@@ -190,11 +190,11 @@ describe Chef::Resource::RemoteDirectory do
context "and there are deeply nested extraneous files in the directory" do
before do
- FileUtils.mkdir_p(File.join(path, 'a', 'multiply', 'nested', 'directory'))
- @existing1 = File.join(path, 'a', 'foo.txt')
- @existing2 = File.join(path, 'a', 'multiply', 'bar.txt')
- @existing3 = File.join(path, 'a', 'multiply', 'nested', 'baz.txt')
- @existing4 = File.join(path, 'a', 'multiply', 'nested', 'directory', 'qux.txt')
+ FileUtils.mkdir_p(File.join(path, "a", "multiply", "nested", "directory"))
+ @existing1 = File.join(path, "a", "foo.txt")
+ @existing2 = File.join(path, "a", "multiply", "bar.txt")
+ @existing3 = File.join(path, "a", "multiply", "nested", "baz.txt")
+ @existing4 = File.join(path, "a", "multiply", "nested", "directory", "qux.txt")
FileUtils.touch(@existing1)
FileUtils.touch(@existing2)
FileUtils.touch(@existing3)
diff --git a/spec/functional/resource/remote_file_spec.rb b/spec/functional/resource/remote_file_spec.rb
index 4fbcd2d24b..7bf95e7a7d 100644
--- a/spec/functional/resource/remote_file_spec.rb
+++ b/spec/functional/resource/remote_file_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tiny_server'
-require 'support/shared/functional/http'
+require "spec_helper"
+require "tiny_server"
+require "support/shared/functional/http"
describe Chef::Resource::RemoteFile do
include ChefHTTPShared
@@ -64,10 +64,10 @@ describe Chef::Resource::RemoteFile do
end
describe "when redownload isn't necessary" do
- let(:source) { 'http://localhost:9000/seattle_capo.png' }
+ let(:source) { "http://localhost:9000/seattle_capo.png" }
before do
- @api.get("/seattle_capo.png", 304, "", { 'Etag' => 'abcdef' } )
+ @api.get("/seattle_capo.png", 304, "", { "Etag" => "abcdef" } )
end
it "does not fetch the file" do
@@ -76,7 +76,7 @@ describe Chef::Resource::RemoteFile do
end
context "when using normal encoding" do
- let(:source) { 'http://localhost:9000/nyan_cat.png' }
+ let(:source) { "http://localhost:9000/nyan_cat.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
it_behaves_like "a file resource"
@@ -85,7 +85,7 @@ describe Chef::Resource::RemoteFile do
end
context "when using gzip encoding" do
- let(:source) { 'http://localhost:9000/nyan_cat.png.gz' }
+ let(:source) { "http://localhost:9000/nyan_cat.png.gz" }
let(:expected_content) { binread(nyan_compressed_filename) }
it_behaves_like "a file resource"
@@ -115,7 +115,7 @@ describe Chef::Resource::RemoteFile do
stop_tiny_server
end
- let(:source) { 'https://localhost:9000/nyan_cat.png' }
+ let(:source) { "https://localhost:9000/nyan_cat.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
@@ -134,7 +134,7 @@ describe Chef::Resource::RemoteFile do
context "when downloading compressed data" do
let(:expected_content) { binread(nyan_uncompressed_filename) }
- let(:source) { 'http://localhost:9000/nyan_cat_content_length_compressed.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_content_length_compressed.png" }
before do
expect(File).not_to exist(path)
@@ -156,7 +156,7 @@ describe Chef::Resource::RemoteFile do
context "when downloding uncompressed data" do
let(:expected_content) { binread(nyan_uncompressed_filename) }
- let(:source) { 'http://localhost:9000/nyan_cat_content_length.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_content_length.png" }
before do
expect(File).not_to exist(path)
@@ -177,7 +177,7 @@ describe Chef::Resource::RemoteFile do
end
context "when downloading truncated compressed data" do
- let(:source) { 'http://localhost:9000/nyan_cat_truncated_compressed.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_truncated_compressed.png" }
before do
expect(File).not_to exist(path)
@@ -190,7 +190,7 @@ describe Chef::Resource::RemoteFile do
end
context "when downloding truncated uncompressed data" do
- let(:source) { 'http://localhost:9000/nyan_cat_truncated.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_truncated.png" }
before do
expect(File).not_to exist(path)
@@ -204,7 +204,7 @@ describe Chef::Resource::RemoteFile do
context "when downloding data with transfer-encoding set" do
let(:expected_content) { binread(nyan_uncompressed_filename) }
- let(:source) { 'http://localhost:9000/nyan_cat_transfer_encoding.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_transfer_encoding.png" }
before do
expect(File).not_to exist(path)
@@ -225,7 +225,7 @@ describe Chef::Resource::RemoteFile do
end
describe "when the download of the source raises an exception" do
- let(:source) { 'http://localhost:0000/seattle_capo.png' }
+ let(:source) { "http://localhost:0000/seattle_capo.png" }
before do
expect(File).not_to exist(path)
diff --git a/spec/functional/resource/rpm_spec.rb b/spec/functional/resource/rpm_spec.rb
index b37ee781f1..f0e57dc58b 100644
--- a/spec/functional/resource/rpm_spec.rb
+++ b/spec/functional/resource/rpm_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
# run this test only for following platforms.
-exclude_test = !['aix', 'centos', 'redhat', 'suse'].include?(ohai[:platform])
+exclude_test = !["aix", "centos", "redhat", "suse"].include?(ohai[:platform])
describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test do
include Chef::Mixin::ShellOut
@@ -61,12 +61,12 @@ describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test d
@pkg_name = "dummy"
@pkg_version = "1-0"
@pkg_path = "/tmp/dummy-1-0.aix6.1.noarch.rpm"
- FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'dummy-1-0.aix6.1.noarch.rpm') , @pkg_path)
+ FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "dummy-1-0.aix6.1.noarch.rpm") , @pkg_path)
when "centos", "redhat", "suse"
@pkg_name = "mytest"
@pkg_version = "1.0-1"
@pkg_path = "/tmp/mytest-1.0-1.noarch.rpm"
- FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'mytest-1.0-1.noarch.rpm') , @pkg_path)
+ FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "mytest-1.0-1.noarch.rpm") , @pkg_path)
end
end
@@ -99,14 +99,14 @@ describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test d
context "package upgrade action" do
before(:each) do
shell_out("rpm -i #{@pkg_path}")
- if ohai[:platform] == 'aix'
+ if ohai[:platform] == "aix"
@pkg_version = "2-0"
@pkg_path = "/tmp/dummy-2-0.aix6.1.noarch.rpm"
- FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'dummy-2-0.aix6.1.noarch.rpm') , @pkg_path)
+ FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "dummy-2-0.aix6.1.noarch.rpm") , @pkg_path)
else
@pkg_version = "2.0-1"
@pkg_path = "/tmp/mytest-2.0-1.noarch.rpm"
- FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'mytest-2.0-1.noarch.rpm') , @pkg_path)
+ FileUtils.cp(File.join(CHEF_SPEC_ASSETS, "mytest-2.0-1.noarch.rpm") , @pkg_path)
end
end
diff --git a/spec/functional/resource/template_spec.rb b/spec/functional/resource/template_spec.rb
index 35c5166e31..b0099e02c0 100644
--- a/spec/functional/resource/template_spec.rb
+++ b/spec/functional/resource/template_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Template do
@@ -44,8 +44,8 @@ describe Chef::Resource::Template do
events = Chef::EventDispatch::Dispatcher.new
run_context = Chef::RunContext.new(node, cookbook_collection, events)
resource = Chef::Resource::Template.new(path, run_context)
- resource.source('openldap_stuff.conf.erb')
- resource.cookbook('openldap')
+ resource.source("openldap_stuff.conf.erb")
+ resource.cookbook("openldap")
# NOTE: partials rely on `cookbook_name` getting set by chef internals and
# ignore the user-set `cookbook` attribute.
@@ -66,14 +66,14 @@ 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.source("openldap_variable_stuff.conf.erb")
resource.variables(:secret => "nutella")
resource.run_action(:create)
expect(IO.read(path)).to eq("super secret is nutella")
end
it "creates the template with the rendered content using a local erb file when the :create action is run" do
- resource.source(File.expand_path(File.join(CHEF_SPEC_DATA,'cookbooks','openldap','templates','default','openldap_stuff.conf.erb')))
+ resource.source(File.expand_path(File.join(CHEF_SPEC_DATA,"cookbooks","openldap","templates","default","openldap_stuff.conf.erb")))
resource.cookbook(nil)
resource.local(true)
resource.run_action(:create)
diff --git a/spec/functional/resource/user/dscl_spec.rb b/spec/functional/resource/user/dscl_spec.rb
index 5d960daf11..db2e67e714 100644
--- a/spec/functional/resource/user/dscl_spec.rb
+++ b/spec/functional/resource/user/dscl_spec.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "chef/mixin/shell_out"
metadata = {
:mac_osx_only => true,
diff --git a/spec/functional/resource/user/useradd_spec.rb b/spec/functional/resource/user/useradd_spec.rb
index 2750d33fd1..5ab6a403da 100644
--- a/spec/functional/resource/user/useradd_spec.rb
+++ b/spec/functional/resource/user/useradd_spec.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "functional/resource/base"
+require "chef/mixin/shell_out"
def user_provider_for_platform
case ohai[:platform]
@@ -50,7 +50,7 @@ describe Chef::Provider::User::Useradd, metadata do
passwd_file = File.open("/etc/passwd", "rb") {|f| f.read}
matcher = /^#{Regexp.escape(username)}.+$/
if passwd_entry = passwd_file.scan(matcher).first
- PwEntry.new(*passwd_entry.split(':'))
+ PwEntry.new(*passwd_entry.split(":"))
else
raise UserNotFound, "no entry matching #{matcher.inspect} found in /etc/passwd"
end
@@ -82,13 +82,13 @@ describe Chef::Provider::User::Useradd, metadata do
end
def try_cleanup
- ['/home/cheftestfoo', '/home/cheftestbar'].each do |f|
+ ["/home/cheftestfoo", "/home/cheftestbar"].each do |f|
FileUtils.rm_rf(f) if File.exists? f
end
- ['cf-test'].each do |u|
+ ["cf-test"].each do |u|
r = Chef::Resource::User.new("DELETE USER", run_context)
- r.username('cf-test')
+ r.username("cf-test")
r.run_action(:remove)
end
end
@@ -522,7 +522,7 @@ describe Chef::Provider::User::Useradd, metadata do
end
def shadow_password
- shadow_entry.split(':')[1]
+ shadow_entry.split(":")[1]
end
def aix_user_lock_status
@@ -665,10 +665,10 @@ describe Chef::Provider::User::Useradd, metadata do
# DEBUG: Ran usermod -U chef-functional-test returned 0
expect(@error).to be_nil
if ohai[:platform] == "aix"
- expect(pw_entry.passwd).to eq('*')
+ expect(pw_entry.passwd).to eq("*")
user_account_should_be_unlocked
else
- expect(pw_entry.passwd).to eq('x')
+ expect(pw_entry.passwd).to eq("x")
expect(shadow_password).to include("!")
end
end
diff --git a/spec/functional/resource/user/windows_spec.rb b/spec/functional/resource/user/windows_spec.rb
index 5e3a9090d4..aefe8ba676 100644
--- a/spec/functional/resource/user/windows_spec.rb
+++ b/spec/functional/resource/user/windows_spec.rb
@@ -15,13 +15,13 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/shell_out'
+require "spec_helper"
+require "chef/mixin/shell_out"
describe Chef::Provider::User::Windows, :windows_only do
include Chef::Mixin::ShellOut
- let(:username) { 'ChefFunctionalTest' }
+ let(:username) { "ChefFunctionalTest" }
let(:password) { SecureRandom.uuid }
let(:node) do
@@ -47,84 +47,84 @@ describe Chef::Provider::User::Windows, :windows_only do
delete_user(username)
end
- describe 'action :create' do
- it 'creates a user when a username and password are given' do
+ describe "action :create" do
+ it "creates a user when a username and password are given" do
new_resource.run_action(:create)
expect(new_resource).to be_updated_by_last_action
expect(shell_out("net user #{username}").exitstatus).to eq(0)
end
- it 'reports no changes if there are no changes needed' do
+ it "reports no changes if there are no changes needed" do
new_resource.run_action(:create)
new_resource.run_action(:create)
expect(new_resource).not_to be_updated_by_last_action
end
- it 'allows chaning the password' do
+ it "allows chaning the password" do
new_resource.run_action(:create)
new_resource.password(SecureRandom.uuid)
new_resource.run_action(:create)
expect(new_resource).to be_updated_by_last_action
end
- context 'with a gid specified' do
- it 'warns unsupported' do
+ context "with a gid specified" do
+ it "warns unsupported" do
expect(Chef::Log).to receive(:warn).with(/not implemented/)
- new_resource.gid('agroup')
+ new_resource.gid("agroup")
new_resource.run_action(:create)
end
end
end
- describe 'action :remove' do
+ describe "action :remove" do
before do
new_resource.run_action(:create)
end
- it 'deletes the user' do
+ it "deletes the user" do
new_resource.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
expect(shell_out("net user #{username}").exitstatus).to eq(2)
end
- it 'is idempotent' do
+ it "is idempotent" do
new_resource.run_action(:remove)
new_resource.run_action(:remove)
expect(new_resource).not_to be_updated_by_last_action
end
end
- describe 'action :lock' do
+ describe "action :lock" do
before do
new_resource.run_action(:create)
end
- it 'locks the user account' do
+ it "locks the user account" do
new_resource.run_action(:lock)
expect(new_resource).to be_updated_by_last_action
expect(shell_out("net user #{username}").stdout).to match(/Account active\s*No/)
end
- it 'is idempotent' do
+ it "is idempotent" do
new_resource.run_action(:lock)
new_resource.run_action(:lock)
expect(new_resource).not_to be_updated_by_last_action
end
end
- describe 'action :unlock' do
+ describe "action :unlock" do
before do
new_resource.run_action(:create)
new_resource.run_action(:lock)
end
- it 'unlocks the user account' do
+ it "unlocks the user account" do
new_resource.run_action(:unlock)
expect(new_resource).to be_updated_by_last_action
expect(shell_out("net user #{username}").stdout).to match(/Account active\s*Yes/)
end
- it 'is idempotent' do
+ it "is idempotent" do
new_resource.run_action(:unlock)
new_resource.run_action(:unlock)
expect(new_resource).not_to be_updated_by_last_action
diff --git a/spec/functional/resource/windows_package_spec.rb b/spec/functional/resource/windows_package_spec.rb
index 957f357846..684f2542c2 100644
--- a/spec/functional/resource/windows_package_spec.rb
+++ b/spec/functional/resource/windows_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'functional/resource/base'
+require "spec_helper"
+require "functional/resource/base"
describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
let(:pkg_name) { nil }
@@ -38,9 +38,9 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
end
describe "install package" do
- let(:pkg_name) { 'Microsoft Visual C++ 2005 Redistributable' }
- let(:pkg_checksum) { 'd6832398e3bc9156a660745f427dc1c2392ce4e9a872e04f41f62d0c6bae07a8' }
- let(:pkg_path) { 'https://download.microsoft.com/download/6/B/B/6BB661D6-A8AE-4819-B79F-236472F6070C/vcredist_x86.exe' }
+ let(:pkg_name) { "Microsoft Visual C++ 2005 Redistributable" }
+ let(:pkg_checksum) { "d6832398e3bc9156a660745f427dc1c2392ce4e9a872e04f41f62d0c6bae07a8" }
+ let(:pkg_path) { "https://download.microsoft.com/download/6/B/B/6BB661D6-A8AE-4819-B79F-236472F6070C/vcredist_x86.exe" }
let(:pkg_checksum) { nil }
let(:pkg_type) { :custom }
let(:pkg_options) { "/Q" }
@@ -56,9 +56,9 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
end
context "installing additional version" do
- let(:pkg_path) { 'https://download.microsoft.com/download/e/1/c/e1c773de-73ba-494a-a5ba-f24906ecf088/vcredist_x86.exe' }
- let(:pkg_checksum) { 'eb00f891919d4f894ab725b158459db8834470c382dc60cd3c3ee2c6de6da92c' }
- let(:pkg_version) { '8.0.56336' }
+ let(:pkg_path) { "https://download.microsoft.com/download/e/1/c/e1c773de-73ba-494a-a5ba-f24906ecf088/vcredist_x86.exe" }
+ let(:pkg_checksum) { "eb00f891919d4f894ab725b158459db8834470c382dc60cd3c3ee2c6de6da92c" }
+ let(:pkg_version) { "8.0.56336" }
it "installs older version" do
subject.run_action(:install)
@@ -70,14 +70,14 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
subject { Chef::Resource::WindowsPackage.new(pkg_name, run_context) }
context "multiple versions and a version given to remove" do
- before { subject.version('8.0.56336')}
+ before { subject.version("8.0.56336")}
it "removes specified version" do
subject.run_action(:remove)
expect(subject).to be_updated_by_last_action
prov = subject.provider_for_action(:remove)
prov.load_current_resource
- expect(prov.current_version_array).to eq([['8.0.59193']])
+ expect(prov.current_version_array).to eq([["8.0.59193"]])
end
end
@@ -102,8 +102,8 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
install1.run_action(:install)
install2 = Chef::Resource::WindowsPackage.new(pkg_name, run_context)
- install2.source 'https://download.microsoft.com/download/e/1/c/e1c773de-73ba-494a-a5ba-f24906ecf088/vcredist_x86.exe'
- install2.version '8.0.56336'
+ install2.source "https://download.microsoft.com/download/e/1/c/e1c773de-73ba-494a-a5ba-f24906ecf088/vcredist_x86.exe"
+ install2.version "8.0.56336"
install2.installer_type pkg_type
install2.options pkg_options
install2.run_action(:install)
@@ -124,9 +124,9 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
after { subject.run_action(:remove) }
context "null soft" do
- let(:pkg_name) { 'Ultra Defragmenter' }
- let(:pkg_path) { 'http://iweb.dl.sourceforge.net/project/ultradefrag/stable-release/6.1.1/ultradefrag-6.1.1.bin.amd64.exe' }
- let(:pkg_checksum) { '11d53ed4c426c8c867ad43f142b7904226ffd9938c02e37086913620d79e3c09' }
+ let(:pkg_name) { "Ultra Defragmenter" }
+ let(:pkg_path) { "http://iweb.dl.sourceforge.net/project/ultradefrag/stable-release/6.1.1/ultradefrag-6.1.1.bin.amd64.exe" }
+ let(:pkg_checksum) { "11d53ed4c426c8c867ad43f142b7904226ffd9938c02e37086913620d79e3c09" }
it "finds the correct installer type" do
subject.run_action(:install)
@@ -135,9 +135,9 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
end
context "inno" do
- let(:pkg_name) { 'Mercurial 3.6.1 (64-bit)' }
- let(:pkg_path) { 'http://mercurial.selenic.com/release/windows/Mercurial-3.6.1-x64.exe' }
- let(:pkg_checksum) { 'febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d' }
+ let(:pkg_name) { "Mercurial 3.6.1 (64-bit)" }
+ let(:pkg_path) { "http://mercurial.selenic.com/release/windows/Mercurial-3.6.1-x64.exe" }
+ let(:pkg_checksum) { "febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d" }
it "finds the correct installer type" do
subject.run_action(:install)
@@ -147,9 +147,9 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
end
describe "install from local file" do
- let(:pkg_name) { 'Mercurial 3.6.1 (64-bit)' }
+ let(:pkg_name) { "Mercurial 3.6.1 (64-bit)" }
let(:pkg_path) { ::File.join(Chef::Config[:file_cache_path], "package", "Mercurial-3.6.1-x64.exe") }
- let(:pkg_checksum) { 'febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d' }
+ let(:pkg_checksum) { "febd29578cb6736163d232708b834a2ddd119aa40abc536b2c313fc5e1b5831d" }
it "installs the app" do
subject.run_action(:install)
@@ -158,7 +158,7 @@ describe Chef::Resource::WindowsPackage, :windows_only, :volatile do
end
describe "uninstall exe without source" do
- let(:pkg_name) { 'Mercurial 3.6.1 (64-bit)' }
+ let(:pkg_name) { "Mercurial 3.6.1 (64-bit)" }
it "uninstalls the app" do
subject.run_action(:remove)
diff --git a/spec/functional/resource/windows_service_spec.rb b/spec/functional/resource/windows_service_spec.rb
index bbefb49623..56d81845e8 100644
--- a/spec/functional/resource/windows_service_spec.rb
+++ b/spec/functional/resource/windows_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_gem_only, :appveyor_only do
diff --git a/spec/functional/rest_spec.rb b/spec/functional/rest_spec.rb
index 7c6b1872ef..e2d472c1d5 100644
--- a/spec/functional/rest_spec.rb
+++ b/spec/functional/rest_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tiny_server'
-require 'support/shared/functional/http'
+require "spec_helper"
+require "tiny_server"
+require "support/shared/functional/http"
describe Chef::REST do
include ChefHTTPShared
diff --git a/spec/functional/run_lock_spec.rb b/spec/functional/run_lock_spec.rb
index f3156ff770..acd63960f6 100644
--- a/spec/functional/run_lock_spec.rb
+++ b/spec/functional/run_lock_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require File.expand_path('../../spec_helper', __FILE__)
-require 'chef/client'
+require File.expand_path("../../spec_helper", __FILE__)
+require "chef/client"
describe Chef::RunLock do
@@ -59,8 +59,8 @@ describe Chef::RunLock do
BREATHING_ROOM = 1
# ClientProcess is defined below
- let!(:p1) { ClientProcess.new(self, 'p1') }
- let!(:p2) { ClientProcess.new(self, 'p2') }
+ let!(:p1) { ClientProcess.new(self, "p1") }
+ let!(:p2) { ClientProcess.new(self, "p2") }
after(:each) do |example|
begin
p1.stop
@@ -103,7 +103,7 @@ describe Chef::RunLock do
end
it "the lockfile is empty" do
- expect(IO.read(lockfile)).to eq('')
+ expect(IO.read(lockfile)).to eq("")
end
context "and a second client gets the lock" do
@@ -157,7 +157,7 @@ describe Chef::RunLock do
end
it "the lockfile is empty" do
- expect(IO.read(lockfile)).to eq('')
+ expect(IO.read(lockfile)).to eq("")
end
it "and a second client tries to acquire the lock, it doesn't get the lock until *after* the first client exits" do
diff --git a/spec/functional/shell_spec.rb b/spec/functional/shell_spec.rb
index a753948c7f..c43f7bca01 100644
--- a/spec/functional/shell_spec.rb
+++ b/spec/functional/shell_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'functional/resource/base'
-require 'chef/version'
-require 'chef/shell'
-require 'chef/mixin/command/unix'
+require "functional/resource/base"
+require "chef/version"
+require "chef/shell"
+require "chef/mixin/command/unix"
describe Shell do
@@ -82,7 +82,7 @@ describe Shell do
when "aix"
config = File.expand_path("shef-config.rb", CHEF_SPEC_DATA)
path_to_chef_shell = File.expand_path("../../../bin/chef-shell", __FILE__)
- output = ''
+ output = ""
status = popen4("#{path_to_chef_shell} -c #{config} #{options}", :waitlast => true) do |pid, stdin, stdout, stderr|
read_until(stdout, "chef (#{Chef::VERSION})>")
yield stdout, stdin if block_given?
@@ -97,7 +97,7 @@ describe Shell do
# Windows ruby installs don't (always?) have PTY,
# so hide the require here
begin
- require 'pty'
+ require "pty"
config = File.expand_path("shef-config.rb", CHEF_SPEC_DATA)
path_to_chef_shell = File.expand_path("../../../bin/chef-shell", __FILE__)
reader, writer, pid = PTY.spawn("#{path_to_chef_shell} -c #{config} #{options}")
diff --git a/spec/functional/tiny_server_spec.rb b/spec/functional/tiny_server_spec.rb
index d21248062a..ebbf9a92dd 100644
--- a/spec/functional/tiny_server_spec.rb
+++ b/spec/functional/tiny_server_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tiny_server'
+require "spec_helper"
+require "tiny_server"
describe TinyServer::API do
before do
@@ -30,30 +30,30 @@ describe TinyServer::API do
end
it "clears the router" do
- @api.get('/blargh', 200, "blargh")
+ @api.get("/blargh", 200, "blargh")
@api.clear
expect(@api.routes["GET"]).to be_empty
end
it "creates a route for a GET request" do
- @api.get('/foo/bar', 200, 'hello foobar')
+ @api.get("/foo/bar", 200, "hello foobar")
# WEBrick gives you the full URI with host, Thin only gave the part after scheme+host+port
- response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => 'http://localhost:1974/foo/bar')
- expect(response).to eq([200, {'Content-Type' => 'application/json'}, [ 'hello foobar' ]])
+ response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => "http://localhost:1974/foo/bar")
+ expect(response).to eq([200, {"Content-Type" => "application/json"}, [ "hello foobar" ]])
end
it "creates a route for a request with a block" do
block_called = false
- @api.get('/bar/baz', 200) { block_called = true; 'hello barbaz' }
- response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => 'http://localhost:1974/bar/baz')
- expect(response).to eq([200, {'Content-Type' => 'application/json'}, [ 'hello barbaz' ]])
+ @api.get("/bar/baz", 200) { block_called = true; "hello barbaz" }
+ response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => "http://localhost:1974/bar/baz")
+ expect(response).to eq([200, {"Content-Type" => "application/json"}, [ "hello barbaz" ]])
expect(block_called).to be_truthy
end
it "returns debugging info for 404s" do
- response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => '/no_such_thing')
+ response = @api.call("REQUEST_METHOD" => "GET", "REQUEST_URI" => "/no_such_thing")
expect(response[0]).to eq(404)
- expect(response[1]).to eq({'Content-Type' => 'application/json'})
+ expect(response[1]).to eq({"Content-Type" => "application/json"})
expect(response[2]).to be_a_kind_of(Array)
response_obj = Chef::JSONCompat.from_json(response[2].first)
expect(response_obj["message"]).to eq("no data matches the request for /no_such_thing")
@@ -70,7 +70,7 @@ describe TinyServer::Manager do
TinyServer::API.instance.get("/index", 200, "[\"hello\"]")
- rest = Chef::HTTP.new('http://localhost:9000')
+ rest = Chef::HTTP.new("http://localhost:9000")
expect(rest.get("index")).to eq("[\"hello\"]")
@server.stop
diff --git a/spec/functional/util/path_helper_spec.rb b/spec/functional/util/path_helper_spec.rb
index 0321702bb8..edd9f2e224 100644
--- a/spec/functional/util/path_helper_spec.rb
+++ b/spec/functional/util/path_helper_spec.rb
@@ -14,9 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'tmpdir'
-require 'chef/util/path_helper'
-require 'spec_helper'
+require "tmpdir"
+require "chef/util/path_helper"
+require "spec_helper"
describe Chef::Util::PathHelper, "escape_glob" do
PathHelper = Chef::Util::PathHelper
@@ -27,7 +27,7 @@ describe Chef::Util::PathHelper, "escape_glob" do
# add some files
files = ["some.rb", "file.txt", "names.csv"]
files.each do |file|
- File.new(File.join(dir, file), 'w').close
+ File.new(File.join(dir, file), "w").close
end
pattern = File.join(PathHelper.escape_glob(dir), "*")
diff --git a/spec/functional/util/powershell/cmdlet_spec.rb b/spec/functional/util/powershell/cmdlet_spec.rb
index 201fb95af8..fe9438f467 100644
--- a/spec/functional/util/powershell/cmdlet_spec.rb
+++ b/spec/functional/util/powershell/cmdlet_spec.rb
@@ -16,22 +16,22 @@
# limitations under the License.
#
-require 'chef/json_compat'
-require File.expand_path('../../../../spec_helper', __FILE__)
+require "chef/json_compat"
+require File.expand_path("../../../../spec_helper", __FILE__)
describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
before(:all) do
ohai = Ohai::System.new
ohai.load_plugins
- ohai.run_plugins(true, ['platform', 'kernel'])
+ ohai.run_plugins(true, ["platform", "kernel"])
@node = Chef::Node.new
@node.consume_external_attrs(ohai.data, {})
end
let(:cmd_output_format) { :text }
- 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(: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(:etc_directory) { "#{ENV['systemroot']}\\system32\\drivers\\etc" }
let(:architecture_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "$env:PROCESSOR_ARCHITECTURE")}
@@ -49,9 +49,9 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
end
it "executes a 64-bit command on a 64-bit OS, 32-bit otherwise" do
- os_arch = ENV['PROCESSOR_ARCHITEW6432']
+ os_arch = ENV["PROCESSOR_ARCHITEW6432"]
if os_arch.nil?
- os_arch = ENV['PROCESSOR_ARCHITECTURE']
+ os_arch = ENV["PROCESSOR_ARCHITECTURE"]
end
result = architecture_cmdlet.run
@@ -61,17 +61,17 @@ 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
it "passes command line arguments to the command" do
- result = cmdlet_alias_requires_switch_or_argument.run({},{},'ls')
+ result = cmdlet_alias_requires_switch_or_argument.run({},{},"ls")
expect(result.succeeded?).to eq(true)
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!
@@ -79,7 +79,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!
@@ -89,7 +89,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
context "when returning json" do
let(:cmd_output_format) { :json }
it "returns json format data" do
- result = cmdlet_alias_requires_switch_or_argument.run({},{},'ls')
+ result = cmdlet_alias_requires_switch_or_argument.run({},{},"ls")
expect(result.succeeded?).to eq(true)
expect(lambda{Chef::JSONCompat.parse(result.return_value)}).not_to raise_error
end
@@ -98,10 +98,10 @@ 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')
+ expect(data["Name"]).to eq("hosts")
end
end
diff --git a/spec/functional/version_spec.rb b/spec/functional/version_spec.rb
index cd5bbc7678..7ff31cd4ed 100644
--- a/spec/functional/version_spec.rb
+++ b/spec/functional/version_spec.rb
@@ -15,10 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require File.expand_path('../../spec_helper', __FILE__)
-require 'chef/mixin/shell_out'
-require 'chef/version'
-require 'ohai/version'
+require File.expand_path("../../spec_helper", __FILE__)
+require "chef/mixin/shell_out"
+require "chef/version"
+require "ohai/version"
describe "Chef Versions" do
include Chef::Mixin::ShellOut
diff --git a/spec/functional/win32/crypto_spec.rb b/spec/functional/win32/crypto_spec.rb
index 1492995886..185231dbdd 100644
--- a/spec/functional/win32/crypto_spec.rb
+++ b/spec/functional/win32/crypto_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/crypto'
+ require "chef/win32/crypto"
end
-describe 'Chef::ReservedNames::Win32::Crypto', :windows_only do
+describe "Chef::ReservedNames::Win32::Crypto", :windows_only do
describe '#encrypt' do
before(:all) do
ohai_reader = Ohai::System.new
@@ -35,9 +35,9 @@ describe 'Chef::ReservedNames::Win32::Crypto', :windows_only do
@run_context = Chef::RunContext.new(new_node, {}, events)
end
- let (:plaintext) { 'p@assword' }
+ let (:plaintext) { "p@assword" }
- it 'can be decrypted by powershell' do
+ it "can be decrypted by powershell" do
encrypted = Chef::ReservedNames::Win32::Crypto.encrypt(plaintext)
resource = Chef::Resource::WindowsScript::PowershellScript.new("Powershell resource functional test", @run_context)
resource.code <<-EOF
diff --git a/spec/functional/win32/registry_spec.rb b/spec/functional/win32/registry_spec.rb
index dcfc49e2b3..4e18074271 100644
--- a/spec/functional/win32/registry_spec.rb
+++ b/spec/functional/win32/registry_spec.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/win32/registry'
+require "spec_helper"
+require "chef/win32/registry"
-describe 'Chef::Win32::Registry', :windows_only do
+describe "Chef::Win32::Registry", :windows_only do
before(:all) do
#Create a registry item
@@ -28,14 +28,14 @@ describe 'Chef::Win32::Registry', :windows_only do
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch"
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch\\Flower"
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root', Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg['RootType1', Win32::Registry::REG_SZ] = 'fibrous'
- reg.write('Roots', Win32::Registry::REG_MULTI_SZ, ["strong roots", "healthy tree"])
+ reg["RootType1", Win32::Registry::REG_SZ] = "fibrous"
+ reg.write("Roots", Win32::Registry::REG_MULTI_SZ, ["strong roots", "healthy tree"])
end
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch', Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg['Strong', Win32::Registry::REG_SZ] = 'bird nest'
+ reg["Strong", Win32::Registry::REG_SZ] = "bird nest"
end
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch\\Flower', Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg['Petals', Win32::Registry::REG_MULTI_SZ] = ["Pink", "Delicate"]
+ reg["Petals", Win32::Registry::REG_MULTI_SZ] = ["Pink", "Delicate"]
end
#Create the node with ohai data
@@ -305,7 +305,7 @@ describe 'Chef::Win32::Registry', :windows_only do
before(:all) do
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Trunk\\Peck\\Woodpecker"
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Trunk\\Peck\\Woodpecker', Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg['Peter', Win32::Registry::REG_SZ] = 'Tiny'
+ reg["Peter", Win32::Registry::REG_SZ] = "Tiny"
end
end
@@ -332,11 +332,11 @@ describe 'Chef::Win32::Registry', :windows_only do
before (:all) do
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch\\Fruit"
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Branch\\Fruit', Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg['Apple', Win32::Registry::REG_MULTI_SZ] = ["Red", "Juicy"]
+ reg["Apple", Win32::Registry::REG_MULTI_SZ] = ["Red", "Juicy"]
end
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Trunk\\Peck\\Woodpecker"
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root\\Trunk\\Peck\\Woodpecker', Win32::Registry::KEY_ALL_ACCESS) do |reg|
- reg['Peter', Win32::Registry::REG_SZ] = 'Tiny'
+ reg["Peter", Win32::Registry::REG_SZ] = "Tiny"
end
end
@@ -527,12 +527,12 @@ describe 'Chef::Win32::Registry', :windows_only do
# 64-bit
::Win32::Registry::HKEY_LOCAL_MACHINE.create("Software\\Root\\Mauve", ::Win32::Registry::KEY_ALL_ACCESS | 0x0100)
::Win32::Registry::HKEY_LOCAL_MACHINE.open('Software\\Root\\Mauve', Win32::Registry::KEY_ALL_ACCESS | 0x0100) do |reg|
- reg['Alert', Win32::Registry::REG_SZ] = 'Universal'
+ reg["Alert", Win32::Registry::REG_SZ] = "Universal"
end
# 32-bit
::Win32::Registry::HKEY_LOCAL_MACHINE.create("Software\\Root\\Poosh", ::Win32::Registry::KEY_ALL_ACCESS | 0x0200)
::Win32::Registry::HKEY_LOCAL_MACHINE.open('Software\\Root\\Poosh', Win32::Registry::KEY_ALL_ACCESS | 0x0200) do |reg|
- reg['Status', Win32::Registry::REG_SZ] = 'Lost'
+ reg["Status", Win32::Registry::REG_SZ] = "Lost"
end
end
diff --git a/spec/functional/win32/security_spec.rb b/spec/functional/win32/security_spec.rb
index 27af263860..6bac2aa07b 100644
--- a/spec/functional/win32/security_spec.rb
+++ b/spec/functional/win32/security_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/security'
+ require "chef/win32/security"
end
-describe 'Chef::Win32::Security', :windows_only do
+describe "Chef::Win32::Security", :windows_only do
it "has_admin_privileges? returns true when running as admin" do
expect(Chef::ReservedNames::Win32::Security.has_admin_privileges?).to eq(true)
end
@@ -35,8 +35,8 @@ describe 'Chef::Win32::Security', :windows_only do
skip "requires user support in mixlib-shellout"
end
- describe 'get_file_security' do
- it 'should return a security descriptor when called with a path that exists' do
+ describe "get_file_security" do
+ it "should return a security descriptor when called with a path that exists" do
security_descriptor = Chef::ReservedNames::Win32::Security.get_file_security(
"C:\\Program Files")
# Make sure the security descriptor works
@@ -44,7 +44,7 @@ describe 'Chef::Win32::Security', :windows_only do
end
end
- describe 'access_check' do
+ describe "access_check" do
let(:security_descriptor) {
Chef::ReservedNames::Win32::Security.get_file_security(
"C:\\Program Files")
@@ -69,30 +69,30 @@ describe 'Chef::Win32::Security', :windows_only do
let(:desired_access) { Chef::ReservedNames::Win32::Security::FILE_GENERIC_READ }
- it 'should check if the provided token has the desired access' do
+ it "should check if the provided token has the desired access" do
expect(Chef::ReservedNames::Win32::Security.access_check(security_descriptor,
token, desired_access, mapping)).to be true
end
end
- describe 'Chef::Win32::Security::Token' do
+ describe "Chef::Win32::Security::Token" do
let(:token) {
Chef::ReservedNames::Win32::Security.open_process_token(
Chef::ReservedNames::Win32::Process.get_current_process,
token_rights)
}
- context 'with all rights' do
+ context "with all rights" do
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_ALL_ACCESS }
- it 'can duplicate a token' do
+ it "can duplicate a token" do
expect{ token.duplicate_token(:SecurityImpersonation) }.not_to raise_error
end
end
- context 'with read only rights' do
+ context "with read only rights" do
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_READ }
- it 'raises an exception when trying to duplicate' do
+ it "raises an exception when trying to duplicate" do
expect{ token.duplicate_token(:SecurityImpersonation) }.to raise_error(Chef::Exceptions::Win32APIError)
end
end
diff --git a/spec/functional/win32/service_manager_spec.rb b/spec/functional/win32/service_manager_spec.rb
index a1ce36146f..616a83cfcf 100644
--- a/spec/functional/win32/service_manager_spec.rb
+++ b/spec/functional/win32/service_manager_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/application/windows_service_manager'
+ require "chef/application/windows_service_manager"
end
#
diff --git a/spec/functional/win32/sid_spec.rb b/spec/functional/win32/sid_spec.rb
index 1f5f66178a..f3f3adfb56 100644
--- a/spec/functional/win32/sid_spec.rb
+++ b/spec/functional/win32/sid_spec.rb
@@ -16,39 +16,39 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/security'
+ require "chef/win32/security"
end
-describe 'Chef::ReservedNames::Win32::SID', :windows_only do
+describe "Chef::ReservedNames::Win32::SID", :windows_only do
if Chef::Platform.windows?
SID ||= Chef::ReservedNames::Win32::Security::SID
end
- it 'should resolve default_security_object_group as a sane user group', :windows_not_domain_joined_only do
+ it "should resolve default_security_object_group as a sane user group", :windows_not_domain_joined_only do
# Domain accounts: domain-specific Domain Users SID
# Microsoft Accounts: SID.current_user
# Else: SID.None
expect(SID.default_security_object_group).to eq(SID.None).or eq(SID.current_user)
end
- context 'running as an elevated administrator user' do
- it 'should resolve default_security_object_owner as the Administrators group' do
+ context "running as an elevated administrator user" do
+ it "should resolve default_security_object_owner as the Administrators group" do
expect(SID.default_security_object_owner).to eq(SID.Administrators)
end
end
- context 'running as a non-elevated administrator user' do
- it 'should resolve default_security_object_owner as the current user' do
- skip 'requires user support in mixlib-shellout, see security_spec.rb'
+ context "running as a non-elevated administrator user" do
+ it "should resolve default_security_object_owner as the current user" do
+ skip "requires user support in mixlib-shellout, see security_spec.rb"
expect(SID.default_security_object_owner).to eq(SID.Administrators)
end
end
- context 'running as a non-elevated, non-administrator user' do
- it 'should resolve default_security_object_owner as the current user' do
- skip 'requires user support in mixlib-shellout, see security_spec.rb'
+ context "running as a non-elevated, non-administrator user" do
+ it "should resolve default_security_object_owner as the current user" do
+ skip "requires user support in mixlib-shellout, see security_spec.rb"
expect(SID.default_security_object_owner).to eq(SID.current_user)
end
end
diff --git a/spec/functional/win32/version_info_spec.rb b/spec/functional/win32/version_info_spec.rb
index c7d41f9616..162033462d 100644
--- a/spec/functional/win32/version_info_spec.rb
+++ b/spec/functional/win32/version_info_spec.rb
@@ -16,18 +16,18 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/file/version_info'
+ require "chef/win32/file/version_info"
end
describe "Chef::ReservedNames::Win32::File::VersionInfo", :windows_only do
- require 'wmi-lite/wmi'
- let(:file_path) { ENV['ComSpec'] }
+ require "wmi-lite/wmi"
+ let(:file_path) { ENV["ComSpec"] }
let(:os_version) do
wmi = WmiLite::Wmi.new
- os_info = wmi.first_of('Win32_OperatingSystem')
- os_info['version']
+ os_info = wmi.first_of("Win32_OperatingSystem")
+ os_info["version"]
end
subject { Chef::ReservedNames::Win32::File::VersionInfo.new(file_path) }
diff --git a/spec/functional/win32/versions_spec.rb b/spec/functional/win32/versions_spec.rb
index 38af47b0c9..8cd6c74fa3 100644
--- a/spec/functional/win32/versions_spec.rb
+++ b/spec/functional/win32/versions_spec.rb
@@ -16,16 +16,16 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/version'
+ require "chef/win32/version"
end
describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on_win2k3 do
before do
wmi = WmiLite::Wmi.new
- host = wmi.first_of('Win32_OperatingSystem')
+ host = wmi.first_of("Win32_OperatingSystem")
# Use WMI to determine current OS version.
# On Win2k8R2 and later, we can dynamically obtain marketing
@@ -37,14 +37,14 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on
# trademark on Win2k8 and Win2k3 that we're not using in our
# library, so we have to set the expectation statically.
if Chef::Platform::windows_server_2003?
- @current_os_version = 'Windows Server 2003 R2'
+ @current_os_version = "Windows Server 2003 R2"
elsif is_windows_server_2008?(host)
- @current_os_version = 'Windows Server 2008'
+ @current_os_version = "Windows Server 2008"
else
# The name from WMI is actually what we want in Win2k8R2+.
# So this expectation sould continue to hold without modification
# as new versions of Windows are released.
- @current_os_version = host['caption']
+ @current_os_version = host["caption"]
end
@version = Chef::ReservedNames::Win32::Version.new
@@ -98,20 +98,20 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only, :not_supported_on
def is_windows_server_2008?(wmi_host)
is_win2k8 = false
- os_version = wmi_host['version']
+ os_version = wmi_host["version"]
# The operating system version is a string in the following form
# that can be split into components based on the '.' delimiter:
# MajorVersionNumber.MinorVersionNumber.BuildNumber
- os_version_components = os_version.split('.')
+ os_version_components = os_version.split(".")
if os_version_components.length < 2
- raise 'WMI returned a Windows version from Win32_OperatingSystem.Version ' +
- 'with an unexpected format. The Windows version could not be determined.'
+ raise "WMI returned a Windows version from Win32_OperatingSystem.Version " +
+ "with an unexpected format. The Windows version could not be determined."
end
# Windows 6.0 is Windows Server 2008, so test the major and
# minor version components
- is_win2k8 = os_version_components[0] == '6' && os_version_components[1] == '0'
+ is_win2k8 = os_version_components[0] == "6" && os_version_components[1] == "0"
end
end
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 5e72a94065..0ca784d468 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -1,13 +1,13 @@
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
-require 'tiny_server'
-require 'tmpdir'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
+require "tiny_server"
+require "tmpdir"
describe "chef-client" do
def recipes_filename
- File.join(CHEF_SPEC_DATA, 'recipes.tgz')
+ File.join(CHEF_SPEC_DATA, "recipes.tgz")
end
def start_tiny_server(server_opts={})
@@ -48,13 +48,13 @@ describe "chef-client" do
# cf. CHEF-4914
let(:chef_client) { "ruby '#{chef_dir}/chef-client' --minimal-ohai" }
- let(:critical_env_vars) { %w(PATH RUBYOPT BUNDLE_GEMFILE GEM_PATH).map {|o| "#{o}=#{ENV[o]}"} .join(' ') }
+ let(:critical_env_vars) { %w(PATH RUBYOPT BUNDLE_GEMFILE GEM_PATH).map {|o| "#{o}=#{ENV[o]}"} .join(" ") }
when_the_repository "has a cookbook with a no-op recipe" do
- before { file 'cookbooks/x/recipes/default.rb', '' }
+ before { file "cookbooks/x/recipes/default.rb", "" }
it "should complete with success" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -63,7 +63,7 @@ EOM
end
it "should complete successfully with no other environment variables", :skip => (Chef::Platform.windows?) do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -79,7 +79,7 @@ EOM
end
it "should complete successfully with --no-listen" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -90,32 +90,32 @@ EOM
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(''))
+ 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.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'))
+ 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.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('')))
+ 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("")))
expect(result.exitstatus).to eq(1)
end
end
- context 'and a config file under .chef/knife.rb' do
- before { file '.chef/knife.rb', 'xxx.xxx' }
+ context "and a config file under .chef/knife.rb" do
+ 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(''))
+ it "should load .chef/knife.rb when -z is specified" do
+ 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
@@ -123,7 +123,7 @@ EOM
end
it "should complete with success" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -132,9 +132,9 @@ EOM
result.error!
end
- context 'and a private key' do
+ context "and a private key" do
before do
- file 'mykey.pem', <<EOM
+ file "mykey.pem", <<EOM
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf
0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk
@@ -166,7 +166,7 @@ EOM
end
it "should complete with success even with a client key" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
client_key #{path_to('mykey.pem').inspect}
cookbook_path #{path_to('cookbooks').inspect}
@@ -177,19 +177,19 @@ EOM
end
it "should run recipes specified directly on the command line" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
client_key #{path_to('mykey.pem').inspect}
cookbook_path #{path_to('cookbooks').inspect}
EOM
- file 'arbitrary.rb', <<EOM
+ file "arbitrary.rb", <<EOM
file #{path_to('tempfile.txt').inspect} do
content '1'
end
EOM
- file 'arbitrary2.rb', <<EOM
+ file "arbitrary2.rb", <<EOM
file #{path_to('tempfile2.txt').inspect} do
content '2'
end
@@ -198,57 +198,57 @@ EOM
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')
- expect(IO.read(path_to('tempfile2.txt'))).to eq('2')
+ expect(IO.read(path_to("tempfile.txt"))).to eq("1")
+ expect(IO.read(path_to("tempfile2.txt"))).to eq("2")
end
it "should run recipes specified as relative paths directly on the command line" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
client_key #{path_to('mykey.pem').inspect}
cookbook_path #{path_to('cookbooks').inspect}
EOM
- file 'arbitrary.rb', <<EOM
+ file "arbitrary.rb", <<EOM
file #{path_to('tempfile.txt').inspect} do
content '1'
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')
+ expect(IO.read(path_to("tempfile.txt"))).to eq("1")
end
it "should run recipes specified directly on the command line AFTER recipes in the run list" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
client_key #{path_to('mykey.pem').inspect}
cookbook_path #{path_to('cookbooks').inspect}
EOM
- file 'cookbooks/x/recipes/constant_definition.rb', <<EOM
+ file "cookbooks/x/recipes/constant_definition.rb", <<EOM
class ::Blah
THECONSTANT = '1'
end
EOM
- file 'arbitrary.rb', <<EOM
+ file "arbitrary.rb", <<EOM
file #{path_to('tempfile.txt').inspect} do
content ::Blah::THECONSTANT
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')
+ expect(IO.read(path_to("tempfile.txt"))).to eq("1")
end
end
it "should complete with success when passed the -z flag" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -258,7 +258,7 @@ EOM
end
it "should complete with success when passed the --local-mode flag" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -268,7 +268,7 @@ EOM
end
it "should not print SSL warnings when running in local-mode" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -279,7 +279,7 @@ EOM
end
it "should complete with success when passed -z and --chef-zero-port" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -289,7 +289,7 @@ EOM
end
it "should complete with success when setting the run list with -r" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
chef_server_url 'http://omg.com/blah'
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -302,7 +302,7 @@ EOM
end
it "should complete with success when using --profile-ruby and output a profile file" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -311,7 +311,7 @@ EOM
end
it "doesn't produce a profile when --profile-ruby is not present" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -322,13 +322,13 @@ EOM
when_the_repository "has a cookbook that should fail chef_version checks" do
before do
- file 'cookbooks/x/recipes/default.rb', ''
- file 'cookbooks/x/metadata.rb', <<EOM
+ file "cookbooks/x/recipes/default.rb", ""
+ file "cookbooks/x/metadata.rb", <<EOM
name 'x'
version '0.0.1'
chef_version '~> 999.99'
EOM
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -342,7 +342,7 @@ EOM
when_the_repository "has a cookbook that uses cheffish resources" do
before do
- file 'cookbooks/x/recipes/default.rb', <<-EOM
+ file "cookbooks/x/recipes/default.rb", <<-EOM
raise "Cheffish was loaded before we used any cheffish things!" if defined?(Cheffish::VERSION)
ran_block = false
got_server = with_chef_server 'https://blah.com' do
@@ -353,7 +353,7 @@ EOM
raise "Cheffish was not loaded when we did cheffish things!" if !defined?(Cheffish::VERSION)
raise "current_chef_server did not return its value!" if got_server[:chef_server_url] != 'https://blah.com'
EOM
- file 'config/client.rb', <<-EOM
+ file "config/client.rb", <<-EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -367,10 +367,10 @@ EOM
when_the_repository "has a cookbook that uses chef-provisioning resources" do
before do
- file 'cookbooks/x/recipes/default.rb', <<-EOM
+ file "cookbooks/x/recipes/default.rb", <<-EOM
with_driver 'blah'
EOM
- file 'config/client.rb', <<-EOM
+ file "config/client.rb", <<-EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
@@ -385,7 +385,7 @@ EOM
when_the_repository "has a cookbook that generates deprecation warnings" do
before do
- file 'cookbooks/x/recipes/default.rb', <<-EOM
+ file "cookbooks/x/recipes/default.rb", <<-EOM
class ::MyResource < Chef::Resource
use_automatic_resource_name
property :x, default: []
@@ -412,7 +412,7 @@ EOM
end
it "should output each deprecation warning only once, at the end of the run" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
# Mimick what happens when you are on the console
@@ -420,7 +420,7 @@ formatters << :doc
log_level :warn
EOM
- ENV.delete('CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS')
+ 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)
expect(result.error?).to be_falsey
@@ -437,7 +437,7 @@ EOM
when_the_repository "has a cookbook with only an audit recipe" do
before do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
audit_mode :enabled
@@ -445,7 +445,7 @@ EOM
end
it "should exit with a zero code when there is not an audit failure" do
- file 'cookbooks/audit_test/recipes/succeed.rb', <<-RECIPE
+ file "cookbooks/audit_test/recipes/succeed.rb", <<-RECIPE
control_group "control group without top level control" do
it "should succeed" do
expect(2 - 2).to eq(0)
@@ -459,7 +459,7 @@ end
end
it "should exit with a non-zero code when there is an audit failure" do
- file 'cookbooks/audit_test/recipes/fail.rb', <<-RECIPE
+ file "cookbooks/audit_test/recipes/fail.rb", <<-RECIPE
control_group "control group without top level control" do
it "should fail" do
expect(2 - 2).to eq(1)
@@ -486,14 +486,14 @@ end
let(:tmp_dir) { Dir.mktmpdir("recipe-url") }
it "should complete with success when passed -z and --recipe-url" do
- file 'config/client.rb', <<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.error!
end
- it 'should fail when passed --recipe-url and not passed -z' do
+ 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)
expect(result.exitstatus).not_to eq(0)
end
diff --git a/spec/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb
index 493ad79e7c..e8e8753731 100644
--- a/spec/integration/client/ipv6_spec.rb
+++ b/spec/integration/client/ipv6_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
describe "chef-client" do
include IntegrationSupport
@@ -88,9 +88,9 @@ END_CLIENT_RB
when_the_repository "has a cookbook with a no-op recipe" do
before do
- cookbook 'noop', '1.0.0', { }, "recipes" => {"default.rb" => "#raise 'foo'"}
- file 'config/client.rb', client_rb_content
- file 'config/validator.pem', validation_pem
+ cookbook "noop", "1.0.0", { }, "recipes" => {"default.rb" => "#raise 'foo'"}
+ file "config/client.rb", client_rb_content
+ file "config/validator.pem", validation_pem
end
it "should complete with success" do
@@ -115,14 +115,14 @@ END_CLIENT_RB
END_RECIPE
- data_bag('expect_bag', { 'expect_item' => {"expect_key" => "expect_value"} })
+ data_bag("expect_bag", { "expect_item" => {"expect_key" => "expect_value"} })
- cookbook 'api-smoke-test', '1.0.0', { }, "recipes" => {"default.rb" => recipe}
+ cookbook "api-smoke-test", "1.0.0", { }, "recipes" => {"default.rb" => recipe}
end
before do
- file 'config/client.rb', client_rb_content
- file 'config/validator.pem', validation_pem
+ file "config/client.rb", client_rb_content
+ file "config/validator.pem", validation_pem
end
it "should complete with success" do
diff --git a/spec/integration/knife/chef_fs_data_store_spec.rb b/spec/integration/knife/chef_fs_data_store_spec.rb
index c1f2c7134f..b4f2d4ca71 100644
--- a/spec/integration/knife/chef_fs_data_store_spec.rb
+++ b/spec/integration/knife/chef_fs_data_store_spec.rb
@@ -15,14 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/list'
-require 'chef/knife/delete'
-require 'chef/knife/show'
-require 'chef/knife/raw'
-require 'chef/knife/cookbook_upload'
-
-describe 'ChefFSDataStore tests', :workstation do
+require "support/shared/integration/integration_helper"
+require "chef/knife/list"
+require "chef/knife/delete"
+require "chef/knife/show"
+require "chef/knife/raw"
+require "chef/knife/cookbook_upload"
+
+describe "ChefFSDataStore tests", :workstation do
include IntegrationSupport
include KnifeSupport
@@ -31,18 +31,18 @@ describe 'ChefFSDataStore tests', :workstation do
when_the_repository "has one of each thing" do
before do
- file 'clients/x.json', {}
- file 'cookbooks/x/metadata.rb', cookbook_x_100_metadata_rb
- file 'data_bags/x/y.json', {}
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/x.json', {}
+ file "clients/x.json", {}
+ file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb
+ file "data_bags/x/y.json", {}
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/x.json", {}
end
- context 'GET /TYPE' do
- it 'knife list -z -R returns everything' do
- knife('list -z -Rfp /').should_succeed <<EOM
+ context "GET /TYPE" do
+ it "knife list -z -R returns everything" do
+ knife("list -z -Rfp /").should_succeed <<EOM
/clients/
/clients/x.json
/cookbooks/
@@ -63,128 +63,128 @@ EOM
end
end
- context 'DELETE /TYPE/NAME' do
- it 'knife delete -z /clients/x.json works' do
- knife('delete -z /clients/x.json').should_succeed "Deleted /clients/x.json\n"
- knife('list -z -Rfp /clients').should_succeed ''
+ context "DELETE /TYPE/NAME" do
+ it "knife delete -z /clients/x.json works" do
+ knife("delete -z /clients/x.json").should_succeed "Deleted /clients/x.json\n"
+ knife("list -z -Rfp /clients").should_succeed ""
end
- it 'knife delete -z -r /cookbooks/x works' do
- knife('delete -z -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -z -Rfp /cookbooks').should_succeed ''
+ it "knife delete -z -r /cookbooks/x works" do
+ knife("delete -z -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -z -Rfp /cookbooks").should_succeed ""
end
- it 'knife delete -z -r /data_bags/x works' do
- knife('delete -z -r /data_bags/x').should_succeed "Deleted /data_bags/x\n"
- knife('list -z -Rfp /data_bags').should_succeed ''
+ it "knife delete -z -r /data_bags/x works" do
+ knife("delete -z -r /data_bags/x").should_succeed "Deleted /data_bags/x\n"
+ knife("list -z -Rfp /data_bags").should_succeed ""
end
- it 'knife delete -z /data_bags/x/y.json works' do
- knife('delete -z /data_bags/x/y.json').should_succeed "Deleted /data_bags/x/y.json\n"
- knife('list -z -Rfp /data_bags').should_succeed "/data_bags/x/\n"
+ it "knife delete -z /data_bags/x/y.json works" do
+ knife("delete -z /data_bags/x/y.json").should_succeed "Deleted /data_bags/x/y.json\n"
+ knife("list -z -Rfp /data_bags").should_succeed "/data_bags/x/\n"
end
- it 'knife delete -z /environments/x.json works' do
- knife('delete -z /environments/x.json').should_succeed "Deleted /environments/x.json\n"
- knife('list -z -Rfp /environments').should_succeed ''
+ it "knife delete -z /environments/x.json works" do
+ knife("delete -z /environments/x.json").should_succeed "Deleted /environments/x.json\n"
+ knife("list -z -Rfp /environments").should_succeed ""
end
- it 'knife delete -z /nodes/x.json works' do
- knife('delete -z /nodes/x.json').should_succeed "Deleted /nodes/x.json\n"
- knife('list -z -Rfp /nodes').should_succeed ''
+ it "knife delete -z /nodes/x.json works" do
+ knife("delete -z /nodes/x.json").should_succeed "Deleted /nodes/x.json\n"
+ knife("list -z -Rfp /nodes").should_succeed ""
end
- it 'knife delete -z /roles/x.json works' do
- knife('delete -z /roles/x.json').should_succeed "Deleted /roles/x.json\n"
- knife('list -z -Rfp /roles').should_succeed ''
+ it "knife delete -z /roles/x.json works" do
+ knife("delete -z /roles/x.json").should_succeed "Deleted /roles/x.json\n"
+ knife("list -z -Rfp /roles").should_succeed ""
end
- it 'knife delete -z /users/x.json works' do
- knife('delete -z /users/x.json').should_succeed "Deleted /users/x.json\n"
- knife('list -z -Rfp /users').should_succeed ''
+ it "knife delete -z /users/x.json works" do
+ knife("delete -z /users/x.json").should_succeed "Deleted /users/x.json\n"
+ knife("list -z -Rfp /users").should_succeed ""
end
end
- context 'GET /TYPE/NAME' do
- it 'knife show -z /clients/x.json works' do
- knife('show -z /clients/x.json').should_succeed( /"x"/ )
+ context "GET /TYPE/NAME" do
+ it "knife show -z /clients/x.json works" do
+ knife("show -z /clients/x.json").should_succeed( /"x"/ )
end
- it 'knife show -z /cookbooks/x/metadata.rb works' do
- knife('show -z /cookbooks/x/metadata.rb').should_succeed "/cookbooks/x/metadata.rb:\n#{cookbook_x_100_metadata_rb}\n"
+ it "knife show -z /cookbooks/x/metadata.rb works" do
+ knife("show -z /cookbooks/x/metadata.rb").should_succeed "/cookbooks/x/metadata.rb:\n#{cookbook_x_100_metadata_rb}\n"
end
- it 'knife show -z /data_bags/x/y.json works' do
- knife('show -z /data_bags/x/y.json').should_succeed( /"y"/ )
+ it "knife show -z /data_bags/x/y.json works" do
+ knife("show -z /data_bags/x/y.json").should_succeed( /"y"/ )
end
- it 'knife show -z /environments/x.json works' do
- knife('show -z /environments/x.json').should_succeed( /"x"/ )
+ it "knife show -z /environments/x.json works" do
+ knife("show -z /environments/x.json").should_succeed( /"x"/ )
end
- it 'knife show -z /nodes/x.json works' do
- knife('show -z /nodes/x.json').should_succeed( /"x"/ )
+ it "knife show -z /nodes/x.json works" do
+ knife("show -z /nodes/x.json").should_succeed( /"x"/ )
end
- it 'knife show -z /roles/x.json works' do
- knife('show -z /roles/x.json').should_succeed( /"x"/ )
+ it "knife show -z /roles/x.json works" do
+ knife("show -z /roles/x.json").should_succeed( /"x"/ )
end
- it 'knife show -z /users/x.json works' do
- knife('show -z /users/x.json').should_succeed( /"x"/ )
+ it "knife show -z /users/x.json works" do
+ knife("show -z /users/x.json").should_succeed( /"x"/ )
end
end
- context 'PUT /TYPE/NAME' do
+ context "PUT /TYPE/NAME" do
before do
- file 'empty.json', {}
- file 'dummynode.json', { "name" => "x", "chef_environment" => "rspec" , "json_class" => "Chef::Node", "normal" => {"foo" => "bar"}}
- file 'rolestuff.json', '{"description":"hi there","name":"x"}'
- file 'cookbooks_to_upload/x/metadata.rb', cookbook_x_100_metadata_rb
+ file "empty.json", {}
+ file "dummynode.json", { "name" => "x", "chef_environment" => "rspec" , "json_class" => "Chef::Node", "normal" => {"foo" => "bar"}}
+ file "rolestuff.json", '{"description":"hi there","name":"x"}'
+ file "cookbooks_to_upload/x/metadata.rb", cookbook_x_100_metadata_rb
end
- it 'knife raw -z -i empty.json -m PUT /clients/x' do
+ it "knife raw -z -i empty.json -m PUT /clients/x" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /clients/x").should_succeed( /"x"/ )
- knife('list --local /clients').should_succeed "/clients/x.json\n"
+ knife("list --local /clients").should_succeed "/clients/x.json\n"
end
- it 'knife cookbook upload works' do
+ it "knife cookbook upload works" do
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
- knife('list --local -Rfp /cookbooks').should_succeed "/cookbooks/x/\n/cookbooks/x/metadata.rb\n"
+ knife("list --local -Rfp /cookbooks").should_succeed "/cookbooks/x/\n/cookbooks/x/metadata.rb\n"
end
- it 'knife raw -z -i empty.json -m PUT /data/x/y' do
+ it "knife raw -z -i empty.json -m PUT /data/x/y" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /data/x/y").should_succeed( /"y"/ )
- knife('list --local -Rfp /data_bags').should_succeed "/data_bags/x/\n/data_bags/x/y.json\n"
+ knife("list --local -Rfp /data_bags").should_succeed "/data_bags/x/\n/data_bags/x/y.json\n"
end
- it 'knife raw -z -i empty.json -m PUT /environments/x' do
+ it "knife raw -z -i empty.json -m PUT /environments/x" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /environments/x").should_succeed( /"x"/ )
- knife('list --local /environments').should_succeed "/environments/x.json\n"
+ knife("list --local /environments").should_succeed "/environments/x.json\n"
end
- it 'knife raw -z -i dummynode.json -m PUT /nodes/x' do
+ it "knife raw -z -i dummynode.json -m PUT /nodes/x" do
knife("raw -z -i #{path_to('dummynode.json')} -m PUT /nodes/x").should_succeed( /"x"/ )
- knife('list --local /nodes').should_succeed "/nodes/x.json\n"
- knife('show -z /nodes/x.json --verbose').should_succeed /"bar"/
+ knife("list --local /nodes").should_succeed "/nodes/x.json\n"
+ knife("show -z /nodes/x.json --verbose").should_succeed /"bar"/
end
- it 'knife raw -z -i empty.json -m PUT /roles/x' do
+ it "knife raw -z -i empty.json -m PUT /roles/x" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /roles/x").should_succeed( /"x"/ )
- knife('list --local /roles').should_succeed "/roles/x.json\n"
+ knife("list --local /roles").should_succeed "/roles/x.json\n"
end
- it 'knife raw -z -i empty.json -m PUT /users/x' do
+ it "knife raw -z -i empty.json -m PUT /users/x" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /users/x").should_succeed( /"x"/ )
- knife('list --local /users').should_succeed "/users/x.json\n"
+ 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
+ expect(IO.read(path_to("roles/x.json"))).to eq <<EOM.strip
{
"name": "x",
"description": "hi there"
@@ -194,65 +194,65 @@ EOM
end
end
- when_the_repository 'is empty' do
- context 'POST /TYPE/NAME' do
+ when_the_repository "is empty" do
+ context "POST /TYPE/NAME" do
before do
- file 'empty.json', { 'name' => 'z' }
- file 'dummynode.json', { "name" => "z", "chef_environment" => "rspec" , "json_class" => "Chef::Node", "normal" => {"foo" => "bar"}}
- file 'empty_x.json', { 'name' => 'x' }
- file 'empty_id.json', { 'id' => 'z' }
- file 'rolestuff.json', '{"description":"hi there","name":"x"}'
- file 'cookbooks_to_upload/z/metadata.rb', cookbook_z_100_metadata_rb
+ file "empty.json", { "name" => "z" }
+ file "dummynode.json", { "name" => "z", "chef_environment" => "rspec" , "json_class" => "Chef::Node", "normal" => {"foo" => "bar"}}
+ file "empty_x.json", { "name" => "x" }
+ file "empty_id.json", { "id" => "z" }
+ file "rolestuff.json", '{"description":"hi there","name":"x"}'
+ file "cookbooks_to_upload/z/metadata.rb", cookbook_z_100_metadata_rb
end
- it 'knife raw -z -i empty.json -m POST /clients' do
+ it "knife raw -z -i empty.json -m POST /clients" do
knife("raw -z -i #{path_to('empty.json')} -m POST /clients").should_succeed( /uri/ )
- knife('list --local /clients').should_succeed "/clients/z.json\n"
+ knife("list --local /clients").should_succeed "/clients/z.json\n"
end
- it 'knife cookbook upload works' do
+ it "knife cookbook upload works" do
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
- knife('list --local -Rfp /cookbooks').should_succeed "/cookbooks/z/\n/cookbooks/z/metadata.rb\n"
+ knife("list --local -Rfp /cookbooks").should_succeed "/cookbooks/z/\n/cookbooks/z/metadata.rb\n"
end
- it 'knife raw -z -i empty.json -m POST /data' do
+ it "knife raw -z -i empty.json -m POST /data" do
knife("raw -z -i #{path_to('empty.json')} -m POST /data").should_succeed( /uri/ )
- knife('list --local -Rfp /data_bags').should_succeed "/data_bags/z/\n"
+ knife("list --local -Rfp /data_bags").should_succeed "/data_bags/z/\n"
end
- it 'knife raw -z -i empty.json -m POST /data/x' do
+ it "knife raw -z -i empty.json -m POST /data/x" do
knife("raw -z -i #{path_to('empty_x.json')} -m POST /data").should_succeed( /uri/ )
knife("raw -z -i #{path_to('empty_id.json')} -m POST /data/x").should_succeed( /"z"/ )
- knife('list --local -Rfp /data_bags').should_succeed "/data_bags/x/\n/data_bags/x/z.json\n"
+ knife("list --local -Rfp /data_bags").should_succeed "/data_bags/x/\n/data_bags/x/z.json\n"
end
- it 'knife raw -z -i empty.json -m POST /environments' do
+ it "knife raw -z -i empty.json -m POST /environments" do
knife("raw -z -i #{path_to('empty.json')} -m POST /environments").should_succeed( /uri/ )
- knife('list --local /environments').should_succeed "/environments/z.json\n"
+ knife("list --local /environments").should_succeed "/environments/z.json\n"
end
- it 'knife raw -z -i dummynode.json -m POST /nodes' do
+ it "knife raw -z -i dummynode.json -m POST /nodes" do
knife("raw -z -i #{path_to('dummynode.json')} -m POST /nodes").should_succeed( /uri/ )
- knife('list --local /nodes').should_succeed "/nodes/z.json\n"
- knife('show -z /nodes/z.json').should_succeed /"bar"/
+ knife("list --local /nodes").should_succeed "/nodes/z.json\n"
+ knife("show -z /nodes/z.json").should_succeed /"bar"/
end
- it 'knife raw -z -i empty.json -m POST /roles' do
+ it "knife raw -z -i empty.json -m POST /roles" do
knife("raw -z -i #{path_to('empty.json')} -m POST /roles").should_succeed( /uri/ )
- knife('list --local /roles').should_succeed "/roles/z.json\n"
+ knife("list --local /roles").should_succeed "/roles/z.json\n"
end
- it 'knife raw -z -i empty.json -m POST /users' do
+ it "knife raw -z -i empty.json -m POST /users" do
knife("raw -z -i #{path_to('empty.json')} -m POST /users").should_succeed( /uri/ )
- knife('list --local /users').should_succeed "/users/z.json\n"
+ knife("list --local /users").should_succeed "/users/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
+ expect(IO.read(path_to("roles/x.json"))).to eq <<EOM.strip
{
"name": "x",
"description": "hi there"
@@ -261,8 +261,8 @@ EOM
end
end
- it 'knife list -z -R returns nothing' do
- knife('list -z -Rfp /').should_succeed <<EOM
+ it "knife list -z -R returns nothing" do
+ knife("list -z -Rfp /").should_succeed <<EOM
/clients/
/cookbooks/
/data_bags/
@@ -273,96 +273,96 @@ EOM
EOM
end
- context 'DELETE /TYPE/NAME' do
- it 'knife delete -z /clients/x.json fails with an error' do
- knife('delete -z /clients/x.json').should_fail "ERROR: /clients/x.json: No such file or directory\n"
+ context "DELETE /TYPE/NAME" do
+ it "knife delete -z /clients/x.json fails with an error" do
+ knife("delete -z /clients/x.json").should_fail "ERROR: /clients/x.json: No such file or directory\n"
end
- it 'knife delete -z -r /cookbooks/x fails with an error' do
- knife('delete -z -r /cookbooks/x').should_fail "ERROR: /cookbooks/x: No such file or directory\n"
+ it "knife delete -z -r /cookbooks/x fails with an error" do
+ knife("delete -z -r /cookbooks/x").should_fail "ERROR: /cookbooks/x: No such file or directory\n"
end
- it 'knife delete -z -r /data_bags/x fails with an error' do
- knife('delete -z -r /data_bags/x').should_fail "ERROR: /data_bags/x: No such file or directory\n"
+ it "knife delete -z -r /data_bags/x fails with an error" do
+ knife("delete -z -r /data_bags/x").should_fail "ERROR: /data_bags/x: No such file or directory\n"
end
- it 'knife delete -z /data_bags/x/y.json fails with an error' do
- knife('delete -z /data_bags/x/y.json').should_fail "ERROR: /data_bags/x/y.json: No such file or directory\n"
+ it "knife delete -z /data_bags/x/y.json fails with an error" do
+ knife("delete -z /data_bags/x/y.json").should_fail "ERROR: /data_bags/x/y.json: No such file or directory\n"
end
- it 'knife delete -z /environments/x.json fails with an error' do
- knife('delete -z /environments/x.json').should_fail "ERROR: /environments/x.json: No such file or directory\n"
+ it "knife delete -z /environments/x.json fails with an error" do
+ knife("delete -z /environments/x.json").should_fail "ERROR: /environments/x.json: No such file or directory\n"
end
- it 'knife delete -z /nodes/x.json fails with an error' do
- knife('delete -z /nodes/x.json').should_fail "ERROR: /nodes/x.json: No such file or directory\n"
+ it "knife delete -z /nodes/x.json fails with an error" do
+ knife("delete -z /nodes/x.json").should_fail "ERROR: /nodes/x.json: No such file or directory\n"
end
- it 'knife delete -z /roles/x.json fails with an error' do
- knife('delete -z /roles/x.json').should_fail "ERROR: /roles/x.json: No such file or directory\n"
+ it "knife delete -z /roles/x.json fails with an error" do
+ knife("delete -z /roles/x.json").should_fail "ERROR: /roles/x.json: No such file or directory\n"
end
- it 'knife delete -z /users/x.json fails with an error' do
- knife('delete -z /users/x.json').should_fail "ERROR: /users/x.json: No such file or directory\n"
+ it "knife delete -z /users/x.json fails with an error" do
+ knife("delete -z /users/x.json").should_fail "ERROR: /users/x.json: No such file or directory\n"
end
end
- context 'GET /TYPE/NAME' do
- it 'knife show -z /clients/x.json fails with an error' do
- knife('show -z /clients/x.json').should_fail "ERROR: /clients/x.json: No such file or directory\n"
+ context "GET /TYPE/NAME" do
+ it "knife show -z /clients/x.json fails with an error" do
+ knife("show -z /clients/x.json").should_fail "ERROR: /clients/x.json: No such file or directory\n"
end
- it 'knife show -z /cookbooks/x/metadata.rb fails with an error' do
- knife('show -z /cookbooks/x/metadata.rb').should_fail "ERROR: /cookbooks/x/metadata.rb: No such file or directory\n"
+ it "knife show -z /cookbooks/x/metadata.rb fails with an error" do
+ knife("show -z /cookbooks/x/metadata.rb").should_fail "ERROR: /cookbooks/x/metadata.rb: No such file or directory\n"
end
- it 'knife show -z /data_bags/x/y.json fails with an error' do
- knife('show -z /data_bags/x/y.json').should_fail "ERROR: /data_bags/x/y.json: No such file or directory\n"
+ it "knife show -z /data_bags/x/y.json fails with an error" do
+ knife("show -z /data_bags/x/y.json").should_fail "ERROR: /data_bags/x/y.json: No such file or directory\n"
end
- it 'knife show -z /environments/x.json fails with an error' do
- knife('show -z /environments/x.json').should_fail "ERROR: /environments/x.json: No such file or directory\n"
+ it "knife show -z /environments/x.json fails with an error" do
+ knife("show -z /environments/x.json").should_fail "ERROR: /environments/x.json: No such file or directory\n"
end
- it 'knife show -z /nodes/x.json fails with an error' do
- knife('show -z /nodes/x.json').should_fail "ERROR: /nodes/x.json: No such file or directory\n"
+ it "knife show -z /nodes/x.json fails with an error" do
+ knife("show -z /nodes/x.json").should_fail "ERROR: /nodes/x.json: No such file or directory\n"
end
- it 'knife show -z /roles/x.json fails with an error' do
- knife('show -z /roles/x.json').should_fail "ERROR: /roles/x.json: No such file or directory\n"
+ it "knife show -z /roles/x.json fails with an error" do
+ knife("show -z /roles/x.json").should_fail "ERROR: /roles/x.json: No such file or directory\n"
end
- it 'knife show -z /users/x.json fails with an error' do
- knife('show -z /users/x.json').should_fail "ERROR: /users/x.json: No such file or directory\n"
+ it "knife show -z /users/x.json fails with an error" do
+ knife("show -z /users/x.json").should_fail "ERROR: /users/x.json: No such file or directory\n"
end
end
- context 'PUT /TYPE/NAME' do
+ context "PUT /TYPE/NAME" do
before do
- file 'empty.json', {}
+ file "empty.json", {}
end
- it 'knife raw -z -i empty.json -m PUT /clients/x fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /clients/x fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /clients/x").should_fail( /404/ )
end
- it 'knife raw -z -i empty.json -m PUT /data/x/y fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /data/x/y fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /data/x/y").should_fail( /404/ )
end
- it 'knife raw -z -i empty.json -m PUT /environments/x fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /environments/x fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /environments/x").should_fail( /404/ )
end
- it 'knife raw -z -i empty.json -m PUT /nodes/x fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /nodes/x fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /nodes/x").should_fail( /404/ )
end
- it 'knife raw -z -i empty.json -m PUT /roles/x fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /roles/x fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /roles/x").should_fail( /404/ )
end
- it 'knife raw -z -i empty.json -m PUT /users/x fails with 404' do
+ it "knife raw -z -i empty.json -m PUT /users/x fails with 404" do
knife("raw -z -i #{path_to('empty.json')} -m PUT /users/x").should_fail( /404/ )
end
end
diff --git a/spec/integration/knife/chef_repo_path_spec.rb b/spec/integration/knife/chef_repo_path_spec.rb
index 31525cdf25..b5c86d7a00 100644
--- a/spec/integration/knife/chef_repo_path_spec.rb
+++ b/spec/integration/knife/chef_repo_path_spec.rb
@@ -15,49 +15,49 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/list'
-require 'chef/knife/show'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/list"
+require "chef/knife/show"
-describe 'chef_repo_path tests', :workstation do
+describe "chef_repo_path tests", :workstation do
include IntegrationSupport
include KnifeSupport
let(:error_rel_path_outside_repo) { /^ERROR: Attempt to use relative path '' when current directory is outside the repository path/ }
# TODO alternate repo_path / *_path
- context 'alternate *_path' do
- when_the_repository 'has clients and clients2, cookbooks and cookbooks2, etc.' do
+ context "alternate *_path" do
+ when_the_repository "has clients and clients2, cookbooks and cookbooks2, etc." do
before do
- file 'clients/client1.json', {}
- file 'cookbooks/cookbook1/metadata.rb', ''
- file 'data_bags/bag/item.json', {}
- file 'environments/env1.json', {}
- file 'nodes/node1.json', {}
- file 'roles/role1.json', {}
- file 'users/user1.json', {}
-
- file 'clients2/client2.json', {}
- file 'cookbooks2/cookbook2/metadata.rb', ''
- file 'data_bags2/bag2/item2.json', {}
- file 'environments2/env2.json', {}
- file 'nodes2/node2.json', {}
- file 'roles2/role2.json', {}
- file 'users2/user2.json', {}
-
- directory 'chef_repo2' do
- file 'clients/client3.json', {}
- file 'cookbooks/cookbook3/metadata.rb', ''
- file 'data_bags/bag3/item3.json', {}
- file 'environments/env3.json', {}
- file 'nodes/node3.json', {}
- file 'roles/role3.json', {}
- file 'users/user3.json', {}
+ file "clients/client1.json", {}
+ file "cookbooks/cookbook1/metadata.rb", ""
+ file "data_bags/bag/item.json", {}
+ file "environments/env1.json", {}
+ file "nodes/node1.json", {}
+ file "roles/role1.json", {}
+ file "users/user1.json", {}
+
+ file "clients2/client2.json", {}
+ file "cookbooks2/cookbook2/metadata.rb", ""
+ file "data_bags2/bag2/item2.json", {}
+ file "environments2/env2.json", {}
+ file "nodes2/node2.json", {}
+ file "roles2/role2.json", {}
+ file "users2/user2.json", {}
+
+ directory "chef_repo2" do
+ file "clients/client3.json", {}
+ file "cookbooks/cookbook3/metadata.rb", ""
+ file "data_bags/bag3/item3.json", {}
+ file "environments/env3.json", {}
+ file "nodes/node3.json", {}
+ file "roles/role3.json", {}
+ file "users/user3.json", {}
end
end
- it 'knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff' do
+ it "knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff" do
Chef::Config.delete(:chef_repo_path)
knife("list --local -Rfp --chef-repo-path #{path_to('chef_repo2')} /").should_succeed <<EOM
/clients/
@@ -79,15 +79,15 @@ describe 'chef_repo_path tests', :workstation do
EOM
end
- context 'when all _paths are set to alternates' do
+ context "when all _paths are set to alternates" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "#{object_name}s2")
end
- Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, 'chef_repo2')
+ Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2")
end
- it 'knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff' do
+ it "knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff" do
knife("list --local -Rfp --chef-repo-path #{path_to('chef_repo2')} /").should_succeed <<EOM
/clients/
/clients/client3.json
@@ -108,24 +108,24 @@ EOM
EOM
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client2.json
cookbooks/
@@ -146,31 +146,31 @@ EOM
end
end
- context 'when cwd is inside data_bags2' do
- before { cwd 'data_bags2' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside data_bags2" do
+ before { cwd "data_bags2" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag2/
bag2/item2.json
EOM
end
- it 'knife list --local -Rfp ../roles lists roles' do
- knife('list --local -Rfp ../roles').should_succeed "/roles/role2.json\n"
+ it "knife list --local -Rfp ../roles lists roles" do
+ knife("list --local -Rfp ../roles").should_succeed "/roles/role2.json\n"
end
end
end
- context 'when all _paths except chef_repo_path are set to alternates' do
+ context "when all _paths except chef_repo_path are set to alternates" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "#{object_name}s2")
end
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client2.json
cookbooks/
@@ -191,24 +191,24 @@ EOM
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside data_bags2' do
- before { cwd 'data_bags2' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside data_bags2" do
+ before { cwd "data_bags2" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag2/
bag2/item2.json
EOM
@@ -216,32 +216,32 @@ EOM
end
end
- context 'when only chef_repo_path is set to its alternate' do
+ context "when only chef_repo_path is set to its alternate" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
- Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, 'chef_repo2')
+ Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2")
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client3.json
cookbooks/
@@ -262,10 +262,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2/data_bags' do
- before { cwd 'chef_repo2/data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2/data_bags" do
+ before { cwd "chef_repo2/data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag3/
bag3/item3.json
EOM
@@ -273,7 +273,7 @@ EOM
end
end
- context 'when paths are set to point to both versions of each' do
+ context "when paths are set to point to both versions of each" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
Chef::Config["#{object_name}_path".to_sym] = [
@@ -281,16 +281,16 @@ EOM
File.join(Chef::Config.chef_repo_path, "#{object_name}s2"),
]
end
- Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, 'chef_repo2')
+ Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2")
end
- context 'when there is a directory in clients1 and file in clients2 with the same name' do
+ context "when there is a directory in clients1 and file in clients2 with the same name" do
before do
- directory 'clients/blah.json'
- file 'clients2/blah.json', {}
+ directory "clients/blah.json"
+ file "clients2/blah.json", {}
end
- it 'knife show /clients/blah.json succeeds' do
- knife('show --local /clients/blah.json').should_succeed <<EOM
+ it "knife show /clients/blah.json succeeds" do
+ knife("show --local /clients/blah.json").should_succeed <<EOM
/clients/blah.json:
{
@@ -299,13 +299,13 @@ EOM
end
end
- context 'when there is a file in cookbooks1 and directory in cookbooks2 with the same name' do
+ context "when there is a file in cookbooks1 and directory in cookbooks2 with the same name" do
before do
- file 'cookbooks/blah', ''
- file 'cookbooks2/blah/metadata.rb', ''
+ file "cookbooks/blah", ""
+ file "cookbooks2/blah/metadata.rb", ""
end
- it 'knife list -Rfp cookbooks shows files in blah' do
- knife('list --local -Rfp /cookbooks').should_succeed <<EOM
+ it "knife list -Rfp cookbooks shows files in blah" do
+ knife("list --local -Rfp /cookbooks").should_succeed <<EOM
/cookbooks/blah/
/cookbooks/blah/metadata.rb
/cookbooks/cookbook1/
@@ -316,13 +316,13 @@ EOM
end
end
- context 'when there is an empty directory in cookbooks1 and a real cookbook in cookbooks2 with the same name' do
+ context "when there is an empty directory in cookbooks1 and a real cookbook in cookbooks2 with the same name" do
before do
- directory 'cookbooks/blah'
- file 'cookbooks2/blah/metadata.rb', ''
+ directory "cookbooks/blah"
+ 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")
+ 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")
/cookbooks/blah/
/cookbooks/blah/metadata.rb
/cookbooks/cookbook1/
@@ -333,13 +333,13 @@ EOM
end
end
- context 'when there is a cookbook in cookbooks1 and a cookbook in cookbooks2 with the same name' do
+ context "when there is a cookbook in cookbooks1 and a cookbook in cookbooks2 with the same name" do
before do
- file 'cookbooks/blah/metadata.json', {}
- file 'cookbooks2/blah/metadata.rb', ''
+ file "cookbooks/blah/metadata.json", {}
+ 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")
+ 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")
/cookbooks/blah/
/cookbooks/blah/metadata.json
/cookbooks/cookbook1/
@@ -350,13 +350,13 @@ EOM
end
end
- context 'when there is a file in data_bags1 and a directory in data_bags2 with the same name' do
+ context "when there is a file in data_bags1 and a directory in data_bags2 with the same name" do
before do
- file 'data_bags/blah', ''
- file 'data_bags2/blah/item.json', ''
+ file "data_bags/blah", ""
+ file "data_bags2/blah/item.json", ""
end
- it 'knife list -Rfp data_bags shows files in blah' do
- knife('list --local -Rfp /data_bags').should_succeed <<EOM
+ it "knife list -Rfp data_bags shows files in blah" do
+ knife("list --local -Rfp /data_bags").should_succeed <<EOM
/data_bags/bag/
/data_bags/bag/item.json
/data_bags/bag2/
@@ -367,13 +367,13 @@ EOM
end
end
- context 'when there is a data bag in data_bags1 and a data bag in data_bags2 with the same name' do
+ context "when there is a data bag in data_bags1 and a data bag in data_bags2 with the same name" do
before do
- file 'data_bags/blah/item1.json', ''
- file 'data_bags2/blah/item2.json', ''
+ file "data_bags/blah/item1.json", ""
+ 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")
+ 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")
/data_bags/bag/
/data_bags/bag/item.json
/data_bags/bag2/
@@ -384,13 +384,13 @@ EOM
end
end
- context 'when there is a directory in environments1 and file in environments2 with the same name' do
+ context "when there is a directory in environments1 and file in environments2 with the same name" do
before do
- directory 'environments/blah.json'
- file 'environments2/blah.json', {}
+ directory "environments/blah.json"
+ file "environments2/blah.json", {}
end
- it 'knife show /environments/blah.json succeeds' do
- knife('show --local /environments/blah.json').should_succeed <<EOM
+ it "knife show /environments/blah.json succeeds" do
+ knife("show --local /environments/blah.json").should_succeed <<EOM
/environments/blah.json:
{
@@ -399,13 +399,13 @@ EOM
end
end
- context 'when there is a directory in nodes1 and file in nodes2 with the same name' do
+ context "when there is a directory in nodes1 and file in nodes2 with the same name" do
before do
- directory 'nodes/blah.json'
- file 'nodes2/blah.json', {}
+ directory "nodes/blah.json"
+ file "nodes2/blah.json", {}
end
- it 'knife show /nodes/blah.json succeeds' do
- knife('show --local /nodes/blah.json').should_succeed <<EOM
+ it "knife show /nodes/blah.json succeeds" do
+ knife("show --local /nodes/blah.json").should_succeed <<EOM
/nodes/blah.json:
{
@@ -414,13 +414,13 @@ EOM
end
end
- context 'when there is a directory in roles1 and file in roles2 with the same name' do
+ context "when there is a directory in roles1 and file in roles2 with the same name" do
before do
- directory 'roles/blah.json'
- file 'roles2/blah.json', {}
+ directory "roles/blah.json"
+ file "roles2/blah.json", {}
end
- it 'knife show /roles/blah.json succeeds' do
- knife('show --local /roles/blah.json').should_succeed <<EOM
+ it "knife show /roles/blah.json succeeds" do
+ knife("show --local /roles/blah.json").should_succeed <<EOM
/roles/blah.json:
{
@@ -429,13 +429,13 @@ EOM
end
end
- context 'when there is a directory in users1 and file in users2 with the same name' do
+ context "when there is a directory in users1 and file in users2 with the same name" do
before do
- directory 'users/blah.json'
- file 'users2/blah.json', {}
+ directory "users/blah.json"
+ file "users2/blah.json", {}
end
- it 'knife show /users/blah.json succeeds' do
- knife('show --local /users/blah.json').should_succeed <<EOM
+ it "knife show /users/blah.json succeeds" do
+ knife("show --local /users/blah.json").should_succeed <<EOM
/users/blah.json:
{
@@ -444,17 +444,17 @@ EOM
end
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag2/
@@ -463,10 +463,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client1.json
clients/client2.json
@@ -496,10 +496,10 @@ EOM
end
end
- context 'when cwd is inside data_bags2' do
- before { cwd 'data_bags2' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside data_bags2" do
+ before { cwd "data_bags2" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag2/
@@ -509,21 +509,21 @@ EOM
end
end
- context 'when when chef_repo_path is set to both places and no other _path is set' do
+ context "when when chef_repo_path is set to both places and no other _path is set" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.chef_repo_path = [
Chef::Config.chef_repo_path,
- File.join(Chef::Config.chef_repo_path, 'chef_repo2'),
+ File.join(Chef::Config.chef_repo_path, "chef_repo2"),
]
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client1.json
clients/client3.json
@@ -553,10 +553,10 @@ EOM
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag3/
@@ -565,10 +565,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client1.json
clients/client3.json
@@ -598,10 +598,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2/data_bags' do
- before { cwd 'chef_repo2/data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2/data_bags" do
+ before { cwd "chef_repo2/data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag3/
@@ -611,33 +611,33 @@ EOM
end
end
- context 'when cookbook_path is set and nothing else' do
+ context "when cookbook_path is set and nothing else" do
before :each do
%w(client data_bag environment node role user).each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.delete(:chef_repo_path)
- Chef::Config.cookbook_path = File.join(@repository_dir, 'chef_repo2', 'cookbooks')
+ Chef::Config.cookbook_path = File.join(@repository_dir, "chef_repo2", "cookbooks")
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client3.json
cookbooks/
@@ -658,10 +658,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2/data_bags' do
- before { cwd 'chef_repo2/data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2/data_bags" do
+ before { cwd "chef_repo2/data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag3/
bag3/item3.json
EOM
@@ -669,22 +669,22 @@ EOM
end
end
- context 'when cookbook_path is set to multiple places and nothing else is set' do
+ context "when cookbook_path is set to multiple places and nothing else is set" do
before :each do
%w(client data_bag environment node role user).each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.delete(:chef_repo_path)
Chef::Config.cookbook_path = [
- File.join(@repository_dir, 'cookbooks'),
- File.join(@repository_dir, 'chef_repo2', 'cookbooks'),
+ File.join(@repository_dir, "cookbooks"),
+ File.join(@repository_dir, "chef_repo2", "cookbooks"),
]
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client1.json
clients/client3.json
@@ -714,10 +714,10 @@ EOM
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag3/
@@ -726,10 +726,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client1.json
clients/client3.json
@@ -759,10 +759,10 @@ EOM
end
end
- context 'when cwd is inside chef_repo2/data_bags' do
- before { cwd 'chef_repo2/data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2/data_bags" do
+ before { cwd "chef_repo2/data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
bag3/
@@ -772,36 +772,36 @@ EOM
end
end
- context 'when data_bag_path and chef_repo_path are set, and nothing else' do
+ context "when data_bag_path and chef_repo_path are set, and nothing else" do
before :each do
%w(client cookbook environment node role user).each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
end
- Chef::Config.data_bag_path = File.join(Chef::Config.chef_repo_path, 'data_bags')
- Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, 'chef_repo2')
+ Chef::Config.data_bag_path = File.join(Chef::Config.chef_repo_path, "data_bags")
+ Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "chef_repo2")
end
- context 'when cwd is at the top level' do
- before { cwd '.' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is at the top level" do
+ before { cwd "." }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
EOM
end
end
- context 'when cwd is inside chef_repo2' do
- before { cwd 'chef_repo2' }
- it 'knife list --local -Rfp lists everything' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside chef_repo2" do
+ before { cwd "chef_repo2" }
+ it "knife list --local -Rfp lists everything" do
+ knife("list --local -Rfp").should_succeed <<EOM
clients/
clients/client3.json
cookbooks/
@@ -822,15 +822,15 @@ EOM
end
end
- context 'when cwd is inside chef_repo2/data_bags' do
- before { cwd 'chef_repo2/data_bags' }
- it 'knife list --local -Rfp fails' do
- knife('list --local -Rfp').should_fail(error_rel_path_outside_repo)
+ context "when cwd is inside chef_repo2/data_bags" do
+ before { cwd "chef_repo2/data_bags" }
+ it "knife list --local -Rfp fails" do
+ knife("list --local -Rfp").should_fail(error_rel_path_outside_repo)
end
end
end
- context 'when data_bag_path is set and nothing else' do
+ context "when data_bag_path is set and nothing else" do
include_context "default config options"
before :each do
@@ -838,28 +838,28 @@ EOM
Chef::Config.delete("#{object_name}_path".to_sym)
end
Chef::Config.delete(:chef_repo_path)
- Chef::Config.data_bag_path = File.join(@repository_dir, 'data_bags')
+ Chef::Config.data_bag_path = File.join(@repository_dir, "data_bags")
end
- it 'knife list --local -Rfp / lists data bags' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "knife list --local -Rfp / lists data bags" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/data_bags/
/data_bags/bag/
/data_bags/bag/item.json
EOM
end
- it 'knife list --local -Rfp /data_bags lists data bags' do
- knife('list --local -Rfp /data_bags').should_succeed <<EOM
+ it "knife list --local -Rfp /data_bags lists data bags" do
+ knife("list --local -Rfp /data_bags").should_succeed <<EOM
/data_bags/bag/
/data_bags/bag/item.json
EOM
end
- context 'when cwd is inside the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife list --local -Rfp lists data bags' do
- knife('list --local -Rfp').should_succeed <<EOM
+ context "when cwd is inside the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife list --local -Rfp lists data bags" do
+ knife("list --local -Rfp").should_succeed <<EOM
bag/
bag/item.json
EOM
@@ -868,21 +868,21 @@ EOM
end
end
- when_the_repository 'is empty' do
- context 'when the repository _paths point to places that do not exist' do
+ when_the_repository "is empty" do
+ context "when the repository _paths point to places that do not exist" do
before :each do
%w(client cookbook data_bag environment node role user).each do |object_name|
- Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, 'nowhere', object_name)
+ Chef::Config["#{object_name}_path".to_sym] = File.join(Chef::Config.chef_repo_path, "nowhere", object_name)
end
- Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, 'nowhere')
+ Chef::Config.chef_repo_path = File.join(Chef::Config.chef_repo_path, "nowhere")
end
- it 'knife list --local -Rfp / fails' do
- knife('list --local -Rfp /').should_succeed ''
+ it "knife list --local -Rfp / fails" do
+ knife("list --local -Rfp /").should_succeed ""
end
- it 'knife list --local -Rfp /data_bags fails' do
- knife('list --local -Rfp /data_bags').should_fail("ERROR: /data_bags: No such file or directory\n")
+ it "knife list --local -Rfp /data_bags fails" do
+ knife("list --local -Rfp /data_bags").should_fail("ERROR: /data_bags: No such file or directory\n")
end
end
end
diff --git a/spec/integration/knife/chef_repository_file_system_spec.rb b/spec/integration/knife/chef_repository_file_system_spec.rb
index 34afd228f3..dc33d299e1 100644
--- a/spec/integration/knife/chef_repository_file_system_spec.rb
+++ b/spec/integration/knife/chef_repository_file_system_spec.rb
@@ -15,15 +15,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/list'
-require 'chef/knife/show'
+require "support/shared/integration/integration_helper"
+require "chef/knife/list"
+require "chef/knife/show"
-describe 'General chef_repo file system checks', :workstation do
+describe "General chef_repo file system checks", :workstation do
include IntegrationSupport
include KnifeSupport
- context 'directories and files that should/should not be ignored' do
+ context "directories and files that should/should not be ignored" do
when_the_repository "has empty roles, environments and data bag item directories" do
before do
directory "roles"
@@ -32,7 +32,7 @@ describe 'General chef_repo file system checks', :workstation do
end
it "knife list --local -Rfp / returns them" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/data_bags/
/data_bags/bag1/
/environments/
@@ -45,25 +45,25 @@ EOM
before { directory "data_bags" }
it "knife list --local / returns it" do
- knife('list --local /').should_succeed "/data_bags\n"
+ knife("list --local /").should_succeed "/data_bags\n"
end
end
when_the_repository "has an empty cookbook directory" do
- before { directory 'cookbooks/cookbook1' }
+ 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
end
when_the_repository "has only empty cookbook subdirectories" do
- before { directory 'cookbooks/cookbook1/recipes' }
+ 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
@@ -71,12 +71,12 @@ EOM
when_the_repository "has empty and non-empty cookbook subdirectories" do
before do
- directory 'cookbooks/cookbook1/recipes'
- file 'cookbooks/cookbook1/templates/default/x.txt', ''
+ directory "cookbooks/cookbook1/recipes"
+ file "cookbooks/cookbook1/templates/default/x.txt", ""
end
it "knife list --local -Rfp / does not return the empty ones" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/templates/
@@ -87,10 +87,10 @@ EOM
end
when_the_repository "has only empty cookbook sub-sub-directories" do
- before { directory 'cookbooks/cookbook1/templates/default' }
+ 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
@@ -98,13 +98,13 @@ EOM
when_the_repository "has empty cookbook sub-sub-directories alongside non-empty ones" do
before do
- file 'cookbooks/cookbook1/templates/default/x.txt', ''
- directory 'cookbooks/cookbook1/templates/rhel'
- directory 'cookbooks/cookbook1/files/default'
+ file "cookbooks/cookbook1/templates/default/x.txt", ""
+ directory "cookbooks/cookbook1/templates/rhel"
+ directory "cookbooks/cookbook1/files/default"
end
it "knife list --local -Rfp / does not return the empty ones" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/templates/
@@ -122,7 +122,7 @@ EOM
end
it "knife list --local -Rfp / should NOT return it" do
- knife('list --local -Rfp /').should_succeed ""
+ knife("list --local -Rfp /").should_succeed ""
end
end
@@ -146,7 +146,7 @@ EOM
end
it "knife list --local -Rfp / should NOT return them" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/data_bags/
/data_bags/bag1/
/data_bags/bag1/item1.json
@@ -160,62 +160,62 @@ EOM
when_the_repository "has extraneous subdirectories and files under a cookbook" do
before do
- directory 'cookbooks/cookbook1' do
- file 'a.rb', ''
- file 'blarghle/blah.rb', ''
- directory 'attributes' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "cookbooks/cookbook1" do
+ file "a.rb", ""
+ file "blarghle/blah.rb", ""
+ directory "attributes" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'definitions' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "definitions" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'recipes' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "recipes" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'libraries' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "libraries" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'templates' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "templates" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'files' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "files" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'resources' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "resources" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
- directory 'providers' do
- file 'a.rb', ''
- file 'b.json', {}
- file 'c/d.rb', ''
- file 'c/e.json', {}
+ directory "providers" do
+ file "a.rb", ""
+ file "b.json", {}
+ file "c/d.rb", ""
+ file "c/e.json", {}
end
end
end
it "knife list --local -Rfp / should NOT return them" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/a.rb
@@ -252,41 +252,41 @@ EOM
end
when_the_repository "has a file in cookbooks/" do
- before { file 'cookbooks/file', '' }
- it 'does not show up in list -Rfp' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ before { file "cookbooks/file", "" }
+ it "does not show up in list -Rfp" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
EOM
end
end
when_the_repository "has a file in data_bags/" do
- before { file 'data_bags/file', '' }
- it 'does not show up in list -Rfp' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ before { file "data_bags/file", "" }
+ it "does not show up in list -Rfp" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/data_bags/
EOM
end
end
end
- when_the_repository 'has a cookbook starting with .' do
+ when_the_repository "has a cookbook starting with ." do
before do
- file 'cookbooks/.svn/metadata.rb', ''
- file 'cookbooks/a.b/metadata.rb', ''
+ file "cookbooks/.svn/metadata.rb", ""
+ file "cookbooks/a.b/metadata.rb", ""
end
- it 'knife list does not show it' do
- knife('list --local -fp /cookbooks').should_succeed "/cookbooks/a.b/\n"
+ it "knife list does not show it" do
+ knife("list --local -fp /cookbooks").should_succeed "/cookbooks/a.b/\n"
end
end
- when_the_repository 'has a data bag starting with .' do
+ when_the_repository "has a data bag starting with ." do
before do
- file 'data_bags/.svn/x.json', {}
- file 'data_bags/a.b/x.json', {}
+ file "data_bags/.svn/x.json", {}
+ file "data_bags/a.b/x.json", {}
end
- it 'knife list does not show it' do
- knife('list --local -fp /data_bags').should_succeed "/data_bags/a.b/\n"
+ it "knife list does not show it" do
+ knife("list --local -fp /data_bags").should_succeed "/data_bags/a.b/\n"
end
end
end
diff --git a/spec/integration/knife/chefignore_spec.rb b/spec/integration/knife/chefignore_spec.rb
index 10cfbbf557..3ffd0453e8 100644
--- a/spec/integration/knife/chefignore_spec.rb
+++ b/spec/integration/knife/chefignore_spec.rb
@@ -15,37 +15,37 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/list'
-require 'chef/knife/show'
+require "support/shared/integration/integration_helper"
+require "chef/knife/list"
+require "chef/knife/show"
-describe 'chefignore tests', :workstation do
+describe "chefignore tests", :workstation do
include IntegrationSupport
include KnifeSupport
when_the_repository "has lots of stuff in it" do
before do
- file 'roles/x.json', {}
- file 'environments/x.json', {}
- file 'data_bags/bag1/x.json', {}
- file 'cookbooks/cookbook1/x.json', {}
+ file "roles/x.json", {}
+ file "environments/x.json", {}
+ file "data_bags/bag1/x.json", {}
+ file "cookbooks/cookbook1/x.json", {}
end
context "and has a chefignore everywhere except cookbooks" do
before do
chefignore = "x.json\nroles/x.json\nenvironments/x.json\ndata_bags/bag1/x.json\nbag1/x.json\ncookbooks/cookbook1/x.json\ncookbook1/x.json\n"
- file 'chefignore', chefignore
- file 'roles/chefignore', chefignore
- file 'environments/chefignore', chefignore
- file 'data_bags/chefignore', chefignore
- file 'data_bags/bag1/chefignore', chefignore
- file 'cookbooks/cookbook1/chefignore', chefignore
+ file "chefignore", chefignore
+ file "roles/chefignore", chefignore
+ file "environments/chefignore", chefignore
+ file "data_bags/chefignore", chefignore
+ file "data_bags/bag1/chefignore", chefignore
+ file "cookbooks/cookbook1/chefignore", chefignore
end
- it 'matching files and directories get ignored' do
+ it "matching files and directories get ignored" do
# NOTE: many of the "chefignore" files should probably not show up
# themselves, but we have other tests that talk about that
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/chefignore
@@ -61,15 +61,15 @@ EOM
end
end
- when_the_repository 'has a cookbook with only chefignored files' do
+ when_the_repository "has a cookbook with only chefignored files" do
before do
- file 'cookbooks/cookbook1/templates/default/x.rb', ''
- file 'cookbooks/cookbook1/libraries/x.rb', ''
- file 'cookbooks/chefignore', "libraries/x.rb\ntemplates/default/x.rb\n"
+ file "cookbooks/cookbook1/templates/default/x.rb", ""
+ file "cookbooks/cookbook1/libraries/x.rb", ""
+ file "cookbooks/chefignore", "libraries/x.rb\ntemplates/default/x.rb\n"
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")
+ 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")
/cookbooks/
EOM
end
@@ -77,17 +77,17 @@ EOM
when_the_repository "has multiple cookbooks" do
before do
- file 'cookbooks/cookbook1/x.json', {}
- file 'cookbooks/cookbook1/y.json', {}
- file 'cookbooks/cookbook2/x.json', {}
- file 'cookbooks/cookbook2/y.json', {}
+ file "cookbooks/cookbook1/x.json", {}
+ file "cookbooks/cookbook1/y.json", {}
+ file "cookbooks/cookbook2/x.json", {}
+ file "cookbooks/cookbook2/y.json", {}
end
- context 'and has a chefignore with filenames' do
- before { file 'cookbooks/chefignore', "x.json\n" }
+ context "and has a chefignore with filenames" do
+ before { file "cookbooks/chefignore", "x.json\n" }
- it 'matching files and directories get ignored in all cookbooks' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "matching files and directories get ignored in all cookbooks" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/y.json
@@ -99,12 +99,12 @@ EOM
context "and has a chefignore with wildcards" do
before do
- file 'cookbooks/chefignore', "x.*\n"
- file 'cookbooks/cookbook1/x.rb', ''
+ file "cookbooks/chefignore", "x.*\n"
+ file "cookbooks/cookbook1/x.rb", ""
end
- it 'matching files and directories get ignored in all cookbooks' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "matching files and directories get ignored in all cookbooks" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/y.json
@@ -116,13 +116,13 @@ EOM
context "and has a chefignore with relative paths" do
before do
- file 'cookbooks/cookbook1/recipes/x.rb', ''
- file 'cookbooks/cookbook2/recipes/y.rb', ''
- file 'cookbooks/chefignore', "recipes/x.rb\n"
+ file "cookbooks/cookbook1/recipes/x.rb", ""
+ file "cookbooks/cookbook2/recipes/y.rb", ""
+ file "cookbooks/chefignore", "recipes/x.rb\n"
end
- it 'matching directories get ignored' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "matching directories get ignored" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/x.json
@@ -138,12 +138,12 @@ EOM
context "and has a chefignore with subdirectories" do
before do
- file 'cookbooks/cookbook1/recipes/y.rb', ''
- file 'cookbooks/chefignore', "recipes\nrecipes/\n"
+ file "cookbooks/cookbook1/recipes/y.rb", ""
+ file "cookbooks/chefignore", "recipes\nrecipes/\n"
end
- it 'matching directories do NOT get ignored' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "matching directories do NOT get ignored" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/recipes/
@@ -159,13 +159,13 @@ EOM
context "and has a chefignore that ignores all files in a subdirectory" do
before do
- file 'cookbooks/cookbook1/templates/default/x.rb', ''
- file 'cookbooks/cookbook1/libraries/x.rb', ''
- file 'cookbooks/chefignore', "libraries/x.rb\ntemplates/default/x.rb\n"
+ file "cookbooks/cookbook1/templates/default/x.rb", ""
+ file "cookbooks/cookbook1/libraries/x.rb", ""
+ file "cookbooks/chefignore", "libraries/x.rb\ntemplates/default/x.rb\n"
end
- it 'ignores the subdirectory entirely' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "ignores the subdirectory entirely" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/x.json
@@ -179,11 +179,11 @@ EOM
context "and has an empty chefignore" do
before do
- file 'cookbooks/chefignore', "\n"
+ file "cookbooks/chefignore", "\n"
end
- it 'nothing is ignored' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "nothing is ignored" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/x.json
@@ -197,11 +197,11 @@ EOM
context "and has a chefignore with comments and empty lines" do
before do
- file 'cookbooks/chefignore', "\n\n # blah\n#\nx.json\n\n"
+ file "cookbooks/chefignore", "\n\n # blah\n#\nx.json\n\n"
end
- it 'matching files and directories get ignored in all cookbooks' do
- knife('list --local -Rfp /').should_succeed <<EOM
+ it "matching files and directories get ignored in all cookbooks" do
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/cookbook1/
/cookbooks/cookbook1/y.json
@@ -215,25 +215,25 @@ EOM
when_the_repository "has multiple cookbook paths" do
before :each do
Chef::Config.cookbook_path = [
- File.join(Chef::Config.chef_repo_path, 'cookbooks1'),
- File.join(Chef::Config.chef_repo_path, 'cookbooks2'),
+ File.join(Chef::Config.chef_repo_path, "cookbooks1"),
+ File.join(Chef::Config.chef_repo_path, "cookbooks2"),
]
end
before do
- file 'cookbooks1/mycookbook/metadata.rb', ''
- file 'cookbooks1/mycookbook/x.json', {}
- file 'cookbooks2/yourcookbook/metadata.rb', ''
- file 'cookbooks2/yourcookbook/x.json', ''
+ file "cookbooks1/mycookbook/metadata.rb", ""
+ file "cookbooks1/mycookbook/x.json", {}
+ file "cookbooks2/yourcookbook/metadata.rb", ""
+ file "cookbooks2/yourcookbook/x.json", ""
end
context "and multiple chefignores" do
before do
- file 'cookbooks1/chefignore', "metadata.rb\n"
- file 'cookbooks2/chefignore', "x.json\n"
+ file "cookbooks1/chefignore", "metadata.rb\n"
+ file "cookbooks2/chefignore", "x.json\n"
end
it "chefignores apply only to the directories they are in" do
- knife('list --local -Rfp /').should_succeed <<EOM
+ knife("list --local -Rfp /").should_succeed <<EOM
/cookbooks/
/cookbooks/mycookbook/
/cookbooks/mycookbook/x.json
@@ -244,14 +244,14 @@ EOM
context "and conflicting cookbooks" do
before do
- file 'cookbooks1/yourcookbook/metadata.rb', ''
- file 'cookbooks1/yourcookbook/x.json', ''
- file 'cookbooks1/yourcookbook/onlyincookbooks1.rb', ''
- file 'cookbooks2/yourcookbook/onlyincookbooks2.rb', ''
+ file "cookbooks1/yourcookbook/metadata.rb", ""
+ file "cookbooks1/yourcookbook/x.json", ""
+ file "cookbooks1/yourcookbook/onlyincookbooks1.rb", ""
+ file "cookbooks2/yourcookbook/onlyincookbooks2.rb", ""
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
@@ -264,32 +264,32 @@ EOM
end
end
- when_the_repository 'has a cookbook named chefignore' do
+ when_the_repository "has a cookbook named chefignore" do
before do
- file 'cookbooks/chefignore/metadata.rb', {}
+ file "cookbooks/chefignore/metadata.rb", {}
end
- it 'knife list -Rfp /cookbooks shows it' do
- knife('list --local -Rfp /cookbooks').should_succeed <<EOM
+ it "knife list -Rfp /cookbooks shows it" do
+ knife("list --local -Rfp /cookbooks").should_succeed <<EOM
/cookbooks/chefignore/
/cookbooks/chefignore/metadata.rb
EOM
end
end
- when_the_repository 'has multiple cookbook paths, one with a chefignore file and the other with a cookbook named chefignore' do
+ when_the_repository "has multiple cookbook paths, one with a chefignore file and the other with a cookbook named chefignore" do
before do
- file 'cookbooks1/chefignore', ''
- file 'cookbooks1/blah/metadata.rb', ''
- file 'cookbooks2/chefignore/metadata.rb', ''
+ file "cookbooks1/chefignore", ""
+ file "cookbooks1/blah/metadata.rb", ""
+ file "cookbooks2/chefignore/metadata.rb", ""
end
before :each do
Chef::Config.cookbook_path = [
- File.join(Chef::Config.chef_repo_path, 'cookbooks1'),
- File.join(Chef::Config.chef_repo_path, 'cookbooks2'),
+ File.join(Chef::Config.chef_repo_path, "cookbooks1"),
+ File.join(Chef::Config.chef_repo_path, "cookbooks2"),
]
end
- it 'knife list -Rfp /cookbooks shows the chefignore cookbook' do
- knife('list --local -Rfp /cookbooks').should_succeed <<EOM
+ it "knife list -Rfp /cookbooks shows the chefignore cookbook" do
+ knife("list --local -Rfp /cookbooks").should_succeed <<EOM
/cookbooks/blah/
/cookbooks/blah/metadata.rb
/cookbooks/chefignore/
diff --git a/spec/integration/knife/common_options_spec.rb b/spec/integration/knife/common_options_spec.rb
index b2e2e3fc2a..0c287580db 100644
--- a/spec/integration/knife/common_options_spec.rb
+++ b/spec/integration/knife/common_options_spec.rb
@@ -15,46 +15,46 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/raw'
+require "support/shared/integration/integration_helper"
+require "chef/knife/raw"
-describe 'knife common options', :workstation do
+describe "knife common options", :workstation do
include IntegrationSupport
include KnifeSupport
when_the_repository "has a node" do
- before { file 'nodes/x.json', {} }
+ before { file "nodes/x.json", {} }
- context 'When chef_zero.enabled is true' do
+ context "When chef_zero.enabled is true" do
before(:each) do
Chef::Config.chef_zero.enabled = true
end
- it 'knife raw /nodes/x should retrieve the node' do
- knife('raw /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw /nodes/x should retrieve the node" do
+ knife("raw /nodes/x").should_succeed( /"name": "x"/ )
end
- context 'And chef_zero.port is 9999' do
+ context "And chef_zero.port is 9999" do
before(:each) { Chef::Config.chef_zero.port = 9999 }
- it 'knife raw /nodes/x should retrieve the node' do
- knife('raw /nodes/x').should_succeed( /"name": "x"/ )
- expect(Chef::Config.chef_server_url).to eq('chefzero://localhost:9999')
+ it "knife raw /nodes/x should retrieve the node" do
+ knife("raw /nodes/x").should_succeed( /"name": "x"/ )
+ expect(Chef::Config.chef_server_url).to eq("chefzero://localhost:9999")
end
end
# 0.0.0.0 is not a valid address to bind to on windows.
- context 'And chef_zero.host is 0.0.0.0', :unix_only do
- before(:each) { Chef::Config.chef_zero.host = '0.0.0.0' }
+ context "And chef_zero.host is 0.0.0.0", :unix_only do
+ before(:each) { Chef::Config.chef_zero.host = "0.0.0.0" }
- it 'knife raw /nodes/x should retrieve the role' do
- knife('raw /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw /nodes/x should retrieve the role" do
+ knife("raw /nodes/x").should_succeed( /"name": "x"/ )
end
end
- context 'and there is a private key' do
+ context "and there is a private key" do
before do
- file 'mykey.pem', <<EOM
+ file "mykey.pem", <<EOM
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEApubutqtYYQ5UiA9QhWP7UvSmsfHsAoPKEVVPdVW/e8Svwpyf
0Xef6OFWVmBE+W442ZjLOe2y6p2nSnaq4y7dg99NFz6X+16mcKiCbj0RCiGqCvCk
@@ -85,29 +85,29 @@ syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T
EOM
end
- it 'knife raw /nodes/x should retrieve the node' do
- knife('raw /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw /nodes/x should retrieve the node" do
+ knife("raw /nodes/x").should_succeed( /"name": "x"/ )
end
end
end
- it 'knife raw -z /nodes/x retrieves the node' do
- knife('raw -z /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw -z /nodes/x retrieves the node" do
+ knife("raw -z /nodes/x").should_succeed( /"name": "x"/ )
end
- it 'knife raw --local-mode /nodes/x retrieves the node' do
- knife('raw --local-mode /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw --local-mode /nodes/x retrieves the node" do
+ knife("raw --local-mode /nodes/x").should_succeed( /"name": "x"/ )
end
- it 'knife raw -z --chef-zero-port=9999 /nodes/x retrieves the node' do
- knife('raw -z --chef-zero-port=9999 /nodes/x').should_succeed( /"name": "x"/ )
- expect(Chef::Config.chef_server_url).to eq('chefzero://localhost:9999')
+ it "knife raw -z --chef-zero-port=9999 /nodes/x retrieves the node" do
+ knife("raw -z --chef-zero-port=9999 /nodes/x").should_succeed( /"name": "x"/ )
+ expect(Chef::Config.chef_server_url).to eq("chefzero://localhost:9999")
end
- context 'when the default port (8889) is already bound' do
+ 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.
@@ -117,16 +117,16 @@ EOM
@server.stop if @server
end
- it 'knife raw -z /nodes/x retrieves the node' do
- knife('raw -z /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw -z /nodes/x retrieves the node" do
+ knife("raw -z /nodes/x").should_succeed( /"name": "x"/ )
expect(URI(Chef::Config.chef_server_url).port).to be > 8889
end
end
- context 'when port 9999 is already bound' do
+ 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.
@@ -136,20 +136,20 @@ EOM
@server.stop if @server
end
- it 'knife raw -z --chef-zero-port=9999-20000 /nodes/x' do
- knife('raw -z --chef-zero-port=9999-20000 /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw -z --chef-zero-port=9999-20000 /nodes/x" do
+ knife("raw -z --chef-zero-port=9999-20000 /nodes/x").should_succeed( /"name": "x"/ )
expect(URI(Chef::Config.chef_server_url).port).to be > 9999
end
- it 'knife raw -z --chef-zero-port=9999-9999,19423' do
- knife('raw -z --chef-zero-port=9999-9999,19423 /nodes/x').should_succeed( /"name": "x"/ )
+ it "knife raw -z --chef-zero-port=9999-9999,19423" do
+ knife("raw -z --chef-zero-port=9999-9999,19423 /nodes/x").should_succeed( /"name": "x"/ )
expect(URI(Chef::Config.chef_server_url).port).to be == 19423
end
end
- it 'knife raw -z --chef-zero-port=9999 /nodes/x retrieves the node' do
- knife('raw -z --chef-zero-port=9999 /nodes/x').should_succeed( /"name": "x"/ )
- expect(Chef::Config.chef_server_url).to eq('chefzero://localhost:9999')
+ it "knife raw -z --chef-zero-port=9999 /nodes/x retrieves the node" do
+ knife("raw -z --chef-zero-port=9999 /nodes/x").should_succeed( /"name": "x"/ )
+ expect(Chef::Config.chef_server_url).to eq("chefzero://localhost:9999")
end
end
end
diff --git a/spec/integration/knife/cookbook_api_ipv6_spec.rb b/spec/integration/knife/cookbook_api_ipv6_spec.rb
index 4b44c87fc1..3033c4cf4a 100644
--- a/spec/integration/knife/cookbook_api_ipv6_spec.rb
+++ b/spec/integration/knife/cookbook_api_ipv6_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
describe "Knife cookbook API integration with IPv6", :workstation, :not_supported_on_gce do
include IntegrationSupport
@@ -84,8 +84,8 @@ END_CLIENT_RB
end
before do
- file 'config/knife.rb', knife_rb_content
- file 'config/knifeuser.pem', client_key
+ file "config/knife.rb", knife_rb_content
+ file "config/knifeuser.pem", client_key
end
it "successfully uploads a cookbook" do
diff --git a/spec/integration/knife/delete_spec.rb b/spec/integration/knife/delete_spec.rb
index 384f06cf83..3a1a93fb51 100644
--- a/spec/integration/knife/delete_spec.rb
+++ b/spec/integration/knife/delete_spec.rb
@@ -15,12 +15,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/delete'
-require 'chef/knife/list'
-require 'chef/knife/raw'
+require "support/shared/integration/integration_helper"
+require "chef/knife/delete"
+require "chef/knife/list"
+require "chef/knife/raw"
-describe 'knife delete', :workstation do
+describe "knife delete", :workstation do
include IntegrationSupport
include KnifeSupport
@@ -100,39 +100,39 @@ EOM
when_the_chef_server "has one of each thing" do
before do
- client 'x', '{}'
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => '{}' }
- environment 'x', '{}'
- node 'x', '{}'
- role 'x', '{}'
- user 'x', '{}'
+ client "x", "{}"
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => "{}" }
+ environment "x", "{}"
+ node "x", "{}"
+ role "x", "{}"
+ user "x", "{}"
end
- when_the_repository 'also has one of each thing' do
+ when_the_repository "also has one of each thing" do
before do
- file 'clients/x.json', {}
- file 'cookbooks/x/metadata.rb', ''
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', {}
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/x.json', {}
- end
-
- it 'knife delete --both /cookbooks/x fails' do
- knife('delete --both /cookbooks/x').should_fail <<EOM
+ file "clients/x.json", {}
+ file "cookbooks/x/metadata.rb", ""
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", {}
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/x.json", {}
+ end
+
+ it "knife delete --both /cookbooks/x fails" do
+ knife("delete --both /cookbooks/x").should_fail <<EOM
ERROR: /cookbooks/x (remote) must be deleted recursively! Pass -r to knife delete.
ERROR: /cookbooks/x (local) must be deleted recursively! Pass -r to knife delete.
EOM
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both -r /cookbooks/x deletes x' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both -r /cookbooks/x deletes x" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -152,7 +152,7 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -171,10 +171,10 @@ EOM
EOM
end
- it 'knife delete -r --local /cookbooks/x deletes x locally but not remotely' do
- knife('delete -r --local /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed <<EOM
+ it "knife delete -r --local /cookbooks/x deletes x locally but not remotely" do
+ knife("delete -r --local /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -193,9 +193,9 @@ EOM
EOM
end
- it 'knife delete -r /cookbooks/x deletes x remotely but not locally' do
- knife('delete -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete -r /cookbooks/x deletes x remotely but not locally" do
+ knife("delete -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -215,22 +215,22 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf --local /").should_succeed everything
end
# TODO delete empty data bag (particularly different on local side)
- context 'with an empty data bag on both' do
+ context "with an empty data bag on both" do
before do
- data_bag 'empty', {}
- directory 'data_bags/empty'
+ data_bag "empty", {}
+ directory "data_bags/empty"
end
- it 'knife delete --both /data_bags/empty fails but deletes local version' do
- knife('delete --both /data_bags/empty').should_fail <<EOM
+ it "knife delete --both /data_bags/empty fails but deletes local version" do
+ knife("delete --both /data_bags/empty").should_fail <<EOM
ERROR: /data_bags/empty (remote) must be deleted recursively! Pass -r to knife delete.
ERROR: /data_bags/empty (local) must be deleted recursively! Pass -r to knife delete.
EOM
- knife('list -Rf /').should_succeed <<EOM
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -253,7 +253,7 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -276,18 +276,18 @@ EOM
end
end
- it 'knife delete --both /data_bags/x fails' do
- knife('delete --both /data_bags/x').should_fail <<EOM
+ it "knife delete --both /data_bags/x fails" do
+ knife("delete --both /data_bags/x").should_fail <<EOM
ERROR: /data_bags/x (remote) must be deleted recursively! Pass -r to knife delete.
ERROR: /data_bags/x (local) must be deleted recursively! Pass -r to knife delete.
EOM
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both -r /data_bags/x deletes x' do
- knife('delete --both -r /data_bags/x').should_succeed "Deleted /data_bags/x\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both -r /data_bags/x deletes x" do
+ knife("delete --both -r /data_bags/x").should_succeed "Deleted /data_bags/x\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -307,7 +307,7 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -326,9 +326,9 @@ EOM
EOM
end
- it 'knife delete --both /environments/x.json deletes x' do
- knife('delete --both /environments/x.json').should_succeed "Deleted /environments/x.json\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both /environments/x.json deletes x" do
+ knife("delete --both /environments/x.json").should_succeed "Deleted /environments/x.json\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -349,7 +349,7 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -369,9 +369,9 @@ EOM
EOM
end
- it 'knife delete --both /roles/x.json deletes x' do
- knife('delete --both /roles/x.json').should_succeed "Deleted /roles/x.json\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both /roles/x.json deletes x" do
+ knife("delete --both /roles/x.json").should_succeed "Deleted /roles/x.json\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -392,7 +392,7 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -412,10 +412,10 @@ EOM
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('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed <<EOM
+ 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("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -435,23 +435,23 @@ EOM
EOM
end
- it 'knife delete --both /environments/nonexistent.json fails' do
- knife('delete --both /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed everything
+ it "knife delete --both /environments/nonexistent.json fails" do
+ knife("delete --both /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both / fails' do
- knife('delete --both /').should_fail <<EOM
+ it "knife delete --both / fails" do
+ knife("delete --both /").should_fail <<EOM
ERROR: / (remote) cannot be deleted.
ERROR: / (local) cannot be deleted.
EOM
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both -r /* fails' do
- knife('delete --both -r /*').should_fail <<EOM
+ it "knife delete --both -r /* fails" do
+ knife("delete --both -r /*").should_fail <<EOM
ERROR: / (remote) cannot be deleted.
ERROR: / (local) cannot be deleted.
ERROR: /clients (remote) cannot be deleted.
@@ -469,31 +469,31 @@ ERROR: /roles (local) cannot be deleted.
ERROR: /users (remote) cannot be deleted.
ERROR: /users (local) cannot be deleted.
EOM
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed everything
end
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
end
- it 'knife delete --both /cookbooks/x fails' do
- knife('delete --both /cookbooks/x').should_fail "ERROR: /cookbooks/x (remote) must be deleted recursively! Pass -r to knife delete.\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ it "knife delete --both /cookbooks/x fails" do
+ knife("delete --both /cookbooks/x").should_fail "ERROR: /cookbooks/x (remote) must be deleted recursively! Pass -r to knife delete.\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both -r /cookbooks/x deletes x' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both -r /cookbooks/x deletes x" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -513,18 +513,18 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed nothing
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both /data_bags/x fails' do
- knife('delete --both /data_bags/x').should_fail "ERROR: /data_bags/x (remote) must be deleted recursively! Pass -r to knife delete.\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ it "knife delete --both /data_bags/x fails" do
+ knife("delete --both /data_bags/x").should_fail "ERROR: /data_bags/x (remote) must be deleted recursively! Pass -r to knife delete.\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both -r /data_bags/x deletes x' do
- knife('delete --both -r /data_bags/x').should_succeed "Deleted /data_bags/x\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both -r /data_bags/x deletes x" do
+ knife("delete --both -r /data_bags/x").should_succeed "Deleted /data_bags/x\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -544,12 +544,12 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed nothing
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both /environments/x.json deletes x' do
- knife('delete --both /environments/x.json').should_succeed "Deleted /environments/x.json\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both /environments/x.json deletes x" do
+ knife("delete --both /environments/x.json").should_succeed "Deleted /environments/x.json\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -570,12 +570,12 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed nothing
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both /roles/x.json deletes x' do
- knife('delete --both /roles/x.json').should_succeed "Deleted /roles/x.json\n"
- knife('list -Rf /').should_succeed <<EOM
+ it "knife delete --both /roles/x.json deletes x" do
+ knife("delete --both /roles/x.json").should_succeed "Deleted /roles/x.json\n"
+ knife("list -Rf /").should_succeed <<EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -596,23 +596,23 @@ EOM
/users/admin.json
/users/x.json
EOM
- knife('list -Rf --local /').should_succeed nothing
+ knife("list -Rf --local /").should_succeed nothing
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('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ 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("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both / fails' do
- knife('delete --both /').should_fail "ERROR: / (remote) cannot be deleted.\nERROR: / (local) cannot be deleted.\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ it "knife delete --both / fails" do
+ knife("delete --both /").should_fail "ERROR: / (remote) cannot be deleted.\nERROR: / (local) cannot be deleted.\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both -r /* fails' do
- knife('delete --both -r /*').should_fail <<EOM
+ it "knife delete --both -r /* fails" do
+ knife("delete --both -r /*").should_fail <<EOM
ERROR: / (remote) cannot be deleted.
ERROR: / (local) cannot be deleted.
ERROR: /clients (remote) cannot be deleted.
@@ -630,21 +630,21 @@ ERROR: /roles (local) cannot be deleted.
ERROR: /users (remote) cannot be deleted.
ERROR: /users (local) cannot be deleted.
EOM
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- it 'knife delete --both /environments/nonexistent.json fails' do
- knife('delete --both /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
- knife('list -Rf /').should_succeed server_everything
- knife('list -Rf --local /').should_succeed nothing
+ it "knife delete --both /environments/nonexistent.json fails" do
+ knife("delete --both /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
+ knife("list -Rf /").should_succeed server_everything
+ knife("list -Rf --local /").should_succeed nothing
end
- context 'and cwd is at the top level' do
- before { cwd '.' }
- it 'knife delete fails' do
- knife('delete').should_fail "FATAL: Must specify at least one argument. If you want to delete everything in this directory, type \"knife delete --recurse .\"\n", :stdout => /USAGE/
- knife('list -Rf /').should_succeed <<EOM
+ context "and cwd is at the top level" do
+ before { cwd "." }
+ it "knife delete fails" do
+ knife("delete").should_fail "FATAL: Must specify at least one argument. If you want to delete everything in this directory, type \"knife delete --recurse .\"\n", :stdout => /USAGE/
+ knife("list -Rf /").should_succeed <<EOM
clients
clients/chef-validator.json
clients/chef-webui.json
@@ -666,7 +666,7 @@ users
users/admin.json
users/x.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
clients
cookbooks
data_bags
@@ -680,29 +680,29 @@ EOM
end
end
- when_the_chef_server 'is empty' do
- when_the_repository 'has one of each thing' do
+ when_the_chef_server "is empty" do
+ when_the_repository "has one of each thing" do
before do
- file 'clients/x.json', {}
- file 'cookbooks/x/metadata.rb', ''
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', {}
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/x.json', {}
- end
-
- it 'knife delete --both /cookbooks/x fails' do
- knife('delete --both /cookbooks/x').should_fail "ERROR: /cookbooks/x (local) must be deleted recursively! Pass -r to knife delete.\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed everything
- end
-
- it 'knife delete --both -r /cookbooks/x deletes x' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed <<EOM
+ file "clients/x.json", {}
+ file "cookbooks/x/metadata.rb", ""
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", {}
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/x.json", {}
+ end
+
+ it "knife delete --both /cookbooks/x fails" do
+ knife("delete --both /cookbooks/x").should_fail "ERROR: /cookbooks/x (local) must be deleted recursively! Pass -r to knife delete.\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed everything
+ end
+
+ it "knife delete --both -r /cookbooks/x deletes x" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -721,16 +721,16 @@ EOM
EOM
end
- it 'knife delete --both /data_bags/x fails' do
- knife('delete --both /data_bags/x').should_fail "ERROR: /data_bags/x (local) must be deleted recursively! Pass -r to knife delete.\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed everything
+ it "knife delete --both /data_bags/x fails" do
+ knife("delete --both /data_bags/x").should_fail "ERROR: /data_bags/x (local) must be deleted recursively! Pass -r to knife delete.\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both -r /data_bags/x deletes x' do
- knife('delete --both -r /data_bags/x').should_succeed "Deleted /data_bags/x\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed <<EOM
+ it "knife delete --both -r /data_bags/x deletes x" do
+ knife("delete --both -r /data_bags/x").should_succeed "Deleted /data_bags/x\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -749,10 +749,10 @@ EOM
EOM
end
- it 'knife delete --both /environments/x.json deletes x' do
- knife('delete --both /environments/x.json').should_succeed "Deleted /environments/x.json\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed <<EOM
+ it "knife delete --both /environments/x.json deletes x" do
+ knife("delete --both /environments/x.json").should_succeed "Deleted /environments/x.json\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -772,10 +772,10 @@ EOM
EOM
end
- it 'knife delete --both /roles/x.json deletes x' do
- knife('delete --both /roles/x.json').should_succeed "Deleted /roles/x.json\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed <<EOM
+ it "knife delete --both /roles/x.json deletes x" do
+ knife("delete --both /roles/x.json").should_succeed "Deleted /roles/x.json\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -795,10 +795,10 @@ EOM
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('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed <<EOM
+ 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("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed <<EOM
/clients
/clients/x.json
/cookbooks
@@ -818,14 +818,14 @@ EOM
EOM
end
- it 'knife delete --both / fails' do
- knife('delete --both /').should_fail "ERROR: / (remote) cannot be deleted.\nERROR: / (local) cannot be deleted.\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed everything
+ it "knife delete --both / fails" do
+ knife("delete --both /").should_fail "ERROR: / (remote) cannot be deleted.\nERROR: / (local) cannot be deleted.\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both -r /* fails' do
- knife('delete --both -r /*').should_fail <<EOM
+ it "knife delete --both -r /* fails" do
+ knife("delete --both -r /*").should_fail <<EOM
ERROR: / (remote) cannot be deleted.
ERROR: / (local) cannot be deleted.
ERROR: /clients (remote) cannot be deleted.
@@ -843,21 +843,21 @@ ERROR: /roles (local) cannot be deleted.
ERROR: /users (remote) cannot be deleted.
ERROR: /users (local) cannot be deleted.
EOM
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed everything
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed everything
end
- it 'knife delete --both /environments/nonexistent.json fails' do
- knife('delete --both /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
- knife('list -Rf /').should_succeed server_nothing
- knife('list -Rf --local /').should_succeed everything
+ it "knife delete --both /environments/nonexistent.json fails" do
+ knife("delete --both /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
+ knife("list -Rf /").should_succeed server_nothing
+ knife("list -Rf --local /").should_succeed everything
end
- context 'and cwd is at the top level' do
- before { cwd '.' }
- it 'knife delete fails' do
- knife('delete').should_fail "FATAL: Must specify at least one argument. If you want to delete everything in this directory, type \"knife delete --recurse .\"\n", :stdout => /USAGE/
- knife('list -Rf /').should_succeed <<EOM
+ context "and cwd is at the top level" do
+ before { cwd "." }
+ it "knife delete fails" do
+ knife("delete").should_fail "FATAL: Must specify at least one argument. If you want to delete everything in this directory, type \"knife delete --recurse .\"\n", :stdout => /USAGE/
+ knife("list -Rf /").should_succeed <<EOM
clients
clients/chef-validator.json
clients/chef-webui.json
@@ -870,7 +870,7 @@ roles
users
users/admin.json
EOM
- knife('list -Rf --local /').should_succeed <<EOM
+ knife("list -Rf --local /").should_succeed <<EOM
clients
clients/x.json
cookbooks
@@ -894,124 +894,124 @@ EOM
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x/metadata.rb', 'version "1.0.0"'
- file 'cookbooks/x/onlyin1.0.0.rb', 'old_text'
+ file "cookbooks/x/metadata.rb", 'version "1.0.0"'
+ file "cookbooks/x/onlyin1.0.0.rb", "old_text"
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
# TODO this seems wrong
- it 'knife delete --both -r /cookbooks/x deletes the latest version on the server and the local version' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('raw /cookbooks/x').should_succeed(/1.0.0/)
- knife('list --local /cookbooks').should_succeed ''
+ it "knife delete --both -r /cookbooks/x deletes the latest version on the server and the local version" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("raw /cookbooks/x").should_succeed(/1.0.0/)
+ knife("list --local /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife delete --both /cookbooks/x deletes the latest version on the server and the local version' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('raw /cookbooks/x').should_succeed(/0.9.9/)
- knife('list --local /cookbooks').should_succeed ''
+ it "knife delete --both /cookbooks/x deletes the latest version on the server and the local version" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("raw /cookbooks/x").should_succeed(/0.9.9/)
+ knife("list --local /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
- before { cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' } }
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
+ before { cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" } }
- it 'knife delete --both /cookbooks/x deletes the server and client version of the cookbook' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('raw /cookbooks/x').should_fail(/404/)
- knife('list --local /cookbooks').should_succeed ''
+ it "knife delete --both /cookbooks/x deletes the server and client version of the cookbook" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("raw /cookbooks/x").should_fail(/404/)
+ knife("list --local /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
- before { cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' } }
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
+ before { cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" } }
- it 'knife delete --both /cookbooks/x deletes the server and client version of the cookbook' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('raw /cookbooks/x').should_fail(/404/)
- knife('list --local /cookbooks').should_succeed ''
+ it "knife delete --both /cookbooks/x deletes the server and client version of the cookbook" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("raw /cookbooks/x").should_fail(/404/)
+ knife("list --local /cookbooks").should_succeed ""
end
end
end
- when_the_repository 'is empty' do
- when_the_chef_server 'has two versions of a cookbook' do
+ when_the_repository "is empty" do
+ when_the_chef_server "has two versions of a cookbook" do
before do
- cookbook 'x', '2.0.11'
- cookbook 'x', '11.0.0'
+ cookbook "x", "2.0.11"
+ cookbook "x", "11.0.0"
end
- it 'knife delete deletes the latest version' do
- knife('delete --both -r /cookbooks/x').should_succeed "Deleted /cookbooks/x\n"
- knife('raw /cookbooks/x').should_succeed( /2.0.11/ )
+ it "knife delete deletes the latest version" do
+ knife("delete --both -r /cookbooks/x").should_succeed "Deleted /cookbooks/x\n"
+ knife("raw /cookbooks/x").should_succeed( /2.0.11/ )
end
end
end
when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
before do
- organization 'foo' do
- container 'x', {}
- group 'x', {}
- policy 'x', '1.2.3', {}
- policy_group 'x', { 'policies' => { 'x' => { 'revision_id' => '1.2.3' } } }
+ organization "foo" do
+ container "x", {}
+ group "x", {}
+ policy "x", "1.2.3", {}
+ policy_group "x", { "policies" => { "x" => { "revision_id" => "1.2.3" } } }
end
end
before :each do
- Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, "/organizations/foo")
end
- it 'knife delete /acls/containers/environments.json fails with a reasonable error' do
- knife('delete /acls/containers/environments.json').should_fail "ERROR: /acls/containers/environments.json (remote) ACLs cannot be deleted.\n"
+ it "knife delete /acls/containers/environments.json fails with a reasonable error" do
+ knife("delete /acls/containers/environments.json").should_fail "ERROR: /acls/containers/environments.json (remote) ACLs cannot be deleted.\n"
end
- it 'knife delete /containers/x.json succeeds' do
- knife('delete /containers/x.json').should_succeed "Deleted /containers/x.json\n"
- knife('raw /containers/x.json').should_fail(/404/)
+ it "knife delete /containers/x.json succeeds" do
+ knife("delete /containers/x.json").should_succeed "Deleted /containers/x.json\n"
+ knife("raw /containers/x.json").should_fail(/404/)
end
- it 'knife delete /groups/x.json succeeds' do
- knife('delete /groups/x.json').should_succeed "Deleted /groups/x.json\n"
- knife('raw /groups/x.json').should_fail(/404/)
+ it "knife delete /groups/x.json succeeds" do
+ knife("delete /groups/x.json").should_succeed "Deleted /groups/x.json\n"
+ knife("raw /groups/x.json").should_fail(/404/)
end
- it 'knife delete /policies/x-1.2.3.json succeeds' do
- knife('raw /policies/x/revisions/1.2.3').should_succeed "{\n \"name\": \"x\",\n \"revision_id\": \"1.2.3\",\n \"run_list\": [\n\n ],\n \"cookbook_locks\": {\n\n }\n}\n"
- knife('delete /policies/x-1.2.3.json').should_succeed "Deleted /policies/x-1.2.3.json\n"
- knife('raw /policies/x/revisions/1.2.3').should_fail(/404/)
+ it "knife delete /policies/x-1.2.3.json succeeds" do
+ knife("raw /policies/x/revisions/1.2.3").should_succeed "{\n \"name\": \"x\",\n \"revision_id\": \"1.2.3\",\n \"run_list\": [\n\n ],\n \"cookbook_locks\": {\n\n }\n}\n"
+ knife("delete /policies/x-1.2.3.json").should_succeed "Deleted /policies/x-1.2.3.json\n"
+ knife("raw /policies/x/revisions/1.2.3").should_fail(/404/)
end
- it 'knife delete /policy_groups/x.json succeeds' do
- knife('raw /policy_groups/x').should_succeed "{\n \"uri\": \"http://127.0.0.1:8900/organizations/foo/policy_groups/x\",\n \"policies\": {\n \"x\": {\n \"revision_id\": \"1.2.3\"\n }\n }\n}\n"
- knife('delete /policy_groups/x.json').should_succeed "Deleted /policy_groups/x.json\n"
- knife('raw /policy_groups/x').should_fail(/404/)
+ it "knife delete /policy_groups/x.json succeeds" do
+ knife("raw /policy_groups/x").should_succeed "{\n \"uri\": \"http://127.0.0.1:8900/organizations/foo/policy_groups/x\",\n \"policies\": {\n \"x\": {\n \"revision_id\": \"1.2.3\"\n }\n }\n}\n"
+ knife("delete /policy_groups/x.json").should_succeed "Deleted /policy_groups/x.json\n"
+ knife("raw /policy_groups/x").should_fail(/404/)
end
- it 'knife delete /org.json fails with a reasonable error' do
- knife('delete /org.json').should_fail "ERROR: /org.json (remote) cannot be deleted.\n"
+ it "knife delete /org.json fails with a reasonable error" do
+ knife("delete /org.json").should_fail "ERROR: /org.json (remote) cannot be deleted.\n"
end
- it 'knife delete /invitations.json fails with a reasonable error' do
- knife('delete /invitations.json').should_fail "ERROR: /invitations.json (remote) cannot be deleted.\n"
+ it "knife delete /invitations.json fails with a reasonable error" do
+ knife("delete /invitations.json").should_fail "ERROR: /invitations.json (remote) cannot be deleted.\n"
end
- it 'knife delete /members.json fails with a reasonable error' do
- knife('delete /members.json').should_fail "ERROR: /members.json (remote) cannot be deleted.\n"
+ it "knife delete /members.json fails with a reasonable error" do
+ knife("delete /members.json").should_fail "ERROR: /members.json (remote) cannot be deleted.\n"
end
end
end
diff --git a/spec/integration/knife/deps_spec.rb b/spec/integration/knife/deps_spec.rb
index 6861913d59..8348c601aa 100644
--- a/spec/integration/knife/deps_spec.rb
+++ b/spec/integration/knife/deps_spec.rb
@@ -15,33 +15,33 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/deps'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/deps"
-describe 'knife deps', :workstation do
+describe "knife deps", :workstation do
include IntegrationSupport
include KnifeSupport
- context 'local' do
- when_the_repository 'has a role with no run_list' do
- before { file 'roles/starring.json', {} }
- it 'knife deps reports no dependencies' do
- knife('deps /roles/starring.json').should_succeed "/roles/starring.json\n"
+ context "local" do
+ when_the_repository "has a role with no run_list" do
+ before { file "roles/starring.json", {} }
+ it "knife deps reports no dependencies" do
+ knife("deps /roles/starring.json").should_succeed "/roles/starring.json\n"
end
end
- when_the_repository 'has a role with a default run_list' do
+ when_the_repository "has a role with a default run_list" do
before do
- file 'roles/starring.json', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
- file 'roles/minor.json', {}
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"'
- file 'cookbooks/quiche/recipes/default.rb', ''
- file 'cookbooks/soup/metadata.rb', 'name "soup"'
- file 'cookbooks/soup/recipes/chicken.rb', ''
- end
- it 'knife deps reports all dependencies' do
- knife('deps /roles/starring.json').should_succeed <<EOM
+ file "roles/starring.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ file "roles/minor.json", {}
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"'
+ file "cookbooks/quiche/recipes/default.rb", ""
+ file "cookbooks/soup/metadata.rb", 'name "soup"'
+ file "cookbooks/soup/recipes/chicken.rb", ""
+ end
+ it "knife deps reports all dependencies" do
+ knife("deps /roles/starring.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -50,17 +50,17 @@ EOM
end
end
- when_the_repository 'has a role with an env_run_list' do
+ when_the_repository "has a role with an env_run_list" do
before do
- file 'roles/starring.json', { 'env_run_lists' => { 'desert' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } }
- file 'roles/minor.json', {}
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"'
- file 'cookbooks/quiche/recipes/default.rb', ''
- file 'cookbooks/soup/metadata.rb', 'name "soup"'
- file 'cookbooks/soup/recipes/chicken.rb', ''
- end
- it 'knife deps reports all dependencies' do
- knife('deps /roles/starring.json').should_succeed <<EOM
+ file "roles/starring.json", { "env_run_lists" => { "desert" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } }
+ file "roles/minor.json", {}
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"'
+ file "cookbooks/quiche/recipes/default.rb", ""
+ file "cookbooks/soup/metadata.rb", 'name "soup"'
+ file "cookbooks/soup/recipes/chicken.rb", ""
+ end
+ it "knife deps reports all dependencies" do
+ knife("deps /roles/starring.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -69,32 +69,32 @@ EOM
end
end
- when_the_repository 'has a node with no environment or run_list' do
- before { file 'nodes/mort.json', {} }
- it 'knife deps reports just the node' do
- knife('deps /nodes/mort.json').should_succeed "/nodes/mort.json\n"
+ when_the_repository "has a node with no environment or run_list" do
+ before { file "nodes/mort.json", {} }
+ it "knife deps reports just the node" do
+ knife("deps /nodes/mort.json").should_succeed "/nodes/mort.json\n"
end
end
- when_the_repository 'has a node with an environment' do
+ when_the_repository "has a node with an environment" do
before do
- file 'environments/desert.json', {}
- file 'nodes/mort.json', { 'chef_environment' => 'desert' }
+ file "environments/desert.json", {}
+ file "nodes/mort.json", { "chef_environment" => "desert" }
end
- it 'knife deps reports just the node' do
- knife('deps /nodes/mort.json').should_succeed "/environments/desert.json\n/nodes/mort.json\n"
+ it "knife deps reports just the node" do
+ knife("deps /nodes/mort.json").should_succeed "/environments/desert.json\n/nodes/mort.json\n"
end
end
- when_the_repository 'has a node with roles and recipes in its run_list' do
+ when_the_repository "has a node with roles and recipes in its run_list" do
before do
- file 'roles/minor.json', {}
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"'
- file 'cookbooks/quiche/recipes/default.rb', ''
- file 'cookbooks/soup/metadata.rb', 'name "soup"'
- file 'cookbooks/soup/recipes/chicken.rb', ''
- file 'nodes/mort.json', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
- end
- it 'knife deps reports just the node' do
- knife('deps /nodes/mort.json').should_succeed <<EOM
+ file "roles/minor.json", {}
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"'
+ file "cookbooks/quiche/recipes/default.rb", ""
+ file "cookbooks/soup/metadata.rb", 'name "soup"'
+ file "cookbooks/soup/recipes/chicken.rb", ""
+ file "nodes/mort.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ end
+ it "knife deps reports just the node" do
+ knife("deps /nodes/mort.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -102,53 +102,53 @@ EOM
EOM
end
end
- when_the_repository 'has a cookbook with no dependencies' do
+ when_the_repository "has a cookbook with no dependencies" do
before do
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"'
- file 'cookbooks/quiche/recipes/default.rb', ''
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"'
+ file "cookbooks/quiche/recipes/default.rb", ""
end
- it 'knife deps reports just the cookbook' do
- knife('deps /cookbooks/quiche').should_succeed "/cookbooks/quiche\n"
+ it "knife deps reports just the cookbook" do
+ knife("deps /cookbooks/quiche").should_succeed "/cookbooks/quiche\n"
end
end
- when_the_repository 'has a cookbook with dependencies' do
+ when_the_repository "has a cookbook with dependencies" do
before do
- file 'cookbooks/kettle/metadata.rb', 'name "kettle"'
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"
+ file "cookbooks/kettle/metadata.rb", 'name "kettle"'
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"
depends "kettle"'
- file 'cookbooks/quiche/recipes/default.rb', ''
+ file "cookbooks/quiche/recipes/default.rb", ""
end
- it 'knife deps reports just the cookbook' do
- knife('deps /cookbooks/quiche').should_succeed "/cookbooks/kettle\n/cookbooks/quiche\n"
+ it "knife deps reports just the cookbook" do
+ knife("deps /cookbooks/quiche").should_succeed "/cookbooks/kettle\n/cookbooks/quiche\n"
end
end
- when_the_repository 'has a data bag' do
- before { file 'data_bags/bag/item.json', {} }
- it 'knife deps reports just the data bag' do
- knife('deps /data_bags/bag/item.json').should_succeed "/data_bags/bag/item.json\n"
+ when_the_repository "has a data bag" do
+ before { file "data_bags/bag/item.json", {} }
+ it "knife deps reports just the data bag" do
+ knife("deps /data_bags/bag/item.json").should_succeed "/data_bags/bag/item.json\n"
end
end
- when_the_repository 'has an environment' do
- before { file 'environments/desert.json', {} }
- it 'knife deps reports just the environment' do
- knife('deps /environments/desert.json').should_succeed "/environments/desert.json\n"
+ when_the_repository "has an environment" do
+ before { file "environments/desert.json", {} }
+ it "knife deps reports just the environment" do
+ knife("deps /environments/desert.json").should_succeed "/environments/desert.json\n"
end
end
- when_the_repository 'has a deep dependency tree' do
+ when_the_repository "has a deep dependency tree" do
before do
- file 'roles/starring.json', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
- file 'roles/minor.json', {}
- file 'cookbooks/quiche/metadata.rb', 'name "quiche"'
- file 'cookbooks/quiche/recipes/default.rb', ''
- file 'cookbooks/soup/metadata.rb', 'name "soup"'
- file 'cookbooks/soup/recipes/chicken.rb', ''
- file 'environments/desert.json', {}
- file 'nodes/mort.json', { 'chef_environment' => 'desert', 'run_list' => [ 'role[starring]' ] }
- file 'nodes/bart.json', { 'run_list' => [ 'role[minor]' ] }
+ file "roles/starring.json", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ file "roles/minor.json", {}
+ file "cookbooks/quiche/metadata.rb", 'name "quiche"'
+ file "cookbooks/quiche/recipes/default.rb", ""
+ file "cookbooks/soup/metadata.rb", 'name "soup"'
+ file "cookbooks/soup/recipes/chicken.rb", ""
+ file "environments/desert.json", {}
+ file "nodes/mort.json", { "chef_environment" => "desert", "run_list" => [ "role[starring]" ] }
+ file "nodes/bart.json", { "run_list" => [ "role[minor]" ] }
end
- it 'knife deps reports all dependencies' do
- knife('deps /nodes/mort.json').should_succeed <<EOM
+ it "knife deps reports all dependencies" do
+ knife("deps /nodes/mort.json").should_succeed <<EOM
/environments/desert.json
/roles/minor.json
/cookbooks/quiche
@@ -157,8 +157,8 @@ depends "kettle"'
/nodes/mort.json
EOM
end
- it 'knife deps * reports all dependencies of all things' do
- knife('deps /nodes/*').should_succeed <<EOM
+ it "knife deps * reports all dependencies of all things" do
+ knife("deps /nodes/*").should_succeed <<EOM
/roles/minor.json
/nodes/bart.json
/environments/desert.json
@@ -168,8 +168,8 @@ EOM
/nodes/mort.json
EOM
end
- it 'knife deps a b reports all dependencies of a and b' do
- knife('deps /nodes/bart.json /nodes/mort.json').should_succeed <<EOM
+ it "knife deps a b reports all dependencies of a and b" do
+ knife("deps /nodes/bart.json /nodes/mort.json").should_succeed <<EOM
/roles/minor.json
/nodes/bart.json
/environments/desert.json
@@ -179,8 +179,8 @@ EOM
/nodes/mort.json
EOM
end
- it 'knife deps --tree /* shows dependencies in a tree' do
- knife('deps --tree /nodes/*').should_succeed <<EOM
+ it "knife deps --tree /* shows dependencies in a tree" do
+ knife("deps --tree /nodes/*").should_succeed <<EOM
/nodes/bart.json
/roles/minor.json
/nodes/mort.json
@@ -191,8 +191,8 @@ EOM
/cookbooks/soup
EOM
end
- it 'knife deps --tree --no-recurse shows only the first level of dependencies' do
- knife('deps --tree --no-recurse /nodes/*').should_succeed <<EOM
+ it "knife deps --tree --no-recurse shows only the first level of dependencies" do
+ knife("deps --tree --no-recurse /nodes/*").should_succeed <<EOM
/nodes/bart.json
/roles/minor.json
/nodes/mort.json
@@ -202,49 +202,49 @@ EOM
end
end
- context 'circular dependencies' do
- when_the_repository 'has cookbooks with circular dependencies' do
+ context "circular dependencies" do
+ when_the_repository "has cookbooks with circular dependencies" do
before do
- file 'cookbooks/foo/metadata.rb', 'name "foo"
+ file "cookbooks/foo/metadata.rb", 'name "foo"
depends "bar"'
- file 'cookbooks/bar/metadata.rb', 'name "bar"
+ file "cookbooks/bar/metadata.rb", 'name "bar"
depends "baz"'
- file 'cookbooks/baz/metadata.rb', 'name "baz"
+ file "cookbooks/baz/metadata.rb", 'name "baz"
depends "foo"'
- file 'cookbooks/self/metadata.rb', 'name "self"
+ file "cookbooks/self/metadata.rb", 'name "self"
depends "self"'
end
- it 'knife deps prints each once' do
- knife('deps /cookbooks/foo /cookbooks/self').should_succeed(
+ it "knife deps prints each once" do
+ knife("deps /cookbooks/foo /cookbooks/self").should_succeed(
stdout: "/cookbooks/baz\n/cookbooks/bar\n/cookbooks/foo\n/cookbooks/self\n",
stderr: "WARN: Ignoring self-dependency in cookbook self, please remove it (in the future this will be fatal).\n",
)
end
- it 'knife deps --tree prints each once' do
- knife('deps --tree /cookbooks/foo /cookbooks/self').should_succeed(
+ it "knife deps --tree prints each once" do
+ knife("deps --tree /cookbooks/foo /cookbooks/self").should_succeed(
stdout: "/cookbooks/foo\n /cookbooks/bar\n /cookbooks/baz\n /cookbooks/foo\n/cookbooks/self\n",
stderr: "WARN: Ignoring self-dependency in cookbook self, please remove it (in the future this will be fatal).\n",
)
end
end
- when_the_repository 'has roles with circular dependencies' do
+ when_the_repository "has roles with circular dependencies" do
before do
- file 'roles/foo.json', { 'run_list' => [ 'role[bar]' ] }
- file 'roles/bar.json', { 'run_list' => [ 'role[baz]' ] }
- file 'roles/baz.json', { 'run_list' => [ 'role[foo]' ] }
- file 'roles/self.json', { 'run_list' => [ 'role[self]' ] }
+ file "roles/foo.json", { "run_list" => [ "role[bar]" ] }
+ file "roles/bar.json", { "run_list" => [ "role[baz]" ] }
+ file "roles/baz.json", { "run_list" => [ "role[foo]" ] }
+ file "roles/self.json", { "run_list" => [ "role[self]" ] }
end
- it 'knife deps prints each once' do
- knife('deps /roles/foo.json /roles/self.json').should_succeed <<EOM
+ it "knife deps prints each once" do
+ knife("deps /roles/foo.json /roles/self.json").should_succeed <<EOM
/roles/baz.json
/roles/bar.json
/roles/foo.json
/roles/self.json
EOM
end
- it 'knife deps --tree prints each once' do
- knife('deps --tree /roles/foo.json /roles/self.json') do
+ it "knife deps --tree prints each once" do
+ knife("deps --tree /roles/foo.json /roles/self.json") do
expect(stdout).to eq("/roles/foo.json\n /roles/bar.json\n /roles/baz.json\n /roles/foo.json\n/roles/self.json\n /roles/self.json\n")
expect(stderr).to eq("WARNING: No knife configuration file found\n")
end
@@ -252,81 +252,81 @@ EOM
end
end
- context 'missing objects' do
- when_the_repository 'is empty' do
- it 'knife deps /blah reports an error' do
- knife('deps /blah').should_fail(
+ context "missing objects" do
+ 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",
)
end
- it 'knife deps /roles/x.json reports an error' do
- knife('deps /roles/x.json').should_fail(
+ 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",
)
end
- it 'knife deps /nodes/x.json reports an error' do
- knife('deps /nodes/x.json').should_fail(
+ 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",
)
end
- it 'knife deps /environments/x.json reports an error' do
- knife('deps /environments/x.json').should_fail(
+ 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",
)
end
- it 'knife deps /cookbooks/x reports an error' do
- knife('deps /cookbooks/x').should_fail(
+ 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",
)
end
- it 'knife deps /data_bags/bag/item reports an error' do
- knife('deps /data_bags/bag/item').should_fail(
+ it "knife deps /data_bags/bag/item reports an error" do
+ knife("deps /data_bags/bag/item").should_fail(
:exit_code => 2,
:stdout => "/data_bags/bag/item\n",
:stderr => "ERROR: /data_bags/bag/item: No such file or directory\n",
)
end
end
- when_the_repository 'is missing a dependent cookbook' do
+ when_the_repository "is missing a dependent cookbook" do
before do
- file 'roles/starring.json', { 'run_list' => [ 'recipe[quiche]'] }
+ file "roles/starring.json", { "run_list" => [ "recipe[quiche]"] }
end
- it 'knife deps reports the cookbook, along with an error' do
- knife('deps /roles/starring.json').should_fail(
+ 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",
)
end
end
- when_the_repository 'is missing a dependent environment' do
+ when_the_repository "is missing a dependent environment" do
before do
- file 'nodes/mort.json', { 'chef_environment' => 'desert' }
+ file "nodes/mort.json", { "chef_environment" => "desert" }
end
- it 'knife deps reports the environment, along with an error' do
- knife('deps /nodes/mort.json').should_fail(
+ 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",
)
end
end
- when_the_repository 'is missing a dependent role' do
+ when_the_repository "is missing a dependent role" do
before do
- file 'roles/starring.json', { 'run_list' => [ 'role[minor]'] }
+ file "roles/starring.json", { "run_list" => [ "role[minor]"] }
end
- it 'knife deps reports the role, along with an error' do
- knife('deps /roles/starring.json').should_fail(
+ 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",
@@ -334,29 +334,29 @@ EOM
end
end
end
- context 'invalid objects' do
- when_the_repository 'is empty' do
- it 'knife deps / reports itself only' do
- knife('deps /').should_succeed("/\n")
+ context "invalid objects" do
+ when_the_repository "is empty" do
+ it "knife deps / reports itself only" do
+ knife("deps /").should_succeed("/\n")
end
- it 'knife deps /roles reports an error' do
- knife('deps /roles').should_fail(
+ 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",
)
end
end
- when_the_repository 'has a data bag' do
- before { file 'data_bags/bag/item.json', '' }
- it 'knife deps /data_bags/bag shows no dependencies' do
- knife('deps /data_bags/bag').should_succeed("/data_bags/bag\n")
+ when_the_repository "has a data bag" do
+ before { file "data_bags/bag/item.json", "" }
+ it "knife deps /data_bags/bag shows no dependencies" do
+ knife("deps /data_bags/bag").should_succeed("/data_bags/bag\n")
end
end
- when_the_repository 'has a cookbook' do
- before { file 'cookbooks/blah/metadata.rb', 'name "blah"' }
- it 'knife deps on a cookbook file shows no dependencies' do
- knife('deps /cookbooks/blah/metadata.rb').should_succeed(
+ when_the_repository "has a cookbook" do
+ before { file "cookbooks/blah/metadata.rb", 'name "blah"' }
+ it "knife deps on a cookbook file shows no dependencies" do
+ knife("deps /cookbooks/blah/metadata.rb").should_succeed(
"/cookbooks/blah/metadata.rb\n"
)
end
@@ -364,25 +364,25 @@ EOM
end
end
- context 'remote' do
+ context "remote" do
include_context "default config options"
- when_the_chef_server 'has a role with no run_list' do
- before { role 'starring', {} }
- it 'knife deps reports no dependencies' do
- knife('deps --remote /roles/starring.json').should_succeed "/roles/starring.json\n"
+ when_the_chef_server "has a role with no run_list" do
+ before { role "starring", {} }
+ it "knife deps reports no dependencies" do
+ knife("deps --remote /roles/starring.json").should_succeed "/roles/starring.json\n"
end
end
- when_the_chef_server 'has a role with a default run_list' do
+ when_the_chef_server "has a role with a default run_list" do
before do
- role 'starring', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
- role 'minor', {}
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
- cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
+ role "starring", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ role "minor", {}
+ cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
+ cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
end
- it 'knife deps reports all dependencies' do
- knife('deps --remote /roles/starring.json').should_succeed <<EOM
+ it "knife deps reports all dependencies" do
+ knife("deps --remote /roles/starring.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -391,15 +391,15 @@ EOM
end
end
- when_the_chef_server 'has a role with an env_run_list' do
+ when_the_chef_server "has a role with an env_run_list" do
before do
- role 'starring', { 'env_run_lists' => { 'desert' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } }
- role 'minor', {}
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
- cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
+ role "starring", { "env_run_lists" => { "desert" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) } }
+ role "minor", {}
+ cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
+ cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
end
- it 'knife deps reports all dependencies' do
- knife('deps --remote /roles/starring.json').should_succeed <<EOM
+ it "knife deps reports all dependencies" do
+ knife("deps --remote /roles/starring.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -408,30 +408,30 @@ EOM
end
end
- when_the_chef_server 'has a node with no environment or run_list' do
- before { node 'mort', {} }
- it 'knife deps reports just the node' do
- knife('deps --remote /nodes/mort.json').should_succeed "/nodes/mort.json\n"
+ when_the_chef_server "has a node with no environment or run_list" do
+ before { node "mort", {} }
+ it "knife deps reports just the node" do
+ knife("deps --remote /nodes/mort.json").should_succeed "/nodes/mort.json\n"
end
end
- when_the_chef_server 'has a node with an environment' do
+ when_the_chef_server "has a node with an environment" do
before do
- environment 'desert', {}
- node 'mort', { 'chef_environment' => 'desert' }
+ environment "desert", {}
+ node "mort", { "chef_environment" => "desert" }
end
- it 'knife deps reports just the node' do
- knife('deps --remote /nodes/mort.json').should_succeed "/environments/desert.json\n/nodes/mort.json\n"
+ it "knife deps reports just the node" do
+ knife("deps --remote /nodes/mort.json").should_succeed "/environments/desert.json\n/nodes/mort.json\n"
end
end
- when_the_chef_server 'has a node with roles and recipes in its run_list' do
+ when_the_chef_server "has a node with roles and recipes in its run_list" do
before do
- role 'minor', {}
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
- cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
- node 'mort', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ role "minor", {}
+ cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
+ cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
+ node "mort", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
end
- it 'knife deps reports just the node' do
- knife('deps --remote /nodes/mort.json').should_succeed <<EOM
+ it "knife deps reports just the node" do
+ knife("deps --remote /nodes/mort.json").should_succeed <<EOM
/roles/minor.json
/cookbooks/quiche
/cookbooks/soup
@@ -439,49 +439,49 @@ EOM
EOM
end
end
- when_the_chef_server 'has a cookbook with no dependencies' do
+ when_the_chef_server "has a cookbook with no dependencies" do
before do
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
+ cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
end
- it 'knife deps reports just the cookbook' do
- knife('deps --remote /cookbooks/quiche').should_succeed "/cookbooks/quiche\n"
+ it "knife deps reports just the cookbook" do
+ knife("deps --remote /cookbooks/quiche").should_succeed "/cookbooks/quiche\n"
end
end
- when_the_chef_server 'has a cookbook with dependencies' do
+ when_the_chef_server "has a cookbook with dependencies" do
before do
- cookbook 'kettle', '1.0.0', { 'metadata.rb' => %Q{name "kettle"\nversion "1.0.0"\n} }
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => 'name "quiche"
-depends "kettle"', 'recipes' => { 'default.rb' => '' } }
+ cookbook "kettle", "1.0.0", { "metadata.rb" => %Q{name "kettle"\nversion "1.0.0"\n} }
+ cookbook "quiche", "1.0.0", { "metadata.rb" => 'name "quiche"
+depends "kettle"', "recipes" => { "default.rb" => "" } }
end
- it 'knife deps reports the cookbook and its dependencies' do
- knife('deps --remote /cookbooks/quiche').should_succeed "/cookbooks/kettle\n/cookbooks/quiche\n"
+ it "knife deps reports the cookbook and its dependencies" do
+ knife("deps --remote /cookbooks/quiche").should_succeed "/cookbooks/kettle\n/cookbooks/quiche\n"
end
end
- when_the_chef_server 'has a data bag' do
- before { data_bag 'bag', { 'item' => {} } }
- it 'knife deps reports just the data bag' do
- knife('deps --remote /data_bags/bag/item.json').should_succeed "/data_bags/bag/item.json\n"
+ when_the_chef_server "has a data bag" do
+ before { data_bag "bag", { "item" => {} } }
+ it "knife deps reports just the data bag" do
+ knife("deps --remote /data_bags/bag/item.json").should_succeed "/data_bags/bag/item.json\n"
end
end
- when_the_chef_server 'has an environment' do
- before { environment 'desert', {} }
- it 'knife deps reports just the environment' do
- knife('deps --remote /environments/desert.json').should_succeed "/environments/desert.json\n"
+ when_the_chef_server "has an environment" do
+ before { environment "desert", {} }
+ it "knife deps reports just the environment" do
+ knife("deps --remote /environments/desert.json").should_succeed "/environments/desert.json\n"
end
end
- when_the_chef_server 'has a deep dependency tree' do
+ when_the_chef_server "has a deep dependency tree" do
before do
- role 'starring', { 'run_list' => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
- role 'minor', {}
- cookbook 'quiche', '1.0.0', { 'metadata.rb' => %Q{name "quiche"\nversion "1.0.0"\n}, 'recipes' => { 'default.rb' => '' } }
- cookbook 'soup', '1.0.0', { 'metadata.rb' => %Q{name "soup"\nversion "1.0.0"\n}, 'recipes' => { 'chicken.rb' => '' } }
- environment 'desert', {}
- node 'mort', { 'chef_environment' => 'desert', 'run_list' => [ 'role[starring]' ] }
- node 'bart', { 'run_list' => [ 'role[minor]' ] }
+ role "starring", { "run_list" => %w(role[minor] recipe[quiche] recipe[soup::chicken]) }
+ role "minor", {}
+ cookbook "quiche", "1.0.0", { "metadata.rb" => %Q{name "quiche"\nversion "1.0.0"\n}, "recipes" => { "default.rb" => "" } }
+ cookbook "soup", "1.0.0", { "metadata.rb" => %Q{name "soup"\nversion "1.0.0"\n}, "recipes" => { "chicken.rb" => "" } }
+ environment "desert", {}
+ node "mort", { "chef_environment" => "desert", "run_list" => [ "role[starring]" ] }
+ node "bart", { "run_list" => [ "role[minor]" ] }
end
- it 'knife deps reports all dependencies' do
- knife('deps --remote /nodes/mort.json').should_succeed <<EOM
+ it "knife deps reports all dependencies" do
+ knife("deps --remote /nodes/mort.json").should_succeed <<EOM
/environments/desert.json
/roles/minor.json
/cookbooks/quiche
@@ -490,8 +490,8 @@ depends "kettle"', 'recipes' => { 'default.rb' => '' } }
/nodes/mort.json
EOM
end
- it 'knife deps * reports all dependencies of all things' do
- knife('deps --remote /nodes/*').should_succeed <<EOM
+ it "knife deps * reports all dependencies of all things" do
+ knife("deps --remote /nodes/*").should_succeed <<EOM
/roles/minor.json
/nodes/bart.json
/environments/desert.json
@@ -501,8 +501,8 @@ EOM
/nodes/mort.json
EOM
end
- it 'knife deps a b reports all dependencies of a and b' do
- knife('deps --remote /nodes/bart.json /nodes/mort.json').should_succeed <<EOM
+ it "knife deps a b reports all dependencies of a and b" do
+ knife("deps --remote /nodes/bart.json /nodes/mort.json").should_succeed <<EOM
/roles/minor.json
/nodes/bart.json
/environments/desert.json
@@ -512,8 +512,8 @@ EOM
/nodes/mort.json
EOM
end
- it 'knife deps --tree /* shows dependencies in a tree' do
- knife('deps --remote --tree /nodes/*').should_succeed <<EOM
+ it "knife deps --tree /* shows dependencies in a tree" do
+ knife("deps --remote --tree /nodes/*").should_succeed <<EOM
/nodes/bart.json
/roles/minor.json
/nodes/mort.json
@@ -524,8 +524,8 @@ EOM
/cookbooks/soup
EOM
end
- it 'knife deps --tree --no-recurse shows only the first level of dependencies' do
- knife('deps --remote --tree --no-recurse /nodes/*').should_succeed <<EOM
+ it "knife deps --tree --no-recurse shows only the first level of dependencies" do
+ knife("deps --remote --tree --no-recurse /nodes/*").should_succeed <<EOM
/nodes/bart.json
/roles/minor.json
/nodes/mort.json
@@ -535,28 +535,28 @@ EOM
end
end
- context 'circular dependencies' do
- when_the_chef_server 'has cookbooks with circular dependencies' do
+ context "circular dependencies" do
+ when_the_chef_server "has cookbooks with circular dependencies" do
before do
- cookbook 'foo', '1.0.0', { 'metadata.rb' => 'name "foo"
+ cookbook "foo", "1.0.0", { "metadata.rb" => 'name "foo"
depends "bar"' }
- cookbook 'bar', '1.0.0', { 'metadata.rb' => 'name "bar"
+ cookbook "bar", "1.0.0", { "metadata.rb" => 'name "bar"
depends "baz"' }
- cookbook 'baz', '1.0.0', { 'metadata.rb' => 'name "baz"
+ cookbook "baz", "1.0.0", { "metadata.rb" => 'name "baz"
depends "foo"' }
- cookbook 'self', '1.0.0', { 'metadata.rb' => 'name "self"
+ cookbook "self", "1.0.0", { "metadata.rb" => 'name "self"
depends "self"' }
end
- it 'knife deps prints each once' do
- knife('deps --remote /cookbooks/foo /cookbooks/self').should_succeed <<EOM
+ it "knife deps prints each once" do
+ knife("deps --remote /cookbooks/foo /cookbooks/self").should_succeed <<EOM
/cookbooks/baz
/cookbooks/bar
/cookbooks/foo
/cookbooks/self
EOM
end
- it 'knife deps --tree prints each once' do
- knife('deps --remote --tree /cookbooks/foo /cookbooks/self').should_succeed <<EOM
+ it "knife deps --tree prints each once" do
+ knife("deps --remote --tree /cookbooks/foo /cookbooks/self").should_succeed <<EOM
/cookbooks/foo
/cookbooks/bar
/cookbooks/baz
@@ -566,23 +566,23 @@ EOM
EOM
end
end
- when_the_chef_server 'has roles with circular dependencies' do
+ when_the_chef_server "has roles with circular dependencies" do
before do
- role 'foo', { 'run_list' => [ 'role[bar]' ] }
- role 'bar', { 'run_list' => [ 'role[baz]' ] }
- role 'baz', { 'run_list' => [ 'role[foo]' ] }
- role 'self', { 'run_list' => [ 'role[self]' ] }
+ role "foo", { "run_list" => [ "role[bar]" ] }
+ role "bar", { "run_list" => [ "role[baz]" ] }
+ role "baz", { "run_list" => [ "role[foo]" ] }
+ role "self", { "run_list" => [ "role[self]" ] }
end
- it 'knife deps prints each once' do
- knife('deps --remote /roles/foo.json /roles/self.json').should_succeed <<EOM
+ it "knife deps prints each once" do
+ knife("deps --remote /roles/foo.json /roles/self.json").should_succeed <<EOM
/roles/baz.json
/roles/bar.json
/roles/foo.json
/roles/self.json
EOM
end
- it 'knife deps --tree prints each once' do
- knife('deps --remote --tree /roles/foo.json /roles/self.json') do
+ it "knife deps --tree prints each once" do
+ knife("deps --remote --tree /roles/foo.json /roles/self.json") do
expect(stdout).to eq("/roles/foo.json\n /roles/bar.json\n /roles/baz.json\n /roles/foo.json\n/roles/self.json\n /roles/self.json\n")
expect(stderr).to eq("WARNING: No knife configuration file found\n")
end
@@ -590,81 +590,81 @@ EOM
end
end
- context 'missing objects' do
- when_the_chef_server 'is empty' do
- it 'knife deps /blah reports an error' do
- knife('deps --remote /blah').should_fail(
+ context "missing objects" do
+ 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",
)
end
- it 'knife deps /roles/x.json reports an error' do
- knife('deps --remote /roles/x.json').should_fail(
+ 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",
)
end
- it 'knife deps /nodes/x.json reports an error' do
- knife('deps --remote /nodes/x.json').should_fail(
+ 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",
)
end
- it 'knife deps /environments/x.json reports an error' do
- knife('deps --remote /environments/x.json').should_fail(
+ 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",
)
end
- it 'knife deps /cookbooks/x reports an error' do
- knife('deps --remote /cookbooks/x').should_fail(
+ 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",
)
end
- it 'knife deps /data_bags/bag/item reports an error' do
- knife('deps --remote /data_bags/bag/item').should_fail(
+ it "knife deps /data_bags/bag/item reports an error" do
+ knife("deps --remote /data_bags/bag/item").should_fail(
:exit_code => 2,
:stdout => "/data_bags/bag/item\n",
:stderr => "ERROR: /data_bags/bag/item: No such file or directory\n",
)
end
end
- when_the_chef_server 'is missing a dependent cookbook' do
+ when_the_chef_server "is missing a dependent cookbook" do
before do
- role 'starring', { 'run_list' => [ 'recipe[quiche]'] }
+ role "starring", { "run_list" => [ "recipe[quiche]"] }
end
- it 'knife deps reports the cookbook, along with an error' do
- knife('deps --remote /roles/starring.json').should_fail(
+ 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",
)
end
end
- when_the_chef_server 'is missing a dependent environment' do
+ when_the_chef_server "is missing a dependent environment" do
before do
- node 'mort', { 'chef_environment' => 'desert' }
+ node "mort", { "chef_environment" => "desert" }
end
- it 'knife deps reports the environment, along with an error' do
- knife('deps --remote /nodes/mort.json').should_fail(
+ 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",
)
end
end
- when_the_chef_server 'is missing a dependent role' do
+ when_the_chef_server "is missing a dependent role" do
before do
- role 'starring', { 'run_list' => [ 'role[minor]'] }
+ role "starring", { "run_list" => [ "role[minor]"] }
end
- it 'knife deps reports the role, along with an error' do
- knife('deps --remote /roles/starring.json').should_fail(
+ 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",
@@ -672,27 +672,27 @@ EOM
end
end
end
- context 'invalid objects' do
- when_the_chef_server 'is empty' do
- it 'knife deps / reports an error' do
- knife('deps --remote /').should_succeed("/\n")
+ context "invalid objects" do
+ when_the_chef_server "is empty" do
+ it "knife deps / reports an error" do
+ knife("deps --remote /").should_succeed("/\n")
end
- it 'knife deps /roles reports an error' do
- knife('deps --remote /roles').should_succeed("/roles\n")
+ it "knife deps /roles reports an error" do
+ knife("deps --remote /roles").should_succeed("/roles\n")
end
end
- when_the_chef_server 'has a data bag' do
- before { data_bag 'bag', { 'item' => {} } }
- it 'knife deps /data_bags/bag shows no dependencies' do
- knife('deps --remote /data_bags/bag').should_succeed("/data_bags/bag\n")
+ when_the_chef_server "has a data bag" do
+ before { data_bag "bag", { "item" => {} } }
+ it "knife deps /data_bags/bag shows no dependencies" do
+ knife("deps --remote /data_bags/bag").should_succeed("/data_bags/bag\n")
end
end
- when_the_chef_server 'has a cookbook' do
+ when_the_chef_server "has a cookbook" do
before do
- cookbook 'blah', '1.0.0', { 'metadata.rb' => 'name "blah"' }
+ cookbook "blah", "1.0.0", { "metadata.rb" => 'name "blah"' }
end
- it 'knife deps on a cookbook file shows no dependencies' do
- knife('deps --remote /cookbooks/blah/metadata.rb').should_succeed(
+ it "knife deps on a cookbook file shows no dependencies" do
+ knife("deps --remote /cookbooks/blah/metadata.rb").should_succeed(
"/cookbooks/blah/metadata.rb\n"
)
end
@@ -700,7 +700,7 @@ EOM
end
end
- it 'knife deps --no-recurse reports an error' do
- knife('deps --no-recurse /').should_fail("ERROR: --no-recurse requires --tree\n")
+ it "knife deps --no-recurse reports an error" do
+ knife("deps --no-recurse /").should_fail("ERROR: --no-recurse requires --tree\n")
end
end
diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb
index b32a4580a1..822b07d9e1 100644
--- a/spec/integration/knife/diff_spec.rb
+++ b/spec/integration/knife/diff_spec.rb
@@ -15,38 +15,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/diff'
+require "support/shared/integration/integration_helper"
+require "chef/knife/diff"
-describe 'knife diff', :workstation do
+describe "knife diff", :workstation do
include IntegrationSupport
include KnifeSupport
- context 'without versioned cookbooks' do
+ context "without versioned cookbooks" do
when_the_chef_server "has one of each thing" do
before do
- client 'x', '{}'
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => '{}' }
- environment 'x', '{}'
- node 'x', '{}'
- role 'x', '{}'
- user 'x', '{}'
+ client "x", "{}"
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => "{}" }
+ environment "x", "{}"
+ node "x", "{}"
+ role "x", "{}"
+ user "x", "{}"
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
end
- it 'knife diff reports everything as deleted' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports everything as deleted" do
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients/chef-validator.json
D\t/clients/chef-webui.json
D\t/clients/x.json
@@ -62,65 +62,65 @@ EOM
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { "description" => "The default Chef environment" }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife diff reports no differences' do
- knife('diff /').should_succeed ''
+ it "knife diff reports no differences" do
+ knife("diff /").should_succeed ""
end
- it 'knife diff /environments/nonexistent.json reports an error' do
- knife('diff /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory on remote or local\n"
+ it "knife diff /environments/nonexistent.json reports an error" do
+ knife("diff /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory on remote or local\n"
end
- it 'knife diff /environments/*.txt reports an error' do
- knife('diff /environments/*.txt').should_fail "ERROR: /environments/*.txt: No such file or directory on remote or local\n"
+ it "knife diff /environments/*.txt reports an error" do
+ knife("diff /environments/*.txt").should_fail "ERROR: /environments/*.txt: No such file or directory on remote or local\n"
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"foo": "bar"
}
EOM
end
- it 'knife diff reports the role as different' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports the role as different" do
+ knife("diff --name-status /").should_succeed <<EOM
M\t/roles/x.json
EOM
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/blah.rb', ''
- file 'cookbooks/y/metadata.rb', cb_metadata("y", "1.0.0")
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/blah.rb", ""
+ file "cookbooks/y/metadata.rb", cb_metadata("y", "1.0.0")
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife diff reports the new files as added' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports the new files as added" do
+ knife("diff --name-status /").should_succeed <<EOM
A\t/clients/y.json
A\t/cookbooks/x/blah.rb
A\t/cookbooks/y
@@ -133,16 +133,16 @@ A\t/users/y.json
EOM
end
- context 'when cwd is the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife diff reports different data bags' do
- knife('diff --name-status').should_succeed <<EOM
+ context "when cwd is the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife diff reports different data bags" do
+ knife("diff --name-status").should_succeed <<EOM
A\tx/z.json
A\ty
EOM
end
- it 'knife diff * reports different data bags' do
- knife('diff --name-status *').should_succeed <<EOM
+ it "knife diff * reports different data bags" do
+ knife("diff --name-status *").should_succeed <<EOM
A\tx/z.json
A\ty
EOM
@@ -151,9 +151,9 @@ EOM
end
end
- when_the_repository 'is empty' do
- it 'knife diff reports everything as deleted' do
- knife('diff --name-status /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife diff reports everything as deleted" do
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -166,51 +166,51 @@ EOM
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'cookbooks/x/onlyin1.0.0.rb', ''
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x/onlyin1.0.0.rb", ""
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => '' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "" }
end
- it 'knife diff /cookbooks/x shows differences' do
- knife('diff --name-status /cookbooks/x').should_succeed <<EOM
+ it "knife diff /cookbooks/x shows differences" do
+ knife("diff --name-status /cookbooks/x").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
EOM
end
- it 'knife diff --diff-filter=MAT does not show deleted files' do
- knife('diff --diff-filter=MAT --name-status /cookbooks/x').should_succeed <<EOM
+ it "knife diff --diff-filter=MAT does not show deleted files" do
+ knife("diff --diff-filter=MAT --name-status /cookbooks/x").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
A\t/cookbooks/x/onlyin1.0.0.rb
EOM
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => '' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "" }
end
- it 'knife diff /cookbooks/x shows no differences' do
- knife('diff --name-status /cookbooks/x').should_succeed ''
+ it "knife diff /cookbooks/x shows no differences" do
+ knife("diff --name-status /cookbooks/x").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => '' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "" }
end
- it 'knife diff /cookbooks/x shows the differences' do
- knife('diff --name-status /cookbooks/x').should_succeed <<EOM
+ it "knife diff /cookbooks/x shows the differences" do
+ knife("diff --name-status /cookbooks/x").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
@@ -218,13 +218,13 @@ EOM
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => '' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "" }
end
- it 'knife diff /cookbooks/x shows the differences' do
- knife('diff --name-status /cookbooks/x').should_succeed <<EOM
+ it "knife diff /cookbooks/x shows the differences" do
+ knife("diff --name-status /cookbooks/x").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin0.9.9.rb
A\t/cookbooks/x/onlyin1.0.0.rb
@@ -233,22 +233,22 @@ EOM
end
end
- context 'json diff tests' do
- when_the_repository 'has an empty environment file' do
+ context "json diff tests" do
+ when_the_repository "has an empty environment file" do
before do
- file 'environments/x.json', {}
+ file "environments/x.json", {}
end
- when_the_chef_server 'has an empty environment' do
- before { environment 'x', {} }
- it 'knife diff returns no differences' do
- knife('diff /environments/x.json').should_succeed ''
+ when_the_chef_server "has an empty environment" do
+ before { environment "x", {} }
+ it "knife diff returns no differences" do
+ knife("diff /environments/x.json").should_succeed ""
end
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
- knife('diff /environments/x.json').should_succeed(/
+ 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
+ knife("diff /environments/x.json").should_succeed(/
{
- "name": "x",
- "description": "hi"
@@ -259,26 +259,26 @@ EOM
end
end
- when_the_repository 'has an environment file with a value in it' do
+ when_the_repository "has an environment file with a value in it" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- when_the_chef_server 'has an environment with the same value' do
+ when_the_chef_server "has an environment with the same value" do
before do
- environment 'x', { 'description' => 'hi' }
+ environment "x", { "description" => "hi" }
end
- it 'knife diff returns no differences' do
- knife('diff /environments/x.json').should_succeed ''
+ it "knife diff returns no differences" do
+ knife("diff /environments/x.json").should_succeed ""
end
end
- when_the_chef_server 'has an environment with no value' do
+ when_the_chef_server "has an environment with no value" do
before do
- environment 'x', {}
+ environment "x", {}
end
- it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do
- knife('diff /environments/x.json').should_succeed(/
+ it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ knife("diff /environments/x.json").should_succeed(/
{
- "name": "x"
\+ "name": "x",
@@ -287,12 +287,12 @@ EOM
/)
end
end
- when_the_chef_server 'has an environment with a different value' do
+ when_the_chef_server "has an environment with a different value" do
before do
- environment 'x', { 'description' => 'lo' }
+ environment "x", { "description" => "lo" }
end
- it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do
- knife('diff /environments/x.json').should_succeed(/
+ it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ knife("diff /environments/x.json").should_succeed(/
{
"name": "x",
- "description": "lo"
@@ -304,14 +304,14 @@ EOM
end
end
- when_the_chef_server 'has an environment' do
- before { environment 'x', {} }
- when_the_repository 'has an environment with bad JSON' do
- before { file 'environments/x.json', '{' }
- it 'knife diff reports an error and does a textual diff' do
+ when_the_chef_server "has an environment" do
+ before { environment "x", {} }
+ when_the_repository "has an environment with bad JSON" do
+ before { file "environments/x.json", "{" }
+ 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
@@ -320,28 +320,28 @@ EOM
with_versioned_cookbooks do
when_the_chef_server "has one of each thing" do
before do
- client 'x', '{}'
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => '{}' }
- environment 'x', '{}'
- node 'x', '{}'
- role 'x', '{}'
- user 'x', '{}'
+ client "x", "{}"
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => "{}" }
+ environment "x", "{}"
+ node "x", "{}"
+ role "x", "{}"
+ user "x", "{}"
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
end
- it 'knife diff reports everything as deleted' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports everything as deleted" do
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients/chef-validator.json
D\t/clients/chef-webui.json
D\t/clients/x.json
@@ -357,65 +357,65 @@ EOM
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { "description" => "The default Chef environment" }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife diff reports no differences' do
- knife('diff /').should_succeed ''
+ it "knife diff reports no differences" do
+ knife("diff /").should_succeed ""
end
- it 'knife diff /environments/nonexistent.json reports an error' do
- knife('diff /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory on remote or local\n"
+ it "knife diff /environments/nonexistent.json reports an error" do
+ knife("diff /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory on remote or local\n"
end
- it 'knife diff /environments/*.txt reports an error' do
- knife('diff /environments/*.txt').should_fail "ERROR: /environments/*.txt: No such file or directory on remote or local\n"
+ it "knife diff /environments/*.txt reports an error" do
+ knife("diff /environments/*.txt").should_fail "ERROR: /environments/*.txt: No such file or directory on remote or local\n"
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"foo": "bar"
}
EOM
end
- it 'knife diff reports the role as different' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports the role as different" do
+ knife("diff --name-status /").should_succeed <<EOM
M\t/roles/x.json
EOM
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', {}
- file 'cookbooks/x-1.0.0/blah.rb', ''
- file 'cookbooks/x-2.0.0/metadata.rb', cb_metadata("x", "2.0.0")
- file 'cookbooks/y-1.0.0/metadata.rb', cb_metadata("y", "1.0.0")
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', {}
+ file "clients/y.json", {}
+ file "cookbooks/x-1.0.0/blah.rb", ""
+ file "cookbooks/x-2.0.0/metadata.rb", cb_metadata("x", "2.0.0")
+ file "cookbooks/y-1.0.0/metadata.rb", cb_metadata("y", "1.0.0")
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", {}
end
- it 'knife diff reports the new files as added' do
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife diff reports the new files as added" do
+ knife("diff --name-status /").should_succeed <<EOM
A\t/clients/y.json
A\t/cookbooks/x-1.0.0/blah.rb
A\t/cookbooks/x-2.0.0
@@ -429,16 +429,16 @@ A\t/users/y.json
EOM
end
- context 'when cwd is the data_bags directory' do
- before { cwd 'data_bags' }
- it 'knife diff reports different data bags' do
- knife('diff --name-status').should_succeed <<EOM
+ context "when cwd is the data_bags directory" do
+ before { cwd "data_bags" }
+ it "knife diff reports different data bags" do
+ knife("diff --name-status").should_succeed <<EOM
A\tx/z.json
A\ty
EOM
end
- it 'knife diff * reports different data bags' do
- knife('diff --name-status *').should_succeed <<EOM
+ it "knife diff * reports different data bags" do
+ knife("diff --name-status *").should_succeed <<EOM
A\tx/z.json
A\ty
EOM
@@ -447,9 +447,9 @@ EOM
end
end
- when_the_repository 'is empty' do
- it 'knife diff reports everything as deleted' do
- knife('diff --name-status /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife diff reports everything as deleted" do
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -462,59 +462,59 @@ EOM
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata("x", "1.0.0")
- file 'cookbooks/x-1.0.0/onlyin1.0.0.rb', ''
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x-1.0.0/onlyin1.0.0.rb", ""
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => '' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "" }
end
- it 'knife diff /cookbooks shows differences' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife diff /cookbooks shows differences" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x-1.0.1
EOM
end
- it 'knife diff --diff-filter=MAT does not show deleted files' do
- knife('diff --diff-filter=MAT --name-status /cookbooks').should_succeed ''
+ it "knife diff --diff-filter=MAT does not show deleted files" do
+ knife("diff --diff-filter=MAT --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => '' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "" }
end
- it 'knife diff /cookbooks shows the differences' do
- knife('diff --name-status /cookbooks').should_succeed "D\t/cookbooks/x-0.9.9\n"
+ it "knife diff /cookbooks shows the differences" do
+ knife("diff --name-status /cookbooks").should_succeed "D\t/cookbooks/x-0.9.9\n"
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => '' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "" }
end
- it 'knife diff /cookbooks shows the differences' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife diff /cookbooks shows the differences" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x-1.0.1
A\t/cookbooks/x-1.0.0
EOM
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => '' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "" }
end
- it 'knife diff /cookbooks shows the differences' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife diff /cookbooks shows the differences" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x-0.9.9
A\t/cookbooks/x-1.0.0
EOM
@@ -522,19 +522,19 @@ EOM
end
end
- context 'json diff tests' do
- when_the_repository 'has an empty environment file' do
- before { file 'environments/x.json', {} }
- when_the_chef_server 'has an empty environment' do
- before { environment 'x', {} }
- it 'knife diff returns no differences' do
- knife('diff /environments/x.json').should_succeed ''
+ context "json diff tests" do
+ when_the_repository "has an empty environment file" do
+ before { file "environments/x.json", {} }
+ when_the_chef_server "has an empty environment" do
+ before { environment "x", {} }
+ it "knife diff returns no differences" do
+ knife("diff /environments/x.json").should_succeed ""
end
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
- knife('diff /environments/x.json').should_succeed(/
+ 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
+ knife("diff /environments/x.json").should_succeed(/
{
- "name": "x",
- "description": "hi"
@@ -545,23 +545,23 @@ EOM
end
end
- when_the_repository 'has an environment file with a value in it' do
+ when_the_repository "has an environment file with a value in it" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- when_the_chef_server 'has an environment with the same value' do
+ when_the_chef_server "has an environment with the same value" do
before do
- environment 'x', { 'description' => 'hi' }
+ environment "x", { "description" => "hi" }
end
- it 'knife diff returns no differences' do
- knife('diff /environments/x.json').should_succeed ''
+ it "knife diff returns no differences" do
+ knife("diff /environments/x.json").should_succeed ""
end
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
- knife('diff /environments/x.json').should_succeed(/
+ 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
+ knife("diff /environments/x.json").should_succeed(/
{
- "name": "x"
\+ "name": "x",
@@ -570,12 +570,12 @@ EOM
/)
end
end
- when_the_chef_server 'has an environment with a different value' do
+ when_the_chef_server "has an environment with a different value" do
before do
- environment 'x', { 'description' => 'lo' }
+ environment "x", { "description" => "lo" }
end
- it 'knife diff reports the difference', :skip => (RUBY_VERSION < "1.9") do
- knife('diff /environments/x.json').should_succeed(/
+ it "knife diff reports the difference", :skip => (RUBY_VERSION < "1.9") do
+ knife("diff /environments/x.json").should_succeed(/
{
"name": "x",
- "description": "lo"
@@ -587,14 +587,14 @@ EOM
end
end
- when_the_chef_server 'has an environment' do
- before { environment 'x', {} }
- when_the_repository 'has an environment with bad JSON' do
- before { file 'environments/x.json', '{' }
- it 'knife diff reports an error and does a textual diff' do
+ when_the_chef_server "has an environment" do
+ before { environment "x", {} }
+ when_the_repository "has an environment with bad JSON" do
+ before { file "environments/x.json", "{" }
+ 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 24618ebcae..faa640f83b 100644
--- a/spec/integration/knife/download_spec.rb
+++ b/spec/integration/knife/download_spec.rb
@@ -15,40 +15,40 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/download'
-require 'chef/knife/diff'
+require "support/shared/integration/integration_helper"
+require "chef/knife/download"
+require "chef/knife/diff"
-describe 'knife download', :workstation do
+describe "knife download", :workstation do
include IntegrationSupport
include KnifeSupport
- context 'without versioned cookbooks' do
+ context "without versioned cookbooks" do
when_the_chef_server "has one of each thing" do
before do
- client 'x', {}
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- node 'x', {}
- role 'x', {}
- user 'x', {}
+ client "x", {}
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ node "x", {}
+ role "x", {}
+ user "x", {}
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
end
- it 'knife download downloads everything' do
- knife('download /').should_succeed <<EOM
+ it "knife download downloads everything" do
+ knife("download /").should_succeed <<EOM
Created /clients/chef-validator.json
Created /clients/chef-webui.json
Created /clients/x.json
@@ -63,38 +63,38 @@ Created /roles/x.json
Created /users/admin.json
Created /users/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { "description" => "The default Chef environment" }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife download makes no changes' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download makes no changes" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife download --purge makes no changes' do
- knife('download --purge /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download --purge makes no changes" do
+ knife("download --purge /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"chef_type": "role",
"default_attributes": {
@@ -113,20 +113,20 @@ EOM
EOM
end
- it 'knife download changes the role' do
- knife('download /').should_succeed "Updated /roles/x.json\n"
- knife('diff --name-status /').should_succeed ''
+ it "knife download changes the role" do
+ knife("download /").should_succeed "Updated /roles/x.json\n"
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife download --no-diff does not change the role' do
- knife('download --no-diff /').should_succeed ''
- knife('diff --name-status /').should_succeed "M\t/roles/x.json\n"
+ it "knife download --no-diff does not change the role" do
+ knife("download --no-diff /").should_succeed ""
+ knife("diff --name-status /").should_succeed "M\t/roles/x.json\n"
end
end
- context 'except the role file is textually different, but not ACTUALLY different' do
+ context "except the role file is textually different, but not ACTUALLY different" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"chef_type": "role",
"default_attributes": {
@@ -145,28 +145,28 @@ EOM
EOM
end
- it 'knife download / does not change anything' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download / does not change anything" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/blah.rb', ''
- file 'cookbooks/y/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/blah.rb", ""
+ file "cookbooks/y/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife download does nothing' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife download does nothing" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
A\t/clients/y.json
A\t/cookbooks/x/blah.rb
A\t/cookbooks/y
@@ -179,8 +179,8 @@ A\t/users/y.json
EOM
end
- it 'knife download --purge deletes the extra files' do
- knife('download --purge /').should_succeed <<EOM
+ it "knife download --purge deletes the extra files" do
+ knife("download --purge /").should_succeed <<EOM
Deleted extra entry /clients/y.json (purge is on)
Deleted extra entry /cookbooks/x/blah.rb (purge is on)
Deleted extra entry /cookbooks/y (purge is on)
@@ -191,14 +191,14 @@ Deleted extra entry /nodes/y.json (purge is on)
Deleted extra entry /roles/y.json (purge is on)
Deleted extra entry /users/y.json (purge is on)
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
end
- when_the_repository 'is empty' do
- it 'knife download creates the extra files' do
- knife('download /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife download creates the extra files" do
+ knife("download /").should_succeed <<EOM
Created /clients
Created /clients/chef-validator.json
Created /clients/chef-webui.json
@@ -220,11 +220,11 @@ Created /users
Created /users/admin.json
Created /users/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife download --no-diff creates the extra files' do
- knife('download --no-diff /').should_succeed <<EOM
+ it "knife download --no-diff creates the extra files" do
+ knife("download --no-diff /").should_succeed <<EOM
Created /clients
Created /clients/chef-validator.json
Created /clients/chef-webui.json
@@ -246,41 +246,41 @@ Created /users
Created /users/admin.json
Created /users/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
- context 'when current directory is top level' do
+ context "when current directory is top level" do
before do
- cwd '.'
+ cwd "."
end
- it 'knife download with no parameters reports an error' do
- knife('download').should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
+ it "knife download with no parameters reports an error" do
+ knife("download").should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
end
end
end
end
# Test download of an item when the other end doesn't even have the container
- when_the_repository 'is empty' do
- when_the_chef_server 'has two data bag items' do
+ when_the_repository "is empty" do
+ when_the_chef_server "has two data bag items" do
before do
- data_bag 'x', { 'y' => {}, 'z' => {} }
+ data_bag "x", { "y" => {}, "z" => {} }
end
- it 'knife download of one data bag item itself succeeds' do
- knife('download /data_bags/x/y.json').should_succeed <<EOM
+ it "knife download of one data bag item itself succeeds" do
+ knife("download /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags
Created /data_bags/x
Created /data_bags/x/y.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/z.json
EOM
end
- it 'knife download /data_bags/x /data_bags/x/y.json downloads x once' do
- knife('download /data_bags/x /data_bags/x/y.json').should_succeed <<EOM
+ it "knife download /data_bags/x /data_bags/x/y.json downloads x once" do
+ knife("download /data_bags/x /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags
Created /data_bags/x
Created /data_bags/x/y.json
@@ -290,285 +290,285 @@ EOM
end
end
- when_the_repository 'has three data bag items' do
+ when_the_repository "has three data bag items" do
before do
- file 'data_bags/x/deleted.json', <<EOM
+ file "data_bags/x/deleted.json", <<EOM
{
"id": "deleted"
}
EOM
- file 'data_bags/x/modified.json', <<EOM
+ file "data_bags/x/modified.json", <<EOM
{
"id": "modified"
}
EOM
- file 'data_bags/x/unmodified.json', <<EOM
+ file "data_bags/x/unmodified.json", <<EOM
{
"id": "unmodified"
}
EOM
end
- when_the_chef_server 'has a modified, unmodified, added and deleted data bag item' do
+ when_the_chef_server "has a modified, unmodified, added and deleted data bag item" do
before do
- data_bag 'x', {
- 'added' => {},
- 'modified' => { 'foo' => 'bar' },
- 'unmodified' => {},
+ data_bag "x", {
+ "added" => {},
+ "modified" => { "foo" => "bar" },
+ "unmodified" => {},
}
end
- it 'knife download of the modified file succeeds' do
- knife('download /data_bags/x/modified.json').should_succeed <<EOM
+ it "knife download of the modified file succeeds" do
+ knife("download /data_bags/x/modified.json").should_succeed <<EOM
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the unmodified file does nothing' do
- knife('download /data_bags/x/unmodified.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife download of the unmodified file does nothing" do
+ knife("download /data_bags/x/unmodified.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the added file succeeds' do
- knife('download /data_bags/x/added.json').should_succeed <<EOM
+ it "knife download of the added file succeeds" do
+ knife("download /data_bags/x/added.json").should_succeed <<EOM
Created /data_bags/x/added.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the deleted file does nothing' do
- knife('download /data_bags/x/deleted.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife download of the deleted file does nothing" do
+ knife("download /data_bags/x/deleted.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download --purge of the deleted file deletes it' do
- knife('download --purge /data_bags/x/deleted.json').should_succeed <<EOM
+ it "knife download --purge of the deleted file deletes it" do
+ knife("download --purge /data_bags/x/deleted.json").should_succeed <<EOM
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
EOM
end
- it 'knife download of the entire data bag downloads everything' do
- knife('download /data_bags/x').should_succeed <<EOM
+ it "knife download of the entire data bag downloads everything" do
+ knife("download /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download --purge of the entire data bag downloads everything' do
- knife('download --purge /data_bags/x').should_succeed <<EOM
+ it "knife download --purge of the entire data bag downloads everything" do
+ knife("download --purge /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- context 'when cwd is the /data_bags directory' do
+ context "when cwd is the /data_bags directory" do
before do
- cwd 'data_bags'
+ cwd "data_bags"
end
- it 'knife download fails' do
- knife('download').should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
+ it "knife download fails" do
+ knife("download").should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
end
- it 'knife download --purge . downloads everything' do
- knife('download --purge .').should_succeed <<EOM
+ it "knife download --purge . downloads everything" do
+ knife("download --purge .").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- it 'knife download --purge * downloads everything' do
- knife('download --purge *').should_succeed <<EOM
+ it "knife download --purge * downloads everything" do
+ knife("download --purge *").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'cookbooks/x/z.rb', ''
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x/z.rb", ""
end
- when_the_chef_server 'has a modified, added and deleted file for the cookbook' do
+ when_the_chef_server "has a modified, added and deleted file for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'metadata.rb' => cb_metadata("x", "1.0.0", "#extra content"), 'y.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "metadata.rb" => cb_metadata("x", "1.0.0", "#extra content"), "y.rb" => "hi" }
end
- it 'knife download of a modified file succeeds' do
- knife('download /cookbooks/x/metadata.rb').should_succeed "Updated /cookbooks/x/metadata.rb\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of a modified file succeeds" do
+ knife("download /cookbooks/x/metadata.rb").should_succeed "Updated /cookbooks/x/metadata.rb\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x/y.rb
A\t/cookbooks/x/z.rb
EOM
end
- it 'knife download of a deleted file does nothing' do
- knife('download /cookbooks/x/z.rb').should_succeed ''
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of a deleted file does nothing" do
+ knife("download /cookbooks/x/z.rb").should_succeed ""
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/y.rb
A\t/cookbooks/x/z.rb
EOM
end
- it 'knife download --purge of a deleted file succeeds' do
- knife('download --purge /cookbooks/x/z.rb').should_succeed "Deleted extra entry /cookbooks/x/z.rb (purge is on)\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download --purge of a deleted file succeeds" do
+ knife("download --purge /cookbooks/x/z.rb").should_succeed "Deleted extra entry /cookbooks/x/z.rb (purge is on)\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/y.rb
EOM
end
- it 'knife download of an added file succeeds' do
- knife('download /cookbooks/x/y.rb').should_succeed "Created /cookbooks/x/y.rb\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of an added file succeeds" do
+ knife("download /cookbooks/x/y.rb").should_succeed "Created /cookbooks/x/y.rb\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
A\t/cookbooks/x/z.rb
EOM
end
- it 'knife download of the cookbook itself succeeds' do
- knife('download /cookbooks/x').should_succeed <<EOM
+ it "knife download of the cookbook itself succeeds" do
+ knife("download /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/metadata.rb
Created /cookbooks/x/y.rb
EOM
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
A\t/cookbooks/x/z.rb
EOM
end
- it 'knife download --purge of the cookbook itself succeeds' do
- knife('download --purge /cookbooks/x').should_succeed <<EOM
+ it "knife download --purge of the cookbook itself succeeds" do
+ knife("download --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/metadata.rb
Created /cookbooks/x/y.rb
Deleted extra entry /cookbooks/x/z.rb (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'cookbooks/x/onlyin1.0.0.rb', 'old_text'
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x/onlyin1.0.0.rb", "old_text"
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the latest version' do
- knife('download --purge /cookbooks/x').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the latest version" do
+ knife("download --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/metadata.rb
Created /cookbooks/x/onlyin1.0.1.rb
Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the updated file' do
- knife('download --purge /cookbooks/x').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the updated file" do
+ knife("download --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/onlyin1.0.0.rb
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the latest version' do
- knife('download --purge /cookbooks/x').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the latest version" do
+ knife("download --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/metadata.rb
Created /cookbooks/x/onlyin1.0.1.rb
Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the old version' do
- knife('download --purge /cookbooks/x').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the old version" do
+ knife("download --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x/metadata.rb
Created /cookbooks/x/onlyin0.9.9.rb
Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_chef_server 'has an environment' do
+ when_the_chef_server "has an environment" do
before do
- environment 'x', {}
+ environment "x", {}
end
- when_the_repository 'has an environment with bad JSON' do
+ when_the_repository "has an environment with bad JSON" do
before do
- file 'environments/x.json', '{'
+ file "environments/x.json", "{"
end
- it 'knife download succeeds' do
+ it "knife download succeeds" do
warning = <<-EOH
WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF
{
(right here) ------^
EOH
- knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n", :stderr => warning
- knife('diff --name-status /environments/x.json').should_succeed ''
+ 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
- when_the_repository 'has the same environment with the wrong name in the file' do
+ when_the_repository "has the same environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife download succeeds' do
- knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife download succeeds" do
+ knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
- when_the_repository 'has the same environment with no name in the file' do
+ when_the_repository "has the same environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife download succeeds' do
- knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife download succeeds" do
+ knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
end
@@ -577,28 +577,28 @@ EOH
with_versioned_cookbooks do
when_the_chef_server "has one of each thing" do
before do
- client 'x', {}
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- node 'x', {}
- role 'x', {}
- user 'x', {}
+ client "x", {}
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ node "x", {}
+ role "x", {}
+ user "x", {}
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
end
- it 'knife download downloads everything' do
- knife('download /').should_succeed <<EOM
+ it "knife download downloads everything" do
+ knife("download /").should_succeed <<EOM
Created /clients/chef-validator.json
Created /clients/chef-webui.json
Created /clients/x.json
@@ -613,49 +613,49 @@ Created /roles/x.json
Created /users/admin.json
Created /users/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { "description" => "The default Chef environment" }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife download makes no changes' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download makes no changes" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife download --purge makes no changes' do
- knife('download --purge /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download --purge makes no changes" do
+ knife("download --purge /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', { "description" => "blarghle" }
+ file "roles/x.json", { "description" => "blarghle" }
end
- it 'knife download changes the role' do
- knife('download /').should_succeed "Updated /roles/x.json\n"
- knife('diff --name-status /').should_succeed ''
+ it "knife download changes the role" do
+ knife("download /").should_succeed "Updated /roles/x.json\n"
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'except the role file is textually different, but not ACTUALLY different' do
+ context "except the role file is textually different, but not ACTUALLY different" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"chef_type": "role" ,
"default_attributes": {
@@ -674,29 +674,29 @@ EOM
EOM
end
- it 'knife download / does not change anything' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife download / does not change anything" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x-1.0.0/blah.rb', ''
- file 'cookbooks/x-2.0.0/metadata.rb', 'version "2.0.0"'
- file 'cookbooks/y-1.0.0/metadata.rb', 'version "1.0.0"'
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x-1.0.0/blah.rb", ""
+ file "cookbooks/x-2.0.0/metadata.rb", 'version "2.0.0"'
+ file "cookbooks/y-1.0.0/metadata.rb", 'version "1.0.0"'
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife download does nothing' do
- knife('download /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ it "knife download does nothing" do
+ knife("download /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
A\t/clients/y.json
A\t/cookbooks/x-1.0.0/blah.rb
A\t/cookbooks/x-2.0.0
@@ -710,8 +710,8 @@ A\t/users/y.json
EOM
end
- it 'knife download --purge deletes the extra files' do
- knife('download --purge /').should_succeed <<EOM
+ it "knife download --purge deletes the extra files" do
+ knife("download --purge /").should_succeed <<EOM
Deleted extra entry /clients/y.json (purge is on)
Deleted extra entry /cookbooks/x-1.0.0/blah.rb (purge is on)
Deleted extra entry /cookbooks/x-2.0.0 (purge is on)
@@ -723,14 +723,14 @@ Deleted extra entry /nodes/y.json (purge is on)
Deleted extra entry /roles/y.json (purge is on)
Deleted extra entry /users/y.json (purge is on)
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
end
- when_the_repository 'is empty' do
- it 'knife download creates the extra files' do
- knife('download /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife download creates the extra files" do
+ knife("download /").should_succeed <<EOM
Created /clients
Created /clients/chef-validator.json
Created /clients/chef-webui.json
@@ -752,324 +752,324 @@ Created /users
Created /users/admin.json
Created /users/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
- context 'when current directory is top level' do
+ context "when current directory is top level" do
before do
- cwd '.'
+ cwd "."
end
- it 'knife download with no parameters reports an error' do
- knife('download').should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
+ it "knife download with no parameters reports an error" do
+ knife("download").should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
end
end
end
end
# Test download of an item when the other end doesn't even have the container
- when_the_repository 'is empty' do
- when_the_chef_server 'has two data bag items' do
+ when_the_repository "is empty" do
+ when_the_chef_server "has two data bag items" do
before do
- data_bag 'x', { 'y' => {}, 'z' => {} }
+ data_bag "x", { "y" => {}, "z" => {} }
end
- it 'knife download of one data bag item itself succeeds' do
- knife('download /data_bags/x/y.json').should_succeed <<EOM
+ it "knife download of one data bag item itself succeeds" do
+ knife("download /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags
Created /data_bags/x
Created /data_bags/x/y.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/z.json
EOM
end
end
end
- when_the_repository 'has three data bag items' do
+ when_the_repository "has three data bag items" do
before do
- file 'data_bags/x/deleted.json', <<EOM
+ file "data_bags/x/deleted.json", <<EOM
{
"id": "deleted"
}
EOM
- file 'data_bags/x/modified.json', <<EOM
+ file "data_bags/x/modified.json", <<EOM
{
"id": "modified"
}
EOM
- file 'data_bags/x/unmodified.json', <<EOM
+ file "data_bags/x/unmodified.json", <<EOM
{
"id": "unmodified"
}
EOM
end
- when_the_chef_server 'has a modified, unmodified, added and deleted data bag item' do
+ when_the_chef_server "has a modified, unmodified, added and deleted data bag item" do
before do
- data_bag 'x', {
- 'added' => {},
- 'modified' => { 'foo' => 'bar' },
- 'unmodified' => {},
+ data_bag "x", {
+ "added" => {},
+ "modified" => { "foo" => "bar" },
+ "unmodified" => {},
}
end
- it 'knife download of the modified file succeeds' do
- knife('download /data_bags/x/modified.json').should_succeed <<EOM
+ it "knife download of the modified file succeeds" do
+ knife("download /data_bags/x/modified.json").should_succeed <<EOM
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the unmodified file does nothing' do
- knife('download /data_bags/x/unmodified.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife download of the unmodified file does nothing" do
+ knife("download /data_bags/x/unmodified.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the added file succeeds' do
- knife('download /data_bags/x/added.json').should_succeed <<EOM
+ it "knife download of the added file succeeds" do
+ knife("download /data_bags/x/added.json").should_succeed <<EOM
Created /data_bags/x/added.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download of the deleted file does nothing' do
- knife('download /data_bags/x/deleted.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife download of the deleted file does nothing" do
+ knife("download /data_bags/x/deleted.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download --purge of the deleted file deletes it' do
- knife('download --purge /data_bags/x/deleted.json').should_succeed <<EOM
+ it "knife download --purge of the deleted file deletes it" do
+ knife("download --purge /data_bags/x/deleted.json").should_succeed <<EOM
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/added.json
M\t/data_bags/x/modified.json
EOM
end
- it 'knife download of the entire data bag downloads everything' do
- knife('download /data_bags/x').should_succeed <<EOM
+ it "knife download of the entire data bag downloads everything" do
+ knife("download /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
A\t/data_bags/x/deleted.json
EOM
end
- it 'knife download --purge of the entire data bag downloads everything' do
- knife('download --purge /data_bags/x').should_succeed <<EOM
+ it "knife download --purge of the entire data bag downloads everything" do
+ knife("download --purge /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- context 'when cwd is the /data_bags directory' do
+ context "when cwd is the /data_bags directory" do
before do
- cwd 'data_bags'
+ cwd "data_bags"
end
- it 'knife download fails' do
- knife('download').should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
+ it "knife download fails" do
+ knife("download").should_fail "FATAL: Must specify at least one argument. If you want to download everything in this directory, type \"knife download .\"\n", :stdout => /USAGE/
end
- it 'knife download --purge . downloads everything' do
- knife('download --purge .').should_succeed <<EOM
+ it "knife download --purge . downloads everything" do
+ knife("download --purge .").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- it 'knife download --purge * downloads everything' do
- knife('download --purge *').should_succeed <<EOM
+ it "knife download --purge * downloads everything" do
+ knife("download --purge *").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', 'name "x"; version "1.0.0"#unmodified'
- file 'cookbooks/x-1.0.0/z.rb', ''
+ file "cookbooks/x-1.0.0/metadata.rb", 'name "x"; version "1.0.0"#unmodified'
+ file "cookbooks/x-1.0.0/z.rb", ""
end
- when_the_chef_server 'has a modified, added and deleted file for the cookbook' do
+ when_the_chef_server "has a modified, added and deleted file for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'y.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "y.rb" => "hi" }
end
- it 'knife download of a modified file succeeds' do
- knife('download /cookbooks/x-1.0.0/metadata.rb').should_succeed "Updated /cookbooks/x-1.0.0/metadata.rb\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of a modified file succeeds" do
+ knife("download /cookbooks/x-1.0.0/metadata.rb").should_succeed "Updated /cookbooks/x-1.0.0/metadata.rb\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x-1.0.0/y.rb
A\t/cookbooks/x-1.0.0/z.rb
EOM
end
- it 'knife download of a deleted file does nothing' do
- knife('download /cookbooks/x-1.0.0/z.rb').should_succeed ''
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of a deleted file does nothing" do
+ knife("download /cookbooks/x-1.0.0/z.rb").should_succeed ""
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x-1.0.0/metadata.rb
D\t/cookbooks/x-1.0.0/y.rb
A\t/cookbooks/x-1.0.0/z.rb
EOM
end
- it 'knife download --purge of a deleted file succeeds' do
- knife('download --purge /cookbooks/x-1.0.0/z.rb').should_succeed "Deleted extra entry /cookbooks/x-1.0.0/z.rb (purge is on)\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download --purge of a deleted file succeeds" do
+ knife("download --purge /cookbooks/x-1.0.0/z.rb").should_succeed "Deleted extra entry /cookbooks/x-1.0.0/z.rb (purge is on)\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x-1.0.0/metadata.rb
D\t/cookbooks/x-1.0.0/y.rb
EOM
end
- it 'knife download of an added file succeeds' do
- knife('download /cookbooks/x-1.0.0/y.rb').should_succeed "Created /cookbooks/x-1.0.0/y.rb\n"
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife download of an added file succeeds" do
+ knife("download /cookbooks/x-1.0.0/y.rb").should_succeed "Created /cookbooks/x-1.0.0/y.rb\n"
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x-1.0.0/metadata.rb
A\t/cookbooks/x-1.0.0/z.rb
EOM
end
- it 'knife download of the cookbook itself succeeds' do
- knife('download /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife download of the cookbook itself succeeds" do
+ knife("download /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0/metadata.rb
Created /cookbooks/x-1.0.0/y.rb
EOM
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
A\t/cookbooks/x-1.0.0/z.rb
EOM
end
- it 'knife download --purge of the cookbook itself succeeds' do
- knife('download --purge /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife download --purge of the cookbook itself succeeds" do
+ knife("download --purge /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0/metadata.rb
Created /cookbooks/x-1.0.0/y.rb
Deleted extra entry /cookbooks/x-1.0.0/z.rb (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata("x", "1.0.0")
- file 'cookbooks/x-1.0.0/onlyin1.0.0.rb', 'old_text'
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x-1.0.0/onlyin1.0.0.rb", "old_text"
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the latest version' do
- knife('download --purge /cookbooks').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the latest version" do
+ knife("download --purge /cookbooks").should_succeed <<EOM
Updated /cookbooks/x-1.0.0/onlyin1.0.0.rb
Created /cookbooks/x-1.0.1
Created /cookbooks/x-1.0.1/metadata.rb
Created /cookbooks/x-1.0.1/onlyin1.0.1.rb
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife download /cookbooks downloads the updated file' do
- knife('download --purge /cookbooks').should_succeed <<EOM
+ it "knife download /cookbooks downloads the updated file" do
+ knife("download --purge /cookbooks").should_succeed <<EOM
Created /cookbooks/x-0.9.9
Created /cookbooks/x-0.9.9/metadata.rb
Created /cookbooks/x-0.9.9/onlyin0.9.9.rb
Updated /cookbooks/x-1.0.0/onlyin1.0.0.rb
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife download /cookbooks/x downloads the latest version' do
- knife('download --purge /cookbooks').should_succeed <<EOM
+ it "knife download /cookbooks/x downloads the latest version" do
+ knife("download --purge /cookbooks").should_succeed <<EOM
Created /cookbooks/x-1.0.1
Created /cookbooks/x-1.0.1/metadata.rb
Created /cookbooks/x-1.0.1/onlyin1.0.1.rb
Deleted extra entry /cookbooks/x-1.0.0 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife download --purge /cookbooks downloads the old version and deletes the new version' do
- knife('download --purge /cookbooks').should_succeed <<EOM
+ it "knife download --purge /cookbooks downloads the old version and deletes the new version" do
+ knife("download --purge /cookbooks").should_succeed <<EOM
Created /cookbooks/x-0.9.9
Created /cookbooks/x-0.9.9/metadata.rb
Created /cookbooks/x-0.9.9/onlyin0.9.9.rb
Deleted extra entry /cookbooks/x-1.0.0 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_chef_server 'has an environment' do
+ when_the_chef_server "has an environment" do
before do
- environment 'x', {}
+ environment "x", {}
end
- when_the_repository 'has the same environment with the wrong name in the file' do
+ when_the_repository "has the same environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife download succeeds' do
- knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife download succeeds" do
+ knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
- when_the_repository 'has the same environment with no name in the file' do
+ when_the_repository "has the same environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife download succeeds' do
- knife('download /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife download succeeds" do
+ knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
end
end # with versioned cookbooks
- when_the_chef_server 'has a cookbook' do
+ when_the_chef_server "has a cookbook" do
before do
- cookbook 'x', '1.0.0'
+ cookbook "x", "1.0.0"
end
- when_the_repository 'is empty' do
- it 'knife download /cookbooks/x signs all requests' do
+ when_the_repository "is empty" do
+ it "knife download /cookbooks/x signs all requests" do
# Check that BasicClient.request() always gets called with X-OPS-USERID
original_new = Chef::HTTP::BasicClient.method(:new)
@@ -1077,13 +1077,13 @@ EOM
new_result = original_new.call(*args)
original_request = new_result.method(:request)
expect(new_result).to receive(:request) { |method, url, body, headers, &response_handler|
- expect(headers['X-OPS-USERID']).not_to be_nil
+ expect(headers["X-OPS-USERID"]).not_to be_nil
original_request.call(method, url, body, headers, &response_handler)
}.at_least(:once)
new_result
}.at_least(:once)
- knife('download /cookbooks/x').should_succeed <<EOM
+ knife("download /cookbooks/x").should_succeed <<EOM
Created /cookbooks
Created /cookbooks/x
Created /cookbooks/x/metadata.rb
@@ -1094,19 +1094,19 @@ EOM
when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
before do
- user 'foo', {}
- user 'bar', {}
- user 'foobar', {}
- organization 'foo', { 'full_name' => 'Something' }
+ user "foo", {}
+ user "bar", {}
+ user "foobar", {}
+ organization "foo", { "full_name" => "Something" }
end
before :each do
- Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, "/organizations/foo")
end
when_the_repository "has all the default stuff" do
before do
- knife('download /').should_succeed <<EOM
+ knife("download /").should_succeed <<EOM
Created /acls
Created /acls/clients
Created /acls/clients/foo-validator.json
@@ -1167,31 +1167,31 @@ Created /roles
EOM
end
- context 'and the server has one of each thing' do
+ context "and the server has one of each thing" do
before do
# acl_for %w(organizations foo groups blah)
- client 'x', {}
- cookbook 'x', '1.0.0'
- container 'x', {}
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- group 'x', {}
- org_invite 'foo'
- org_member 'bar'
- node 'x', {}
- policy 'x', '1.0.0', {}
- policy 'blah', '1.0.0', {}
- policy_group 'x', {
- 'policies' => {
- 'x' => { 'revision_id' => '1.0.0' },
- 'blah' => { 'revision_id' => '1.0.0' },
+ client "x", {}
+ cookbook "x", "1.0.0"
+ container "x", {}
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ group "x", {}
+ org_invite "foo"
+ org_member "bar"
+ node "x", {}
+ policy "x", "1.0.0", {}
+ policy "blah", "1.0.0", {}
+ policy_group "x", {
+ "policies" => {
+ "x" => { "revision_id" => "1.0.0" },
+ "blah" => { "revision_id" => "1.0.0" },
}
}
- role 'x', {}
+ role "x", {}
end
before do
- knife('download /acls /groups/clients.json /groups/users.json').should_succeed <<-EOM
+ knife("download /acls /groups/clients.json /groups/users.json").should_succeed <<-EOM
Created /acls/clients/x.json
Created /acls/containers/x.json
Created /acls/cookbooks/x.json
@@ -1205,8 +1205,8 @@ Updated /groups/users.json
EOM
end
- it 'knife download / downloads everything' do
- knife('download /').should_succeed <<EOM
+ it "knife download / downloads everything" do
+ knife("download /").should_succeed <<EOM
Created /clients/x.json
Created /containers/x.json
Created /cookbooks/x
@@ -1223,58 +1223,58 @@ Created /policies/x-1.0.0.json
Created /policy_groups/x.json
Created /roles/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
context "and the repository has an identical copy of each thing" do
before do
# TODO We have to upload acls for an existing group due to a lack of
# dependency detection during upload. Fix that!
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'containers/x.json', {}
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/x.json', {}
- file 'groups/x.json', {}
- file 'invitations.json', [ 'foo' ]
- file 'members.json', [ 'bar' ]
- file 'nodes/x.json', {}
- file 'org.json', { 'full_name' => 'Something' }
- file 'policies/x-1.0.0.json', { }
- file 'policies/blah-1.0.0.json', { }
- file 'policy_groups/x.json', { 'policies' => { 'x' => { 'revision_id' => '1.0.0' }, 'blah' => { 'revision_id' => '1.0.0' } } }
- file 'roles/x.json', {}
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "containers/x.json", {}
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/x.json", {}
+ file "groups/x.json", {}
+ file "invitations.json", [ "foo" ]
+ file "members.json", [ "bar" ]
+ file "nodes/x.json", {}
+ file "org.json", { "full_name" => "Something" }
+ file "policies/x-1.0.0.json", { }
+ file "policies/blah-1.0.0.json", { }
+ file "policy_groups/x.json", { "policies" => { "x" => { "revision_id" => "1.0.0" }, "blah" => { "revision_id" => "1.0.0" } } }
+ file "roles/x.json", {}
end
- it 'knife download makes no changes' do
- knife('download /').should_succeed ''
+ it "knife download makes no changes" do
+ knife("download /").should_succeed ""
end
end
context "and the repository has a slightly different copy of each thing" do
before do
# acl_for %w(organizations foo groups blah)
- file 'clients/x.json', { 'validator' => true }
- file 'containers/x.json', {}
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.1")
- file 'data_bags/x/y.json', { 'a' => 'b' }
- file 'environments/x.json', { 'description' => 'foo' }
- file 'groups/x.json', { 'description' => 'foo' }
- file 'groups/x.json', { 'groups' => [ 'admin' ] }
- file 'nodes/x.json', { 'run_list' => [ 'blah' ] }
- file 'org.json', { 'full_name' => 'Something Else ' }
- file 'policies/x-1.0.0.json', { 'run_list' => [ 'blah' ] }
- file 'policy_groups/x.json', {
- 'policies' => {
- 'x' => { 'revision_id' => '1.0.1' },
- 'y' => { 'revision_id' => '1.0.0' },
+ file "clients/x.json", { "validator" => true }
+ file "containers/x.json", {}
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.1")
+ file "data_bags/x/y.json", { "a" => "b" }
+ file "environments/x.json", { "description" => "foo" }
+ file "groups/x.json", { "description" => "foo" }
+ file "groups/x.json", { "groups" => [ "admin" ] }
+ file "nodes/x.json", { "run_list" => [ "blah" ] }
+ file "org.json", { "full_name" => "Something Else " }
+ file "policies/x-1.0.0.json", { "run_list" => [ "blah" ] }
+ file "policy_groups/x.json", {
+ "policies" => {
+ "x" => { "revision_id" => "1.0.1" },
+ "y" => { "revision_id" => "1.0.0" },
}
}
- file 'roles/x.json', { 'run_list' => [ 'blah' ] }
+ file "roles/x.json", { "run_list" => [ "blah" ] }
end
- it 'knife download updates everything' do
- knife('download /').should_succeed <<EOM
+ it "knife download updates everything" do
+ knife("download /").should_succeed <<EOM
Updated /clients/x.json
Updated /cookbooks/x/metadata.rb
Updated /data_bags/x/y.json
@@ -1289,7 +1289,7 @@ Updated /policies/x-1.0.0.json
Updated /policy_groups/x.json
Updated /roles/x.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
end
diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb
index eb2ed279e5..32f5bb43f8 100644
--- a/spec/integration/knife/list_spec.rb
+++ b/spec/integration/knife/list_spec.rb
@@ -15,11 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/list'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/list"
-describe 'knife list', :workstation do
+describe "knife list", :workstation do
include IntegrationSupport
include KnifeSupport
@@ -27,7 +27,7 @@ describe 'knife list', :workstation do
when_the_chef_server "is empty" do
it "knife list / returns all top level directories" do
- knife('list /').should_succeed <<-EOM
+ knife("list /").should_succeed <<-EOM
/clients
/cookbooks
/data_bags
@@ -39,7 +39,7 @@ EOM
end
it "knife list -R / returns everything" do
- knife('list -R /').should_succeed <<-EOM
+ knife("list -R /").should_succeed <<-EOM
/:
clients
cookbooks
@@ -72,27 +72,27 @@ EOM
when_the_chef_server "has plenty of stuff in it" do
before do
- client 'client1', {}
- client 'client2', {}
- cookbook 'cookbook1', '1.0.0'
- cookbook 'cookbook2', '1.0.1', { 'recipes' => { 'default.rb' => '' } }
- data_bag 'bag1', { 'item1' => {}, 'item2' => {} }
- data_bag 'bag2', { 'item1' => {}, 'item2' => {} }
- environment 'environment1', {}
- environment 'environment2', {}
- node 'node1', {}
- node 'node2', {}
- policy 'policy1', '1.2.3', {}
- policy 'policy2', '1.2.3', {}
- policy 'policy2', '1.3.5', {}
- role 'role1', {}
- role 'role2', {}
- user 'user1', {}
- user 'user2', {}
+ client "client1", {}
+ client "client2", {}
+ cookbook "cookbook1", "1.0.0"
+ cookbook "cookbook2", "1.0.1", { "recipes" => { "default.rb" => "" } }
+ data_bag "bag1", { "item1" => {}, "item2" => {} }
+ data_bag "bag2", { "item1" => {}, "item2" => {} }
+ environment "environment1", {}
+ environment "environment2", {}
+ node "node1", {}
+ node "node2", {}
+ policy "policy1", "1.2.3", {}
+ policy "policy2", "1.2.3", {}
+ policy "policy2", "1.3.5", {}
+ role "role1", {}
+ role "role2", {}
+ user "user1", {}
+ user "user2", {}
end
it "knife list / returns all top level directories" do
- knife('list /').should_succeed <<-EOM
+ knife("list /").should_succeed <<-EOM
/clients
/cookbooks
/data_bags
@@ -104,7 +104,7 @@ EOM
end
it "knife list -R / returns everything" do
- knife('list -R /').should_succeed <<-EOM
+ knife("list -R /").should_succeed <<-EOM
/:
clients
cookbooks
@@ -167,7 +167,7 @@ EOM
end
it "knife list -R --flat / returns everything" do
- knife('list -R --flat /').should_succeed <<-EOM
+ knife("list -R --flat /").should_succeed <<-EOM
/clients
/clients/chef-validator.json
/clients/chef-webui.json
@@ -205,7 +205,7 @@ EOM
end
it "knife list -Rfp / returns everything" do
- knife('list -Rfp /').should_succeed <<-EOM
+ knife("list -Rfp /").should_succeed <<-EOM
/clients/
/clients/chef-validator.json
/clients/chef-webui.json
@@ -243,18 +243,18 @@ EOM
end
it "knife list /cookbooks returns the list of cookbooks" do
- knife('list /cookbooks').should_succeed <<-EOM
+ knife("list /cookbooks").should_succeed <<-EOM
/cookbooks/cookbook1
/cookbooks/cookbook2
EOM
end
it "knife list /cookbooks/*2/*/*.rb returns the one file" do
- knife('list /cookbooks/*2/*/*.rb').should_succeed "/cookbooks/cookbook2/recipes/default.rb\n"
+ knife("list /cookbooks/*2/*/*.rb").should_succeed "/cookbooks/cookbook2/recipes/default.rb\n"
end
it "knife list /**.rb returns all ruby files" do
- knife('list /**.rb').should_succeed <<-EOM
+ knife("list /**.rb").should_succeed <<-EOM
/cookbooks/cookbook1/metadata.rb
/cookbooks/cookbook2/metadata.rb
/cookbooks/cookbook2/recipes/default.rb
@@ -262,7 +262,7 @@ EOM
end
it "knife list /cookbooks/**.rb returns all ruby files" do
- knife('list /cookbooks/**.rb').should_succeed <<-EOM
+ knife("list /cookbooks/**.rb").should_succeed <<-EOM
/cookbooks/cookbook1/metadata.rb
/cookbooks/cookbook2/metadata.rb
/cookbooks/cookbook2/recipes/default.rb
@@ -270,7 +270,7 @@ EOM
end
it "knife list /**.json returns all json files" do
- knife('list /**.json').should_succeed <<-EOM
+ knife("list /**.json").should_succeed <<-EOM
/clients/chef-validator.json
/clients/chef-webui.json
/clients/client1.json
@@ -293,7 +293,7 @@ EOM
end
it "knife list /data**.json returns all data bag json files" do
- knife('list /data**.json').should_succeed <<-EOM
+ knife("list /data**.json").should_succeed <<-EOM
/data_bags/bag1/item1.json
/data_bags/bag1/item2.json
/data_bags/bag2/item1.json
@@ -302,30 +302,30 @@ EOM
end
it "knife list /environments/missing_file.json reports missing file" do
- knife('list /environments/missing_file.json').should_fail "ERROR: /environments/missing_file.json: No such file or directory\n"
+ knife("list /environments/missing_file.json").should_fail "ERROR: /environments/missing_file.json: No such file or directory\n"
end
context "missing file/directory exact match tests" do
it "knife list /blarghle reports missing directory" do
- knife('list /blarghle').should_fail "ERROR: /blarghle: No such file or directory\n"
+ knife("list /blarghle").should_fail "ERROR: /blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle reports missing directory" do
- knife('list /roles/blarghle').should_fail "ERROR: /roles/blarghle: No such file or directory\n"
+ knife("list /roles/blarghle").should_fail "ERROR: /roles/blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle/blorghle reports missing directory" do
- knife('list /roles/blarghle/blorghle').should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
+ knife("list /roles/blarghle/blorghle").should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
end
end
- context 'symlink tests' do
- when_the_repository 'is empty' do
- context 'when cwd is at the top of the repository' do
- before { cwd '.' }
+ context "symlink tests" do
+ when_the_repository "is empty" do
+ context "when cwd is at the top of the repository" do
+ before { cwd "." }
it "knife list -Rfp returns everything" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
clients/
clients/chef-validator.json
clients/chef-webui.json
@@ -364,13 +364,13 @@ EOM
end
end
- when_the_repository 'has a cookbooks directory' do
- before { directory 'cookbooks' }
- context 'when cwd is in cookbooks/' do
- before { cwd 'cookbooks' }
+ when_the_repository "has a cookbooks directory" do
+ before { directory "cookbooks" }
+ context "when cwd is in cookbooks/" do
+ before { cwd "cookbooks" }
it "knife list -Rfp / returns everything" do
- knife('list -Rfp /').should_succeed <<-EOM
+ knife("list -Rfp /").should_succeed <<-EOM
/clients/
/clients/chef-validator.json
/clients/chef-webui.json
@@ -408,7 +408,7 @@ EOM
end
it "knife list -Rfp .. returns everything" do
- knife('list -Rfp ..').should_succeed <<-EOM
+ knife("list -Rfp ..").should_succeed <<-EOM
/clients/
/clients/chef-validator.json
/clients/chef-webui.json
@@ -446,7 +446,7 @@ EOM
end
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -458,14 +458,14 @@ EOM
end
end
- when_the_repository 'has a cookbooks/cookbook2 directory' do
- before { directory 'cookbooks/cookbook2' }
+ when_the_repository "has a cookbooks/cookbook2 directory" do
+ before { directory "cookbooks/cookbook2" }
- context 'when cwd is in cookbooks/cookbook2' do
- before { cwd 'cookbooks/cookbook2' }
+ context "when cwd is in cookbooks/cookbook2" do
+ before { cwd "cookbooks/cookbook2" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
metadata.rb
recipes/
recipes/default.rb
@@ -474,17 +474,17 @@ 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'
+ directory "cookbooks"
+ symlink "symlinked", "cookbooks"
end
- context 'when cwd is in cookbooks/' do
- before { cwd 'cookbooks' }
+ context "when cwd is in cookbooks/" do
+ before { cwd "cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -495,11 +495,11 @@ EOM
end
end
- context 'when cwd is in symlinked/' do
- before { cwd 'symlinked' }
+ context "when cwd is in symlinked/" do
+ before { cwd "symlinked" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -511,17 +511,17 @@ 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'
+ directory "real_cookbooks"
+ symlink "cookbooks", "real_cookbooks"
end
- context 'when cwd is in real_cookbooks/' do
- before { cwd 'real_cookbooks' }
+ context "when cwd is in real_cookbooks/" do
+ before { cwd "real_cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -532,11 +532,11 @@ EOM
end
end
- context 'when cwd is in cookbooks/' do
- before { cwd 'cookbooks' }
+ context "when cwd is in cookbooks/" do
+ before { cwd "cookbooks" }
it "knife list -Rfp returns cookbooks" do
- knife('list -Rfp').should_succeed <<-EOM
+ knife("list -Rfp").should_succeed <<-EOM
cookbook1/
cookbook1/metadata.rb
cookbook2/
@@ -553,51 +553,51 @@ EOM
context "--local" do
when_the_repository "is empty" do
it "knife list --local / returns nothing" do
- knife('list --local /').should_succeed ""
+ knife("list --local /").should_succeed ""
end
it "knife list /roles returns nothing" do
- knife('list --local /roles').should_fail "ERROR: /roles: No such file or directory\n"
+ knife("list --local /roles").should_fail "ERROR: /roles: No such file or directory\n"
end
end
when_the_repository "has a bunch of stuff" do
before do
- file 'clients/client1.json', {}
- file 'clients/client2.json', {}
+ file "clients/client1.json", {}
+ file "clients/client2.json", {}
- directory 'cookbooks/cookbook1' do
- file 'metadata.rb', cb_metadata("cookbook1", "1.0.0")
+ directory "cookbooks/cookbook1" do
+ file "metadata.rb", cb_metadata("cookbook1", "1.0.0")
end
- directory 'cookbooks/cookbook2' do
- file 'metadata.rb', cb_metadata("cookbook2", "2.0.0")
- file 'recipes/default.rb', ''
+ directory "cookbooks/cookbook2" do
+ file "metadata.rb", cb_metadata("cookbook2", "2.0.0")
+ file "recipes/default.rb", ""
end
- directory 'data_bags' do
- directory 'bag1' do
- file 'item1.json', {}
- file 'item2.json', {}
+ directory "data_bags" do
+ directory "bag1" do
+ file "item1.json", {}
+ file "item2.json", {}
end
- directory 'bag2' do
- file 'item1.json', {}
- file 'item2.json', {}
+ directory "bag2" do
+ file "item1.json", {}
+ file "item2.json", {}
end
end
- file 'environments/environment1.json', {}
- file 'environments/environment2.json', {}
- file 'nodes/node1.json', {}
- file 'nodes/node2.json', {}
+ file "environments/environment1.json", {}
+ file "environments/environment2.json", {}
+ file "nodes/node1.json", {}
+ file "nodes/node2.json", {}
- file 'roles/role1.json', {}
- file 'roles/role2.json', {}
- file 'users/user1.json', {}
- file 'users/user2.json', {}
+ file "roles/role1.json", {}
+ file "roles/role2.json", {}
+ file "users/user1.json", {}
+ file "users/user2.json", {}
end
it "knife list -Rfp / returns everything" do
- knife('list -Rp --local --flat /').should_succeed <<-EOM
+ knife("list -Rp --local --flat /").should_succeed <<-EOM
/clients/
/clients/client1.json
/clients/client2.json
@@ -632,15 +632,15 @@ EOM
context "missing file/directory tests" do
it "knife list --local /blarghle reports missing directory" do
- knife('list --local /blarghle').should_fail "ERROR: /blarghle: No such file or directory\n"
+ knife("list --local /blarghle").should_fail "ERROR: /blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle reports missing directory" do
- knife('list --local /roles/blarghle').should_fail "ERROR: /roles/blarghle: No such file or directory\n"
+ knife("list --local /roles/blarghle").should_fail "ERROR: /roles/blarghle: No such file or directory\n"
end
it "knife list /roles/blarghle/blorghle reports missing directory" do
- knife('list --local /roles/blarghle/blorghle').should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
+ knife("list --local /roles/blarghle/blorghle").should_fail "ERROR: /roles/blarghle/blorghle: No such file or directory\n"
end
end
end
@@ -648,16 +648,16 @@ EOM
when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
before do
- organization 'foo'
+ organization "foo"
end
before :each do
- Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, "/organizations/foo")
end
- context 'and is empty' do
+ context "and is empty" do
it "knife list / returns all top level directories" do
- knife('list /').should_succeed <<-EOM
+ knife("list /").should_succeed <<-EOM
/acls
/clients
/containers
@@ -676,7 +676,7 @@ EOM
end
it "knife list -R / returns everything" do
- knife('list -R /').should_succeed <<-EOM
+ knife("list -R /").should_succeed <<-EOM
/:
acls
clients
@@ -777,8 +777,8 @@ EOM
end
end
- it 'knife list -R / returns everything' do
- knife('list -R /').should_succeed <<-EOM
+ it "knife list -R / returns everything" do
+ knife("list -R /").should_succeed <<-EOM
/:
acls
clients
@@ -880,35 +880,35 @@ EOM
context "has plenty of stuff in it" do
before do
- client 'client1', {}
- client 'client2', {}
- container 'container1', {}
- container 'container2', {}
- cookbook 'cookbook1', '1.0.0'
- cookbook 'cookbook2', '1.0.1', { 'recipes' => { 'default.rb' => '' } }
- data_bag 'bag1', { 'item1' => {}, 'item2' => {} }
- data_bag 'bag2', { 'item1' => {}, 'item2' => {} }
- environment 'environment1', {}
- environment 'environment2', {}
- group 'group1', {}
- group 'group2', {}
- node 'node1', {}
- node 'node2', {}
- org_invite 'user1'
- org_member 'user2'
- policy 'policy1', '1.2.3', {}
- policy 'policy2', '1.2.3', {}
- policy 'policy2', '1.3.5', {}
- policy_group 'policy_group1', { 'policies' => { 'policy1' => { 'revision_id' => '1.2.3' } } }
- policy_group 'policy_group2', { 'policies' => { 'policy2' => { 'revision_id' => '1.3.5' } } }
- role 'role1', {}
- role 'role2', {}
- user 'user1', {}
- user 'user2', {}
+ client "client1", {}
+ client "client2", {}
+ container "container1", {}
+ container "container2", {}
+ cookbook "cookbook1", "1.0.0"
+ cookbook "cookbook2", "1.0.1", { "recipes" => { "default.rb" => "" } }
+ data_bag "bag1", { "item1" => {}, "item2" => {} }
+ data_bag "bag2", { "item1" => {}, "item2" => {} }
+ environment "environment1", {}
+ environment "environment2", {}
+ group "group1", {}
+ group "group2", {}
+ node "node1", {}
+ node "node2", {}
+ org_invite "user1"
+ org_member "user2"
+ policy "policy1", "1.2.3", {}
+ policy "policy2", "1.2.3", {}
+ policy "policy2", "1.3.5", {}
+ policy_group "policy_group1", { "policies" => { "policy1" => { "revision_id" => "1.2.3" } } }
+ policy_group "policy_group2", { "policies" => { "policy2" => { "revision_id" => "1.3.5" } } }
+ role "role1", {}
+ role "role2", {}
+ user "user1", {}
+ user "user2", {}
end
it "knife list -Rfp / returns everything" do
- knife('list -Rfp /').should_succeed <<-EOM
+ knife("list -Rfp /").should_succeed <<-EOM
/acls/
/acls/clients/
/acls/clients/client1.json
diff --git a/spec/integration/knife/raw_spec.rb b/spec/integration/knife/raw_spec.rb
index 75fc8fa55e..92b972b87b 100644
--- a/spec/integration/knife/raw_spec.rb
+++ b/spec/integration/knife/raw_spec.rb
@@ -15,12 +15,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/raw'
-require 'chef/knife/show'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/raw"
+require "chef/knife/show"
-describe 'knife raw', :workstation do
+describe "knife raw", :workstation do
include IntegrationSupport
include KnifeSupport
include AppServerSupport
@@ -29,17 +29,17 @@ describe 'knife raw', :workstation do
when_the_chef_server "has one of each thing" do
before do
- client 'x', '{}'
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => '{}' }
- environment 'x', '{}'
- node 'x', '{}'
- role 'x', '{}'
- user 'x', '{}'
+ client "x", "{}"
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => "{}" }
+ environment "x", "{}"
+ node "x", "{}"
+ role "x", "{}"
+ user "x", "{}"
end
- it 'knife raw /nodes/x returns the node', :skip => (RUBY_VERSION < "1.9") do
- knife('raw /nodes/x').should_succeed <<EOM
+ it "knife raw /nodes/x returns the node", :skip => (RUBY_VERSION < "1.9") do
+ knife("raw /nodes/x").should_succeed <<EOM
{
"name": "x",
"json_class": "Chef::Node",
@@ -64,12 +64,12 @@ describe 'knife raw', :workstation do
EOM
end
- it 'knife raw /blarghle returns 404' do
- knife('raw /blarghle').should_fail(/ERROR: Server responded with error 404 "Not Found\s*"/)
+ it "knife raw /blarghle returns 404" do
+ 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
- knife('raw -m DELETE /roles/x').should_succeed <<EOM
+ 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",
"description": "",
@@ -89,11 +89,11 @@ EOM
}
}
EOM
- knife('show /roles/x.json').should_fail "ERROR: /roles/x.json: No such file or directory\n"
+ 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
- Tempfile.open('raw_put_input') do |file|
+ 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
{
"name": "x",
@@ -136,7 +136,7 @@ EOM
}
}
EOM
- knife('show /roles/x.json').should_succeed <<EOM
+ knife("show /roles/x.json").should_succeed <<EOM
/roles/x.json:
{
"name": "x",
@@ -146,8 +146,8 @@ EOM
end
end
- it 'knife raw -m POST -i blah.txt /roles succeeds', :skip => (RUBY_VERSION < "1.9") do
- Tempfile.open('raw_put_input') do |file|
+ 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
{
"name": "y",
@@ -172,7 +172,7 @@ EOM
"uri": "#{Chef::Config.chef_server_url}/roles/y"
}
EOM
- knife('show /roles/y.json').should_succeed <<EOM
+ knife("show /roles/y.json").should_succeed <<EOM
/roles/y.json:
{
"name": "y",
@@ -182,11 +182,11 @@ EOM
end
end
- context 'When a server returns raw json' do
+ context "When a server returns raw json" do
before :each do
Chef::Config.chef_server_url = "http://localhost:9018"
app = lambda do |env|
- [200, {'Content-Type' => 'application/json' }, ['{ "x": "y", "a": "b" }'] ]
+ [200, {"Content-Type" => "application/json" }, ['{ "x": "y", "a": "b" }'] ]
end
@raw_server, @raw_server_thread = start_app_server(app, 9018)
end
@@ -196,8 +196,8 @@ EOM
@raw_server_thread.kill if @raw_server_thread
end
- it 'knife raw /blah returns the prettified json', :skip => (RUBY_VERSION < "1.9") do
- knife('raw /blah').should_succeed <<EOM
+ it "knife raw /blah returns the prettified json", :skip => (RUBY_VERSION < "1.9") do
+ knife("raw /blah").should_succeed <<EOM
{
"x": "y",
"a": "b"
@@ -205,18 +205,18 @@ EOM
EOM
end
- it 'knife raw --no-pretty /blah returns the raw json' do
- knife('raw --no-pretty /blah').should_succeed <<EOM
+ it "knife raw --no-pretty /blah returns the raw json" do
+ knife("raw --no-pretty /blah").should_succeed <<EOM
{ "x": "y", "a": "b" }
EOM
end
end
- context 'When a server returns text' do
+ context "When a server returns text" do
before :each do
Chef::Config.chef_server_url = "http://localhost:9018"
app = lambda do |env|
- [200, {'Content-Type' => 'text' }, ['{ "x": "y", "a": "b" }'] ]
+ [200, {"Content-Type" => "text" }, ['{ "x": "y", "a": "b" }'] ]
end
@raw_server, @raw_server_thread = start_app_server(app, 9018)
end
@@ -226,14 +226,14 @@ EOM
@raw_server_thread.kill if @raw_server_thread
end
- it 'knife raw /blah returns the raw text' do
- knife('raw /blah').should_succeed(<<EOM)
+ it "knife raw /blah returns the raw text" do
+ knife("raw /blah").should_succeed(<<EOM)
{ "x": "y", "a": "b" }
EOM
end
- it 'knife raw --no-pretty /blah returns the raw text' do
- knife('raw --no-pretty /blah').should_succeed(<<EOM)
+ it "knife raw --no-pretty /blah returns the raw text" do
+ knife("raw --no-pretty /blah").should_succeed(<<EOM)
{ "x": "y", "a": "b" }
EOM
end
diff --git a/spec/integration/knife/redirection_spec.rb b/spec/integration/knife/redirection_spec.rb
index 77bda99453..ee12e85314 100644
--- a/spec/integration/knife/redirection_spec.rb
+++ b/spec/integration/knife/redirection_spec.rb
@@ -15,26 +15,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/list'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/list"
-describe 'redirection', :workstation do
+describe "redirection", :workstation do
include IntegrationSupport
include KnifeSupport
include AppServerSupport
include_context "default config options"
- when_the_chef_server 'has a role' do
- before { role 'x', {} }
+ when_the_chef_server "has a role" do
+ before { role "x", {} }
- context 'and another server redirects to it with 302' do
+ context "and another server redirects to it with 302" do
before :each do
real_chef_server_url = Chef::Config.chef_server_url
Chef::Config.chef_server_url = "http://localhost:9018"
app = lambda do |env|
- [302, {'Content-Type' => 'text','Location' => "#{real_chef_server_url}#{env['PATH_INFO']}" }, ['302 found'] ]
+ [302, {"Content-Type" => "text","Location" => "#{real_chef_server_url}#{env['PATH_INFO']}" }, ["302 found"] ]
end
@redirector_server, @redirector_server_thread = start_app_server(app, 9018)
end
@@ -44,8 +44,8 @@ describe 'redirection', :workstation do
@redirector_thread.kill if @redirector_thread
end
- it 'knife list /roles returns the role' do
- knife('list /roles').should_succeed "/roles/x.json\n"
+ it "knife list /roles returns the role" do
+ knife("list /roles").should_succeed "/roles/x.json\n"
end
end
end
diff --git a/spec/integration/knife/serve_spec.rb b/spec/integration/knife/serve_spec.rb
index 7bf7d29b40..74b47c0fe3 100644
--- a/spec/integration/knife/serve_spec.rb
+++ b/spec/integration/knife/serve_spec.rb
@@ -15,34 +15,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/serve'
-require 'chef/server_api'
+require "support/shared/integration/integration_helper"
+require "chef/knife/serve"
+require "chef/server_api"
-describe 'knife serve', :workstation do
+describe "knife serve", :workstation do
include IntegrationSupport
include KnifeSupport
include AppServerSupport
- when_the_repository 'also has one of each thing' do
- before { file 'nodes/x.json', { 'foo' => 'bar' } }
+ when_the_repository "also has one of each thing" do
+ before { file "nodes/x.json", { "foo" => "bar" } }
- it 'knife serve serves up /nodes/x' do
+ it "knife serve serves up /nodes/x" do
exception = nil
t = Thread.new do
begin
- knife('serve --chef-zero-port=8890')
+ knife("serve --chef-zero-port=8890")
rescue
exception = $!
end
end
begin
Chef::Config.log_level = :debug
- Chef::Config.chef_server_url = 'http://localhost:8890'
+ Chef::Config.chef_server_url = "http://localhost:8890"
Chef::Config.node_name = nil
Chef::Config.client_key = nil
api = Chef::ServerAPI.new
- expect(api.get('nodes/x')['name']).to eq('x')
+ expect(api.get("nodes/x")["name"]).to eq("x")
rescue
if exception
raise exception
diff --git a/spec/integration/knife/show_spec.rb b/spec/integration/knife/show_spec.rb
index fad5126f66..06183243ee 100644
--- a/spec/integration/knife/show_spec.rb
+++ b/spec/integration/knife/show_spec.rb
@@ -15,11 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'support/shared/context/config'
-require 'chef/knife/show'
+require "support/shared/integration/integration_helper"
+require "support/shared/context/config"
+require "chef/knife/show"
-describe 'knife show', :workstation do
+describe "knife show", :workstation do
include IntegrationSupport
include KnifeSupport
@@ -27,81 +27,81 @@ describe 'knife show', :workstation do
when_the_chef_server "has one of each thing" do
before do
- client 'x', '{}'
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => '{}' }
- environment 'x', '{}'
- node 'x', '{}'
- role 'x', '{}'
- user 'x', '{}'
+ client "x", "{}"
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => "{}" }
+ environment "x", "{}"
+ node "x", "{}"
+ role "x", "{}"
+ user "x", "{}"
end
- when_the_repository 'also has one of each thing' do
+ when_the_repository "also has one of each thing" do
before do
- file 'clients/x.json', { 'foo' => 'bar' }
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0')
- file 'data_bags/x/y.json', { 'foo' => 'bar' }
- file 'environments/_default.json', { 'foo' => 'bar' }
- file 'environments/x.json', { 'foo' => 'bar' }
- file 'nodes/x.json', { 'foo' => 'bar' }
- file 'roles/x.json', { 'foo' => 'bar' }
- file 'users/x.json', { 'foo' => 'bar' }
+ file "clients/x.json", { "foo" => "bar" }
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", { "foo" => "bar" }
+ file "environments/_default.json", { "foo" => "bar" }
+ file "environments/x.json", { "foo" => "bar" }
+ file "nodes/x.json", { "foo" => "bar" }
+ file "roles/x.json", { "foo" => "bar" }
+ file "users/x.json", { "foo" => "bar" }
end
- it 'knife show /cookbooks/x/metadata.rb shows the remote version' do
- knife('show /cookbooks/x/metadata.rb').should_succeed <<EOM
+ it "knife show /cookbooks/x/metadata.rb shows the remote version" do
+ knife("show /cookbooks/x/metadata.rb").should_succeed <<EOM
/cookbooks/x/metadata.rb:
name "x"; version "1.0.0"
EOM
end
- it 'knife show --local /cookbooks/x/metadata.rb shows the local version' do
- knife('show --local /cookbooks/x/metadata.rb').should_succeed <<EOM
+ it "knife show --local /cookbooks/x/metadata.rb shows the local version" do
+ knife("show --local /cookbooks/x/metadata.rb").should_succeed <<EOM
/cookbooks/x/metadata.rb:
name "x"; version "1.0.0"
EOM
end
- it 'knife show /data_bags/x/y.json shows the remote version' do
- knife('show /data_bags/x/y.json').should_succeed <<EOM
+ it "knife show /data_bags/x/y.json shows the remote version" do
+ knife("show /data_bags/x/y.json").should_succeed <<EOM
/data_bags/x/y.json:
{
"id": "y"
}
EOM
end
- it 'knife show --local /data_bags/x/y.json shows the local version' do
- knife('show --local /data_bags/x/y.json').should_succeed <<EOM
+ it "knife show --local /data_bags/x/y.json shows the local version" do
+ knife("show --local /data_bags/x/y.json").should_succeed <<EOM
/data_bags/x/y.json:
{
"foo": "bar"
}
EOM
end
- it 'knife show /environments/x.json shows the remote version', :skip => (RUBY_VERSION < "1.9") do
- knife('show /environments/x.json').should_succeed <<EOM
+ 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:
{
"name": "x"
}
EOM
end
- it 'knife show --local /environments/x.json shows the local version' do
- knife('show --local /environments/x.json').should_succeed <<EOM
+ it "knife show --local /environments/x.json shows the local version" do
+ knife("show --local /environments/x.json").should_succeed <<EOM
/environments/x.json:
{
"foo": "bar"
}
EOM
end
- it 'knife show /roles/x.json shows the remote version', :skip => (RUBY_VERSION < "1.9") do
- knife('show /roles/x.json').should_succeed <<EOM
+ 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:
{
"name": "x"
}
EOM
end
- it 'knife show --local /roles/x.json shows the local version' do
- knife('show --local /roles/x.json').should_succeed <<EOM
+ it "knife show --local /roles/x.json shows the local version" do
+ knife("show --local /roles/x.json").should_succeed <<EOM
/roles/x.json:
{
"foo": "bar"
@@ -109,34 +109,34 @@ EOM
EOM
end
# show directory
- it 'knife show /data_bags/x fails' do
- knife('show /data_bags/x').should_fail "ERROR: /data_bags/x: is a directory\n"
+ it "knife show /data_bags/x fails" do
+ knife("show /data_bags/x").should_fail "ERROR: /data_bags/x: is a directory\n"
end
- it 'knife show --local /data_bags/x fails' do
- knife('show --local /data_bags/x').should_fail "ERROR: /data_bags/x: is a directory\n"
+ it "knife show --local /data_bags/x fails" do
+ knife("show --local /data_bags/x").should_fail "ERROR: /data_bags/x: is a directory\n"
end
# show nonexistent file
- it 'knife show /environments/nonexistent.json fails' do
- knife('show /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
+ it "knife show /environments/nonexistent.json fails" do
+ knife("show /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
end
- it 'knife show --local /environments/nonexistent.json fails' do
- knife('show --local /environments/nonexistent.json').should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
+ it "knife show --local /environments/nonexistent.json fails" do
+ knife("show --local /environments/nonexistent.json").should_fail "ERROR: /environments/nonexistent.json: No such file or directory\n"
end
end
end
- when_the_chef_server 'has a hash with multiple keys' do
+ when_the_chef_server "has a hash with multiple keys" do
before do
- environment 'x', {
- 'default_attributes' => { 'foo' => 'bar' },
- 'cookbook_versions' => { 'blah' => '= 1.0.0'},
- 'override_attributes' => { 'x' => 'y' },
- 'description' => 'woo',
- 'name' => 'x',
+ environment "x", {
+ "default_attributes" => { "foo" => "bar" },
+ "cookbook_versions" => { "blah" => "= 1.0.0"},
+ "override_attributes" => { "x" => "y" },
+ "description" => "woo",
+ "name" => "x",
}
end
- it 'knife show shows the attributes in a predetermined order', :skip => (RUBY_VERSION < "1.9") do
- knife('show /environments/x.json').should_succeed <<EOM
+ 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:
{
"name": "x",
@@ -155,10 +155,10 @@ EOM
end
end
- when_the_repository 'has an environment with bad JSON' do
- before { file 'environments/x.json', '{' }
- it 'knife show succeeds' do
- knife('show --local /environments/x.json').should_succeed <<EOM
+ when_the_repository "has an environment with bad JSON" do
+ before { file "environments/x.json", "{" }
+ it "knife show succeeds" do
+ knife("show --local /environments/x.json").should_succeed <<EOM
/environments/x.json:
{
EOM
diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb
index 6b7679de44..79dae99acf 100644
--- a/spec/integration/knife/upload_spec.rb
+++ b/spec/integration/knife/upload_spec.rb
@@ -15,44 +15,44 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'support/shared/integration/integration_helper'
-require 'chef/knife/upload'
-require 'chef/knife/diff'
-require 'chef/knife/raw'
-require 'chef/json_compat'
+require "support/shared/integration/integration_helper"
+require "chef/knife/upload"
+require "chef/knife/diff"
+require "chef/knife/raw"
+require "chef/json_compat"
-describe 'knife upload', :workstation do
+describe "knife upload", :workstation do
include IntegrationSupport
include KnifeSupport
- context 'without versioned cookbooks' do
+ context "without versioned cookbooks" do
when_the_chef_server "has one of each thing" do
before do
- client 'x', {}
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- node 'x', {}
- role 'x', {}
- user 'x', {}
+ client "x", {}
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ node "x", {}
+ role "x", {}
+ user "x", {}
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
- end
-
- it 'knife upload does nothing' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
+ end
+
+ it "knife upload does nothing" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients/chef-validator.json
D\t/clients/chef-webui.json
D\t/clients/x.json
@@ -67,8 +67,8 @@ D\t/users/x.json
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")
+ 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")
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)
@@ -80,56 +80,56 @@ Deleted extra entry /roles/x.json (purge is on)
Deleted extra entry /users/admin.json (purge is on)
Deleted extra entry /users/x.json (purge is on)
EOM
- knife('diff --name-status /').should_succeed <<EOM
+ knife("diff --name-status /").should_succeed <<EOM
D\t/environments/_default.json
EOM
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { "description" => "The default Chef environment" }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife upload makes no changes' do
- knife('upload /cookbooks/x').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload makes no changes" do
+ knife("upload /cookbooks/x").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife upload --purge makes no changes' do
- knife('upload --purge /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload --purge makes no changes" do
+ knife("upload --purge /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', { 'description' => 'blarghle' }
+ file "roles/x.json", { "description" => "blarghle" }
end
- it 'knife upload changes the role' do
- knife('upload /').should_succeed "Updated /roles/x.json\n"
- knife('diff --name-status /').should_succeed ''
+ it "knife upload changes the role" do
+ knife("upload /").should_succeed "Updated /roles/x.json\n"
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife upload --no-diff does not change the role' do
- knife('upload --no-diff /').should_succeed ''
- knife('diff --name-status /').should_succeed "M\t/roles/x.json\n"
+ it "knife upload --no-diff does not change the role" do
+ knife("upload --no-diff /").should_succeed ""
+ knife("diff --name-status /").should_succeed "M\t/roles/x.json\n"
end
end
- context 'except the role file is textually different, but not ACTUALLY different' do
+ context "except the role file is textually different, but not ACTUALLY different" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"chef_type": "role",
"default_attributes": {
@@ -148,45 +148,45 @@ EOM
EOM
end
- it 'knife upload / does not change anything' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload / does not change anything" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'when cookbook metadata has a self-dependency' do
+ context "when cookbook metadata has a self-dependency" do
before do
- file 'cookbooks/x/metadata.rb', "name 'x'; version '1.0.0'; depends 'x'"
+ file "cookbooks/x/metadata.rb", "name 'x'; version '1.0.0'; depends 'x'"
end
it "should warn", :chef_lt_13_only do
- knife('upload /cookbooks').should_succeed(
+ knife("upload /cookbooks").should_succeed(
stdout: "Updated /cookbooks/x\n",
stderr: "WARN: Ignoring self-dependency in cookbook x, please remove it (in the future this will be fatal).\n",
)
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
it "should fail in Chef 13", :chef_gte_13_only do
- knife('upload /cookbooks').should_fail ''
+ knife("upload /cookbooks").should_fail ""
# FIXME: include the error message here
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x/blah.rb', ''
- file 'cookbooks/y/metadata.rb', cb_metadata("y", "1.0.0")
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x/blah.rb", ""
+ file "cookbooks/y/metadata.rb", cb_metadata("y", "1.0.0")
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife upload adds the new files' do
- knife('upload /').should_succeed <<EOM
+ it "knife upload adds the new files" do
+ knife("upload /").should_succeed <<EOM
Created /clients/y.json
Updated /cookbooks/x
Created /cookbooks/y
@@ -198,11 +198,11 @@ Created /nodes/y.json
Created /roles/y.json
Created /users/y.json
EOM
- knife('diff /').should_succeed ''
+ knife("diff /").should_succeed ""
end
- it 'knife upload --no-diff adds the new files' do
- knife('upload --no-diff /').should_succeed <<EOM
+ it "knife upload --no-diff adds the new files" do
+ knife("upload --no-diff /").should_succeed <<EOM
Created /clients/y.json
Updated /cookbooks/x
Created /cookbooks/y
@@ -214,15 +214,15 @@ Created /nodes/y.json
Created /roles/y.json
Created /users/y.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
end
- when_the_repository 'is empty' do
- it 'knife upload does nothing' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife upload does nothing" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -233,8 +233,8 @@ D\t/users
EOM
end
- it 'knife upload --purge deletes nothing' do
- knife('upload --purge /').should_fail <<EOM
+ it "knife upload --purge deletes nothing" do
+ knife("upload --purge /").should_fail <<EOM
ERROR: /clients cannot be deleted.
ERROR: /cookbooks cannot be deleted.
ERROR: /data_bags cannot be deleted.
@@ -243,7 +243,7 @@ ERROR: /nodes cannot be deleted.
ERROR: /roles cannot be deleted.
ERROR: /users cannot be deleted.
EOM
- knife('diff --name-status /').should_succeed <<EOM
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -254,178 +254,178 @@ D\t/users
EOM
end
- context 'when current directory is top level' do
+ context "when current directory is top level" do
before do
- cwd '.'
+ cwd "."
end
- it 'knife upload with no parameters reports an error' do
- knife('upload').should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
+ it "knife upload with no parameters reports an error" do
+ knife("upload").should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
end
end
end
end
- when_the_chef_server 'is empty' do
- when_the_repository 'has a data bag item' do
+ when_the_chef_server "is empty" do
+ when_the_repository "has a data bag item" do
before do
- file 'data_bags/x/y.json', { 'foo' => 'bar' }
+ file "data_bags/x/y.json", { "foo" => "bar" }
end
- it 'knife upload of the data bag uploads only the values in the data bag item and no other' do
- knife('upload /data_bags/x/y.json').should_succeed <<EOM
+ it "knife upload of the data bag uploads only the values in the data bag item and no other" do
+ knife("upload /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags/x
Created /data_bags/x/y.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<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([ 'foo', 'id' ])
+ expect(Chef::JSONCompat.parse(knife("raw /data/x/y").stdout, :create_additions => false).keys.sort).to eq([ "foo", "id" ])
end
- it 'knife upload /data_bags/x /data_bags/x/y.json uploads x once' do
- knife('upload /data_bags/x /data_bags/x/y.json').should_succeed <<EOM
+ it "knife upload /data_bags/x /data_bags/x/y.json uploads x once" do
+ knife("upload /data_bags/x /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags/x
Created /data_bags/x/y.json
EOM
end
end
- when_the_repository 'has a data bag item with keys chef_type and data_bag' do
+ when_the_repository "has a data bag item with keys chef_type and data_bag" do
before do
- file 'data_bags/x/y.json', { 'chef_type' => 'aaa', 'data_bag' => 'bbb' }
+ file "data_bags/x/y.json", { "chef_type" => "aaa", "data_bag" => "bbb" }
end
- it 'upload preserves chef_type and data_bag' do
- knife('upload /data_bags/x/y.json').should_succeed <<EOM
+ it "upload preserves chef_type and data_bag" do
+ knife("upload /data_bags/x/y.json").should_succeed <<EOM
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)
- expect(result.keys.sort).to eq([ 'chef_type', 'data_bag', 'id' ])
- expect(result['chef_type']).to eq('aaa')
- expect(result['data_bag']).to eq('bbb')
+ knife("diff --name-status /data_bags").should_succeed ""
+ result = Chef::JSONCompat.parse(knife("raw /data/x/y").stdout, :create_additions => false)
+ expect(result.keys.sort).to eq([ "chef_type", "data_bag", "id" ])
+ expect(result["chef_type"]).to eq("aaa")
+ expect(result["data_bag"]).to eq("bbb")
end
end
# Test upload of an item when the other end doesn't even have the container
- when_the_repository 'has two data bag items' do
+ when_the_repository "has two data bag items" do
before do
- file 'data_bags/x/y.json', {}
- file 'data_bags/x/z.json', {}
+ file "data_bags/x/y.json", {}
+ file "data_bags/x/z.json", {}
end
- it 'knife upload of one data bag item itself succeeds' do
- knife('upload /data_bags/x/y.json').should_succeed <<EOM
+ it "knife upload of one data bag item itself succeeds" do
+ knife("upload /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags/x
Created /data_bags/x/y.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
A\t/data_bags/x/z.json
EOM
end
end
end
- when_the_chef_server 'has three data bag items' do
+ when_the_chef_server "has three data bag items" do
before do
- data_bag 'x', { 'deleted' => {}, 'modified' => {}, 'unmodified' => {} }
+ data_bag "x", { "deleted" => {}, "modified" => {}, "unmodified" => {} }
end
- when_the_repository 'has a modified, unmodified, added and deleted data bag item' do
+ when_the_repository "has a modified, unmodified, added and deleted data bag item" do
before do
- file 'data_bags/x/added.json', {}
- file 'data_bags/x/modified.json', { 'foo' => 'bar' }
- file 'data_bags/x/unmodified.json', {}
+ file "data_bags/x/added.json", {}
+ file "data_bags/x/modified.json", { "foo" => "bar" }
+ file "data_bags/x/unmodified.json", {}
end
- it 'knife upload of the modified file succeeds' do
- knife('upload /data_bags/x/modified.json').should_succeed <<EOM
+ it "knife upload of the modified file succeeds" do
+ knife("upload /data_bags/x/modified.json").should_succeed <<EOM
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the unmodified file does nothing' do
- knife('upload /data_bags/x/unmodified.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife upload of the unmodified file does nothing" do
+ knife("upload /data_bags/x/unmodified.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the added file succeeds' do
- knife('upload /data_bags/x/added.json').should_succeed <<EOM
+ it "knife upload of the added file succeeds" do
+ knife("upload /data_bags/x/added.json").should_succeed <<EOM
Created /data_bags/x/added.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
EOM
end
- it 'knife upload of the deleted file does nothing' do
- knife('upload /data_bags/x/deleted.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife upload of the deleted file does nothing" do
+ knife("upload /data_bags/x/deleted.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload --purge of the deleted file deletes it' do
- knife('upload --purge /data_bags/x/deleted.json').should_succeed <<EOM
+ it "knife upload --purge of the deleted file deletes it" do
+ knife("upload --purge /data_bags/x/deleted.json").should_succeed <<EOM
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the entire data bag uploads everything' do
- knife('upload /data_bags/x').should_succeed <<EOM
+ it "knife upload of the entire data bag uploads everything" do
+ knife("upload /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
EOM
end
- it 'knife upload --purge of the entire data bag uploads everything' do
- knife('upload --purge /data_bags/x').should_succeed <<EOM
+ it "knife upload --purge of the entire data bag uploads everything" do
+ knife("upload --purge /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- context 'when cwd is the /data_bags directory' do
+ context "when cwd is the /data_bags directory" do
before do
- cwd 'data_bags'
+ cwd "data_bags"
end
- it 'knife upload fails' do
- knife('upload').should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
+ it "knife upload fails" do
+ knife("upload").should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
end
- it 'knife upload --purge . uploads everything' do
- knife('upload --purge .').should_succeed <<EOM
+ it "knife upload --purge . uploads everything" do
+ knife("upload --purge .").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- it 'knife upload --purge * uploads everything' do
- knife('upload --purge *').should_succeed <<EOM
+ it "knife upload --purge * uploads everything" do
+ knife("upload --purge *").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
end
end
@@ -434,128 +434,128 @@ EOM
# Cookbook upload is a funny thing ... direct cookbook upload works, but
# upload of a file is designed not to work at present. Make sure that is the
# case.
- when_the_chef_server 'has a cookbook' do
+ when_the_chef_server "has a cookbook" do
before do
- cookbook 'x', '1.0.0', { 'z.rb' => '' }
+ cookbook "x", "1.0.0", { "z.rb" => "" }
end
- when_the_repository 'has a modified, extra and missing file for the cookbook' do
+ when_the_repository "has a modified, extra and missing file for the cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0", "#modified")
- file 'cookbooks/x/y.rb', 'hi'
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "#modified")
+ file "cookbooks/x/y.rb", "hi"
end
- it 'knife upload of any individual file fails' do
- knife('upload /cookbooks/x/metadata.rb').should_fail "ERROR: /cookbooks/x/metadata.rb cannot be updated.\n"
- knife('upload /cookbooks/x/y.rb').should_fail "ERROR: /cookbooks/x cannot have a child created under it.\n"
- knife('upload --purge /cookbooks/x/z.rb').should_fail "ERROR: /cookbooks/x/z.rb cannot be deleted.\n"
+ it "knife upload of any individual file fails" do
+ knife("upload /cookbooks/x/metadata.rb").should_fail "ERROR: /cookbooks/x/metadata.rb cannot be updated.\n"
+ knife("upload /cookbooks/x/y.rb").should_fail "ERROR: /cookbooks/x cannot have a child created under it.\n"
+ knife("upload --purge /cookbooks/x/z.rb").should_fail "ERROR: /cookbooks/x/z.rb cannot be deleted.\n"
end
# TODO this is a bit of an inconsistency: if we didn't specify --purge,
# technically we shouldn't have deleted missing files. But ... cookbooks
# are a special case.
- it 'knife upload of the cookbook itself succeeds' do
- knife('upload /cookbooks/x').should_succeed <<EOM
+ it "knife upload of the cookbook itself succeeds" do
+ knife("upload /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
- it 'knife upload --purge of the cookbook itself succeeds' do
- knife('upload /cookbooks/x').should_succeed <<EOM
+ it "knife upload --purge of the cookbook itself succeeds" do
+ knife("upload /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_repository 'has a missing file for the cookbook' do
+ when_the_repository "has a missing file for the cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0')
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
end
- it 'knife upload of the cookbook succeeds' do
- knife('upload /cookbooks/x').should_succeed <<EOM
+ it "knife upload of the cookbook succeeds" do
+ knife("upload /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_repository 'has an extra file for the cookbook' do
+ when_the_repository "has an extra file for the cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0')
- file 'cookbooks/x/z.rb', ''
- file 'cookbooks/x/blah.rb', ''
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x/z.rb", ""
+ file "cookbooks/x/blah.rb", ""
end
- it 'knife upload of the cookbook succeeds' do
- knife('upload /cookbooks/x').should_succeed <<EOM
+ it "knife upload of the cookbook succeeds" do
+ knife("upload /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_repository 'has a different file in the cookbook' do
+ when_the_repository "has a different file in the cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0')
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
end
- it 'knife upload --freeze freezes the cookbook' do
- knife('upload --freeze /cookbooks/x').should_succeed <<EOM
+ it "knife upload --freeze freezes the cookbook" do
+ knife("upload --freeze /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
# Modify a file and attempt to upload
- file 'cookbooks/x/metadata.rb', 'name "x"; version "1.0.0"#different'
- knife('upload /cookbooks/x').should_fail "ERROR: /cookbooks failed to write: Cookbook x is frozen\n"
+ file "cookbooks/x/metadata.rb", 'name "x"; version "1.0.0"#different'
+ knife("upload /cookbooks/x").should_fail "ERROR: /cookbooks failed to write: Cookbook x is frozen\n"
end
end
end
- when_the_chef_server 'has a frozen cookbook' do
+ 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
+ when_the_repository "has an update to said cookbook" do
before do
- file 'cookbooks/frozencook/metadata.rb', cb_metadata("frozencook", "1.0.0", "# This is different")
+ file "cookbooks/frozencook/metadata.rb", cb_metadata("frozencook", "1.0.0", "# This is different")
end
- it 'knife upload fails to upload the frozen cookbook' do
- knife('upload /cookbooks/frozencook').should_fail "ERROR: /cookbooks failed to write: Cookbook frozencook is frozen\n"
+ it "knife upload fails to upload the frozen cookbook" do
+ knife("upload /cookbooks/frozencook").should_fail "ERROR: /cookbooks failed to write: Cookbook frozencook is frozen\n"
end
- it 'knife upload --force uploads the frozen cookbook' do
- knife('upload --force /cookbooks/frozencook').should_succeed <<EOM
+ it "knife upload --force uploads the frozen cookbook" do
+ knife("upload --force /cookbooks/frozencook").should_succeed <<EOM
Updated /cookbooks/frozencook
EOM
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0')
- file 'cookbooks/x/onlyin1.0.0.rb', 'old_text'
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x/onlyin1.0.0.rb", "old_text"
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the local version' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the local version" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
EOM
- knife('upload --purge /cookbooks/x').should_succeed <<EOM
+ knife("upload --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
@@ -563,35 +563,35 @@ EOM
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the local version' do
- knife('upload --purge /cookbooks/x').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the local version" do
+ knife("upload --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the local version' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the local version" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
EOM
- knife('upload --purge /cookbooks/x').should_succeed <<EOM
+ knife("upload --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x/metadata.rb
D\t/cookbooks/x/onlyin1.0.1.rb
A\t/cookbooks/x/onlyin1.0.0.rb
@@ -599,31 +599,31 @@ EOM
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the new version' do
- knife('upload --purge /cookbooks/x').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the new version" do
+ knife("upload --purge /cookbooks/x").should_succeed <<EOM
Updated /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_chef_server 'has an environment' do
+ when_the_chef_server "has an environment" do
before do
- environment 'x', {}
+ environment "x", {}
end
- when_the_repository 'has an environment with bad JSON' do
+ when_the_repository "has an environment with bad JSON" do
before do
- file 'environments/x.json', '{'
+ file "environments/x.json", "{"
end
- it 'knife upload tries and fails' do
+ it "knife upload tries and fails" do
error1 = <<-EOH
WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error: premature EOF
{
@@ -640,75 +640,75 @@ WARN: Parse error reading #{path_to('environments/x.json')} as JSON: parse error
(right here) ------^
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("upload /environments/x.json").should_fail(error1)
+ knife("diff --name-status /environments/x.json").should_succeed("M\t/environments/x.json\n", :stderr => warn)
end
end
- when_the_repository 'has the same environment with the wrong name in the file' do
+ when_the_repository "has the same environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife upload fails' do
- knife('upload /environments/x.json').should_fail "ERROR: /environments/x.json failed to write: Name must be 'x' (is 'y')\n"
- knife('diff --name-status /environments/x.json').should_succeed "M\t/environments/x.json\n"
+ it "knife upload fails" do
+ knife("upload /environments/x.json").should_fail "ERROR: /environments/x.json failed to write: Name must be 'x' (is 'y')\n"
+ knife("diff --name-status /environments/x.json").should_succeed "M\t/environments/x.json\n"
end
end
- when_the_repository 'has the same environment with no name in the file' do
+ when_the_repository "has the same environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife upload succeeds' do
- knife('upload /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
end
- when_the_chef_server 'is empty' do
+ when_the_chef_server "is empty" do
- when_the_repository 'has an environment with the wrong name in the file' do
+ when_the_repository "has an environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife upload fails' do
- knife('upload /environments/x.json').should_fail "ERROR: /environments failed to create_child: Error creating 'x.json': Name must be 'x' (is 'y')\n"
- knife('diff --name-status /environments/x.json').should_succeed "A\t/environments/x.json\n"
+ it "knife upload fails" do
+ knife("upload /environments/x.json").should_fail "ERROR: /environments failed to create_child: Error creating 'x.json': Name must be 'x' (is 'y')\n"
+ knife("diff --name-status /environments/x.json").should_succeed "A\t/environments/x.json\n"
end
end
- when_the_repository 'has an environment with no name in the file' do
+ when_the_repository "has an environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife upload succeeds' do
- knife('upload /environments/x.json').should_succeed "Created /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /environments/x.json").should_succeed "Created /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
- when_the_repository 'has a data bag with no id in the file' do
+ when_the_repository "has a data bag with no id in the file" do
before do
- file 'data_bags/bag/x.json', { 'foo' => 'bar' }
+ file "data_bags/bag/x.json", { "foo" => "bar" }
end
- it 'knife upload succeeds' do
- knife('upload /data_bags/bag/x.json').should_succeed "Created /data_bags/bag\nCreated /data_bags/bag/x.json\n"
- knife('diff --name-status /data_bags/bag/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /data_bags/bag/x.json").should_succeed "Created /data_bags/bag\nCreated /data_bags/bag/x.json\n"
+ knife("diff --name-status /data_bags/bag/x.json").should_succeed ""
end
end
end
when_the_chef_server "is empty" do
- when_the_repository 'has a cookbook with an invalid chef_version constraint in it' do
+ when_the_repository "has a cookbook with an invalid chef_version constraint in it" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0', "\nchef_version '~> 999.0'")
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nchef_version '~> 999.0'")
end
- it 'knife upload succeeds' do
- knife('upload /cookbooks/x').should_succeed <<EOM
+ it "knife upload succeeds" do
+ knife("upload /cookbooks/x").should_succeed <<EOM
Created /cookbooks/x
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
@@ -718,29 +718,29 @@ EOM
when_the_chef_server "has one of each thing" do
before do
- client 'x', {}
- cookbook 'x', '1.0.0'
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- node 'x', {}
- role 'x', {}
- user 'x', {}
+ client "x", {}
+ cookbook "x", "1.0.0"
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ node "x", {}
+ role "x", {}
+ user "x", {}
end
- when_the_repository 'has only top-level directories' do
+ when_the_repository "has only top-level directories" do
before do
- directory 'clients'
- directory 'cookbooks'
- directory 'data_bags'
- directory 'environments'
- directory 'nodes'
- directory 'roles'
- directory 'users'
- end
-
- it 'knife upload does nothing' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ directory "clients"
+ directory "cookbooks"
+ directory "data_bags"
+ directory "environments"
+ directory "nodes"
+ directory "roles"
+ directory "users"
+ end
+
+ it "knife upload does nothing" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients/chef-validator.json
D\t/clients/chef-webui.json
D\t/clients/x.json
@@ -755,8 +755,8 @@ D\t/users/x.json
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")
+ 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")
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)
@@ -768,52 +768,52 @@ Deleted extra entry /roles/x.json (purge is on)
Deleted extra entry /users/admin.json (purge is on)
Deleted extra entry /users/x.json (purge is on)
EOM
- knife('diff --name-status /').should_succeed <<EOM
+ knife("diff --name-status /").should_succeed <<EOM
D\t/environments/_default.json
EOM
end
end
- when_the_repository 'has an identical copy of each thing' do
+ when_the_repository "has an identical copy of each thing" do
before do
- file 'clients/chef-validator.json', { 'validator' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/chef-webui.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', '1.0.0')
- file 'data_bags/x/y.json', {}
- file 'environments/_default.json', { 'description' => 'The default Chef environment' }
- file 'environments/x.json', {}
- file 'nodes/x.json', {}
- file 'roles/x.json', {}
- file 'users/admin.json', { 'admin' => true, 'public_key' => ChefZero::PUBLIC_KEY }
- file 'users/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/chef-validator.json", { "validator" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/chef-webui.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/_default.json", { "description" => "The default Chef environment" }
+ file "environments/x.json", {}
+ file "nodes/x.json", {}
+ file "roles/x.json", {}
+ file "users/admin.json", { "admin" => true, "public_key" => ChefZero::PUBLIC_KEY }
+ file "users/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife upload makes no changes' do
- knife('upload /cookbooks/x-1.0.0').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload makes no changes" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- it 'knife upload --purge makes no changes' do
- knife('upload --purge /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload --purge makes no changes" do
+ knife("upload --purge /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
- context 'except the role file' do
+ context "except the role file" do
before do
- file 'roles/x.json', { 'description' => 'blarghle' }
+ file "roles/x.json", { "description" => "blarghle" }
end
- it 'knife upload changes the role' do
- knife('upload /').should_succeed "Updated /roles/x.json\n"
- knife('diff --name-status /').should_succeed ''
+ it "knife upload changes the role" do
+ knife("upload /").should_succeed "Updated /roles/x.json\n"
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'except the role file is textually different, but not ACTUALLY different' do
+ context "except the role file is textually different, but not ACTUALLY different" do
before do
- file 'roles/x.json', <<EOM
+ file "roles/x.json", <<EOM
{
"chef_type": "role",
"default_attributes": {
@@ -832,28 +832,28 @@ EOM
EOM
end
- it 'knife upload / does not change anything' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed ''
+ it "knife upload / does not change anything" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed ""
end
end
- context 'as well as one extra copy of each thing' do
+ context "as well as one extra copy of each thing" do
before do
- file 'clients/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'cookbooks/x-1.0.0/blah.rb', ''
- file 'cookbooks/x-2.0.0/metadata.rb', cb_metadata('x', '2.0.0')
- file 'cookbooks/y-1.0.0/metadata.rb', cb_metadata('y', '1.0.0')
- file 'data_bags/x/z.json', {}
- file 'data_bags/y/zz.json', {}
- file 'environments/y.json', {}
- file 'nodes/y.json', {}
- file 'roles/y.json', {}
- file 'users/y.json', { 'public_key' => ChefZero::PUBLIC_KEY }
+ file "clients/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "cookbooks/x-1.0.0/blah.rb", ""
+ file "cookbooks/x-2.0.0/metadata.rb", cb_metadata("x", "2.0.0")
+ file "cookbooks/y-1.0.0/metadata.rb", cb_metadata("y", "1.0.0")
+ file "data_bags/x/z.json", {}
+ file "data_bags/y/zz.json", {}
+ file "environments/y.json", {}
+ file "nodes/y.json", {}
+ file "roles/y.json", {}
+ file "users/y.json", { "public_key" => ChefZero::PUBLIC_KEY }
end
- it 'knife upload adds the new files' do
- knife('upload /').should_succeed <<EOM
+ it "knife upload adds the new files" do
+ knife("upload /").should_succeed <<EOM
Created /clients/y.json
Updated /cookbooks/x-1.0.0
Created /cookbooks/x-2.0.0
@@ -866,15 +866,15 @@ Created /nodes/y.json
Created /roles/y.json
Created /users/y.json
EOM
- knife('diff --name-status /').should_succeed ''
+ knife("diff --name-status /").should_succeed ""
end
end
end
- when_the_repository 'is empty' do
- it 'knife upload does nothing' do
- knife('upload /').should_succeed ''
- knife('diff --name-status /').should_succeed <<EOM
+ when_the_repository "is empty" do
+ it "knife upload does nothing" do
+ knife("upload /").should_succeed ""
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -885,8 +885,8 @@ D\t/users
EOM
end
- it 'knife upload --purge deletes nothing' do
- knife('upload --purge /').should_fail <<EOM
+ it "knife upload --purge deletes nothing" do
+ knife("upload --purge /").should_fail <<EOM
ERROR: /clients cannot be deleted.
ERROR: /cookbooks cannot be deleted.
ERROR: /data_bags cannot be deleted.
@@ -895,7 +895,7 @@ ERROR: /nodes cannot be deleted.
ERROR: /roles cannot be deleted.
ERROR: /users cannot be deleted.
EOM
- knife('diff --name-status /').should_succeed <<EOM
+ knife("diff --name-status /").should_succeed <<EOM
D\t/clients
D\t/cookbooks
D\t/data_bags
@@ -906,130 +906,130 @@ D\t/users
EOM
end
- context 'when current directory is top level' do
+ context "when current directory is top level" do
before do
- cwd '.'
+ cwd "."
end
- it 'knife upload with no parameters reports an error' do
- knife('upload').should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
+ it "knife upload with no parameters reports an error" do
+ knife("upload").should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
end
end
end
end
# Test upload of an item when the other end doesn't even have the container
- when_the_chef_server 'is empty' do
- when_the_repository 'has two data bag items' do
+ when_the_chef_server "is empty" do
+ when_the_repository "has two data bag items" do
before do
- file 'data_bags/x/y.json', {}
- file 'data_bags/x/z.json', {}
+ file "data_bags/x/y.json", {}
+ file "data_bags/x/z.json", {}
end
- it 'knife upload of one data bag item itself succeeds' do
- knife('upload /data_bags/x/y.json').should_succeed <<EOM
+ it "knife upload of one data bag item itself succeeds" do
+ knife("upload /data_bags/x/y.json").should_succeed <<EOM
Created /data_bags/x
Created /data_bags/x/y.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
A\t/data_bags/x/z.json
EOM
end
end
end
- when_the_chef_server 'has three data bag items' do
+ when_the_chef_server "has three data bag items" do
before do
- data_bag 'x', { 'deleted' => {}, 'modified' => {}, 'unmodified' => {} }
+ data_bag "x", { "deleted" => {}, "modified" => {}, "unmodified" => {} }
end
- when_the_repository 'has a modified, unmodified, added and deleted data bag item' do
+ when_the_repository "has a modified, unmodified, added and deleted data bag item" do
before do
- file 'data_bags/x/added.json', {}
- file 'data_bags/x/modified.json', { 'foo' => 'bar' }
- file 'data_bags/x/unmodified.json', {}
+ file "data_bags/x/added.json", {}
+ file "data_bags/x/modified.json", { "foo" => "bar" }
+ file "data_bags/x/unmodified.json", {}
end
- it 'knife upload of the modified file succeeds' do
- knife('upload /data_bags/x/modified.json').should_succeed <<EOM
+ it "knife upload of the modified file succeeds" do
+ knife("upload /data_bags/x/modified.json").should_succeed <<EOM
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the unmodified file does nothing' do
- knife('upload /data_bags/x/unmodified.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife upload of the unmodified file does nothing" do
+ knife("upload /data_bags/x/unmodified.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the added file succeeds' do
- knife('upload /data_bags/x/added.json').should_succeed <<EOM
+ it "knife upload of the added file succeeds" do
+ knife("upload /data_bags/x/added.json").should_succeed <<EOM
Created /data_bags/x/added.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
EOM
end
- it 'knife upload of the deleted file does nothing' do
- knife('upload /data_bags/x/deleted.json').should_succeed ''
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ it "knife upload of the deleted file does nothing" do
+ knife("upload /data_bags/x/deleted.json").should_succeed ""
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload --purge of the deleted file deletes it' do
- knife('upload --purge /data_bags/x/deleted.json').should_succeed <<EOM
+ it "knife upload --purge of the deleted file deletes it" do
+ knife("upload --purge /data_bags/x/deleted.json").should_succeed <<EOM
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
M\t/data_bags/x/modified.json
A\t/data_bags/x/added.json
EOM
end
- it 'knife upload of the entire data bag uploads everything' do
- knife('upload /data_bags/x').should_succeed <<EOM
+ it "knife upload of the entire data bag uploads everything" do
+ knife("upload /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
EOM
- knife('diff --name-status /data_bags').should_succeed <<EOM
+ knife("diff --name-status /data_bags").should_succeed <<EOM
D\t/data_bags/x/deleted.json
EOM
end
- it 'knife upload --purge of the entire data bag uploads everything' do
- knife('upload --purge /data_bags/x').should_succeed <<EOM
+ it "knife upload --purge of the entire data bag uploads everything" do
+ knife("upload --purge /data_bags/x").should_succeed <<EOM
Created /data_bags/x/added.json
Updated /data_bags/x/modified.json
Deleted extra entry /data_bags/x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- context 'when cwd is the /data_bags directory' do
+ context "when cwd is the /data_bags directory" do
before do
- cwd 'data_bags'
+ cwd "data_bags"
end
- it 'knife upload fails' do
- knife('upload').should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
+ it "knife upload fails" do
+ knife("upload").should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
end
- it 'knife upload --purge . uploads everything' do
- knife('upload --purge .').should_succeed <<EOM
+ it "knife upload --purge . uploads everything" do
+ knife("upload --purge .").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
- it 'knife upload --purge * uploads everything' do
- knife('upload --purge *').should_succeed <<EOM
+ it "knife upload --purge * uploads everything" do
+ knife("upload --purge *").should_succeed <<EOM
Created x/added.json
Updated x/modified.json
Deleted extra entry x/deleted.json (purge is on)
EOM
- knife('diff --name-status /data_bags').should_succeed ''
+ knife("diff --name-status /data_bags").should_succeed ""
end
end
end
@@ -1038,271 +1038,271 @@ EOM
# Cookbook upload is a funny thing ... direct cookbook upload works, but
# upload of a file is designed not to work at present. Make sure that is the
# case.
- when_the_chef_server 'has a cookbook' do
+ when_the_chef_server "has a cookbook" do
before do
- cookbook 'x', '1.0.0', { 'z.rb' => '' }
+ cookbook "x", "1.0.0", { "z.rb" => "" }
end
- when_the_repository 'has a modified, extra and missing file for the cookbook' do
+ when_the_repository "has a modified, extra and missing file for the cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', '1.0.0', '#modified')
- file 'cookbooks/x-1.0.0/y.rb', 'hi'
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0", '#modified')
+ file "cookbooks/x-1.0.0/y.rb", "hi"
end
- it 'knife upload of any individual file fails' do
- knife('upload /cookbooks/x-1.0.0/metadata.rb').should_fail "ERROR: /cookbooks/x-1.0.0/metadata.rb cannot be updated.\n"
- knife('upload /cookbooks/x-1.0.0/y.rb').should_fail "ERROR: /cookbooks/x-1.0.0 cannot have a child created under it.\n"
- knife('upload --purge /cookbooks/x-1.0.0/z.rb').should_fail "ERROR: /cookbooks/x-1.0.0/z.rb cannot be deleted.\n"
+ it "knife upload of any individual file fails" do
+ knife("upload /cookbooks/x-1.0.0/metadata.rb").should_fail "ERROR: /cookbooks/x-1.0.0/metadata.rb cannot be updated.\n"
+ knife("upload /cookbooks/x-1.0.0/y.rb").should_fail "ERROR: /cookbooks/x-1.0.0 cannot have a child created under it.\n"
+ knife("upload --purge /cookbooks/x-1.0.0/z.rb").should_fail "ERROR: /cookbooks/x-1.0.0/z.rb cannot be deleted.\n"
end
# TODO this is a bit of an inconsistency: if we didn't specify --purge,
# technically we shouldn't have deleted missing files. But ... cookbooks
# are a special case.
- it 'knife upload of the cookbook itself succeeds' do
- knife('upload /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife upload of the cookbook itself succeeds" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
- it 'knife upload --purge of the cookbook itself succeeds' do
- knife('upload /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife upload --purge of the cookbook itself succeeds" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_repository 'has a missing file for the cookbook' do
+ when_the_repository "has a missing file for the cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', "1.0.0")
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
end
- it 'knife upload of the cookbook succeeds' do
- knife('upload /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife upload of the cookbook succeeds" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_repository 'has an extra file for the cookbook' do
+ when_the_repository "has an extra file for the cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', '1.0.0')
- file 'cookbooks/x-1.0.0/z.rb', ''
- file 'cookbooks/x-1.0.0/blah.rb', ''
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x-1.0.0/z.rb", ""
+ file "cookbooks/x-1.0.0/blah.rb", ""
end
- it 'knife upload of the cookbook succeeds' do
- knife('upload /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife upload of the cookbook succeeds" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_repository 'has a cookbook' do
+ when_the_repository "has a cookbook" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', '1.0.0')
- file 'cookbooks/x-1.0.0/onlyin1.0.0.rb', 'old_text'
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0")
+ file "cookbooks/x-1.0.0/onlyin1.0.0.rb", "old_text"
end
- when_the_chef_server 'has a later version for the cookbook' do
+ when_the_chef_server "has a later version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => '' }
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => "" }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife upload /cookbooks uploads the local version' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks uploads the local version" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
M\t/cookbooks/x-1.0.0/onlyin1.0.0.rb
D\t/cookbooks/x-1.0.1
EOM
- knife('upload --purge /cookbooks').should_succeed <<EOM
+ knife("upload --purge /cookbooks").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
Deleted extra entry /cookbooks/x-1.0.1 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook' do
+ when_the_chef_server "has an earlier version for the cookbook" do
before do
- cookbook 'x', '1.0.0', { 'onlyin1.0.0.rb' => ''}
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "1.0.0", { "onlyin1.0.0.rb" => ""}
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife upload /cookbooks uploads the local version' do
- knife('upload --purge /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks uploads the local version" do
+ knife("upload --purge /cookbooks").should_succeed <<EOM
Updated /cookbooks/x-1.0.0
Deleted extra entry /cookbooks/x-0.9.9 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has a later version for the cookbook, and no current version' do
+ when_the_chef_server "has a later version for the cookbook, and no current version" do
before do
- cookbook 'x', '1.0.1', { 'onlyin1.0.1.rb' => 'hi' }
+ cookbook "x", "1.0.1", { "onlyin1.0.1.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the local version' do
- knife('diff --name-status /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the local version" do
+ knife("diff --name-status /cookbooks").should_succeed <<EOM
D\t/cookbooks/x-1.0.1
A\t/cookbooks/x-1.0.0
EOM
- knife('upload --purge /cookbooks').should_succeed <<EOM
+ knife("upload --purge /cookbooks").should_succeed <<EOM
Created /cookbooks/x-1.0.0
Deleted extra entry /cookbooks/x-1.0.1 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
- when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
+ when_the_chef_server "has an earlier version for the cookbook, and no current version" do
before do
- cookbook 'x', '0.9.9', { 'onlyin0.9.9.rb' => 'hi' }
+ cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" }
end
- it 'knife upload /cookbooks/x uploads the new version' do
- knife('upload --purge /cookbooks').should_succeed <<EOM
+ it "knife upload /cookbooks/x uploads the new version" do
+ knife("upload --purge /cookbooks").should_succeed <<EOM
Created /cookbooks/x-1.0.0
Deleted extra entry /cookbooks/x-0.9.9 (purge is on)
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
- when_the_chef_server 'has an environment' do
+ when_the_chef_server "has an environment" do
before do
- environment 'x', {}
+ environment "x", {}
end
- when_the_repository 'has the same environment with the wrong name in the file' do
+ when_the_repository "has the same environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife upload fails' do
- knife('upload /environments/x.json').should_fail "ERROR: /environments/x.json failed to write: Name must be 'x' (is 'y')\n"
- knife('diff --name-status /environments/x.json').should_succeed "M\t/environments/x.json\n"
+ it "knife upload fails" do
+ knife("upload /environments/x.json").should_fail "ERROR: /environments/x.json failed to write: Name must be 'x' (is 'y')\n"
+ knife("diff --name-status /environments/x.json").should_succeed "M\t/environments/x.json\n"
end
end
- when_the_repository 'has the same environment with no name in the file' do
+ when_the_repository "has the same environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife upload succeeds' do
- knife('upload /environments/x.json').should_succeed "Updated /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /environments/x.json").should_succeed "Updated /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
end
- when_the_chef_server 'is empty' do
+ when_the_chef_server "is empty" do
- when_the_repository 'has an environment with the wrong name in the file' do
+ when_the_repository "has an environment with the wrong name in the file" do
before do
- file 'environments/x.json', { 'name' => 'y' }
+ file "environments/x.json", { "name" => "y" }
end
- it 'knife upload fails' do
- knife('upload /environments/x.json').should_fail "ERROR: /environments failed to create_child: Error creating 'x.json': Name must be 'x' (is 'y')\n"
- knife('diff --name-status /environments/x.json').should_succeed "A\t/environments/x.json\n"
+ it "knife upload fails" do
+ knife("upload /environments/x.json").should_fail "ERROR: /environments failed to create_child: Error creating 'x.json': Name must be 'x' (is 'y')\n"
+ knife("diff --name-status /environments/x.json").should_succeed "A\t/environments/x.json\n"
end
end
- when_the_repository 'has an environment with no name in the file' do
+ when_the_repository "has an environment with no name in the file" do
before do
- file 'environments/x.json', { 'description' => 'hi' }
+ file "environments/x.json", { "description" => "hi" }
end
- it 'knife upload succeeds' do
- knife('upload /environments/x.json').should_succeed "Created /environments/x.json\n"
- knife('diff --name-status /environments/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /environments/x.json").should_succeed "Created /environments/x.json\n"
+ knife("diff --name-status /environments/x.json").should_succeed ""
end
end
- when_the_repository 'has a data bag with no id in the file' do
+ when_the_repository "has a data bag with no id in the file" do
before do
- file 'data_bags/bag/x.json', { 'foo' => 'bar' }
+ file "data_bags/bag/x.json", { "foo" => "bar" }
end
- it 'knife upload succeeds' do
- knife('upload /data_bags/bag/x.json').should_succeed "Created /data_bags/bag\nCreated /data_bags/bag/x.json\n"
- knife('diff --name-status /data_bags/bag/x.json').should_succeed ''
+ it "knife upload succeeds" do
+ knife("upload /data_bags/bag/x.json").should_succeed "Created /data_bags/bag\nCreated /data_bags/bag/x.json\n"
+ knife("diff --name-status /data_bags/bag/x.json").should_succeed ""
end
end
end
when_the_chef_server "is empty" do
- when_the_repository 'has a cookbook with an invalid chef_version constraint in it' do
+ when_the_repository "has a cookbook with an invalid chef_version constraint in it" do
before do
- file 'cookbooks/x-1.0.0/metadata.rb', cb_metadata('x', '1.0.0', "\nchef_version '~> 999.0'")
+ file "cookbooks/x-1.0.0/metadata.rb", cb_metadata("x", "1.0.0", "\nchef_version '~> 999.0'")
end
- it 'knife upload succeeds' do
- knife('upload /cookbooks/x-1.0.0').should_succeed <<EOM
+ it "knife upload succeeds" do
+ knife("upload /cookbooks/x-1.0.0").should_succeed <<EOM
Created /cookbooks/x-1.0.0
EOM
- knife('diff --name-status /cookbooks').should_succeed ''
+ knife("diff --name-status /cookbooks").should_succeed ""
end
end
end
end # with versioned cookbooks
- when_the_chef_server 'has a user' do
+ when_the_chef_server "has a user" do
before do
- user 'x', {}
+ user "x", {}
end
- when_the_repository 'has the same user with json_class in it' do
+ when_the_repository "has the same user with json_class in it" do
before do
- file 'users/x.json', { 'admin' => true, 'json_class' => 'Chef::WebUIUser' }
+ file "users/x.json", { "admin" => true, "json_class" => "Chef::WebUIUser" }
end
- it 'knife upload /users/x.json succeeds' do
- knife('upload /users/x.json').should_succeed "Updated /users/x.json\n"
+ it "knife upload /users/x.json succeeds" do
+ knife("upload /users/x.json").should_succeed "Updated /users/x.json\n"
end
end
end
when_the_chef_server "is in Enterprise mode", :osc_compat => false, :single_org => false do
before do
- user 'foo', {}
- user 'bar', {}
- user 'foobar', {}
- organization 'foo', { 'full_name' => 'Something' }
+ user "foo", {}
+ user "bar", {}
+ user "foobar", {}
+ organization "foo", { "full_name" => "Something" }
end
before :each do
- Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, '/organizations/foo')
+ Chef::Config.chef_server_url = URI.join(Chef::Config.chef_server_url, "/organizations/foo")
end
- context 'and has nothing but a single group named blah' do
- group 'blah', {}
+ context "and has nothing but a single group named blah" do
+ group "blah", {}
- when_the_repository 'has at least one of each thing' do
+ when_the_repository "has at least one of each thing" do
before do
# TODO We have to upload acls for an existing group due to a lack of
# dependency detection during upload. Fix that!
- file 'acls/groups/blah.json', {}
- file 'clients/x.json', { 'public_key' => ChefZero::PUBLIC_KEY }
- file 'containers/x.json', {}
- file 'cookbooks/x/metadata.rb', cb_metadata("x", "1.0.0")
- file 'data_bags/x/y.json', {}
- file 'environments/x.json', {}
- file 'groups/x.json', {}
- file 'invitations.json', [ 'foo' ]
- file 'members.json', [ 'bar' ]
- file 'org.json', { 'full_name' => 'wootles' }
- file 'nodes/x.json', {}
- file 'policies/x-1.0.0.json', { }
- file 'policies/blah-1.0.0.json', { }
- file 'policy_groups/x.json', { 'policies' => { 'x' => { 'revision_id' => '1.0.0' }, 'blah' => { 'revision_id' => '1.0.0' } } }
- file 'roles/x.json', {}
- end
-
- it 'knife upload / uploads everything' do
- knife('upload /').should_succeed <<EOM
+ file "acls/groups/blah.json", {}
+ file "clients/x.json", { "public_key" => ChefZero::PUBLIC_KEY }
+ file "containers/x.json", {}
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0")
+ file "data_bags/x/y.json", {}
+ file "environments/x.json", {}
+ file "groups/x.json", {}
+ file "invitations.json", [ "foo" ]
+ file "members.json", [ "bar" ]
+ file "org.json", { "full_name" => "wootles" }
+ file "nodes/x.json", {}
+ file "policies/x-1.0.0.json", { }
+ file "policies/blah-1.0.0.json", { }
+ file "policy_groups/x.json", { "policies" => { "x" => { "revision_id" => "1.0.0" }, "blah" => { "revision_id" => "1.0.0" } } }
+ file "roles/x.json", {}
+ end
+
+ it "knife upload / uploads everything" do
+ knife("upload /").should_succeed <<EOM
Updated /acls/groups/blah.json
Created /clients/x.json
Created /containers/x.json
@@ -1320,39 +1320,39 @@ Created /policies/x-1.0.0.json
Created /policy_groups/x.json
Created /roles/x.json
EOM
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'foo' ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar' ])
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ "foo" ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar" ])
end
context "When the chef server has an identical copy of each thing" do
before do
- file 'invitations.json', [ 'foo' ]
- file 'members.json', [ 'bar' ]
- file 'org.json', { 'full_name' => 'Something' }
+ file "invitations.json", [ "foo" ]
+ file "members.json", [ "bar" ]
+ file "org.json", { "full_name" => "Something" }
# acl_for %w(organizations foo groups blah)
- client 'x', {}
- cookbook 'x', '1.0.0'
- container 'x', {}
- data_bag 'x', { 'y' => {} }
- environment 'x', {}
- group 'x', {}
- org_invite 'foo'
- org_member 'bar'
- node 'x', {}
- policy 'x', '1.0.0', {}
- policy 'blah', '1.0.0', {}
- policy_group 'x', {
- 'policies' => {
- 'x' => { 'revision_id' => '1.0.0' },
- 'blah' => { 'revision_id' => '1.0.0' },
+ client "x", {}
+ cookbook "x", "1.0.0"
+ container "x", {}
+ data_bag "x", { "y" => {} }
+ environment "x", {}
+ group "x", {}
+ org_invite "foo"
+ org_member "bar"
+ node "x", {}
+ policy "x", "1.0.0", {}
+ policy "blah", "1.0.0", {}
+ policy_group "x", {
+ "policies" => {
+ "x" => { "revision_id" => "1.0.0" },
+ "blah" => { "revision_id" => "1.0.0" },
}
}
- role 'x', {}
+ role "x", {}
end
- it 'knife upload makes no changes' do
- knife('upload /').should_succeed <<EOM
+ it "knife upload makes no changes" do
+ knife("upload /").should_succeed <<EOM
Updated /acls/groups/blah.json
EOM
end
@@ -1360,7 +1360,7 @@ EOM
context "When the chef server has a slightly different copy of the policy revision" do
before do
- policy 'x', '1.0.0', { 'run_list' => [ 'blah' ] }
+ policy "x", "1.0.0", { "run_list" => [ "blah" ] }
end
it "should fail because policies are not updateable" do
@@ -1373,27 +1373,27 @@ EOM
context "When the chef server has a slightly different copy of each thing (except policy revisions)" do
before do
# acl_for %w(organizations foo groups blah)
- client 'x', { 'validator' => true }
- container 'x', {}
- cookbook 'x', '1.0.0', { 'recipes' => { 'default.rb' => '' } }
- data_bag 'x', { 'y' => { 'a' => 'b' } }
- environment 'x', { 'description' => 'foo' }
- group 'x', { 'groups' => [ 'admin' ] }
- node 'x', { 'run_list' => [ 'blah' ] }
- policy 'x', '1.0.0', { }
- policy 'x', '1.0.1', { }
- policy 'y', '1.0.0', { }
- policy_group 'x', {
- 'policies' => {
- 'x' => { 'revision_id' => '1.0.1' },
- 'y' => { 'revision_id' => '1.0.0' },
+ client "x", { "validator" => true }
+ container "x", {}
+ cookbook "x", "1.0.0", { "recipes" => { "default.rb" => "" } }
+ data_bag "x", { "y" => { "a" => "b" } }
+ environment "x", { "description" => "foo" }
+ group "x", { "groups" => [ "admin" ] }
+ node "x", { "run_list" => [ "blah" ] }
+ policy "x", "1.0.0", { }
+ policy "x", "1.0.1", { }
+ policy "y", "1.0.0", { }
+ policy_group "x", {
+ "policies" => {
+ "x" => { "revision_id" => "1.0.1" },
+ "y" => { "revision_id" => "1.0.0" },
}
}
- role 'x', { 'run_list' => [ 'blah' ] }
+ role "x", { "run_list" => [ "blah" ] }
end
- it 'knife upload updates everything' do
- knife('upload /').should_succeed <<EOM
+ it "knife upload updates everything" do
+ knife("upload /").should_succeed <<EOM
Updated /acls/groups/blah.json
Updated /clients/x.json
Updated /cookbooks/x
@@ -1408,103 +1408,103 @@ Created /policies/blah-1.0.0.json
Updated /policy_groups/x.json
Updated /roles/x.json
EOM
- knife('diff --name-status --diff-filter=AMT /').should_succeed ''
+ knife("diff --name-status --diff-filter=AMT /").should_succeed ""
end
end
end
- when_the_repository 'has an org.json that does not change full_name' do
+ when_the_repository "has an org.json that does not change full_name" do
before do
- file 'org.json', { 'full_name' => 'Something' }
+ file "org.json", { "full_name" => "Something" }
end
- it 'knife upload / emits a warning for bar and adds foo and foobar' do
- knife('upload /').should_succeed ''
- expect(api.get('/')['full_name']).to eq('Something')
+ it "knife upload / emits a warning for bar and adds foo and foobar" do
+ knife("upload /").should_succeed ""
+ expect(api.get("/")["full_name"]).to eq("Something")
end
end
- when_the_repository 'has an org.json that changes full_name' do
+ when_the_repository "has an org.json that changes full_name" do
before do
- file 'org.json', { 'full_name' => 'Something Else'}
+ file "org.json", { "full_name" => "Something Else"}
end
- it 'knife upload / emits a warning for bar and adds foo and foobar' do
- knife('upload /').should_succeed "Updated /org.json\n"
- expect(api.get('/')['full_name']).to eq('Something Else')
+ it "knife upload / emits a warning for bar and adds foo and foobar" do
+ knife("upload /").should_succeed "Updated /org.json\n"
+ expect(api.get("/")["full_name"]).to eq("Something Else")
end
end
- context 'and has invited foo and bar is already a member' do
- org_invite 'foo'
- org_member 'bar'
+ context "and has invited foo and bar is already a member" do
+ org_invite "foo"
+ org_member "bar"
- when_the_repository 'wants to invite foo, bar and foobar' do
+ when_the_repository "wants to invite foo, bar and foobar" do
before do
- file 'invitations.json', [ 'foo', 'bar', 'foobar' ]
+ file "invitations.json", [ "foo", "bar", "foobar" ]
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"
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'foo', 'foobar' ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar' ])
+ 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"
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ "foo", "foobar" ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar" ])
end
end
- when_the_repository 'wants to make foo, bar and foobar members' do
+ when_the_repository "wants to make foo, bar and foobar members" do
before do
- file 'members.json', [ 'foo', 'bar', 'foobar' ]
+ file "members.json", [ "foo", "bar", "foobar" ]
end
- it 'knife upload / emits a warning for bar and adds foo and foobar' do
- knife('upload /').should_succeed "Updated /members.json\n"
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar', 'foo', 'foobar' ])
+ it "knife upload / emits a warning for bar and adds foo and foobar" do
+ knife("upload /").should_succeed "Updated /members.json\n"
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar", "foo", "foobar" ])
end
end
- when_the_repository 'wants to invite foo and have bar as a member' do
+ when_the_repository "wants to invite foo and have bar as a member" do
before do
- file 'invitations.json', [ 'foo' ]
- file 'members.json', [ 'bar' ]
+ file "invitations.json", [ "foo" ]
+ file "members.json", [ "bar" ]
end
- it 'knife upload / does nothing' do
- knife('upload /').should_succeed ''
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'foo' ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar' ])
+ it "knife upload / does nothing" do
+ knife("upload /").should_succeed ""
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ "foo" ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar" ])
end
end
end
- context 'and has invited bar and foo' do
- org_invite 'bar', 'foo'
+ context "and has invited bar and foo" do
+ org_invite "bar", "foo"
- when_the_repository 'wants to invite foo and bar (different order)' do
+ when_the_repository "wants to invite foo and bar (different order)" do
before do
- file 'invitations.json', [ 'foo', 'bar' ]
+ file "invitations.json", [ "foo", "bar" ]
end
- it 'knife upload / does nothing' do
- knife('upload /').should_succeed ''
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ 'bar', 'foo' ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ ])
+ it "knife upload / does nothing" do
+ knife("upload /").should_succeed ""
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ "bar", "foo" ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ ])
end
end
end
- context 'and has already added bar and foo as members of the org' do
- org_member 'bar', 'foo'
+ context "and has already added bar and foo as members of the org" do
+ org_member "bar", "foo"
- when_the_repository 'wants to add foo and bar (different order)' do
+ when_the_repository "wants to add foo and bar (different order)" do
before do
- file 'members.json', [ 'foo', 'bar' ]
+ file "members.json", [ "foo", "bar" ]
end
- it 'knife upload / does nothing' do
- knife('upload /').should_succeed ''
- expect(api.get('association_requests').map { |a| a['username'] }).to eq([ ])
- expect(api.get('users').map { |a| a['user']['username'] }).to eq([ 'bar', 'foo' ])
+ it "knife upload / does nothing" do
+ knife("upload /").should_succeed ""
+ expect(api.get("association_requests").map { |a| a["username"] }).to eq([ ])
+ expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar", "foo" ])
end
end
end
diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb
index bd5eaf66a4..dc7e19a3cb 100644
--- a/spec/integration/recipes/lwrp_inline_resources_spec.rb
+++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb
@@ -1,5 +1,5 @@
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
describe "LWRPs with inline resources" do
include IntegrationSupport
@@ -29,7 +29,7 @@ describe "LWRPs with inline resources" do
use_inline_resources
def action_a
r = new_resource
- ruby_block 'run a' do
+ ruby_block "run a" do
block { r.ran_a "ran a" }
end
end
@@ -39,8 +39,8 @@ describe "LWRPs with inline resources" do
it "this is totally a bug, but for backcompat purposes, it adds the resources to the main resource collection and does not get marked updated" do
r = nil
expect_recipe {
- r = lwrp_inline_resources_test 'hi'
- }.to have_updated('ruby_block[run a]', :run)
+ r = lwrp_inline_resources_test "hi"
+ }.to have_updated("ruby_block[run a]", :run)
expect(r.ran_a).to eq "ran a"
end
end
@@ -58,7 +58,7 @@ describe "LWRPs with inline resources" do
action :a do
r = new_resource
- ruby_block 'run a' do
+ ruby_block "run a" do
block { r.ran_a "ran a" }
end
end
@@ -68,7 +68,7 @@ describe "LWRPs with inline resources" do
r = new_resource
# Grab ran_a right now, before we converge
ran_a = r.ran_a
- ruby_block 'run b' do
+ ruby_block "run b" do
block { r.ran_b "ran b: ran_a value was #{ran_a.inspect}" }
end
end
@@ -78,34 +78,34 @@ describe "LWRPs with inline resources" do
it "resources declared in b are executed immediately inline" do
r = nil
expect_recipe {
- r = lwrp_inline_resources_test2 'hi' do
+ r = lwrp_inline_resources_test2 "hi" do
action :b
end
- }.to have_updated('lwrp_inline_resources_test2[hi]', :b).
- and have_updated('ruby_block[run a]', :run).
- and have_updated('ruby_block[run b]', :run)
+ }.to have_updated("lwrp_inline_resources_test2[hi]", :b).
+ and have_updated("ruby_block[run a]", :run).
+ and have_updated("ruby_block[run b]", :run)
expect(r.ran_b).to eq "ran b: ran_a value was \"ran a\""
end
end
when_the_repository "has a cookbook with a nested LWRP" do
before do
- directory 'cookbooks/x' do
+ directory "cookbooks/x" do
- file 'resources/do_nothing.rb', <<-EOM
+ file "resources/do_nothing.rb", <<-EOM
actions :create, :nothing
default_action :create
EOM
- file 'providers/do_nothing.rb', <<-EOM
+ file "providers/do_nothing.rb", <<-EOM
action :create do
end
EOM
- file 'resources/my_machine.rb', <<-EOM
+ file "resources/my_machine.rb", <<-EOM
actions :create, :nothing
default_action :create
EOM
- file 'providers/my_machine.rb', <<-EOM
+ file "providers/my_machine.rb", <<-EOM
use_inline_resources
action :create do
x_do_nothing 'a'
@@ -113,7 +113,7 @@ describe "LWRPs with inline resources" do
end
EOM
- file 'recipes/default.rb', <<-EOM
+ file "recipes/default.rb", <<-EOM
x_my_machine "me"
x_my_machine "you"
EOM
@@ -122,7 +122,7 @@ describe "LWRPs with inline resources" do
end
it "should complete with success" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
log_level :warn
diff --git a/spec/integration/recipes/lwrp_spec.rb b/spec/integration/recipes/lwrp_spec.rb
index 7ecdfc7c3a..3bc008d4f8 100644
--- a/spec/integration/recipes/lwrp_spec.rb
+++ b/spec/integration/recipes/lwrp_spec.rb
@@ -1,5 +1,5 @@
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
describe "LWRPs" do
include IntegrationSupport
@@ -20,17 +20,17 @@ describe "LWRPs" do
when_the_repository "has a cookbook named l-w-r-p" do
before do
- directory 'cookbooks/l-w-r-p' do
+ directory "cookbooks/l-w-r-p" do
- file 'resources/foo.rb', <<EOM
+ file "resources/foo.rb", <<EOM
default_action :create
EOM
- file 'providers/foo.rb', <<EOM
+ file "providers/foo.rb", <<EOM
action :create do
end
EOM
- file 'recipes/default.rb', <<EOM
+ file "recipes/default.rb", <<EOM
l_w_r_p_foo "me"
EOM
@@ -38,7 +38,7 @@ EOM
end
it "should complete with success" do
- file 'config/client.rb', <<EOM
+ file "config/client.rb", <<EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
log_level :warn
diff --git a/spec/integration/recipes/provider_choice.rb b/spec/integration/recipes/provider_choice.rb
index 01537b2c05..d08090bbe8 100644
--- a/spec/integration/recipes/provider_choice.rb
+++ b/spec/integration/recipes/provider_choice.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe "Recipe DSL methods" do
include IntegrationSupport
@@ -26,7 +26,7 @@ describe "Recipe DSL methods" do
it "provider_thingy 'blah' runs the provider and warns" do
recipe = converge {
- provider_thingy 'blah' do; end
+ provider_thingy "blah" do; end
}
expect(recipe.logged_warnings).to match /hello from Chef::Provider::ProviderThingy/
expect(recipe.logged_warnings).to match /you must use 'provides' to provide DSL/i
diff --git a/spec/integration/recipes/recipe_dsl_spec.rb b/spec/integration/recipes/recipe_dsl_spec.rb
index 52bca87c99..db4d158eec 100644
--- a/spec/integration/recipes/recipe_dsl_spec.rb
+++ b/spec/integration/recipes/recipe_dsl_spec.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe "Recipe DSL methods" do
include IntegrationSupport
@@ -15,7 +15,7 @@ describe "Recipe DSL methods" do
before(:context) {
class BaseThingy < Chef::Resource
- resource_name 'base_thingy'
+ resource_name "base_thingy"
default_action :create
class<<self
@@ -51,27 +51,27 @@ describe "Recipe DSL methods" do
it "creates base_thingy when you call base_thingy in a recipe" do
recipe = converge {
- base_thingy 'blah' do; end
+ base_thingy "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
- expect(BaseThingy.created_name).to eq 'blah'
+ expect(recipe.logged_warnings).to eq ""
+ expect(BaseThingy.created_name).to eq "blah"
expect(BaseThingy.created_resource).to eq BaseThingy
end
it "errors out when you call base_thingy do ... end in a recipe" do
expect_converge {
base_thingy do; end
- }.to raise_error(ArgumentError, 'You must supply a name when declaring a base_thingy resource')
+ }.to raise_error(ArgumentError, "You must supply a name when declaring a base_thingy resource")
end
it "emits a warning when you call base_thingy 'foo', 'bar' do ... end in a recipe" do
Chef::Config[:treat_deprecation_warnings_as_errors] = false
recipe = converge {
- base_thingy 'foo', 'bar' do
+ base_thingy "foo", "bar" do
end
}
expect(recipe.logged_warnings).to match(/Cannot create resource base_thingy with more than one argument. All arguments except the name \("foo"\) will be ignored. This will cause an error in Chef 13. Arguments: \["foo", "bar"\]/)
- expect(BaseThingy.created_name).to eq 'foo'
+ expect(BaseThingy.created_name).to eq "foo"
expect(BaseThingy.created_resource).to eq BaseThingy
end
@@ -99,7 +99,7 @@ describe "Recipe DSL methods" do
it "backcompat_thingy creates a Chef::Resource::BackcompatThingy" do
recipe = converge {
- backcompat_thingy 'blah' do; end
+ backcompat_thingy "blah" do; end
}
expect(BaseThingy.created_resource).to eq Chef::Resource::BackcompatThingy
expect(BaseThingy.created_provider).to eq Chef::Provider::BackcompatThingy
@@ -117,7 +117,7 @@ describe "Recipe DSL methods" do
it "backcompat_thingy creates a BackcompatThingy" do
recipe = converge {
- backcompat_thingy 'blah' do; end
+ backcompat_thingy "blah" do; end
}
expect(recipe.logged_warnings).to match(/Class Chef::Provider::BackcompatThingy does not declare 'provides :backcompat_thingy'./)
expect(BaseThingy.created_resource).not_to be_nil
@@ -135,7 +135,7 @@ describe "Recipe DSL methods" do
it "bar_thingy does not work" do
expect_converge {
- bar_thingy 'blah' do; end
+ bar_thingy "blah" do; end
}.to raise_error(NoMethodError)
end
end
@@ -151,7 +151,7 @@ describe "Recipe DSL methods" do
it "no_name_thingy does not work" do
expect_converge {
- no_name_thingy 'blah' do; end
+ no_name_thingy "blah" do; end
}.to raise_error(NoMethodError)
end
end
@@ -167,15 +167,15 @@ describe "Recipe DSL methods" do
it "another_no_name_thingy does not work" do
expect_converge {
- another_no_name_thingy 'blah' do; end
+ another_no_name_thingy "blah" do; end
}.to raise_error(NoMethodError)
end
it "another_thingy_name works" do
recipe = converge {
- another_thingy_name 'blah' do; end
+ another_thingy_name "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq(AnotherNoNameThingy)
end
end
@@ -192,21 +192,21 @@ describe "Recipe DSL methods" do
it "another_no_name_thingy does not work" do
expect_converge {
- another_no_name_thingy2 'blah' do; end
+ another_no_name_thingy2 "blah" do; end
}.to raise_error(NoMethodError)
end
it "another_thingy_name2 does not work" do
expect_converge {
- another_thingy_name2 'blah' do; end
+ another_thingy_name2 "blah" do; end
}.to raise_error(NoMethodError)
end
it "yet_another_thingy_name3 works" do
recipe = converge {
- another_thingy_name3 'blah' do; end
+ another_thingy_name3 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq(AnotherNoNameThingy2)
end
end
@@ -217,7 +217,7 @@ describe "Recipe DSL methods" do
class AnotherNoNameThingy3 < BaseThingy
resource_name :another_no_name_thingy_3
- provides :another_no_name_thingy3, os: 'blarghle'
+ provides :another_no_name_thingy3, os: "blarghle"
end
}
@@ -225,18 +225,18 @@ describe "Recipe DSL methods" do
it "and os = linux, another_no_name_thingy3 does not work" do
expect_converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_no_name_thingy3 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_no_name_thingy3 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy3 works" do
recipe = converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_no_name_thingy3 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_no_name_thingy3 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy3)
end
end
@@ -246,8 +246,8 @@ describe "Recipe DSL methods" do
class AnotherNoNameThingy4 < BaseThingy
resource_name :another_no_name_thingy_4
- provides :another_no_name_thingy4, os: 'blarghle'
- provides :another_no_name_thingy4, platform_family: 'foo'
+ provides :another_no_name_thingy4, os: "blarghle"
+ provides :another_no_name_thingy4, platform_family: "foo"
end
}
@@ -255,28 +255,28 @@ describe "Recipe DSL methods" do
it "and os = linux, another_no_name_thingy4 does not work" do
expect_converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_no_name_thingy4 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_no_name_thingy4 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy4 works" do
recipe = converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_no_name_thingy4 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_no_name_thingy4 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy4)
end
it "and platform_family = foo, another_no_name_thingy4 works" do
recipe = converge {
# TODO this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:platform_family] = 'foo'
- another_no_name_thingy4 'blah' do; end
+ run_context.node.automatic[:platform_family] = "foo"
+ another_no_name_thingy4 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy4)
end
end
@@ -286,7 +286,7 @@ describe "Recipe DSL methods" do
class AnotherNoNameThingy5 < BaseThingy
resource_name :another_thingy_name_for_another_no_name_thingy5
- provides :another_no_name_thingy5, os: 'blarghle'
+ provides :another_no_name_thingy5, os: "blarghle"
end
}
@@ -294,26 +294,26 @@ describe "Recipe DSL methods" do
it "and os = linux, another_no_name_thingy5 does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_no_name_thingy5 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_no_name_thingy5 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy5 works" do
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_no_name_thingy5 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_no_name_thingy5 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy5)
end
it "the new resource name can be used in a recipe" do
recipe = converge {
- another_thingy_name_for_another_no_name_thingy5 'blah' do; end
+ another_thingy_name_for_another_no_name_thingy5 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy5)
end
end
@@ -322,7 +322,7 @@ describe "Recipe DSL methods" do
before(:context) {
class AnotherNoNameThingy6 < BaseThingy
- provides :another_no_name_thingy6, os: 'blarghle'
+ provides :another_no_name_thingy6, os: "blarghle"
resource_name :another_thingy_name_for_another_no_name_thingy6
end
@@ -331,26 +331,26 @@ describe "Recipe DSL methods" do
it "and os = linux, another_no_name_thingy6 does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_no_name_thingy6 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_no_name_thingy6 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_no_name_thingy6 works" do
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_no_name_thingy6 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_no_name_thingy6 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy6)
end
it "the new resource name can be used in a recipe" do
recipe = converge {
- another_thingy_name_for_another_no_name_thingy6 'blah' do; end
+ another_thingy_name_for_another_no_name_thingy6 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy6)
end
end
@@ -360,7 +360,7 @@ describe "Recipe DSL methods" do
class AnotherNoNameThingy7 < BaseThingy
resource_name :another_thingy_name_for_another_no_name_thingy7
- provides :another_thingy_name_for_another_no_name_thingy7, os: 'blarghle'
+ provides :another_thingy_name_for_another_no_name_thingy7, os: "blarghle"
end
}
@@ -368,26 +368,26 @@ describe "Recipe DSL methods" do
it "and os = linux, another_thingy_name_for_another_no_name_thingy7 does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_thingy_name_for_another_no_name_thingy7 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_thingy_name_for_another_no_name_thingy7 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_thingy_name_for_another_no_name_thingy7 works" do
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_thingy_name_for_another_no_name_thingy7 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_thingy_name_for_another_no_name_thingy7 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy7)
end
it "the old resource name does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_no_name_thingy_7 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_no_name_thingy_7 "blah" do; end
}.to raise_error(NoMethodError)
end
end
@@ -397,7 +397,7 @@ describe "Recipe DSL methods" do
before(:context) {
class AnotherNoNameThingy8 < BaseThingy
- provides :another_thingy_name_for_another_no_name_thingy8, os: 'blarghle'
+ provides :another_thingy_name_for_another_no_name_thingy8, os: "blarghle"
resource_name :another_thingy_name_for_another_no_name_thingy8
end
@@ -406,26 +406,26 @@ describe "Recipe DSL methods" do
it "and os = linux, another_thingy_name_for_another_no_name_thingy8 does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_thingy_name_for_another_no_name_thingy8 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_thingy_name_for_another_no_name_thingy8 "blah" do; end
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
it "and os = blarghle, another_thingy_name_for_another_no_name_thingy8 works" do
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
- another_thingy_name_for_another_no_name_thingy8 'blah' do; end
+ run_context.node.automatic[:os] = "blarghle"
+ another_thingy_name_for_another_no_name_thingy8 "blah" do; end
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq (AnotherNoNameThingy8)
end
it "the old resource name does not work" do
expect_converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
- another_thingy_name8 'blah' do; end
+ run_context.node.automatic[:os] = "linux"
+ another_thingy_name8 "blah" do; end
}.to raise_error(NoMethodError)
end
end
@@ -444,13 +444,13 @@ describe "Recipe DSL methods" do
it "my_supplier does not work in a recipe" do
expect_converge {
- my_supplier 'blah' do; end
+ my_supplier "blah" do; end
}.to raise_error(NoMethodError)
end
it "hemlock works in a recipe" do
expect_recipe {
- hemlock 'blah' do; end
+ hemlock "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::MySupplier
end
@@ -467,7 +467,7 @@ describe "Recipe DSL methods" do
it "thingy3 works in a recipe" do
expect_recipe {
- thingy3 'blah' do; end
+ thingy3 "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
@@ -483,14 +483,14 @@ describe "Recipe DSL methods" do
it "thingy3 works in a recipe and yields Thingy3 (the alphabetical one)" do
recipe = converge {
- thingy3 'blah' do; end
+ thingy3 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
it "thingy4 does not work in a recipe" do
expect_converge {
- thingy4 'blah' do; end
+ thingy4 "blah" do; end
}.to raise_error(NoMethodError)
end
@@ -514,7 +514,7 @@ describe "Recipe DSL methods" do
it "thingy5 works in a recipe" do
expect_recipe {
- thingy5 'blah' do; end
+ thingy5 "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy5
end
@@ -531,14 +531,14 @@ describe "Recipe DSL methods" do
it "thingy6 works in a recipe and yields Thingy6" do
recipe = converge {
- thingy6 'blah' do; end
+ thingy6 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy6
end
it "thingy5 works in a recipe and yields Foo::Thingy5 (the alphabetical one)" do
recipe = converge {
- thingy5 'blah' do; end
+ thingy5 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy5
end
@@ -558,7 +558,7 @@ describe "Recipe DSL methods" do
it "thingy5reverse works in a recipe and yields AThingy5 (the alphabetical one)" do
recipe = converge {
- thingy5reverse 'blah' do; end
+ thingy5reverse "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::AThingy5
end
@@ -577,7 +577,7 @@ describe "Recipe DSL methods" do
it "thingy5_2 works in a recipe and yields the RecipeDSLSpaceNamespace one (the alphabetical one)" do
recipe = converge {
- thingy5_2 'blah' do; end
+ thingy5_2 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy5
end
@@ -596,7 +596,7 @@ describe "Recipe DSL methods" do
it "thingy5_2reverse works in a recipe and yields the ARecipeDSLSpaceNamespace one (the alphabetical one)" do
recipe = converge {
- thingy5_2reverse 'blah' do; end
+ thingy5_2reverse "blah" do; end
}
expect(BaseThingy.created_resource).to eq ARecipeDSLSpecNamespace::Thingy5
end
@@ -614,7 +614,7 @@ describe "Recipe DSL methods" do
it "thingy3 works in a recipe" do
expect_recipe {
- thingy3 'blah' do; end
+ thingy3 "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
@@ -630,14 +630,14 @@ describe "Recipe DSL methods" do
it "thingy3 works in a recipe and yields Thingy3 (the alphabetical one)" do
recipe = converge {
- thingy3 'blah' do; end
+ thingy3 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
it "thingy4 does not work in a recipe" do
expect_converge {
- thingy4 'blah' do; end
+ thingy4 "blah" do; end
}.to raise_error(NoMethodError)
end
@@ -657,14 +657,14 @@ describe "Recipe DSL methods" do
it "thingy3 works in a recipe and yields Thingy3 (the alphabetical one)" do
recipe = converge {
- thingy3 'blah' do; end
+ thingy3 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy3
end
it "thingy4 does not work in a recipe" do
expect_converge {
- thingy4 'blah' do; end
+ thingy4 "blah" do; end
}.to raise_error(NoMethodError)
end
@@ -697,14 +697,14 @@ describe "Recipe DSL methods" do
it "thingy7 works in a recipe and yields Thingy7" do
recipe = converge {
- thingy7 'blah' do; end
+ thingy7 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy7
end
it "thingy8 works in a recipe and yields Thingy7 (alphabetical)" do
recipe = converge {
- thingy8 'blah' do; end
+ thingy8 "blah" do; end
}
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy7
end
@@ -728,21 +728,21 @@ describe "Recipe DSL methods" do
it "thingy12 works in a recipe and yields Thingy12" do
expect_recipe {
- thingy12 'blah' do; end
+ thingy12 "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
end
it "twizzle works in a recipe and yields Thingy12" do
expect_recipe {
- twizzle 'blah' do; end
+ twizzle "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
end
it "twizzle2 works in a recipe and yields Thingy12" do
expect_recipe {
- twizzle2 'blah' do; end
+ twizzle2 "blah" do; end
}.to emit_no_warnings_or_errors
expect(BaseThingy.created_resource).to eq RecipeDSLSpecNamespace::Thingy12
end
@@ -752,20 +752,20 @@ describe "Recipe DSL methods" do
before(:context) {
class MySuperThingyFoo < BaseThingy
resource_name :my_super_thingy_foo
- provides :my_super_thingy, platform: 'foo'
+ provides :my_super_thingy, platform: "foo"
end
class MySuperThingyBar < BaseThingy
resource_name :my_super_thingy_bar
- provides :my_super_thingy, platform: 'bar'
+ provides :my_super_thingy, platform: "bar"
end
}
it "A run with platform 'foo' uses MySuperThingyFoo" do
r = Cheffish::ChefRun.new(chef_config)
- r.client.run_context.node.automatic['platform'] = 'foo'
+ r.client.run_context.node.automatic["platform"] = "foo"
r.compile_recipe {
- my_super_thingy 'blah' do; end
+ my_super_thingy "blah" do; end
}
r.converge
expect(r).to emit_no_warnings_or_errors
@@ -774,9 +774,9 @@ describe "Recipe DSL methods" do
it "A run with platform 'bar' uses MySuperThingyBar" do
r = Cheffish::ChefRun.new(chef_config)
- r.client.run_context.node.automatic['platform'] = 'bar'
+ r.client.run_context.node.automatic["platform"] = "bar"
r.compile_recipe {
- my_super_thingy 'blah' do; end
+ my_super_thingy "blah" do; end
}
r.converge
expect(r).to emit_no_warnings_or_errors
@@ -785,10 +785,10 @@ describe "Recipe DSL methods" do
it "A run with platform 'x' reports that my_super_thingy is not supported" do
r = Cheffish::ChefRun.new(chef_config)
- r.client.run_context.node.automatic['platform'] = 'x'
+ r.client.run_context.node.automatic["platform"] = "x"
expect {
r.compile_recipe {
- my_super_thingy 'blah' do; end
+ my_super_thingy "blah" do; end
}
}.to raise_error(Chef::Exceptions::NoSuchResourceType)
end
@@ -819,7 +819,7 @@ describe "Recipe DSL methods" do
it "declaring a resource providing the same :thingy11 with os: 'linux' does not produce a warning" do
expect(Chef::Log).not_to receive(:warn)
class RecipeDSLSpecNamespace::Thingy11AlternateProvider < BaseThingy
- provides :thingy11, os: 'linux'
+ provides :thingy11, os: "linux"
end
end
end
@@ -859,7 +859,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_a
end
@@ -887,7 +887,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -905,7 +905,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_z
end
@@ -923,7 +923,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -944,7 +944,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_z
end
@@ -962,7 +962,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -987,7 +987,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
@@ -1036,7 +1036,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class_a
end
end
@@ -1048,7 +1048,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
end
@@ -1075,7 +1075,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
@@ -1087,7 +1087,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class_z
end
end
@@ -1104,7 +1104,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
end
@@ -1118,7 +1118,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{two_classes_one_dsl} 'blah'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
end
@@ -1136,7 +1136,7 @@ describe "Recipe DSL methods" do
def self.inspect; name.inspect; end
end
result.resource_name two_classes_one_dsl
- result.provides two_classes_one_dsl, os: 'blarghle'
+ result.provides two_classes_one_dsl, os: "blarghle"
result
}
before { resource_class_blarghle } # pull on it so it gets defined before the recipe runs
@@ -1145,10 +1145,10 @@ describe "Recipe DSL methods" do
two_classes_one_dsl = self.two_classes_one_dsl
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'blarghle'
+ run_context.node.automatic[:os] = "blarghle"
instance_eval("#{two_classes_one_dsl} 'blah' do; end")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class_blarghle
end
@@ -1156,10 +1156,10 @@ describe "Recipe DSL methods" do
two_classes_one_dsl = self.two_classes_one_dsl
recipe = converge {
# this is an ugly way to test, make Cheffish expose node attrs
- run_context.node.automatic[:os] = 'linux'
+ run_context.node.automatic[:os] = "linux"
instance_eval("#{two_classes_one_dsl} 'blah' do; end")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
end
end
@@ -1196,7 +1196,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{dsl_name} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_resource).to eq resource_class
expect(resource_class.called_provides).to be_truthy
end
@@ -1264,7 +1264,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{my_resource} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
@@ -1291,7 +1291,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{my_resource} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
end
@@ -1308,7 +1308,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{my_resource} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
end
@@ -1337,7 +1337,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{my_resource} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class2
end
end
@@ -1363,7 +1363,7 @@ describe "Recipe DSL methods" do
recipe = converge {
instance_eval("#{my_resource} 'foo'")
}
- expect(recipe.logged_warnings).to eq ''
+ expect(recipe.logged_warnings).to eq ""
expect(BaseThingy.created_provider).to eq provider_class
expect(provider_class.called_provides).to be_truthy
end
@@ -1484,7 +1484,7 @@ describe "Recipe DSL methods" do
it "looks up the provider in Chef::Provider converting the resource name from snake case to camel case" do
resource = nil
recipe = converge {
- resource = lw_resource_with_hw_provider_test_case 'blah' do; end
+ resource = lw_resource_with_hw_provider_test_case "blah" do; end
}
expect(resource.created_provider).to eq(Chef::Provider::LwResourceWithHwProviderTestCase)
end
diff --git a/spec/integration/recipes/remote_directory.rb b/spec/integration/recipes/remote_directory.rb
index a1988ccd52..77fe183136 100644
--- a/spec/integration/recipes/remote_directory.rb
+++ b/spec/integration/recipes/remote_directory.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe Chef::Resource::RemoteDirectory do
include IntegrationSupport
@@ -20,7 +20,7 @@ describe Chef::Resource::RemoteDirectory do
when_the_repository "has a cookbook with a source_dir with two subdirectories, each with one file and subdir in a different alphabetical order" do
before do
- file 'config/client.rb', <<-EOM
+ file "config/client.rb", <<-EOM
local_mode true
cookbook_path "#{path_to('cookbooks')}"
EOM
diff --git a/spec/integration/recipes/resource_action_spec.rb b/spec/integration/recipes/resource_action_spec.rb
index 17a1eb9acd..b8c533b31d 100644
--- a/spec/integration/recipes/resource_action_spec.rb
+++ b/spec/integration/recipes/resource_action_spec.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
# Houses any classes we declare
module ResourceActionSpec
@@ -36,7 +36,7 @@ describe "Resource.action" do
end
EOM
expect(ActionJackson.ran_action).to eq :access_attribute
- expect(ActionJackson.succeeded).to eq 'foo!'
+ expect(ActionJackson.succeeded).to eq "foo!"
end
it "the action can access public methods" do
@@ -47,7 +47,7 @@ describe "Resource.action" do
end
EOM
expect(ActionJackson.ran_action).to eq :access_method
- expect(ActionJackson.succeeded).to eq 'foo_public!'
+ expect(ActionJackson.succeeded).to eq "foo_public!"
end
it "the action can access protected methods" do
@@ -58,7 +58,7 @@ describe "Resource.action" do
end
EOM
expect(ActionJackson.ran_action).to eq :access_protected_method
- expect(ActionJackson.succeeded).to eq 'foo_protected!'
+ expect(ActionJackson.succeeded).to eq "foo_protected!"
end
it "the action cannot access private methods" do
@@ -98,7 +98,7 @@ describe "Resource.action" do
end
EOM
expect(ActionJackson.ran_action).to eq :access_class_method
- expect(ActionJackson.succeeded).to eq 'ruby_block_converged!'
+ expect(ActionJackson.succeeded).to eq "ruby_block_converged!"
end
it "the action's resources converge before the next resource converges" do
@@ -115,8 +115,8 @@ describe "Resource.action" do
end
EOM
expect(ActionJackson.ran_action).to eq :access_attribute
- expect(ActionJackson.succeeded).to eq 'foo!'
- expect(ActionJackson.ruby_block_converged).to eq 'foo!'
+ expect(ActionJackson.succeeded).to eq "foo!"
+ expect(ActionJackson.ruby_block_converged).to eq "foo!"
end
end
@@ -140,21 +140,21 @@ describe "Resource.action" do
public
def foo_public
- 'foo_public!'
+ "foo_public!"
end
protected
def foo_protected
- 'foo_protected!'
+ "foo_protected!"
end
private
def foo_private
- 'foo_private!'
+ "foo_private!"
end
public
action :access_recipe_dsl do
ActionJackson.ran_action = :access_recipe_dsl
- ruby_block 'hi there' do
+ ruby_block "hi there" do
block do
ActionJackson.succeeded = true
end
@@ -205,7 +205,7 @@ describe "Resource.action" do
end
it "Can retrieve ancestors of action class without crashing" do
- converge { action_jackson 'hi' }
+ converge { action_jackson "hi" }
expect { ActionJackson.action_class.ancestors.join(",") }.not_to raise_error
end
@@ -260,9 +260,9 @@ describe "Resource.action" do
it "the default action remains the same even though new actions were specified first" do
converge {
- action_jackalope 'hi' do
- foo 'foo!'
- bar 'bar!'
+ action_jackalope "hi" do
+ foo "foo!"
+ bar "bar!"
end
}
expect(ActionJackson.ran_action).to eq :access_recipe_dsl
@@ -271,10 +271,10 @@ describe "Resource.action" do
it "new actions run, and can access overridden, new, and overridden attributes" do
converge {
- action_jackalope 'hi' do
- foo 'foo!'
- bar 'bar!'
- blarghle 'blarghle!'
+ action_jackalope "hi" do
+ foo "foo!"
+ bar "bar!"
+ blarghle "blarghle!"
action :access_jackalope
end
}
@@ -284,10 +284,10 @@ describe "Resource.action" do
it "overridden actions run, call super, and can access overridden, new, and overridden attributes" do
converge {
- action_jackalope 'hi' do
- foo 'foo!'
- bar 'bar!'
- blarghle 'blarghle!'
+ action_jackalope "hi" do
+ foo "foo!"
+ bar "bar!"
+ blarghle "blarghle!"
action :access_attribute
end
}
@@ -299,10 +299,10 @@ describe "Resource.action" do
it "non-overridden actions run and can access overridden and non-overridden variables (but not necessarily new ones)" do
converge {
- action_jackalope 'hi' do
- foo 'foo!'
- bar 'bar!'
- blarghle 'blarghle!'
+ action_jackalope "hi" do
+ foo "foo!"
+ bar "bar!"
+ blarghle "blarghle!"
action :access_attribute2
end
}
@@ -328,8 +328,8 @@ describe "Resource.action" do
it "the default action is :nothing" do
converge {
- no_action_jackson 'hi' do
- foo 'foo!'
+ no_action_jackson "hi" do
+ foo "foo!"
NoActionJackson.action_was = action
end
}
@@ -352,7 +352,7 @@ describe "Resource.action" do
it "Running the action works" do
expect_recipe {
- weird_action_jackson 'hi'
+ weird_action_jackson "hi"
}.to be_up_to_date
expect(WeirdActionJackson.action_was).to eq :"a-b-c d"
end
@@ -373,7 +373,7 @@ describe "Resource.action" do
resource_name :resource_action_spec_also_with_x
property :x
action :set_x_to_x do
- resource_action_spec_with_x 'hi' do
+ resource_action_spec_with_x "hi" do
x x
end
end
@@ -381,13 +381,13 @@ describe "Resource.action" do
__LINE__-4
end
action :set_x_to_x_in_non_initializer do
- r = resource_action_spec_with_x 'hi' do
+ r = resource_action_spec_with_x "hi" do
x 10
end
x_times_2 = r.x*2
end
action :set_x_to_10 do
- resource_action_spec_with_x 'hi' do
+ resource_action_spec_with_x "hi" do
x 10
end
end
@@ -397,7 +397,7 @@ describe "Resource.action" do
it "Using the enclosing resource to set x to x emits a warning that you're using the wrong x" do
recipe = converge {
- resource_action_spec_also_with_x 'hi' do
+ resource_action_spec_also_with_x "hi" do
x 1
action :set_x_to_x
end
@@ -409,7 +409,7 @@ describe "Resource.action" do
it "Using the enclosing resource to set x to x outside the initializer emits no warning" do
expect_recipe {
- resource_action_spec_also_with_x 'hi' do
+ resource_action_spec_also_with_x "hi" do
x 1
action :set_x_to_x_in_non_initializer
end
@@ -418,7 +418,7 @@ describe "Resource.action" do
it "Using the enclosing resource to set x to 10 emits no warning" do
expect_recipe {
- resource_action_spec_also_with_x 'hi' do
+ resource_action_spec_also_with_x "hi" do
x 1
action :set_x_to_10
end
@@ -427,7 +427,7 @@ describe "Resource.action" do
it "Using the enclosing resource to set x to 10 emits no warning" do
expect_recipe {
- r = resource_action_spec_also_with_x 'hi'
+ r = resource_action_spec_also_with_x "hi"
r.x 1
r.action :set_x_to_10
}.to emit_no_warnings_or_errors
@@ -442,14 +442,14 @@ describe "Resource.action" do
property :template
action :create do
template "x" do
- 'blah'
+ "blah"
end
end
end
it "Raises an error when attempting to use a template in the action" do
expect_converge {
- has_property_named_template 'hi'
+ has_property_named_template "hi"
}.to raise_error(/Property template of has_property_named_template\[hi\] cannot be passed a block! If you meant to create a resource named template instead, you'll need to first rename the property./)
end
end
@@ -484,16 +484,16 @@ describe "Resource.action" do
end
it "the methods are not available on the resource" do
- expect { DeclaresActionClassMethods.new('hi').a }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').b }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').c }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').d }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").a }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").b }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").c }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").d }.to raise_error(NameError)
end
it "the methods are available to the action" do
r = nil
expect_recipe {
- r = declares_action_class_methods 'hi'
+ r = declares_action_class_methods "hi"
}.to emit_no_warnings_or_errors
expect(r.x).to eq(10)
end
@@ -512,17 +512,17 @@ describe "Resource.action" do
end
it "the methods are not available on the resource" do
- expect { DeclaresActionClassMethods.new('hi').a }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').b }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').c }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').d }.to raise_error(NameError)
- expect { DeclaresActionClassMethods.new('hi').e }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").a }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").b }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").c }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").d }.to raise_error(NameError)
+ expect { DeclaresActionClassMethods.new("hi").e }.to raise_error(NameError)
end
it "the methods are available to the action" do
r = nil
expect_recipe {
- r = declares_action_class_methods_too 'hi'
+ r = declares_action_class_methods_too "hi"
}.to emit_no_warnings_or_errors
expect(r.x).to eq(15)
end
diff --git a/spec/integration/recipes/resource_converge_if_changed_spec.rb b/spec/integration/recipes/resource_converge_if_changed_spec.rb
index f3b562c50d..2bcccd9831 100644
--- a/spec/integration/recipes/resource_converge_if_changed_spec.rb
+++ b/spec/integration/recipes/resource_converge_if_changed_spec.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe "Resource::ActionClass#converge_if_changed" do
include IntegrationSupport
@@ -23,10 +23,10 @@ describe "Resource::ActionClass#converge_if_changed" do
result = Class.new(Chef::Resource) do
def self.to_s; resource_name; end
def self.inspect; resource_name.inspect; end
- property :identity1, identity: true, default: 'default_identity1'
- property :control1, desired_state: false, default: 'default_control1'
- property :state1, default: 'default_state1'
- property :state2, default: 'default_state2'
+ property :identity1, identity: true, default: "default_identity1"
+ property :control1, desired_state: false, default: "default_control1"
+ property :state1, default: "default_state1"
+ property :state2, default: "default_state2"
attr_accessor :converged
def initialize(*args)
super
@@ -51,8 +51,8 @@ describe "Resource::ActionClass#converge_if_changed" do
context "and current_resource with state1=current, state2=current" do
before :each do
resource_class.load_current_value do
- state1 'current_state1'
- state2 'current_state2'
+ state1 "current_state1"
+ state2 "current_state2"
end
end
@@ -198,8 +198,8 @@ EOM
context "and current_resource with identity1=current, control1=current" do
before :each do
resource_class.load_current_value do
- identity1 'current_identity1'
- control1 'current_control1'
+ identity1 "current_identity1"
+ control1 "current_control1"
end
end
@@ -314,8 +314,8 @@ EOM
context "and current_resource with state1=current, state2=current" do
before :each do
resource_class.load_current_value do
- state1 'current_state1'
- state2 'current_state2'
+ state1 "current_state1"
+ state2 "current_state2"
end
end
diff --git a/spec/integration/recipes/resource_load_spec.rb b/spec/integration/recipes/resource_load_spec.rb
index 556201efd8..66a36b1431 100644
--- a/spec/integration/recipes/resource_load_spec.rb
+++ b/spec/integration/recipes/resource_load_spec.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe "Resource.load_current_value" do
include IntegrationSupport
@@ -55,29 +55,29 @@ describe "Resource.load_current_value" do
e = self
r = nil
converge {
- r = public_send(e.resource_name, 'blah') do
- x 'desired'
+ r = public_send(e.resource_name, "blah") do
+ x "desired"
end
}
r
end
it "current_resource is passed name but not x" do
- expect(resource.current_value.x).to eq 'loaded 2 (name=blah)'
+ expect(resource.current_value.x).to eq "loaded 2 (name=blah)"
end
it "resource.current_value returns a different resource" do
- expect(resource.current_value.x).to eq 'loaded 2 (name=blah)'
- expect(resource.x).to eq 'desired'
+ expect(resource.current_value.x).to eq "loaded 2 (name=blah)"
+ expect(resource.x).to eq "desired"
end
it "resource.current_value constructs the resource anew each time" do
- expect(resource.current_value.x).to eq 'loaded 2 (name=blah)'
- expect(resource.current_value.x).to eq 'loaded 3 (name=blah)'
+ expect(resource.current_value.x).to eq "loaded 2 (name=blah)"
+ expect(resource.current_value.x).to eq "loaded 3 (name=blah)"
end
it "the provider accesses the current value of x" do
- expect(resource.class.created_x).to eq 'desired'
+ expect(resource.class.created_x).to eq "desired"
end
context "and identity: :i and :d with desired_state: false" do
@@ -89,12 +89,12 @@ describe "Resource.load_current_value" do
}
before {
- resource.i 'desired_i'
- resource.d 'desired_d'
+ resource.i "desired_i"
+ resource.d "desired_d"
}
it "i, name and d are passed to load_current_value, but not x" do
- expect(resource.current_value.x).to eq 'loaded 2 (d=desired_d, i=desired_i, name=blah)'
+ expect(resource.current_value.x).to eq "loaded 2 (d=desired_d, i=desired_i, name=blah)"
end
end
@@ -107,12 +107,12 @@ describe "Resource.load_current_value" do
}
before {
- resource.i 'desired_i'
- resource.d 'desired_d'
+ resource.i "desired_i"
+ resource.d "desired_d"
}
it "i, name and d are passed to load_current_value, but not x" do
- expect(resource.current_value.x).to eq 'loaded 2 (d=desired_d, i=desired_i, name=blah)'
+ expect(resource.current_value.x).to eq "loaded 2 (d=desired_d, i=desired_i, name=blah)"
end
end
end
@@ -122,14 +122,14 @@ describe "Resource.load_current_value" do
e = self
r = nil
converge {
- r = public_send(e.resource_name, 'blah') do
+ r = public_send(e.resource_name, "blah") do
end
}
r
end
it "the provider accesses values from load_current_value" do
- expect(resource.class.created_x).to eq 'loaded 1 (name=blah)'
+ expect(resource.class.created_x).to eq "loaded 1 (name=blah)"
end
end
@@ -151,8 +151,8 @@ describe "Resource.load_current_value" do
e = self
r = nil
converge {
- r = public_send(e.subresource_name, 'blah') do
- x 'desired'
+ r = public_send(e.subresource_name, "blah") do
+ x "desired"
end
}
r
@@ -160,7 +160,7 @@ describe "Resource.load_current_value" do
context "and a child resource class with no load_current_value" do
it "the parent load_current_value is used" do
- expect(subresource.current_value.x).to eq 'loaded 2 (name=blah)'
+ expect(subresource.current_value.x).to eq "loaded 2 (name=blah)"
end
it "load_current_value yields a copy of the child class" do
expect(subresource.current_value).to be_kind_of(subresource_class)
@@ -179,8 +179,8 @@ describe "Resource.load_current_value" do
it "the overridden load_current_value is used" do
current_resource = subresource.current_value
- expect(current_resource.x).to eq 'default 3'
- expect(current_resource.y).to eq 'loaded_y 2 (name=blah)'
+ expect(current_resource.x).to eq "default 3"
+ expect(current_resource.y).to eq "loaded_y 2 (name=blah)"
end
end
@@ -197,8 +197,8 @@ describe "Resource.load_current_value" do
it "the original load_current_value is called as well as the child one" do
current_resource = subresource.current_value
- expect(current_resource.x).to eq 'loaded 3 (name=blah)'
- expect(current_resource.y).to eq 'loaded_y 4 (name=blah, x=loaded 3 (name=blah))'
+ expect(current_resource.x).to eq "loaded 3 (name=blah)"
+ expect(current_resource.y).to eq "loaded_y 4 (name=blah, x=loaded 3 (name=blah))"
end
end
end
diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb
index 6240a38144..4849cb4d40 100644
--- a/spec/integration/solo/solo_spec.rb
+++ b/spec/integration/solo/solo_spec.rb
@@ -1,9 +1,9 @@
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/shell_out'
-require 'chef/run_lock'
-require 'chef/config'
-require 'timeout'
-require 'fileutils'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/shell_out"
+require "chef/run_lock"
+require "chef/config"
+require "timeout"
+require "fileutils"
describe "chef-solo" do
include IntegrationSupport
@@ -19,12 +19,12 @@ describe "chef-solo" do
when_the_repository "has a cookbook with a basic recipe" do
before do
- file 'cookbooks/x/metadata.rb', cookbook_x_100_metadata_rb
- file 'cookbooks/x/recipes/default.rb', 'puts "ITWORKS"'
+ file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb
+ file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"'
end
it "should complete with success" do
- file 'config/solo.rb', <<EOM
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
@@ -34,12 +34,12 @@ EOM
end
it "should evaluate its node.json file" do
- file 'config/solo.rb', <<EOM
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
- file 'config/node.json',<<-E
+ file "config/node.json",<<-E
{"run_list":["x::default"]}
E
@@ -52,15 +52,15 @@ E
when_the_repository "has a cookbook with an undeclared dependency" do
before do
- file 'cookbooks/x/metadata.rb', cookbook_x_100_metadata_rb
- file 'cookbooks/x/recipes/default.rb', 'include_recipe "ancient::aliens"'
+ file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb
+ file "cookbooks/x/recipes/default.rb", 'include_recipe "ancient::aliens"'
- file 'cookbooks/ancient/metadata.rb', cookbook_ancient_100_metadata_rb
- file 'cookbooks/ancient/recipes/aliens.rb', 'print "it was aliens"'
+ file "cookbooks/ancient/metadata.rb", cookbook_ancient_100_metadata_rb
+ file "cookbooks/ancient/recipes/aliens.rb", 'print "it was aliens"'
end
it "should exit with an error" do
- file 'config/solo.rb', <<EOM
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
@@ -72,9 +72,9 @@ EOM
when_the_repository "has a cookbook with an incompatible chef_version" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0', "\nchef_version '~> 999.0'")
- file 'cookbooks/x/recipes/default.rb', 'puts "ITWORKS"'
- file 'config/solo.rb', <<EOM
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nchef_version '~> 999.0'")
+ file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"'
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
@@ -89,9 +89,9 @@ EOM
when_the_repository "has a cookbook with an incompatible ohai_version" do
before do
- file 'cookbooks/x/metadata.rb', cb_metadata('x', '1.0.0', "\nohai_version '~> 999.0'")
- file 'cookbooks/x/recipes/default.rb', 'puts "ITWORKS"'
- file 'config/solo.rb', <<EOM
+ file "cookbooks/x/metadata.rb", cb_metadata("x", "1.0.0", "\nohai_version '~> 999.0'")
+ file "cookbooks/x/recipes/default.rb", 'puts "ITWORKS"'
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
@@ -107,10 +107,10 @@ EOM
when_the_repository "has a cookbook with a recipe with sleep" do
before do
- directory 'logs'
- file 'logs/runs.log', ''
- file 'cookbooks/x/metadata.rb', cookbook_x_100_metadata_rb
- file 'cookbooks/x/recipes/default.rb', <<EOM
+ directory "logs"
+ file "logs/runs.log", ""
+ file "cookbooks/x/metadata.rb", cookbook_x_100_metadata_rb
+ file "cookbooks/x/recipes/default.rb", <<EOM
ruby_block "sleeping" do
block do
sleep 5
@@ -120,7 +120,7 @@ EOM
end
it "while running solo concurrently" do
- file 'config/solo.rb', <<EOM
+ file "config/solo.rb", <<EOM
cookbook_path "#{path_to('cookbooks')}"
file_cache_path "#{path_to('config/cache')}"
EOM
@@ -149,7 +149,7 @@ EOM
# Unfortunately file / directory helpers in integration tests
# are implemented using before(:each) so we need to do all below
# checks in one example.
- run_log = File.read(path_to('logs/runs.log'))
+ run_log = File.read(path_to("logs/runs.log"))
# both of the runs should succeed
expect(run_log.lines.reject {|l| !l.include? "INFO: Chef Run complete in"}.length).to eq(2)
diff --git a/spec/scripts/ssl-serve.rb b/spec/scripts/ssl-serve.rb
index 24ed70addc..0a2376049b 100644
--- a/spec/scripts/ssl-serve.rb
+++ b/spec/scripts/ssl-serve.rb
@@ -5,10 +5,10 @@
# You can use it to test various HTTP behaviors in chef, like chef-client's
# `-j` and `-c` options and remote_file with https connections.
#
-require 'pp'
-require 'openssl'
-require 'webrick'
-require 'webrick/https'
+require "pp"
+require "openssl"
+require "webrick"
+require "webrick/https"
$ssl = true
@@ -32,9 +32,9 @@ end
# 5 == debug, 3 == warning
LOGGER = WEBrick::Log.new(STDOUT, 5)
DEFAULT_OPTIONS = {
- :server => 'webrick',
+ :server => "webrick",
:Port => 9000,
- :Host => 'localhost',
+ :Host => "localhost",
:environment => :none,
:Logger => LOGGER,
:DocumentRoot => File.expand_path("/tmp/chef-118-sampledata")
@@ -45,7 +45,7 @@ webrick_opts = DEFAULT_OPTIONS.merge(server_opts)
pp :webrick_opts => webrick_opts
server = WEBrick::HTTPServer.new(webrick_opts)
-trap 'INT' do server.shutdown end
+trap "INT" do server.shutdown end
server.start
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index deedffed91..2d95ddcae9 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -28,15 +28,15 @@ end
$:.unshift File.expand_path("../..", __FILE__)
-require 'rubygems'
-require 'rspec/mocks'
+require "rubygems"
+require "rspec/mocks"
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
$:.unshift(File.expand_path("../lib", __FILE__))
$:.unshift(File.dirname(__FILE__))
if ENV["COVERAGE"]
- require 'simplecov'
+ require "simplecov"
SimpleCov.start do
add_filter "/spec/"
add_group "Remote File", "remote_file"
@@ -46,34 +46,34 @@ if ENV["COVERAGE"]
end
end
-require 'chef'
-require 'chef/knife'
+require "chef"
+require "chef/knife"
-Dir['lib/chef/knife/**/*.rb'].
- map {|f| f.gsub('lib/', '') }.
- map {|f| f.gsub(%r[\.rb$], '') }.
+Dir["lib/chef/knife/**/*.rb"].
+ map {|f| f.gsub("lib/", "") }.
+ map {|f| f.gsub(%r[\.rb$], "") }.
each {|f| require f }
-require 'chef/resource_resolver'
-require 'chef/provider_resolver'
+require "chef/resource_resolver"
+require "chef/provider_resolver"
-require 'chef/mixins'
-require 'chef/dsl'
-require 'chef/application'
-require 'chef/applications'
+require "chef/mixins"
+require "chef/dsl"
+require "chef/application"
+require "chef/applications"
-require 'chef/shell'
-require 'chef/util/file_edit'
+require "chef/shell"
+require "chef/util/file_edit"
-require 'chef/config'
+require "chef/config"
# If you want to load anything into the testing environment
# without versioning it, add it to spec/support/local_gems.rb
-require 'spec/support/local_gems.rb' if File.exists?(File.join(File.dirname(__FILE__), 'support', 'local_gems.rb'))
+require "spec/support/local_gems.rb" if File.exists?(File.join(File.dirname(__FILE__), "support", "local_gems.rb"))
# Explicitly require spec helpers that need to load first
-require 'spec/support/platform_helpers'
-require 'spec/support/shared/unit/mock_shellout'
+require "spec/support/platform_helpers"
+require "spec/support/shared/unit/mock_shellout"
# Autoloads support files
# Excludes support/platforms by default
@@ -81,23 +81,23 @@ require 'spec/support/shared/unit/mock_shellout'
Dir["spec/support/**/*.rb"].
reject { |f| f =~ %r{^spec/support/platforms} }.
reject { |f| f =~ %r{^spec/support/pedant} }.
- map { |f| f.gsub(%r{.rb$}, '') }.
- map { |f| f.gsub(%r[spec/], '')}.
+ map { |f| f.gsub(%r{.rb$}, "") }.
+ map { |f| f.gsub(%r[spec/], "")}.
each { |f| require f }
OHAI_SYSTEM = Ohai::System.new
OHAI_SYSTEM.all_plugins("platform")
test_node = Chef::Node.new
-test_node.automatic['os'] = (OHAI_SYSTEM['os'] || 'unknown_os').dup.freeze
-test_node.automatic['platform_family'] = (OHAI_SYSTEM['platform_family'] || 'unknown_platform_family').dup.freeze
-test_node.automatic['platform'] = (OHAI_SYSTEM['platform'] || 'unknown_platform').dup.freeze
-test_node.automatic['platform_version'] = (OHAI_SYSTEM['platform_version'] || 'unknown_platform_version').dup.freeze
+test_node.automatic["os"] = (OHAI_SYSTEM["os"] || "unknown_os").dup.freeze
+test_node.automatic["platform_family"] = (OHAI_SYSTEM["platform_family"] || "unknown_platform_family").dup.freeze
+test_node.automatic["platform"] = (OHAI_SYSTEM["platform"] || "unknown_platform").dup.freeze
+test_node.automatic["platform_version"] = (OHAI_SYSTEM["platform_version"] || "unknown_platform_version").dup.freeze
TEST_NODE = test_node.freeze
-TEST_OS = TEST_NODE['os']
-TEST_PLATFORM = TEST_NODE['platform']
-TEST_PLATFORM_VERSION = TEST_NODE['platform_version']
-TEST_PLATFORM_FAMILY = TEST_NODE['platform_family']
+TEST_OS = TEST_NODE["os"]
+TEST_PLATFORM = TEST_NODE["platform"]
+TEST_PLATFORM_VERSION = TEST_NODE["platform_version"]
+TEST_PLATFORM_FAMILY = TEST_NODE["platform_family"]
RSpec.configure do |config|
config.include(Matchers)
@@ -180,7 +180,7 @@ RSpec.configure do |config|
node = TEST_NODE.dup
resource_class = Chef::ResourceResolver.resolve(type, node: node)
if resource_class
- resource = resource_class.new('test', Chef::RunContext.new(node, nil, nil))
+ resource = resource_class.new("test", Chef::RunContext.new(node, nil, nil))
begin
provider = resource.provider_for_action(Array(resource_class.default_action).first)
provider.class != target_provider
@@ -203,20 +203,20 @@ RSpec.configure do |config|
Chef::Config.treat_deprecation_warnings_as_errors(true)
# Set environment variable so the setting persists in child processes
- ENV['CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS'] = "1"
+ ENV["CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS"] = "1"
end
# raise if anyone commits any test to CI with :focus set on it
config.before(:example, :focus) do
- raise 'This example was committed with `:focus` and should not have been'
- end if ENV['CI']
+ raise "This example was committed with `:focus` and should not have been"
+ end if ENV["CI"]
config.before(:suite) do
ARGV.clear
end
end
-require 'webrick/utils'
+require "webrick/utils"
# Webrick uses a centralized/synchronized timeout manager. It works by
# starting a thread to check for timeouts on an interval. The timeout
@@ -242,4 +242,4 @@ module WEBrick
end
# Enough stuff needs json serialization that I'm just adding it here for equality asserts
-require 'chef/json_compat'
+require "chef/json_compat"
diff --git a/spec/stress/win32/file_spec.rb b/spec/stress/win32/file_spec.rb
index 6c4b26b05c..fac811774f 100644
--- a/spec/stress/win32/file_spec.rb
+++ b/spec/stress/win32/file_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/win32/file' if windows?
+require "spec_helper"
+require "chef/win32/file" if windows?
-describe 'Chef::ReservedNames::Win32::File', :windows_only do
+describe "Chef::ReservedNames::Win32::File", :windows_only do
before(:each) do
@path = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "data", "old_home_dir", "my-dot-emacs"))
end
diff --git a/spec/stress/win32/memory_spec.rb b/spec/stress/win32/memory_spec.rb
index ed3ad306d0..707613071e 100644
--- a/spec/stress/win32/memory_spec.rb
+++ b/spec/stress/win32/memory_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-describe 'Chef::ReservedNames::Win32::Memory', :windows_only do
+describe "Chef::ReservedNames::Win32::Memory", :windows_only do
end
diff --git a/spec/stress/win32/security_spec.rb b/spec/stress/win32/security_spec.rb
index 4e0c903aea..1e7d8c3b6f 100644
--- a/spec/stress/win32/security_spec.rb
+++ b/spec/stress/win32/security_spec.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if windows?
- require 'chef/win32/security'
- require 'tmpdir'
- require 'fileutils'
+ require "chef/win32/security"
+ require "tmpdir"
+ require "fileutils"
end
-describe 'Chef::ReservedNames::Win32::Security', :windows_only do
+describe "Chef::ReservedNames::Win32::Security", :windows_only do
def monkeyfoo
File.join(CHEF_SPEC_DATA, "monkeyfoo").gsub("/", "\\")
diff --git a/spec/support/chef_helpers.rb b/spec/support/chef_helpers.rb
index 851b1dce0a..a792cd3c5f 100644
--- a/spec/support/chef_helpers.rb
+++ b/spec/support/chef_helpers.rb
@@ -15,7 +15,7 @@
#
CHEF_SPEC_DATA = File.expand_path(File.dirname(__FILE__) + "/../data/")
CHEF_SPEC_ASSETS = File.expand_path(File.dirname(__FILE__) + "/../functional/assets/")
-CHEF_SPEC_BACKUP_PATH = File.join(Dir.tmpdir, 'test-backup-path')
+CHEF_SPEC_BACKUP_PATH = File.join(Dir.tmpdir, "test-backup-path")
Chef::Config[:log_level] = :fatal
Chef::Config[:persistent_queue] = false
@@ -82,12 +82,12 @@ end
# This is a helper to canonicalize paths that we're using in the file
# tests.
def canonicalize_path(path)
- windows? ? path.gsub('/', '\\') : path
+ windows? ? path.gsub("/", '\\') : path
end
# Check if a cmd exists on the PATH
def which(cmd)
- paths = ENV['PATH'].split(File::PATH_SEPARATOR) + [ '/bin', '/usr/bin', '/sbin', '/usr/sbin' ]
+ paths = ENV["PATH"].split(File::PATH_SEPARATOR) + [ "/bin", "/usr/bin", "/sbin", "/usr/sbin" ]
paths.each do |path|
filename = File.join(path, cmd)
return filename if File.executable?(filename)
diff --git a/spec/support/key_helpers.rb b/spec/support/key_helpers.rb
index 076f709380..cec0e26cb4 100644
--- a/spec/support/key_helpers.rb
+++ b/spec/support/key_helpers.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
shared_examples_for "a knife key command" do
let(:stderr) { StringIO.new }
diff --git a/spec/support/lib/chef/resource/with_state.rb b/spec/support/lib/chef/resource/with_state.rb
index 773ae7ddb8..60269632b0 100644
--- a/spec/support/lib/chef/resource/with_state.rb
+++ b/spec/support/lib/chef/resource/with_state.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/json_compat'
+require "chef/knife"
+require "chef/json_compat"
class Chef
class Resource
diff --git a/spec/support/lib/chef/resource/zen_follower.rb b/spec/support/lib/chef/resource/zen_follower.rb
index 155e6ae729..83ae078f1d 100644
--- a/spec/support/lib/chef/resource/zen_follower.rb
+++ b/spec/support/lib/chef/resource/zen_follower.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/json_compat'
+require "chef/knife"
+require "chef/json_compat"
class Chef
class Resource
diff --git a/spec/support/lib/chef/resource/zen_master.rb b/spec/support/lib/chef/resource/zen_master.rb
index 4106549d79..6f6f4fcabb 100644
--- a/spec/support/lib/chef/resource/zen_master.rb
+++ b/spec/support/lib/chef/resource/zen_master.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/knife'
-require 'chef/json_compat'
+require "chef/knife"
+require "chef/json_compat"
class Chef
class Resource
diff --git a/spec/support/matchers/leak.rb b/spec/support/matchers/leak.rb
index 01d1e53f92..80f0ae44c7 100644
--- a/spec/support/matchers/leak.rb
+++ b/spec/support/matchers/leak.rb
@@ -60,10 +60,10 @@ module Matchers
def profiler
@profiler ||= begin
if Chef::Platform.windows?
- require File.join(File.dirname(__FILE__), '..', 'platforms', 'prof', 'win32')
+ require File.join(File.dirname(__FILE__), "..", "platforms", "prof", "win32")
RSpec::Prof::Win32::Profiler.new
else
- require File.join(File.dirname(__FILE__), '..', 'prof', 'gc')
+ require File.join(File.dirname(__FILE__), "..", "prof", "gc")
RSpec::Prof::GC::Profiler.new
end
end
diff --git a/spec/support/mock/constant.rb b/spec/support/mock/constant.rb
index c706ad29dd..98756d715f 100644
--- a/spec/support/mock/constant.rb
+++ b/spec/support/mock/constant.rb
@@ -23,7 +23,7 @@ def mock_constants(constants, &block)
end
def parse_constant(constant)
- source, _, constant_name = constant.to_s.rpartition('::')
+ source, _, constant_name = constant.to_s.rpartition("::")
[constantize(source), constant_name]
end
@@ -41,7 +41,7 @@ end
# File activesupport/lib/active_support/inflector/methods.rb, line 209
def constantize(camel_cased_word)
- names = camel_cased_word.split('::')
+ names = camel_cased_word.split("::")
names.shift if names.empty? || names.first.empty?
constant = Object
diff --git a/spec/support/mock/platform.rb b/spec/support/mock/platform.rb
index 7eae82fe7d..a8bbf13589 100644
--- a/spec/support/mock/platform.rb
+++ b/spec/support/mock/platform.rb
@@ -7,7 +7,7 @@
# or +Chef::FileAccessControl+
def platform_mock(platform = :unix, &block)
allow(ChefConfig).to receive(:windows?).and_return(platform == :windows ? true : false)
- ENV['SYSTEMDRIVE'] = (platform == :windows ? 'C:' : nil)
+ ENV["SYSTEMDRIVE"] = (platform == :windows ? "C:" : nil)
if platform == :windows
Chef::Config.set_defaults_for_windows
@@ -16,7 +16,7 @@ def platform_mock(platform = :unix, &block)
end
if block_given?
- mock_constants({"RUBY_PLATFORM" => (platform == :windows ? 'i386-mingw32' : 'x86_64-darwin11.2.0'),
+ mock_constants({"RUBY_PLATFORM" => (platform == :windows ? "i386-mingw32" : "x86_64-darwin11.2.0"),
"File::PATH_SEPARATOR" => (platform == :windows ? ";" : ":"),
"File::ALT_SEPARATOR" => (platform == :windows ? "\\" : nil) }) do
yield
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index e80df90499..0259dc6dfb 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -1,6 +1,6 @@
-require 'fcntl'
-require 'chef/mixin/shell_out'
-require 'ohai/mixin/gce_metadata'
+require "fcntl"
+require "chef/mixin/shell_out"
+require "ohai/mixin/gce_metadata"
class ShellHelpers
extend Chef::Mixin::ShellOut
@@ -11,11 +11,11 @@ def ruby_lt_20?
end
def chef_gte_13?
- Chef::VERSION.split('.').first.to_i >= 13
+ Chef::VERSION.split(".").first.to_i >= 13
end
def chef_lt_13?
- Chef::VERSION.split('.').first.to_i < 13
+ Chef::VERSION.split(".").first.to_i < 13
end
def ruby_gte_19?
@@ -27,11 +27,11 @@ def ruby_20?
end
def ruby_64bit?
- !!(RbConfig::CONFIG['host_cpu'] =~ /x86_64/)
+ !!(RbConfig::CONFIG["host_cpu"] =~ /x86_64/)
end
def ruby_32bit?
- !!(RbConfig::CONFIG['host_cpu'] =~ /i686/)
+ !!(RbConfig::CONFIG["host_cpu"] =~ /i686/)
end
def windows?
@@ -43,29 +43,29 @@ def ohai
OHAI_SYSTEM
end
-require 'wmi-lite/wmi' if windows?
+require "wmi-lite/wmi" if windows?
def windows_domain_joined?
return false unless windows?
wmi = WmiLite::Wmi.new
- computer_system = wmi.first_of('Win32_ComputerSystem')
- computer_system['partofdomain']
+ computer_system = wmi.first_of("Win32_ComputerSystem")
+ computer_system["partofdomain"]
end
def windows_win2k3?
return false unless windows?
wmi = WmiLite::Wmi.new
- host = wmi.first_of('Win32_OperatingSystem')
- (host['version'] && host['version'].start_with?("5.2"))
+ host = wmi.first_of("Win32_OperatingSystem")
+ (host["version"] && host["version"].start_with?("5.2"))
end
def windows_2008r2_or_later?
return false unless windows?
wmi = WmiLite::Wmi.new
- host = wmi.first_of('Win32_OperatingSystem')
- version = host['version']
+ host = wmi.first_of("Win32_OperatingSystem")
+ version = host["version"]
return false unless version
- components = version.split('.').map do | component |
+ components = version.split(".").map do | component |
component.to_i
end
components.length >=2 && components[0] >= 6 && components[1] >= 1
@@ -75,7 +75,7 @@ def windows_powershell_dsc?
return false unless windows?
supports_dsc = false
begin
- wmi = WmiLite::Wmi.new('root/microsoft/windows/desiredstateconfiguration')
+ wmi = WmiLite::Wmi.new("root/microsoft/windows/desiredstateconfiguration")
lcm = wmi.query("SELECT * FROM meta_class WHERE __this ISA 'MSFT_DSCLocalConfigurationManager'")
supports_dsc = !! lcm
rescue WmiLite::WmiException
@@ -84,7 +84,7 @@ def windows_powershell_dsc?
end
def windows_nano_server?
- require 'chef/platform/query_helpers'
+ require "chef/platform/query_helpers"
Chef::Platform.windows_nano_server?
end
@@ -117,7 +117,7 @@ end
# detects if the hardware is 64-bit (evaluates to true in "WOW64" mode in a 32-bit app on a 64-bit system)
def windows64?
- windows? && ( ENV['PROCESSOR_ARCHITECTURE'] == 'AMD64' || ENV['PROCESSOR_ARCHITEW6432'] == 'AMD64' )
+ windows? && ( ENV["PROCESSOR_ARCHITECTURE"] == "AMD64" || ENV["PROCESSOR_ARCHITEW6432"] == "AMD64" )
end
# detects if the hardware is 32-bit
@@ -156,10 +156,10 @@ def wpar?
end
def supports_cloexec?
- Fcntl.const_defined?('F_SETFD') && Fcntl.const_defined?('FD_CLOEXEC')
+ Fcntl.const_defined?("F_SETFD") && Fcntl.const_defined?("FD_CLOEXEC")
end
-DEV_NULL = windows? ? 'NUL' : '/dev/null'
+DEV_NULL = windows? ? "NUL" : "/dev/null"
def selinux_enabled?
# This code is currently copied from lib/chef/util/selinux to make
diff --git a/spec/support/platforms/prof/win32.rb b/spec/support/platforms/prof/win32.rb
index ab256ff0fc..379f75a594 100644
--- a/spec/support/platforms/prof/win32.rb
+++ b/spec/support/platforms/prof/win32.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/win32/process'
+require "chef/win32/process"
module RSpec
module Prof
diff --git a/spec/support/platforms/win32/spec_service.rb b/spec/support/platforms/win32/spec_service.rb
index 3e1f6c3638..037ccc93de 100644
--- a/spec/support/platforms/win32/spec_service.rb
+++ b/spec/support/platforms/win32/spec_service.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'win32/daemon'
+require "win32/daemon"
class SpecService < ::Win32::Daemon
def service_init
@@ -26,7 +26,7 @@ class SpecService < ::Win32::Daemon
def service_main(*startup_parameters)
while running? do
if !File.exists?(@test_service_file)
- File.open(@test_service_file, 'wb') do |f|
+ File.open(@test_service_file, "wb") do |f|
f.write("This file is created by SpecService")
end
end
diff --git a/spec/support/shared/context/client.rb b/spec/support/shared/context/client.rb
index eec66dcb26..2089928618 100644
--- a/spec/support/shared/context/client.rb
+++ b/spec/support/shared/context/client.rb
@@ -1,5 +1,5 @@
-require 'spec_helper'
+require "spec_helper"
# Stubs a basic client object
shared_context "client" do
@@ -140,7 +140,7 @@ shared_context "a client run" do
before do
Chef::Config[:client_fork] = enable_fork
- Chef::Config[:cache_path] = windows? ? 'C:\chef' : '/var/chef'
+ Chef::Config[:cache_path] = windows? ? 'C:\chef' : "/var/chef"
Chef::Config[:why_run] = false
Chef::Config[:audit_mode] = :enabled
diff --git a/spec/support/shared/context/config.rb b/spec/support/shared/context/config.rb
index 1412356f3a..bb4ff7e0d1 100644
--- a/spec/support/shared/context/config.rb
+++ b/spec/support/shared/context/config.rb
@@ -5,15 +5,15 @@
#
# Required chef files here:
-require 'chef/config'
+require "chef/config"
# Required spec files here:
-require 'spec_helper'
+require "spec_helper"
# Basic config. Nothing fancy.
shared_context "default config options" do
before do
- Chef::Config[:cache_path] = windows? ? 'C:\chef' : '/var/chef'
+ Chef::Config[:cache_path] = windows? ? 'C:\chef' : "/var/chef"
end
# Don't need to have an after block to reset the config...
diff --git a/spec/support/shared/context/win32.rb b/spec/support/shared/context/win32.rb
index 60ed92ca1d..9e0099d8af 100644
--- a/spec/support/shared/context/win32.rb
+++ b/spec/support/shared/context/win32.rb
@@ -18,8 +18,8 @@
RSpec.shared_context "Win32" do
before(:all) do
@original_win32 = if defined?(Win32)
- win32 = Object.send(:const_get, 'Win32')
- Object.send(:remove_const, 'Win32')
+ win32 = Object.send(:const_get, "Win32")
+ Object.send(:remove_const, "Win32")
win32
else
nil
@@ -28,7 +28,7 @@ RSpec.shared_context "Win32" do
end
after(:all) do
- Object.send(:remove_const, 'Win32') if defined?(Win32)
- Object.send(:const_set, 'Win32', @original_win32) if @original_win32
+ Object.send(:remove_const, "Win32") if defined?(Win32)
+ Object.send(:const_set, "Win32", @original_win32) if @original_win32
end
end
diff --git a/spec/support/shared/examples/client.rb b/spec/support/shared/examples/client.rb
index 330cb40ac6..5af63dc307 100644
--- a/spec/support/shared/examples/client.rb
+++ b/spec/support/shared/examples/client.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
-require 'spec/support/shared/context/client'
+require "spec_helper"
+require "spec/support/shared/context/client"
# requires platform and platform_version be defined
shared_examples "a completed run" do
diff --git a/spec/support/shared/functional/directory_resource.rb b/spec/support/shared/functional/directory_resource.rb
index 51c7550a78..6aeef139b3 100644
--- a/spec/support/shared/functional/directory_resource.rb
+++ b/spec/support/shared/functional/directory_resource.rb
@@ -48,7 +48,7 @@ shared_examples_for "a directory resource" do
expect(File).not_to exist(path)
resource.recursive(true)
- @recursive_path = File.join(path, 'red-headed-stepchild')
+ @recursive_path = File.join(path, "red-headed-stepchild")
resource.path(@recursive_path)
resource.run_action(:create)
end
@@ -133,7 +133,7 @@ shared_examples_for "a directory resource" do
context "with the recursive option" do
before do
- FileUtils.mkdir(File.join(path, 'red-headed-stepchild'))
+ FileUtils.mkdir(File.join(path, "red-headed-stepchild"))
resource.recursive(true)
resource.run_action(:delete)
end
@@ -152,7 +152,7 @@ shared_context Chef::Resource::Directory do
# deployment strategies more completely.
let(:test_file_dir) do
if windows?
- File.join(ENV['systemdrive'], "test-dir")
+ File.join(ENV["systemdrive"], "test-dir")
else
File.join(CHEF_SPEC_DATA, "test-dir")
end
diff --git a/spec/support/shared/functional/file_resource.rb b/spec/support/shared/functional/file_resource.rb
index 3ce3c9c94e..4f517b2041 100644
--- a/spec/support/shared/functional/file_resource.rb
+++ b/spec/support/shared/functional/file_resource.rb
@@ -144,7 +144,7 @@ shared_examples_for "a file with the wrong content" do
end
context "when diff is enabled" do
- describe 'sensitive attribute' do
+ describe "sensitive attribute" do
context "should be insensitive by default" do
it { expect(resource.sensitive).to(be_falsey) }
end
@@ -165,7 +165,7 @@ shared_examples_for "a file with the wrong content" do
end
it "should suppress the diff" do
- expect(resource.diff).to(include('suppressed sensitive resource'))
+ expect(resource.diff).to(include("suppressed sensitive resource"))
expect(reporter_messages[1]).to eq("suppressed sensitive resource")
end
@@ -776,7 +776,7 @@ shared_examples_for "a configured file resource" do
end
context "when the target file is a socket",:unix_only do
- require 'socket'
+ require "socket"
# It turns out that the path to a socket can have at most ~104
# bytes. Therefore we are creating our sockets in tmpdir so that
@@ -1020,14 +1020,14 @@ end
shared_context Chef::Resource::File do
if windows?
- require 'chef/win32/file'
+ require "chef/win32/file"
end
# We create the files in a different directory than tmp to exercise
# different file deployment strategies more completely.
let(:test_file_dir) do
if windows?
- File.join(ENV['systemdrive'], "test-dir")
+ File.join(ENV["systemdrive"], "test-dir")
else
File.join(CHEF_SPEC_DATA, "test-dir")
end
diff --git a/spec/support/shared/functional/http.rb b/spec/support/shared/functional/http.rb
index cfbb8e3689..7b7c17106d 100644
--- a/spec/support/shared/functional/http.rb
+++ b/spec/support/shared/functional/http.rb
@@ -22,11 +22,11 @@
module ChefHTTPShared
def nyan_uncompressed_filename
- File.join(CHEF_SPEC_DATA, 'remote_file', 'nyan_cat.png')
+ File.join(CHEF_SPEC_DATA, "remote_file", "nyan_cat.png")
end
def nyan_compressed_filename
- File.join(CHEF_SPEC_DATA, 'remote_file', 'nyan_cat.png.gz')
+ File.join(CHEF_SPEC_DATA, "remote_file", "nyan_cat.png.gz")
end
def binread(file)
@@ -60,7 +60,7 @@ module ChefHTTPShared
# this ends in .gz, we do not uncompress it and drop it on the filesystem as a .gz file (the internet often lies)
# (expected_content should be compressed)
- @api.get("/nyan_cat.png.gz", 200, nil, { 'Content-Type' => 'application/gzip', 'Content-Encoding' => 'gzip' } ) {
+ @api.get("/nyan_cat.png.gz", 200, nil, { "Content-Type" => "application/gzip", "Content-Encoding" => "gzip" } ) {
File.open(nyan_compressed_filename, "rb") do |f|
f.read
end
@@ -68,7 +68,7 @@ module ChefHTTPShared
# this is an uncompressed file that was compressed by some mod_gzip-ish webserver thingy, so we will expand it
# (expected_content should be uncompressed)
- @api.get("/nyan_cat_compressed.png", 200, nil, { 'Content-Type' => 'application/gzip', 'Content-Encoding' => 'gzip' } ) {
+ @api.get("/nyan_cat_compressed.png", 200, nil, { "Content-Type" => "application/gzip", "Content-Encoding" => "gzip" } ) {
File.open(nyan_compressed_filename, "rb") do |f|
f.read
end
@@ -81,7 +81,7 @@ module ChefHTTPShared
# (expected_content should be uncompressed)
@api.get("/nyan_cat_content_length.png", 200, nil,
{
- 'Content-Length' => nyan_uncompressed_size.to_s
+ "Content-Length" => nyan_uncompressed_size.to_s
}
) {
File.open(nyan_uncompressed_filename, "rb") do |f|
@@ -92,9 +92,9 @@ module ChefHTTPShared
# (expected_content should be uncompressed)
@api.get("/nyan_cat_content_length_compressed.png", 200, nil,
{
- 'Content-Length' => nyan_compressed_size.to_s,
- 'Content-Type' => 'application/gzip',
- 'Content-Encoding' => 'gzip',
+ "Content-Length" => nyan_compressed_size.to_s,
+ "Content-Type" => "application/gzip",
+ "Content-Encoding" => "gzip",
}
) {
File.open(nyan_compressed_filename, "rb") do |f|
@@ -109,7 +109,7 @@ module ChefHTTPShared
# (expected_content should be uncompressed)
@api.get("/nyan_cat_truncated.png", 200, nil,
{
- 'Content-Length' => (nyan_uncompressed_size + 1).to_s
+ "Content-Length" => (nyan_uncompressed_size + 1).to_s
}
) {
File.open(nyan_uncompressed_filename, "rb") do |f|
@@ -120,9 +120,9 @@ module ChefHTTPShared
# (expected_content should be uncompressed)
@api.get("/nyan_cat_truncated_compressed.png", 200, nil,
{
- 'Content-Length' => (nyan_compressed_size + 1).to_s,
- 'Content-Type' => 'application/gzip',
- 'Content-Encoding' => 'gzip',
+ "Content-Length" => (nyan_compressed_size + 1).to_s,
+ "Content-Type" => "application/gzip",
+ "Content-Encoding" => "gzip",
}
) {
File.open(nyan_compressed_filename, "rb") do |f|
@@ -137,8 +137,8 @@ module ChefHTTPShared
# (expected_content should be uncompressed)
@api.get("/nyan_cat_transfer_encoding.png", 200, nil,
{
- 'Content-Length' => (nyan_uncompressed_size + 1).to_s,
- 'Transfer-Encoding' => 'anything',
+ "Content-Length" => (nyan_uncompressed_size + 1).to_s,
+ "Transfer-Encoding" => "anything",
}
) {
File.open(nyan_uncompressed_filename, "rb") do |f|
@@ -149,19 +149,19 @@ module ChefHTTPShared
#
# 403 with a Content-Length
#
- @api.get('/forbidden', 403, 'Forbidden',
+ @api.get("/forbidden", 403, "Forbidden",
{
- 'Content-Length' => 'Forbidden'.bytesize.to_s
+ "Content-Length" => "Forbidden".bytesize.to_s
}
)
- @api.post('/posty', 200, 'Hi!')
+ @api.post("/posty", 200, "Hi!")
#
# 400 with an error
#
- @api.get('/bad_request', 400, '{ "error": [ "Your request is just terrible." ] }')
- @api.post('/bad_request', 400, '{ "error": [ "Your request is just terrible." ] }')
+ @api.get("/bad_request", 400, '{ "error": [ "Your request is just terrible." ] }')
+ @api.post("/bad_request", 400, '{ "error": [ "Your request is just terrible." ] }')
end
@@ -175,14 +175,14 @@ end
shared_examples_for "downloading all the things" do
describe "when downloading a simple uncompressed file" do
- let(:source) { 'http://localhost:9000/nyan_cat.png' }
+ let(:source) { "http://localhost:9000/nyan_cat.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
it_behaves_like "downloads requests correctly"
end
describe "when downloading a compressed file that should be left compressed" do
- let(:source) { 'http://localhost:9000/nyan_cat.png.gz' }
+ let(:source) { "http://localhost:9000/nyan_cat.png.gz" }
let(:expected_content) { binread(nyan_compressed_filename) }
# its the callers responsibility to disable_gzip when downloading a .gz url
@@ -192,57 +192,57 @@ shared_examples_for "downloading all the things" do
end
describe "when downloading a file that has been compressed by the webserver" do
- let(:source) { 'http://localhost:9000/nyan_cat_compressed.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_compressed.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
it_behaves_like "downloads requests correctly"
end
describe "when downloading an uncompressed file with a correct content_length" do
- let(:source) { 'http://localhost:9000/nyan_cat_content_length.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_content_length.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
it_behaves_like "downloads requests correctly"
end
describe "when downloading a file that has been compressed by the webserver with a correct content_length" do
- let(:source) { 'http://localhost:9000/nyan_cat_content_length_compressed.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_content_length_compressed.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
it_behaves_like "downloads requests correctly"
end
describe "when downloading an uncompressed file that is truncated" do
- let(:source) { 'http://localhost:9000/nyan_cat_truncated.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_truncated.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
it_behaves_like "validates content length and throws an exception"
end
describe "when downloading a file that has been compressed by the webserver that is truncated" do
- let(:source) { 'http://localhost:9000/nyan_cat_truncated_compressed.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_truncated_compressed.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
it_behaves_like "validates content length and throws an exception"
end
describe "when downloading a file that has transfer encoding set with a bad content length that should be ignored" do
- let(:source) { 'http://localhost:9000/nyan_cat_transfer_encoding.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_transfer_encoding.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
it_behaves_like "downloads requests correctly"
end
describe "when downloading an endpoint that 403s" do
- let(:source) { 'http://localhost:9000/forbidden' }
+ let(:source) { "http://localhost:9000/forbidden" }
it_behaves_like "an endpoint that 403s"
end
describe "when downloading an endpoint that 403s" do
- let(:source) { 'http://localhost:9000/nyan_cat_content_length_compressed.png' }
+ let(:source) { "http://localhost:9000/nyan_cat_content_length_compressed.png" }
let(:expected_content) { binread(nyan_uncompressed_filename) }
- let(:source2) { 'http://localhost:9000/forbidden' }
+ let(:source2) { "http://localhost:9000/forbidden" }
it_behaves_like "a 403 after a successful request when reusing the request object"
end
diff --git a/spec/support/shared/functional/securable_resource.rb b/spec/support/shared/functional/securable_resource.rb
index 1e8edec9ae..453f7e2f45 100644
--- a/spec/support/shared/functional/securable_resource.rb
+++ b/spec/support/shared/functional/securable_resource.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'etc'
-require 'functional/resource/base'
+require "etc"
+require "functional/resource/base"
shared_context "setup correct permissions" do
if windows?
@@ -38,9 +38,9 @@ shared_context "setup correct permissions" do
# Root only context.
before :each, :unix_only, :requires_root do
if ohai[:platform] == "aix"
- File.chown(Etc.getpwnam('guest').uid, 1337, path)
+ File.chown(Etc.getpwnam("guest").uid, 1337, path)
else
- File.chown(Etc.getpwnam('nobody').uid, 1337, path)
+ File.chown(Etc.getpwnam("nobody").uid, 1337, path)
end
end
@@ -155,9 +155,9 @@ shared_examples_for "a securable resource with existing target" do
context "on Unix", :unix_only do
if ohai[:platform] == "aix"
- let(:expected_user_name) { 'guest' }
+ let(:expected_user_name) { "guest" }
else
- let(:expected_user_name) { 'nobody' }
+ let(:expected_user_name) { "nobody" }
end
let(:expected_uid) { Etc.getpwnam(expected_user_name).uid }
let(:desired_gid) { 1337 }
@@ -197,7 +197,7 @@ shared_examples_for "a securable resource with existing target" do
describe "when setting the permissions from octal given as a String" do
before do
- @mode_string = '776'
+ @mode_string = "776"
resource.mode @mode_string
resource.run_action(:create)
end
@@ -258,7 +258,7 @@ shared_examples_for "a securable resource with existing target" do
describe "when setting group" do
before do
- resource.group('Administrators')
+ resource.group("Administrators")
resource.run_action(:create)
end
@@ -273,8 +273,8 @@ shared_examples_for "a securable resource with existing target" do
describe "when setting rights and deny_rights" do
before do
- resource.deny_rights(:modify, 'Guest')
- resource.rights(:read, 'Guest')
+ resource.deny_rights(:modify, "Guest")
+ resource.rights(:read, "Guest")
resource.run_action(:create)
end
@@ -303,7 +303,7 @@ shared_examples_for "a securable resource without existing target" do
end
it "sets owner when owner is specified" do
- resource.owner 'Guest'
+ resource.owner "Guest"
resource.run_action(:create)
expect(descriptor.owner).to eq(SID.Guest)
end
@@ -322,7 +322,7 @@ shared_examples_for "a securable resource without existing target" do
arbitrary_non_default_owner = SID.Guest
expect(arbitrary_non_default_owner).not_to eq(SID.default_security_object_owner)
- resource.owner 'Guest' # Change to arbitrary_non_default_owner once issue #1508 is fixed
+ resource.owner "Guest" # Change to arbitrary_non_default_owner once issue #1508 is fixed
resource.run_action(:create)
expect(descriptor.owner).to eq(arbitrary_non_default_owner)
@@ -340,7 +340,7 @@ shared_examples_for "a securable resource without existing target" do
end
it "sets group when group is specified" do
- resource.group 'Everyone'
+ resource.group "Everyone"
resource.run_action(:create)
expect(descriptor.group).to eq(SID.Everyone)
end
@@ -353,7 +353,7 @@ shared_examples_for "a securable resource without existing target" do
arbitrary_non_default_group = SID.Everyone
expect(arbitrary_non_default_group).not_to eq(SID.default_security_object_group)
- resource.group 'Everyone' # Change to arbitrary_non_default_group once issue #1508 is fixed
+ resource.group "Everyone" # Change to arbitrary_non_default_group once issue #1508 is fixed
resource.run_action(:create)
expect(descriptor.group).to eq(arbitrary_non_default_group)
@@ -366,45 +366,45 @@ shared_examples_for "a securable resource without existing target" do
describe "with rights and deny_rights attributes" do
it "correctly sets :read rights" do
- resource.rights(:read, 'Guest')
+ resource.rights(:read, "Guest")
resource.run_action(:create)
expect(explicit_aces).to eq(allowed_acl(SID.Guest, expected_read_perms))
end
it "correctly sets :read_execute rights" do
- resource.rights(:read_execute, 'Guest')
+ resource.rights(:read_execute, "Guest")
resource.run_action(:create)
expect(explicit_aces).to eq(allowed_acl(SID.Guest, expected_read_execute_perms))
end
it "correctly sets :write rights" do
- resource.rights(:write, 'Guest')
+ resource.rights(:write, "Guest")
resource.run_action(:create)
expect(explicit_aces).to eq(allowed_acl(SID.Guest, expected_write_perms))
end
it "correctly sets :modify rights" do
- resource.rights(:modify, 'Guest')
+ resource.rights(:modify, "Guest")
resource.run_action(:create)
expect(explicit_aces).to eq(allowed_acl(SID.Guest, expected_modify_perms))
end
it "correctly sets :full_control rights" do
- resource.rights(:full_control, 'Guest')
+ resource.rights(:full_control, "Guest")
resource.run_action(:create)
expect(explicit_aces).to eq(allowed_acl(SID.Guest, expected_full_control_perms))
end
it "correctly sets deny_rights" do
# deny is an ACE with full rights, but is a deny type ace, not an allow type
- resource.deny_rights(:full_control, 'Guest')
+ resource.deny_rights(:full_control, "Guest")
resource.run_action(:create)
expect(explicit_aces).to eq(denied_acl(SID.Guest, expected_full_control_perms))
end
it "Sets multiple rights" do
- resource.rights(:read, 'Everyone')
- resource.rights(:modify, 'Guest')
+ resource.rights(:read, "Everyone")
+ resource.rights(:modify, "Guest")
resource.run_action(:create)
expect(explicit_aces).to eq(
@@ -414,8 +414,8 @@ shared_examples_for "a securable resource without existing target" do
end
it "Sets deny_rights ahead of rights" do
- resource.rights(:read, 'Everyone')
- resource.deny_rights(:modify, 'Guest')
+ resource.rights(:read, "Everyone")
+ resource.deny_rights(:modify, "Guest")
resource.run_action(:create)
expect(explicit_aces).to eq(
@@ -425,8 +425,8 @@ shared_examples_for "a securable resource without existing target" do
end
it "Sets deny_rights ahead of rights when specified in reverse order" do
- resource.deny_rights(:modify, 'Guest')
- resource.rights(:read, 'Everyone')
+ resource.deny_rights(:modify, "Guest")
+ resource.rights(:read, "Everyone")
resource.run_action(:create)
expect(explicit_aces).to eq(
@@ -445,9 +445,9 @@ shared_examples_for "a securable resource without existing target" do
it "respects mode in string form as an octal number" do
#on windows, mode cannot modify owner and/or group permissons
#unless the owner and/or group as appropriate is specified
- resource.mode '400'
- resource.owner 'Guest'
- resource.group 'Everyone'
+ resource.mode "400"
+ resource.owner "Guest"
+ resource.group "Everyone"
resource.run_action(:create)
expect(explicit_aces).to eq([ ACE.access_allowed(SID.Guest, Security::FILE_GENERIC_READ) ])
@@ -455,7 +455,7 @@ shared_examples_for "a securable resource without existing target" do
it "respects mode in numeric form as a ruby-interpreted octal" do
resource.mode 0700
- resource.owner 'Guest'
+ resource.owner "Guest"
resource.run_action(:create)
expect(explicit_aces).to eq([ ACE.access_allowed(SID.Guest, Security::FILE_GENERIC_READ | Security::FILE_GENERIC_WRITE | Security::FILE_GENERIC_EXECUTE | Security::DELETE) ])
@@ -463,8 +463,8 @@ shared_examples_for "a securable resource without existing target" do
it "respects the owner, group and everyone bits of mode" do
resource.mode 0754
- resource.owner 'Guest'
- resource.group 'Administrators'
+ resource.owner "Guest"
+ resource.group "Administrators"
resource.run_action(:create)
expect(explicit_aces).to eq([
@@ -476,8 +476,8 @@ shared_examples_for "a securable resource without existing target" do
it "respects the individual read, write and execute bits of mode" do
resource.mode 0421
- resource.owner 'Guest'
- resource.group 'Administrators'
+ resource.owner "Guest"
+ resource.group "Administrators"
resource.run_action(:create)
expect(explicit_aces).to eq([
@@ -487,7 +487,7 @@ shared_examples_for "a securable resource without existing target" do
])
end
- it 'warns when mode tries to set owner bits but owner is not specified' do
+ it "warns when mode tries to set owner bits but owner is not specified" do
@warn = []
allow(Chef::Log).to receive(:warn) { |msg| @warn << msg }
@@ -497,7 +497,7 @@ shared_examples_for "a securable resource without existing target" do
expect(@warn.include?("Mode 400 includes bits for the owner, but owner is not specified")).to be_truthy
end
- it 'warns when mode tries to set group bits but group is not specified' do
+ it "warns when mode tries to set group bits but group is not specified" do
@warn = []
allow(Chef::Log).to receive(:warn) { |msg| @warn << msg }
@@ -511,7 +511,7 @@ shared_examples_for "a securable resource without existing target" do
it "does not inherit aces if inherits is set to false" do
# We need at least one ACE if we're creating a securable without
# inheritance
- resource.rights(:full_control, 'Administrators')
+ resource.rights(:full_control, "Administrators")
resource.inherits(false)
resource.run_action(:create)
diff --git a/spec/support/shared/functional/securable_resource_with_reporting.rb b/spec/support/shared/functional/securable_resource_with_reporting.rb
index 3176ebba0d..c9b5bae465 100644
--- a/spec/support/shared/functional/securable_resource_with_reporting.rb
+++ b/spec/support/shared/functional/securable_resource_with_reporting.rb
@@ -1,5 +1,5 @@
-require 'functional/resource/base'
+require "functional/resource/base"
ALL_EXPANDED_PERMISSIONS = ["generic read",
"generic write",
@@ -76,9 +76,9 @@ shared_examples_for "a securable resource with reporting" do
# TODO/bug: duplicated from the "securable resource" tests
if ohai[:platform] == "aix"
- let(:expected_user_name) { 'guest' }
+ let(:expected_user_name) { "guest" }
else
- let(:expected_user_name) { 'nobody' }
+ let(:expected_user_name) { "nobody" }
end
before do
@@ -96,9 +96,9 @@ shared_examples_for "a securable resource with reporting" do
# TODO: duplicated from "securable resource"
if ohai[:platform] == "aix"
- let(:expected_user_name) { 'guest' }
+ let(:expected_user_name) { "guest" }
else
- let(:expected_user_name) { 'nobody' }
+ let(:expected_user_name) { "nobody" }
end
let(:expected_uid) { Etc.getpwnam(expected_user_name).uid }
let(:desired_gid) { 1337 }
@@ -303,7 +303,7 @@ shared_examples_for "a securable resource with reporting" do
context "and owner is specified with a string (username) in new_resource" do
# TODO/bug: duplicated from the "securable resource" tests
- let(:expected_user_name) { 'Guest' }
+ let(:expected_user_name) { "Guest" }
before do
resource.owner(expected_user_name)
diff --git a/spec/support/shared/functional/win32_service.rb b/spec/support/shared/functional/win32_service.rb
index 8eca7a47fa..5bd2d772cb 100644
--- a/spec/support/shared/functional/win32_service.rb
+++ b/spec/support/shared/functional/win32_service.rb
@@ -1,5 +1,5 @@
-require 'chef/application/windows_service_manager'
+require "chef/application/windows_service_manager"
shared_context "using Win32::Service" do
# Some helper methods.
@@ -46,7 +46,7 @@ shared_context "using Win32::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')),
+ :service_file_path => File.expand_path(File.join(File.dirname(__FILE__), "../../platforms/win32/spec_service.rb")),
:delayed_start => true,
}
}
diff --git a/spec/support/shared/functional/windows_script.rb b/spec/support/shared/functional/windows_script.rb
index d84c06c86b..423d968ea5 100644
--- a/spec/support/shared/functional/windows_script.rb
+++ b/spec/support/shared/functional/windows_script.rb
@@ -19,7 +19,7 @@
# Shared context used by both Powershell and Batch script provider
# tests.
-require 'chef/platform/query_helpers'
+require "chef/platform/query_helpers"
shared_context Chef::Resource::WindowsScript do
before(:all) do
@@ -56,11 +56,11 @@ shared_context Chef::Resource::WindowsScript do
if resource_architecture
expected_architecture = resource_architecture
else
- expected_architecture = @ohai_reader.data['kernel']['machine'].to_sym
+ expected_architecture = @ohai_reader.data["kernel"]["machine"].to_sym
end
end
let(:expected_architecture_output) do
- expected_architecture == :i386 ? 'X86' : 'AMD64'
+ expected_architecture == :i386 ? "X86" : "AMD64"
end
let(:guard_script_suffix) do
"guard"
@@ -99,7 +99,7 @@ shared_context Chef::Resource::WindowsScript do
it "executes a 64-bit guard", :windows64_only do
resource.only_if resource_guard_command, :architecture => guard_architecture
resource.run_action(:run)
- expect(get_guard_process_architecture).to eq('amd64')
+ expect(get_guard_process_architecture).to eq("amd64")
end
end
@@ -108,7 +108,7 @@ shared_context Chef::Resource::WindowsScript do
it "executes a 32-bit guard" do
resource.only_if resource_guard_command, :architecture => guard_architecture
resource.run_action(:run)
- expect(get_guard_process_architecture).to eq('x86')
+ expect(get_guard_process_architecture).to eq("x86")
end
end
@@ -138,8 +138,8 @@ shared_context Chef::Resource::WindowsScript do
before(:each) do
@dir = Dir.mktmpdir("Jerry Smith")
@original_env = ENV.to_hash.dup
- ENV.delete('TMP')
- ENV['TMP'] = @dir
+ ENV.delete("TMP")
+ ENV["TMP"] = @dir
end
after(:each) do
@@ -183,7 +183,7 @@ shared_context Chef::Resource::WindowsScript do
end
end
- def get_windows_script_output(suffix = '')
+ def get_windows_script_output(suffix = "")
File.read("#{script_output_path}#{suffix}")
end
@@ -195,7 +195,7 @@ shared_context Chef::Resource::WindowsScript do
get_process_architecture(guard_script_suffix)
end
- def get_process_architecture(suffix = '')
+ def get_process_architecture(suffix = "")
get_windows_script_output(suffix).strip.downcase
end
diff --git a/spec/support/shared/integration/app_server_support.rb b/spec/support/shared/integration/app_server_support.rb
index a133833d3e..da32a477fd 100644
--- a/spec/support/shared/integration/app_server_support.rb
+++ b/spec/support/shared/integration/app_server_support.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'rack'
-require 'stringio'
+require "rack"
+require "stringio"
module AppServerSupport
def start_app_server(app, port)
diff --git a/spec/support/shared/integration/integration_helper.rb b/spec/support/shared/integration/integration_helper.rb
index 7d62a698d8..a19c9b35e7 100644
--- a/spec/support/shared/integration/integration_helper.rb
+++ b/spec/support/shared/integration/integration_helper.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'tmpdir'
-require 'fileutils'
-require 'chef/config'
-require 'chef/json_compat'
-require 'chef/server_api'
-require 'support/shared/integration/knife_support'
-require 'support/shared/integration/app_server_support'
-require 'cheffish/rspec/chef_run_support'
-require 'spec_helper'
+require "tmpdir"
+require "fileutils"
+require "chef/config"
+require "chef/json_compat"
+require "chef/server_api"
+require "support/shared/integration/knife_support"
+require "support/shared/integration/app_server_support"
+require "cheffish/rspec/chef_run_support"
+require "spec_helper"
module Cheffish
class BasicChefClient
@@ -75,8 +75,8 @@ module IntegrationSupport
def file(relative_path, contents)
filename = path_to(relative_path)
dir = File.dirname(filename)
- FileUtils.mkdir_p(dir) unless dir == '.'
- File.open(filename, 'w') do |file|
+ FileUtils.mkdir_p(dir) unless dir == "."
+ File.open(filename, "w") do |file|
raw = case contents
when Hash, Array
Chef::JSONCompat.to_json_pretty(contents)
@@ -90,7 +90,7 @@ module IntegrationSupport
def symlink(relative_path, relative_dest)
filename = path_to(relative_path)
dir = File.dirname(filename)
- FileUtils.mkdir_p(dir) unless dir == '.'
+ FileUtils.mkdir_p(dir) unless dir == "."
dest_filename = path_to(relative_dest)
File.symlink(dest_filename, filename)
end
@@ -111,7 +111,7 @@ module IntegrationSupport
RSpec.shared_context "with a chef repo" do
before :each do
raise "Can only create one directory per test" if @repository_dir
- @repository_dir = Dir.mktmpdir('chef_repo')
+ @repository_dir = Dir.mktmpdir("chef_repo")
Chef::Config.chef_repo_path = @repository_dir
%w(client cookbook data_bag environment node role user).each do |object_name|
Chef::Config.delete("#{object_name}_path".to_sym)
@@ -140,7 +140,7 @@ 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
diff --git a/spec/support/shared/integration/knife_support.rb b/spec/support/shared/integration/knife_support.rb
index fb624bca8b..0a8b855222 100644
--- a/spec/support/shared/integration/knife_support.rb
+++ b/spec/support/shared/integration/knife_support.rb
@@ -15,14 +15,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/config'
-require 'chef/knife'
-require 'chef/application/knife'
-require 'logger'
-require 'chef/log'
+require "chef/config"
+require "chef/knife"
+require "chef/application/knife"
+require "logger"
+require "chef/log"
module KnifeSupport
- DEBUG = ENV['DEBUG']
+ DEBUG = ENV["DEBUG"]
def knife(*args, &block)
# Allow knife('role from file roles/blah.json') rather than requiring the
# arguments to be split like knife('role', 'from', 'file', 'roles/blah.json')
@@ -37,7 +37,7 @@ module KnifeSupport
Chef::Config[:concurrency] = 1
# Work on machines where we can't access /var
- checksums_cache_dir = Dir.mktmpdir('checksums') do |checksums_cache_dir|
+ checksums_cache_dir = Dir.mktmpdir("checksums") do |checksums_cache_dir|
Chef::Config[:cache_options] = {
:path => checksums_cache_dir,
:skip_expires => true,
@@ -146,11 +146,11 @@ module KnifeSupport
private
def should_result_in(expected)
- expected[:stdout] = '' if !expected[:stdout]
- expected[:stderr] = '' if !expected[:stderr]
+ expected[:stdout] = "" if !expected[:stdout]
+ expected[:stderr] = "" if !expected[:stderr]
expected[:exit_code] = 0 if !expected[:exit_code]
# TODO make this go away
- stderr_actual = @stderr.sub(/^WARNING: No knife configuration file found\n/, '')
+ stderr_actual = @stderr.sub(/^WARNING: No knife configuration file found\n/, "")
if expected[:stderr].is_a?(Regexp)
expect(stderr_actual).to match(expected[:stderr])
diff --git a/spec/support/shared/matchers/exit_with_code.rb b/spec/support/shared/matchers/exit_with_code.rb
index 32ebf8db15..cf1825f2ed 100644
--- a/spec/support/shared/matchers/exit_with_code.rb
+++ b/spec/support/shared/matchers/exit_with_code.rb
@@ -1,4 +1,4 @@
-require 'rspec/expectations'
+require "rspec/expectations"
# Lifted from http://stackoverflow.com/questions/1480537/how-can-i-validate-exits-and-aborts-in-rspec
RSpec::Matchers.define :exit_with_code do |exp_code|
diff --git a/spec/support/shared/matchers/match_environment_variable.rb b/spec/support/shared/matchers/match_environment_variable.rb
index c8c905f44a..393775ea29 100644
--- a/spec/support/shared/matchers/match_environment_variable.rb
+++ b/spec/support/shared/matchers/match_environment_variable.rb
@@ -1,6 +1,6 @@
-require 'rspec/expectations'
-require 'spec/support/platform_helpers'
+require "rspec/expectations"
+require "spec/support/platform_helpers"
RSpec::Matchers.define :match_environment_variable do |varname|
match do |actual|
diff --git a/spec/support/shared/unit/api_versioning.rb b/spec/support/shared/unit/api_versioning.rb
index ccbe95d029..261efc6f52 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" }
@@ -55,7 +55,7 @@ shared_examples_for "user and client reregister" do
context "when the exception is 406 and returns x-ops-server-api-version header" do
before do
allow(rest_v0).to receive(:put).and_raise(exception_406)
- allow(response_406).to receive(:[]).with('x-ops-server-api-version').and_return(Chef::JSONCompat.to_json(return_hash_406))
+ allow(response_406).to receive(:[]).with("x-ops-server-api-version").and_return(Chef::JSONCompat.to_json(return_hash_406))
end
it "raises an error about only V0 being supported" do
diff --git a/spec/support/shared/unit/execute_resource.rb b/spec/support/shared/unit/execute_resource.rb
index 3a88ff8890..e5bcbd5e91 100644
--- a/spec/support/shared/unit/execute_resource.rb
+++ b/spec/support/shared/unit/execute_resource.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
shared_examples_for "an execute resource" do
diff --git a/spec/support/shared/unit/file_system_support.rb b/spec/support/shared/unit/file_system_support.rb
index 3aee46fc7f..f071cffee3 100644
--- a/spec/support/shared/unit/file_system_support.rb
+++ b/spec/support/shared/unit/file_system_support.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/chef_fs/file_system'
-require 'chef/chef_fs/file_system/memory/memory_root'
-require 'chef/chef_fs/file_system/memory/memory_dir'
-require 'chef/chef_fs/file_system/memory/memory_file'
+require "chef/chef_fs/file_system"
+require "chef/chef_fs/file_system/memory/memory_root"
+require "chef/chef_fs/file_system/memory/memory_dir"
+require "chef/chef_fs/file_system/memory/memory_file"
module FileSystemSupport
def memory_fs(pretty_name, value, cannot_be_in_regex = nil)
@@ -33,7 +33,7 @@ module FileSystemSupport
dir
end
- def memory_fs_value(value, name = '', parent = nil)
+ def memory_fs_value(value, name = "", parent = nil)
if value.is_a?(Hash)
dir = Chef::ChefFS::FileSystem::Memory::MemoryDir.new(name, parent)
value.each do |key, child|
diff --git a/spec/support/shared/unit/platform_introspector.rb b/spec/support/shared/unit/platform_introspector.rb
index 52a780eb10..51a2befdbb 100644
--- a/spec/support/shared/unit/platform_introspector.rb
+++ b/spec/support/shared/unit/platform_introspector.rb
@@ -30,10 +30,10 @@ shared_examples_for "a platform introspector" do
@platform_hash["debian"] = {["5", "6"] => "debian-5/6", "default" => "debian"}
@platform_hash["default"] = "default"
# The following @platform_hash keys are used for testing version constraints
- @platform_hash['exact_match'] = { '1.2.3' => 'exact', '>= 1.0' => 'not exact'}
- @platform_hash['multiple_matches'] = { '~> 2.3.4' => 'matched ~> 2.3.4', '>= 2.3' => 'matched >=2.3' }
- @platform_hash['invalid_cookbook_version'] = {'>= 21' => 'Matches a single number'}
- @platform_hash['successful_matches'] = { '< 3.0' => 'matched < 3.0', '>= 3.0' => 'matched >= 3.0' }
+ @platform_hash["exact_match"] = { "1.2.3" => "exact", ">= 1.0" => "not exact"}
+ @platform_hash["multiple_matches"] = { "~> 2.3.4" => "matched ~> 2.3.4", ">= 2.3" => "matched >=2.3" }
+ @platform_hash["invalid_cookbook_version"] = {">= 21" => "Matches a single number"}
+ @platform_hash["successful_matches"] = { "< 3.0" => "matched < 3.0", ">= 3.0" => "matched >= 3.0" }
@platform_family_hash = {
"debian" => "debian value",
@@ -84,28 +84,28 @@ shared_examples_for "a platform introspector" do
expect(platform_introspector.value_for_platform(@platform_hash)).to eq("openbsd")
end
- it 'returns the exact match' do
- node.automatic_attrs[:platform] = 'exact_match'
- node.automatic_attrs[:platform_version] = '1.2.3'
- expect(platform_introspector.value_for_platform(@platform_hash)).to eq('exact')
+ it "returns the exact match" do
+ node.automatic_attrs[:platform] = "exact_match"
+ node.automatic_attrs[:platform_version] = "1.2.3"
+ expect(platform_introspector.value_for_platform(@platform_hash)).to eq("exact")
end
- it 'raises RuntimeError' do
- node.automatic_attrs[:platform] = 'multiple_matches'
- node.automatic_attrs[:platform_version] = '2.3.4'
+ it "raises RuntimeError" do
+ node.automatic_attrs[:platform] = "multiple_matches"
+ node.automatic_attrs[:platform_version] = "2.3.4"
expect {platform_introspector.value_for_platform(@platform_hash)}.to raise_error(RuntimeError)
end
- it 'should not require .0 to match >= 21.0' do
- node.automatic_attrs[:platform] = 'invalid_cookbook_version'
- node.automatic_attrs[:platform_version] = '21'
- expect(platform_introspector.value_for_platform(@platform_hash)).to eq('Matches a single number')
+ it "should not require .0 to match >= 21.0" do
+ node.automatic_attrs[:platform] = "invalid_cookbook_version"
+ node.automatic_attrs[:platform_version] = "21"
+ expect(platform_introspector.value_for_platform(@platform_hash)).to eq("Matches a single number")
end
- it 'should return the value for that match' do
- node.automatic_attrs[:platform] = 'successful_matches'
- node.automatic_attrs[:platform_version] = '2.9'
- expect(platform_introspector.value_for_platform(@platform_hash)).to eq('matched < 3.0')
+ it "should return the value for that match" do
+ node.automatic_attrs[:platform] = "successful_matches"
+ node.automatic_attrs[:platform_version] = "2.9"
+ expect(platform_introspector.value_for_platform(@platform_hash)).to eq("matched < 3.0")
end
describe "when platform versions is an array" do
@@ -125,17 +125,17 @@ shared_examples_for "a platform introspector" do
describe "when checking platform?" do
it "returns true if the node is a provided platform and platforms are provided as symbols" do
- node.automatic_attrs[:platform] = 'ubuntu'
+ node.automatic_attrs[:platform] = "ubuntu"
expect(platform_introspector.platform?([:redhat, :ubuntu])).to eq(true)
end
it "returns true if the node is a provided platform and platforms are provided as strings" do
- node.automatic_attrs[:platform] = 'ubuntu'
+ node.automatic_attrs[:platform] = "ubuntu"
expect(platform_introspector.platform?(["redhat", "ubuntu"])).to eq(true)
end
it "returns false if the node is not of the provided platforms" do
- node.automatic_attrs[:platform] = 'ubuntu'
+ node.automatic_attrs[:platform] = "ubuntu"
expect(platform_introspector.platform?(:splatlinux)).to eq(false)
end
end
@@ -143,17 +143,17 @@ shared_examples_for "a platform introspector" do
describe "when checking platform_family?" do
it "returns true if the node is in a provided platform family and families are provided as symbols" do
- node.automatic_attrs[:platform_family] = 'debian'
+ node.automatic_attrs[:platform_family] = "debian"
expect(platform_introspector.platform_family?([:rhel, :debian])).to eq(true)
end
it "returns true if the node is a provided platform and platforms are provided as strings" do
- node.automatic_attrs[:platform_family] = 'rhel'
+ node.automatic_attrs[:platform_family] = "rhel"
expect(platform_introspector.platform_family?(["rhel", "debian"])).to eq(true)
end
it "returns false if the node is not of the provided platforms" do
- node.automatic_attrs[:platform_family] = 'suse'
+ node.automatic_attrs[:platform_family] = "suse"
expect(platform_introspector.platform_family?(:splatlinux)).to eq(false)
end
@@ -176,13 +176,13 @@ shared_examples_for "a platform introspector" do
it "returns the correct default for a given platform" do
node.automatic_attrs[:platform] = "debian"
- node.automatic_attrs[:platform_version] = '9000'
+ node.automatic_attrs[:platform_version] = "9000"
expect(platform_introspector.value_for_platform(@platform_hash)).to eq([ :restart, :reload, :status ])
end
it "returns the correct platform+version specific value " do
node.automatic_attrs[:platform] = "debian"
- node.automatic_attrs[:platform_version] = '4.0'
+ node.automatic_attrs[:platform_version] = "4.0"
expect(platform_introspector.value_for_platform(@platform_hash)).to eq([:restart, :reload])
end
end
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb
index 973cb047f7..82260b07df 100644
--- a/spec/support/shared/unit/provider/file.rb
+++ b/spec/support/shared/unit/provider/file.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tmpdir'
+require "spec_helper"
+require "tmpdir"
if windows?
- require 'chef/win32/file'
+ require "chef/win32/file"
end
# Filesystem stubs
@@ -37,7 +37,7 @@ end
# forwards-vs-reverse slashes on windows sucks
def windows_path
- windows? ? normalized_path.gsub(/\\/, '/') : normalized_path
+ windows? ? normalized_path.gsub(/\\/, "/") : normalized_path
end
# this is all getting a bit stupid, CHEF-4802 cut to remove all this
@@ -460,7 +460,7 @@ shared_examples_for Chef::Provider::File do
before { setup_normal_file }
let(:tempfile) {
- 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
}
@@ -507,7 +507,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
@@ -520,7 +520,7 @@ 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'],
+ 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)
@@ -584,13 +584,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
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
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 60b048975a..07fe1f772b 100644
--- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb
+++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
@@ -60,14 +60,14 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
it "should set the option for #{attribute} if the new resources #{attribute} is not nil" do
allow(@new_resource).to receive(attribute).and_return("hola")
- expect(provider.universal_options).to eql([option, 'hola'])
+ expect(provider.universal_options).to eql([option, "hola"])
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(attribute).and_return("hola")
- expect(provider.universal_options).to eql([option, 'hola'])
+ expect(provider.universal_options).to eql([option, "hola"])
end
it "should set the option for #{attribute} if the new resources #{attribute} is not nil, without homedir management (using real attributes)" do
@@ -75,7 +75,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
allow(@new_resource).to receive(:non_unique).and_return(false)
allow(@new_resource).to receive(:non_unique).and_return(false)
allow(@new_resource).to receive(attribute).and_return("hola")
- expect(provider.universal_options).to eql([option, 'hola'])
+ expect(provider.universal_options).to eql([option, "hola"])
end
end
@@ -83,7 +83,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
combined_opts = []
supported_useradd_options.sort{ |a,b| a[0] <=> b[0] }.each do |attribute, option|
allow(@new_resource).to receive(attribute).and_return("hola")
- combined_opts << option << 'hola'
+ combined_opts << option << "hola"
end
expect(provider.universal_options).to eql(combined_opts)
end
@@ -156,17 +156,17 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
provider.current_resource = @current_resource
provider.new_resource.manage_home true
provider.new_resource.home "/Users/mud"
- provider.new_resource.gid '23'
+ provider.new_resource.gid "23"
end
it "runs useradd with the computed command options" do
command = ["useradd",
- "-c", 'Adam Jacob',
- "-g", '23' ]
- command.concat(["-p", 'abracadabra']) if supported_useradd_options.key?("password")
- command.concat([ "-s", '/usr/bin/zsh',
- "-u", '1000',
- "-d", '/Users/mud',
+ "-c", "Adam Jacob",
+ "-g", "23" ]
+ command.concat(["-p", "abracadabra"]) if supported_useradd_options.key?("password")
+ command.concat([ "-s", "/usr/bin/zsh",
+ "-u", "1000",
+ "-d", "/Users/mud",
"-m",
"adam" ])
expect(provider).to receive(:shell_out!).with(*command).and_return(true)
@@ -183,11 +183,11 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
it "should not include -m or -d in the command options" do
command = ["useradd",
- "-c", 'Adam Jacob',
- "-g", '23']
- command.concat(["-p", 'abracadabra']) if supported_useradd_options.key?("password")
- command.concat([ "-s", '/usr/bin/zsh',
- "-u", '1000',
+ "-c", "Adam Jacob",
+ "-g", "23"]
+ command.concat(["-p", "abracadabra"]) if supported_useradd_options.key?("password")
+ command.concat([ "-s", "/usr/bin/zsh",
+ "-u", "1000",
"-r",
"adam" ])
expect(provider).to receive(:shell_out!).with(*command).and_return(true)
@@ -202,15 +202,15 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
before(:each) do
provider.new_resource.manage_home true
provider.new_resource.home "/Users/mud"
- provider.new_resource.gid '23'
+ provider.new_resource.gid "23"
end
# CHEF-3423, -m must come before the username
# CHEF-4305, -d must come before -m to support CentOS/RHEL 5
it "runs usermod with the computed command options" do
command = ["usermod",
- "-g", '23',
- "-d", '/Users/mud',
+ "-g", "23",
+ "-d", "/Users/mud",
"-m",
"adam" ]
expect(provider).to receive(:shell_out!).with(*command).and_return(true)
@@ -220,8 +220,8 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
it "does not set the -r option to usermod" do
@new_resource.system(true)
command = ["usermod",
- "-g", '23',
- "-d", '/Users/mud',
+ "-g", "23",
+ "-d", "/Users/mud",
"-m",
"adam" ]
expect(provider).to receive(:shell_out!).with(*command).and_return(true)
@@ -231,7 +231,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
it "CHEF-3429: does not set -m if we aren't changing the home directory" do
expect(provider).to receive(:updating_home?).and_return(false)
command = ["usermod",
- "-g", '23',
+ "-g", "23",
"adam" ]
expect(provider).to receive(:shell_out!).with(*command).and_return(true)
provider.manage_user
@@ -307,7 +307,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
end
it "should raise a Chef::Exceptions::User if passwd -S fails on anything other than redhat/centos" do
- @node.automatic_attrs[:platform] = 'ubuntu'
+ @node.automatic_attrs[:platform] = "ubuntu"
expect(provider).to receive(:shell_out!).
with("passwd", "-S", @new_resource.username, {:returns=>[0, 1]}).
and_return(passwd_s_status)
@@ -315,7 +315,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
expect { provider.check_lock }.to raise_error(Chef::Exceptions::User)
end
- ['redhat', 'centos'].each do |os|
+ ["redhat", "centos"].each do |os|
it "should not raise a Chef::Exceptions::User if passwd -S exits with 1 on #{os} and the passwd package is version 0.73-1" do
@node.automatic_attrs[:platform] = os
expect(passwd_s_status).to receive(:exitstatus).and_return(1)
diff --git a/spec/support/shared/unit/script_resource.rb b/spec/support/shared/unit/script_resource.rb
index 18ee94606e..60967f30a3 100644
--- a/spec/support/shared/unit/script_resource.rb
+++ b/spec/support/shared/unit/script_resource.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
shared_examples_for "a script resource" do
@@ -49,18 +49,18 @@ shared_examples_for "a script resource" do
end
it "should raise an exception if users set command on the resource", :chef_gte_13_only do
- expect { script_resource.command('foo') }.to raise_error(Chef::Exceptions::Script)
+ expect { script_resource.command("foo") }.to raise_error(Chef::Exceptions::Script)
end
it "should not raise an exception if users set command on the resource", :chef_lt_13_only do
- expect { script_resource.command('foo') }.not_to raise_error
+ expect { script_resource.command("foo") }.not_to raise_error
end
describe "when executing guards" do
let(:resource) {
resource = script_resource
resource.run_context = run_context
- resource.code 'echo hi'
+ resource.code "echo hi"
resource
}
let(:node) {
@@ -83,7 +83,7 @@ shared_examples_for "a script resource" do
expect_any_instance_of(Chef::Resource::Conditional).not_to receive(:evaluate_block)
expect_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).not_to receive(:evaluate_action)
expect_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).to receive(:evaluate).and_return(true)
- resource.only_if 'echo hi'
+ resource.only_if "echo hi"
expect(resource.should_skip?(:run)).to eq(nil)
end
@@ -91,7 +91,7 @@ shared_examples_for "a script resource" do
expect_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).not_to receive(:evaluate)
expect_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:evaluate_action).and_return(true)
resource.guard_interpreter :script
- resource.only_if 'echo hi'
+ resource.only_if "echo hi"
expect(resource.should_skip?(:run)).to eq(nil)
end
end
diff --git a/spec/support/shared/unit/windows_script_resource.rb b/spec/support/shared/unit/windows_script_resource.rb
index a2fc884ff2..f32cdc6e50 100644
--- a/spec/support/shared/unit/windows_script_resource.rb
+++ b/spec/support/shared/unit/windows_script_resource.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'support/shared/unit/execute_resource'
-require 'support/shared/unit/script_resource'
+require "support/shared/unit/execute_resource"
+require "support/shared/unit/script_resource"
shared_examples_for "a Windows script resource" do
before(:each) do
@@ -51,7 +51,7 @@ shared_examples_for "a Windows script resource" do
it "should use a resource to evaluate the guard when guard_interpreter is not specified" do
expect_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:evaluate_action).and_return(true)
expect_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).not_to receive(:evaluate)
- @resource.only_if 'echo hi'
+ @resource.only_if "echo hi"
expect(@resource.should_skip?(:run)).to eq(nil)
end
diff --git a/spec/tiny_server.rb b/spec/tiny_server.rb
index ec2a11fe43..8ad9d2695f 100644
--- a/spec/tiny_server.rb
+++ b/spec/tiny_server.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'rubygems'
-require 'webrick'
-require 'webrick/https'
-require 'rack'
+require "rubygems"
+require "webrick"
+require "webrick/https"
+require "rack"
#require 'thin'
-require 'singleton'
-require 'open-uri'
-require 'chef/config'
+require "singleton"
+require "open-uri"
+require "chef/config"
module TinyServer
@@ -48,9 +48,9 @@ module TinyServer
# 5 == debug, 3 == warning
LOGGER = WEBrick::Log.new(STDOUT, 3)
DEFAULT_OPTIONS = {
- :server => 'webrick',
+ :server => "webrick",
:Port => 9000,
- :Host => 'localhost',
+ :Host => "localhost",
:environment => :none,
:Logger => LOGGER,
:AccessLog => [] # Remove this option to enable the access log when debugging.
@@ -155,7 +155,7 @@ module TinyServer
: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) ]]
+ [404, {"Content-Type" => "application/json"}, [ Chef::JSONCompat.to_json(debug_info) ]]
end
end
@@ -185,7 +185,7 @@ module TinyServer
end
class Response
- HEADERS = {'Content-Type' => 'application/json'}
+ HEADERS = {"Content-Type" => "application/json"}
def initialize(response_code=200, data=nil, headers=nil, &block)
@response_code, @data = response_code, data
diff --git a/spec/unit/api_client/registration_spec.rb b/spec/unit/api_client/registration_spec.rb
index 6f0f552c4d..bddb33fa0d 100644
--- a/spec/unit/api_client/registration_spec.rb
+++ b/spec/unit/api_client/registration_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tempfile'
+require "spec_helper"
+require "tempfile"
-require 'chef/api_client/registration'
+require "chef/api_client/registration"
describe Chef::ApiClient::Registration do
@@ -63,7 +63,7 @@ describe Chef::ApiClient::Registration do
let(:response_409) { Net::HTTPConflict.new("1.1", "409", "Conflict") }
let(:exception_409) { Net::HTTPServerException.new("409 conflict", response_409) }
- let(:generated_private_key_pem) { IO.read(File.expand_path('ssl/private_key.pem', CHEF_SPEC_DATA)) }
+ let(:generated_private_key_pem) { IO.read(File.expand_path("ssl/private_key.pem", CHEF_SPEC_DATA)) }
let(:generated_private_key) { OpenSSL::PKey::RSA.new(generated_private_key_pem) }
let(:generated_public_key) { generated_private_key.public_key }
@@ -88,7 +88,7 @@ describe Chef::ApiClient::Registration do
before do
Chef::Config[:validation_client_name] = "test-validator"
- Chef::Config[:validation_key] = File.expand_path('ssl/private_key.pem', CHEF_SPEC_DATA)
+ Chef::Config[:validation_key] = File.expand_path("ssl/private_key.pem", CHEF_SPEC_DATA)
allow(OpenSSL::PKey::RSA).to receive(:generate).with(2048).and_return(generated_private_key)
end
@@ -196,7 +196,7 @@ describe Chef::ApiClient::Registration do
describe "when writing the private key to disk" do
before do
- allow(registration).to receive(:private_key).and_return('--begin rsa key etc--')
+ allow(registration).to receive(:private_key).and_return("--begin rsa key etc--")
end
# Permission read via File.stat is busted on windows, though creating the
@@ -215,8 +215,8 @@ describe Chef::ApiClient::Registration do
expect(IO.read(key_location)).to eq("--begin rsa key etc--")
end
- context 'when the client key location is a symlink' do
- it 'does not follow the symlink', :unix_only do
+ context "when the client key location is a symlink" do
+ it "does not follow the symlink", :unix_only do
expected_flags = (File::CREAT|File::TRUNC|File::RDWR)
if defined?(File::NOFOLLOW)
@@ -226,12 +226,12 @@ describe Chef::ApiClient::Registration do
expect(registration.file_flags).to eq(expected_flags)
end
- context 'with follow_client_key_symlink set to true' do
+ context "with follow_client_key_symlink set to true" do
before do
Chef::Config[:follow_client_key_symlink] = true
end
- it 'follows the symlink', :unix_only do
+ it "follows the symlink", :unix_only do
expect(registration.file_flags).to eq(File::CREAT|File::TRUNC|File::RDWR)
end
end
diff --git a/spec/unit/api_client_spec.rb b/spec/unit/api_client_spec.rb
index 2a3f63bde5..1f313d7447 100644
--- a/spec/unit/api_client_spec.rb
+++ b/spec/unit/api_client_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/api_client'
-require 'tempfile'
+require "chef/api_client"
+require "tempfile"
# DEPRECATION NOTE
#
@@ -226,7 +226,7 @@ describe Chef::ApiClient do
@http_client = double("Chef::ServerAPI mock")
allow(Chef::ServerAPI).to receive(:new).and_return(@http_client)
expect(@http_client).to receive(:get).with("clients/black").and_return(client)
- @client = Chef::ApiClient.load(client['name'])
+ @client = Chef::ApiClient.load(client["name"])
end
it "should deserialize to a Chef::ApiClient object" do
@@ -258,7 +258,7 @@ describe Chef::ApiClient do
describe "with correctly configured API credentials" do
before do
Chef::Config[:node_name] = "silent-bob"
- Chef::Config[:client_key] = File.expand_path('ssl/private_key.pem', CHEF_SPEC_DATA)
+ Chef::Config[:client_key] = File.expand_path("ssl/private_key.pem", CHEF_SPEC_DATA)
end
after do
diff --git a/spec/unit/api_client_v1_spec.rb b/spec/unit/api_client_v1_spec.rb
index ab55a04950..f3df1f44eb 100644
--- a/spec/unit/api_client_v1_spec.rb
+++ b/spec/unit/api_client_v1_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/api_client_v1'
-require 'tempfile'
+require "chef/api_client_v1"
+require "tempfile"
describe Chef::ApiClientV1 do
before(:each) do
@@ -254,7 +254,7 @@ describe Chef::ApiClientV1 do
@http_client = double("Chef::ServerAPI mock")
allow(Chef::ServerAPI).to receive(:new).and_return(@http_client)
expect(@http_client).to receive(:get).with("clients/black").and_return(client)
- @client = Chef::ApiClientV1.load(client['name'])
+ @client = Chef::ApiClientV1.load(client["name"])
end
it "should deserialize to a Chef::ApiClientV1 object" do
@@ -290,7 +290,7 @@ describe Chef::ApiClientV1 do
describe "with correctly configured API credentials" do
before do
Chef::Config[:node_name] = "silent-bob"
- Chef::Config[:client_key] = File.expand_path('ssl/private_key.pem', CHEF_SPEC_DATA)
+ Chef::Config[:client_key] = File.expand_path("ssl/private_key.pem", CHEF_SPEC_DATA)
end
after do
@@ -326,7 +326,7 @@ 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) {
{
@@ -338,8 +338,8 @@ describe Chef::ApiClientV1 do
before do
@client = Chef::ApiClientV1.new
- allow(@client).to receive(:chef_rest_v0).and_return(double('chef rest root v0 object'))
- allow(@client).to receive(:chef_rest_v1).and_return(double('chef rest root v1 object'))
+ allow(@client).to receive(:chef_rest_v0).and_return(double("chef rest root v0 object"))
+ allow(@client).to receive(:chef_rest_v1).and_return(double("chef rest root v1 object"))
@client.name "some_name"
@client.validator true
@client.admin true
diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb
index f6cd0bae03..5aad53d209 100644
--- a/spec/unit/application/apply_spec.rb
+++ b/spec/unit/application/apply_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
+require "spec_helper"
describe Chef::Application::Apply do
diff --git a/spec/unit/application/client_spec.rb b/spec/unit/application/client_spec.rb
index 727536f1f8..6ff9597b53 100644
--- a/spec/unit/application/client_spec.rb
+++ b/spec/unit/application/client_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
+require "spec_helper"
describe Chef::Application::Client, "reconfigure" do
let(:app) do
@@ -42,8 +42,8 @@ describe Chef::Application::Client, "reconfigure" do
ARGV.replace(@original_argv)
end
- describe 'parse cli_arguments' do
- it 'should call set_specific_recipes' do
+ describe "parse cli_arguments" do
+ it "should call set_specific_recipes" do
expect(app).to receive(:set_specific_recipes).and_return(true)
app.reconfigure
end
@@ -310,9 +310,9 @@ describe Chef::Application::Client, "run_application", :unix_only do
@client = Chef::Client.new
allow(Chef::Client).to receive(:new).and_return(@client)
allow(@client).to receive(:run) do
- @pipe[1].puts 'started'
+ @pipe[1].puts "started"
sleep 1
- @pipe[1].puts 'finished'
+ @pipe[1].puts "finished"
end
end
diff --git a/spec/unit/application/knife_spec.rb b/spec/unit/application/knife_spec.rb
index 0fb25176f9..163489110f 100644
--- a/spec/unit/application/knife_spec.rb
+++ b/spec/unit/application/knife_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
+require "spec_helper"
require "#{CHEF_SPEC_DATA}/knife_subcommand/test_yourself"
describe Chef::Application::Knife do
@@ -84,7 +84,7 @@ describe Chef::Application::Knife do
describe "when given a path to the client key" do
it "expands a relative path relative to the CWD" do
- relative_path = '.chef/client.pem'
+ relative_path = ".chef/client.pem"
allow(Dir).to receive(:pwd).and_return(CHEF_SPEC_DATA)
with_argv(*%W{noop knife command -k #{relative_path}}) do
expect(@knife).to receive(:exit).with(0)
@@ -94,19 +94,19 @@ describe Chef::Application::Knife do
end
it "expands a ~/home/path to the correct full path" do
- home_path = '~/.chef/client.pem'
+ home_path = "~/.chef/client.pem"
with_argv(*%W{noop knife command -k #{home_path}}) do
expect(@knife).to receive(:exit).with(0)
@knife.run
end
- expect(Chef::Config[:client_key]).to eq(File.join(ENV['HOME'], '.chef/client.pem').gsub((File::ALT_SEPARATOR || '\\'), File::SEPARATOR))
+ expect(Chef::Config[:client_key]).to eq(File.join(ENV["HOME"], ".chef/client.pem").gsub((File::ALT_SEPARATOR || '\\'), File::SEPARATOR))
end
it "does not expand a full path" do
full_path = if windows?
- 'C:/chef/client.pem'
+ "C:/chef/client.pem"
else
- '/etc/chef/client.pem'
+ "/etc/chef/client.pem"
end
with_argv(*%W{noop knife command -k #{full_path}}) do
expect(@knife).to receive(:exit).with(0)
@@ -135,7 +135,7 @@ describe Chef::Application::Knife do
expect(@knife).to receive(:exit).with(0)
@knife.run
end
- expect(Chef::Config[:environment]).to eq('production')
+ expect(Chef::Config[:environment]).to eq("production")
end
it "should load the environment from the CLI options" do
@@ -143,7 +143,7 @@ describe Chef::Application::Knife do
expect(@knife).to receive(:exit).with(0)
@knife.run
end
- expect(Chef::Config[:environment]).to eq('development')
+ expect(Chef::Config[:environment]).to eq("development")
end
it "should override the config file environment with the CLI environment" do
@@ -152,7 +152,7 @@ describe Chef::Application::Knife do
expect(@knife).to receive(:exit).with(0)
@knife.run
end
- expect(Chef::Config[:environment]).to eq('override')
+ expect(Chef::Config[:environment]).to eq("override")
end
it "should override the config file environment with the CLI environment regardless of order" do
@@ -161,7 +161,7 @@ describe Chef::Application::Knife do
expect(@knife).to receive(:exit).with(0)
@knife.run
end
- expect(Chef::Config[:environment]).to eq('override')
+ expect(Chef::Config[:environment]).to eq("override")
end
it "should run a sub command with the applications command line option prototype" do
diff --git a/spec/unit/application/solo_spec.rb b/spec/unit/application/solo_spec.rb
index 7013bfa0bc..c5b24f7826 100644
--- a/spec/unit/application/solo_spec.rb
+++ b/spec/unit/application/solo_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
+require "spec_helper"
describe Chef::Application::Solo do
@@ -34,7 +34,7 @@ describe Chef::Application::Solo do
end
describe "configuring the application" do
- it 'should call set_specific_recipes' do
+ it "should call set_specific_recipes" do
expect(app).to receive(:set_specific_recipes)
app.reconfigure
end
@@ -106,7 +106,7 @@ Enable chef-client interval runs by setting `:client_fork = true` in your config
describe "when the recipe_url configuration option is specified" do
let(:tarfile) { StringIO.new("remote_tarball_content") }
let(:target_file) { StringIO.new }
- let(:shellout) { double(run_command: nil, error!: nil, stdout: '') }
+ let(:shellout) { double(run_command: nil, error!: nil, stdout: "") }
before do
Chef::Config[:cookbook_path] = "#{Dir.tmpdir}/chef-solo/cookbooks"
diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb
index 20b7e3a506..6a78e5c827 100644
--- a/spec/unit/application_spec.rb
+++ b/spec/unit/application_spec.rb
@@ -16,7 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
+require "spec_helper"
describe Chef::Application do
before do
@@ -51,7 +51,7 @@ describe Chef::Application do
@app.reconfigure
end
- it 'should not receive set_specific_recipes' do
+ it "should not receive set_specific_recipes" do
expect(@app).to_not receive(:set_specific_recipes)
@app.reconfigure
end
@@ -298,18 +298,18 @@ describe Chef::Application do
end
end
- describe 'run_chef_client' do
- context 'with an application' do
+ describe "run_chef_client" do
+ context "with an application" do
let(:app) { Chef::Application.new }
- context 'when called with an invalid argument' do
+ context "when called with an invalid argument" do
before do
allow(app).to receive(:fork_chef_client).and_return(true)
allow(app).to receive(:run_with_graceful_exit_option).and_return(true)
end
- it 'should raise an argument error detailing the problem' do
- specific_recipes_regexp = Regexp.new 'received non-Array like specific_recipes argument'
+ it "should raise an argument error detailing the problem" do
+ specific_recipes_regexp = Regexp.new "received non-Array like specific_recipes argument"
expect { app.run_chef_client(nil) }.to raise_error(ArgumentError, specific_recipes_regexp)
end
end
@@ -320,7 +320,7 @@ describe Chef::Application do
allow(app).to receive(:run_with_graceful_exit_option).and_return(true)
end
- it 'should be cool' do
+ it "should be cool" do
expect { app.run_chef_client([]) }.not_to raise_error
end
end
diff --git a/spec/unit/audit/audit_event_proxy_spec.rb b/spec/unit/audit/audit_event_proxy_spec.rb
index d8c495deeb..a866075f72 100644
--- a/spec/unit/audit/audit_event_proxy_spec.rb
+++ b/spec/unit/audit/audit_event_proxy_spec.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/audit/audit_event_proxy'
+require "spec_helper"
+require "chef/audit/audit_event_proxy"
describe Chef::Audit::AuditEventProxy do
diff --git a/spec/unit/audit/audit_reporter_spec.rb b/spec/unit/audit/audit_reporter_spec.rb
index f9f03c9620..6b0d1566bf 100644
--- a/spec/unit/audit/audit_reporter_spec.rb
+++ b/spec/unit/audit/audit_reporter_spec.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Audit::AuditReporter do
@@ -75,7 +75,7 @@ describe Chef::Audit::AuditReporter do
it "posts audit data to server endpoint" do
headers = {
- 'X-Ops-Audit-Report-Protocol-Version' => Chef::Audit::AuditReporter::PROTOCOL_VERSION
+ "X-Ops-Audit-Report-Protocol-Version" => Chef::Audit::AuditReporter::PROTOCOL_VERSION
}
expect(rest).to receive(:post).
diff --git a/spec/unit/audit/control_group_data_spec.rb b/spec/unit/audit/control_group_data_spec.rb
index 3705fafbe7..b25d925e12 100644
--- a/spec/unit/audit/control_group_data_spec.rb
+++ b/spec/unit/audit/control_group_data_spec.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'securerandom'
+require "spec_helper"
+require "securerandom"
describe Chef::Audit::AuditData do
diff --git a/spec/unit/audit/logger_spec.rb b/spec/unit/audit/logger_spec.rb
index 9dd9ce2cd9..1091ed936b 100644
--- a/spec/unit/audit/logger_spec.rb
+++ b/spec/unit/audit/logger_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Audit::Logger do
@@ -23,19 +23,19 @@ describe Chef::Audit::Logger do
Chef::Audit::Logger.instance_variable_set(:@buffer, nil)
end
- it 'calling puts creates @buffer and adds the message' do
+ it "calling puts creates @buffer and adds the message" do
Chef::Audit::Logger.puts("Output message")
expect(Chef::Audit::Logger.read_buffer).to eq("Output message\n")
end
- it 'calling puts multiple times adds to the message' do
+ it "calling puts multiple times adds to the message" do
Chef::Audit::Logger.puts("Output message")
Chef::Audit::Logger.puts("Output message")
Chef::Audit::Logger.puts("Output message")
expect(Chef::Audit::Logger.read_buffer).to eq("Output message\nOutput message\nOutput message\n")
end
- it 'calling it before @buffer is set returns an empty string' do
+ it "calling it before @buffer is set returns an empty string" do
expect(Chef::Audit::Logger.read_buffer).to eq("")
end
diff --git a/spec/unit/audit/rspec_formatter_spec.rb b/spec/unit/audit/rspec_formatter_spec.rb
index 471473e387..e4160bb070 100644
--- a/spec/unit/audit/rspec_formatter_spec.rb
+++ b/spec/unit/audit/rspec_formatter_spec.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/audit/rspec_formatter'
+require "spec_helper"
+require "chef/audit/rspec_formatter"
describe Chef::Audit::RspecFormatter do
let(:formatter) { Chef::Audit::RspecFormatter.new(nil) }
diff --git a/spec/unit/audit/runner_spec.rb b/spec/unit/audit/runner_spec.rb
index 1de024260f..83cf8e370b 100644
--- a/spec/unit/audit/runner_spec.rb
+++ b/spec/unit/audit/runner_spec.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'rspec/core/sandbox'
-require 'chef/audit/runner'
-require 'chef/audit/audit_event_proxy'
-require 'chef/audit/rspec_formatter'
-require 'rspec/support/spec/in_sub_process'
-require 'rspec/support/spec/stderr_splitter'
+require "spec_helper"
+require "rspec/core/sandbox"
+require "chef/audit/runner"
+require "chef/audit/audit_event_proxy"
+require "chef/audit/rspec_formatter"
+require "rspec/support/spec/in_sub_process"
+require "rspec/support/spec/stderr_splitter"
describe Chef::Audit::Runner do
@@ -54,7 +54,7 @@ describe Chef::Audit::Runner do
context "during #run" do
describe "#setup" do
- let(:log_location) { File.join(Dir.tmpdir, 'audit_log') }
+ let(:log_location) { File.join(Dir.tmpdir, "audit_log") }
let(:color) { false }
before do
diff --git a/spec/unit/chef_class_spec.rb b/spec/unit/chef_class_spec.rb
index f1b877520c..899ce1c7d2 100644
--- a/spec/unit/chef_class_spec.rb
+++ b/spec/unit/chef_class_spec.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe "Chef class" do
let(:platform) { "debian" }
let(:node) do
node = Chef::Node.new
- node.automatic['platform'] = platform
+ node.automatic["platform"] = platform
node
end
@@ -86,7 +86,7 @@ describe "Chef class" do
end
context '#event_handler' do
- it 'adds a new handler' do
+ it "adds a new handler" do
x = 1
Chef.event_handler do
on :converge_start do
@@ -98,7 +98,7 @@ describe "Chef class" do
expect(x).to eq(2)
end
- it 'raise error if unknown event type is passed' do
+ it "raise error if unknown event type is passed" do
expect do
Chef.event_handler do
on :yolo do
diff --git a/spec/unit/chef_fs/config_spec.rb b/spec/unit/chef_fs/config_spec.rb
index 145cdf2d12..cac4d7d9a2 100644
--- a/spec/unit/chef_fs/config_spec.rb
+++ b/spec/unit/chef_fs/config_spec.rb
@@ -16,16 +16,16 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/exceptions'
-require 'lib/chef/chef_fs/config.rb'
+require "spec_helper"
+require "chef/exceptions"
+require "lib/chef/chef_fs/config.rb"
describe Chef::ChefFS::Config do
describe "initialize" do
it "warns when hosted setups use 'everything'" do
base_config = Hash.new()
- base_config[:repo_mode] = 'everything'
- base_config[:chef_server_url] = 'http://foo.com/organizations/fake_org/'
+ base_config[:repo_mode] = "everything"
+ base_config[:chef_server_url] = "http://foo.com/organizations/fake_org/"
ui = double("ui")
expect(ui).to receive(:warn)
@@ -35,8 +35,8 @@ describe Chef::ChefFS::Config do
it "doesn't warn when hosted setups use 'hosted_everything'" do
base_config = Hash.new()
- base_config[:repo_mode] = 'hosted_everything'
- base_config[:chef_server_url] = 'http://foo.com/organizations/fake_org/'
+ base_config[:repo_mode] = "hosted_everything"
+ base_config[:chef_server_url] = "http://foo.com/organizations/fake_org/"
ui = double("ui")
expect(ui).to receive(:warn).exactly(0).times
@@ -46,8 +46,8 @@ describe Chef::ChefFS::Config do
it "doesn't warn when non-hosted setups use 'everything'" do
base_config = Hash.new()
- base_config[:repo_mode] = 'everything'
- base_config[:chef_server_url] = 'http://foo.com/'
+ base_config[:repo_mode] = "everything"
+ base_config[:chef_server_url] = "http://foo.com/"
ui = double("ui")
expect(ui).to receive(:warn).exactly(0).times
diff --git a/spec/unit/chef_fs/data_handler/group_handler_spec.rb b/spec/unit/chef_fs/data_handler/group_handler_spec.rb
index 6e71fa3b10..7cbd0e4c22 100644
--- a/spec/unit/chef_fs/data_handler/group_handler_spec.rb
+++ b/spec/unit/chef_fs/data_handler/group_handler_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'lib/chef/chef_fs/data_handler/group_data_handler'
+require "spec_helper"
+require "lib/chef/chef_fs/data_handler/group_data_handler"
class TestEntry < Mash
attr_accessor :name, :org
@@ -31,32 +31,32 @@ end
describe Chef::ChefFS::DataHandler::GroupDataHandler do
describe '#normalize_for_post' do
let(:entry) do
- TestEntry.new('workers.json', 'hive')
+ TestEntry.new("workers.json", "hive")
end
let(:group) do
- { 'name' => 'worker_bees',
- 'clients' => %w(honey sting),
- 'users' => %w(fizz buzz),
- 'actors' => %w(honey),
+ { "name" => "worker_bees",
+ "clients" => %w(honey sting),
+ "users" => %w(fizz buzz),
+ "actors" => %w(honey),
}
end
let(:normalized) do
- { 'actors' =>
- { 'users' => %w(fizz buzz),
- 'clients'=> %w(honey sting),
- 'groups'=> [],
+ { "actors" =>
+ { "users" => %w(fizz buzz),
+ "clients"=> %w(honey sting),
+ "groups"=> [],
},
- 'groupname' => 'workers',
- 'name' => 'worker_bees',
- 'orgname' => 'hive',
+ "groupname" => "workers",
+ "name" => "worker_bees",
+ "orgname" => "hive",
}
end
let(:handler) { described_class.new }
- it 'normalizes the users, clients and groups into actors' do
+ it "normalizes the users, clients and groups into actors" do
expect(handler.normalize_for_post(group, entry)).to eq(normalized)
end
end
diff --git a/spec/unit/chef_fs/diff_spec.rb b/spec/unit/chef_fs/diff_spec.rb
index 284a7a5ab7..e2f9a9169d 100644
--- a/spec/unit/chef_fs/diff_spec.rb
+++ b/spec/unit/chef_fs/diff_spec.rb
@@ -16,24 +16,24 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/chef_fs/file_pattern'
-require 'chef/chef_fs/command_line'
+require "spec_helper"
+require "chef/chef_fs/file_pattern"
+require "chef/chef_fs/command_line"
# Removes the date stamp from the diff and replaces it with ' DATE'
# example match: "/dev/null\t2012-10-16 16:15:54.000000000 +0000"
# windows match: "--- /dev/null\tTue Oct 16 18:04:34 2012"
def remove_os_differences(diff)
diff = diff.gsub(/([+-]{3}.*)\t.*/, '\1 DATE')
- diff.gsub(/^@@ -\d(,\d)? \+\d(,\d)? @@/, 'CONTEXT_LINE_NUMBERS')
+ 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
+ context "with two filesystems with all types of difference" do
let(:a) {
- memory_fs('a', {
+ memory_fs("a", {
:both_dirs => {
:sub_both_dirs => { :subsub => nil },
:sub_both_files => nil,
@@ -60,7 +60,7 @@ describe 'diff', :uses_diff => true do
}, /cannot_be_in_a/)
}
let(:b) {
- memory_fs('b', {
+ memory_fs("b", {
:both_dirs => {
:sub_both_dirs => { :subsub => nil },
:sub_both_files => nil,
@@ -86,9 +86,9 @@ describe 'diff', :uses_diff => true do
:file_in_a_dir_in_b => {},
}, /cannot_be_in_b/)
}
- it 'Chef::ChefFS::CommandLine.diff_print(/)' do
+ it "Chef::ChefFS::CommandLine.diff_print(/)" do
results = []
- Chef::ChefFS::CommandLine.diff_print(pattern('/'), a, b, nil, nil) do |diff|
+ Chef::ChefFS::CommandLine.diff_print(pattern("/"), a, b, nil, nil) do |diff|
results << remove_os_differences(diff)
end
expect(results).to match_array([
@@ -110,17 +110,17 @@ deleted file
+++ /dev/null DATE
CONTEXT_LINE_NUMBERS
-subsub
-','Only in a/both_dirs: sub_a_only_dir
-','diff --knife a/both_dirs/sub_a_only_file b/both_dirs/sub_a_only_file
+',"Only in a/both_dirs: sub_a_only_dir
+",'diff --knife a/both_dirs/sub_a_only_file b/both_dirs/sub_a_only_file
deleted file
--- a/both_dirs/sub_a_only_file DATE
+++ /dev/null DATE
CONTEXT_LINE_NUMBERS
-sub_a_only_file
-','File a/both_dirs/sub_dir_in_a_file_in_b is a directory while file b/both_dirs/sub_dir_in_a_file_in_b is a regular file
-','File a/both_dirs/sub_file_in_a_dir_in_b is a regular file while file b/both_dirs/sub_file_in_a_dir_in_b is a directory
-','Only in b/both_dirs: sub_b_only_dir
-','diff --knife a/both_dirs/sub_b_only_file b/both_dirs/sub_b_only_file
+',"File a/both_dirs/sub_dir_in_a_file_in_b is a directory while file b/both_dirs/sub_dir_in_a_file_in_b is a regular file
+","File a/both_dirs/sub_file_in_a_dir_in_b is a regular file while file b/both_dirs/sub_file_in_a_dir_in_b is a directory
+","Only in b/both_dirs: sub_b_only_dir
+",'diff --knife a/both_dirs/sub_b_only_file b/both_dirs/sub_b_only_file
new file
--- /dev/null DATE
+++ b/both_dirs/sub_b_only_file DATE
@@ -144,17 +144,17 @@ deleted file
+++ /dev/null DATE
CONTEXT_LINE_NUMBERS
-subsub
-','Only in a: a_only_dir
-','diff --knife a/a_only_file b/a_only_file
+',"Only in a: a_only_dir
+",'diff --knife a/a_only_file b/a_only_file
deleted file
--- a/a_only_file DATE
+++ /dev/null DATE
CONTEXT_LINE_NUMBERS
-a_only_file
-','File a/dir_in_a_file_in_b is a directory while file b/dir_in_a_file_in_b is a regular file
-','File a/file_in_a_dir_in_b is a regular file while file b/file_in_a_dir_in_b is a directory
-','Only in b: b_only_dir
-','diff --knife a/b_only_file b/b_only_file
+',"File a/dir_in_a_file_in_b is a directory while file b/dir_in_a_file_in_b is a regular file
+","File a/file_in_a_dir_in_b is a regular file while file b/file_in_a_dir_in_b is a directory
+","Only in b: b_only_dir
+",'diff --knife a/b_only_file b/b_only_file
new file
--- /dev/null DATE
+++ b/b_only_file DATE
@@ -162,9 +162,9 @@ CONTEXT_LINE_NUMBERS
+b_only_file
' ])
end
- it 'Chef::ChefFS::CommandLine.diff_print(/both_dirs)' do
+ it "Chef::ChefFS::CommandLine.diff_print(/both_dirs)" do
results = []
- Chef::ChefFS::CommandLine.diff_print(pattern('/both_dirs'), a, b, nil, nil) do |diff|
+ Chef::ChefFS::CommandLine.diff_print(pattern("/both_dirs"), a, b, nil, nil) do |diff|
results << remove_os_differences(diff)
end
expect(results).to match_array([
@@ -186,17 +186,17 @@ deleted file
+++ /dev/null DATE
CONTEXT_LINE_NUMBERS
-subsub
-','Only in a/both_dirs: sub_a_only_dir
-','diff --knife a/both_dirs/sub_a_only_file b/both_dirs/sub_a_only_file
+',"Only in a/both_dirs: sub_a_only_dir
+",'diff --knife a/both_dirs/sub_a_only_file b/both_dirs/sub_a_only_file
deleted file
--- a/both_dirs/sub_a_only_file DATE
+++ /dev/null DATE
CONTEXT_LINE_NUMBERS
-sub_a_only_file
-','File a/both_dirs/sub_dir_in_a_file_in_b is a directory while file b/both_dirs/sub_dir_in_a_file_in_b is a regular file
-','File a/both_dirs/sub_file_in_a_dir_in_b is a regular file while file b/both_dirs/sub_file_in_a_dir_in_b is a directory
-','Only in b/both_dirs: sub_b_only_dir
-','diff --knife a/both_dirs/sub_b_only_file b/both_dirs/sub_b_only_file
+',"File a/both_dirs/sub_dir_in_a_file_in_b is a directory while file b/both_dirs/sub_dir_in_a_file_in_b is a regular file
+","File a/both_dirs/sub_file_in_a_dir_in_b is a regular file while file b/both_dirs/sub_file_in_a_dir_in_b is a directory
+","Only in b/both_dirs: sub_b_only_dir
+",'diff --knife a/both_dirs/sub_b_only_file b/both_dirs/sub_b_only_file
new file
--- /dev/null DATE
+++ b/both_dirs/sub_b_only_file DATE
@@ -204,33 +204,33 @@ CONTEXT_LINE_NUMBERS
+sub_b_only_file
' ])
end
- it 'Chef::ChefFS::CommandLine.diff_print(/) with depth 1' do
+ it "Chef::ChefFS::CommandLine.diff_print(/) with depth 1" do
results = []
- Chef::ChefFS::CommandLine.diff_print(pattern('/'), a, b, 1, nil) do |diff|
+ Chef::ChefFS::CommandLine.diff_print(pattern("/"), a, b, 1, nil) do |diff|
results << remove_os_differences(diff)
end
expect(results).to match_array([
-'Common subdirectories: b/both_dirs
-','diff --knife a/both_files_different b/both_files_different
+"Common subdirectories: b/both_dirs
+",'diff --knife a/both_files_different b/both_files_different
--- a/both_files_different DATE
+++ b/both_files_different DATE
CONTEXT_LINE_NUMBERS
-a
+b
-','Common subdirectories: b/both_dirs_empty
-','Common subdirectories: b/dirs_empty_in_b_filled_in_a
-','Common subdirectories: b/dirs_empty_in_a_filled_in_b
-','Only in a: a_only_dir
-','diff --knife a/a_only_file b/a_only_file
+',"Common subdirectories: b/both_dirs_empty
+","Common subdirectories: b/dirs_empty_in_b_filled_in_a
+","Common subdirectories: b/dirs_empty_in_a_filled_in_b
+","Only in a: a_only_dir
+",'diff --knife a/a_only_file b/a_only_file
deleted file
--- a/a_only_file DATE
+++ /dev/null DATE
CONTEXT_LINE_NUMBERS
-a_only_file
-','File a/dir_in_a_file_in_b is a directory while file b/dir_in_a_file_in_b is a regular file
-','File a/file_in_a_dir_in_b is a regular file while file b/file_in_a_dir_in_b is a directory
-','Only in b: b_only_dir
-','diff --knife a/b_only_file b/b_only_file
+',"File a/dir_in_a_file_in_b is a directory while file b/dir_in_a_file_in_b is a regular file
+","File a/file_in_a_dir_in_b is a regular file while file b/file_in_a_dir_in_b is a directory
+","Only in b: b_only_dir
+",'diff --knife a/b_only_file b/b_only_file
new file
--- /dev/null DATE
+++ b/b_only_file DATE
@@ -238,33 +238,33 @@ CONTEXT_LINE_NUMBERS
+b_only_file
' ])
end
- it 'Chef::ChefFS::CommandLine.diff_print(/*_*) with depth 0' do
+ it "Chef::ChefFS::CommandLine.diff_print(/*_*) with depth 0" do
results = []
- Chef::ChefFS::CommandLine.diff_print(pattern('/*_*'), a, b, 0, nil) do |diff|
+ Chef::ChefFS::CommandLine.diff_print(pattern("/*_*"), a, b, 0, nil) do |diff|
results << remove_os_differences(diff)
end
expect(results).to match_array([
-'Common subdirectories: b/both_dirs
-','diff --knife a/both_files_different b/both_files_different
+"Common subdirectories: b/both_dirs
+",'diff --knife a/both_files_different b/both_files_different
--- a/both_files_different DATE
+++ b/both_files_different DATE
CONTEXT_LINE_NUMBERS
-a
+b
-','Common subdirectories: b/both_dirs_empty
-','Common subdirectories: b/dirs_empty_in_b_filled_in_a
-','Common subdirectories: b/dirs_empty_in_a_filled_in_b
-','Only in a: a_only_dir
-','diff --knife a/a_only_file b/a_only_file
+',"Common subdirectories: b/both_dirs_empty
+","Common subdirectories: b/dirs_empty_in_b_filled_in_a
+","Common subdirectories: b/dirs_empty_in_a_filled_in_b
+","Only in a: a_only_dir
+",'diff --knife a/a_only_file b/a_only_file
deleted file
--- a/a_only_file DATE
+++ /dev/null DATE
CONTEXT_LINE_NUMBERS
-a_only_file
-','File a/dir_in_a_file_in_b is a directory while file b/dir_in_a_file_in_b is a regular file
-','File a/file_in_a_dir_in_b is a regular file while file b/file_in_a_dir_in_b is a directory
-','Only in b: b_only_dir
-','diff --knife a/b_only_file b/b_only_file
+',"File a/dir_in_a_file_in_b is a directory while file b/dir_in_a_file_in_b is a regular file
+","File a/file_in_a_dir_in_b is a regular file while file b/file_in_a_dir_in_b is a directory
+","Only in b: b_only_dir
+",'diff --knife a/b_only_file b/b_only_file
new file
--- /dev/null DATE
+++ b/b_only_file DATE
@@ -272,9 +272,9 @@ CONTEXT_LINE_NUMBERS
+b_only_file
' ])
end
- it 'Chef::ChefFS::CommandLine.diff_print(/) in name-only mode' do
+ it "Chef::ChefFS::CommandLine.diff_print(/) in name-only mode" do
results = []
- Chef::ChefFS::CommandLine.diff_print(pattern('/'), a, b, nil, :name_only) do |diff|
+ Chef::ChefFS::CommandLine.diff_print(pattern("/"), a, b, nil, :name_only) do |diff|
results << remove_os_differences(diff)
end
expect(results).to match_array([
@@ -298,9 +298,9 @@ CONTEXT_LINE_NUMBERS
"b/file_in_a_dir_in_b\n",
])
end
- it 'Chef::ChefFS::CommandLine.diff_print(/) in name-status mode' do
+ it "Chef::ChefFS::CommandLine.diff_print(/) in name-status mode" do
results = []
- Chef::ChefFS::CommandLine.diff_print(pattern('/'), a, b, nil, :name_status) do |diff|
+ Chef::ChefFS::CommandLine.diff_print(pattern("/"), a, b, nil, :name_status) do |diff|
results << remove_os_differences(diff)
end
expect(results).to match_array([
diff --git a/spec/unit/chef_fs/file_pattern_spec.rb b/spec/unit/chef_fs/file_pattern_spec.rb
index ed5f314605..91970cd23c 100644
--- a/spec/unit/chef_fs/file_pattern_spec.rb
+++ b/spec/unit/chef_fs/file_pattern_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/chef_fs/file_pattern'
+require "spec_helper"
+require "chef/chef_fs/file_pattern"
describe Chef::ChefFS::FilePattern do
def p(str)
@@ -26,455 +26,455 @@ describe Chef::ChefFS::FilePattern do
# Different kinds of patterns
context 'with empty pattern ""' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('') }
- it 'match?' do
- expect(pattern.match?('')).to be_truthy
- expect(pattern.match?('/')).to be_falsey
- expect(pattern.match?('a')).to be_falsey
- expect(pattern.match?('a/b')).to be_falsey
+ let(:pattern) { Chef::ChefFS::FilePattern.new("") }
+ it "match?" do
+ expect(pattern.match?("")).to be_truthy
+ expect(pattern.match?("/")).to be_falsey
+ expect(pattern.match?("a")).to be_falsey
+ expect(pattern.match?("a/b")).to be_falsey
end
- it 'exact_path' do
- expect(pattern.exact_path).to eq('')
+ it "exact_path" do
+ expect(pattern.exact_path).to eq("")
end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('')).to be_falsey
- expect(pattern.could_match_children?('a/b')).to be_falsey
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("")).to be_falsey
+ expect(pattern.could_match_children?("a/b")).to be_falsey
end
end
context 'with root pattern "/"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('/') }
- it 'match?' do
- expect(pattern.match?('/')).to be_truthy
- expect(pattern.match?('')).to be_falsey
- expect(pattern.match?('a')).to be_falsey
- expect(pattern.match?('/a')).to be_falsey
- end
- it 'exact_path' do
- expect(pattern.exact_path).to eq('/')
- end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('')).to be_falsey
- expect(pattern.could_match_children?('/')).to be_falsey
- expect(pattern.could_match_children?('a')).to be_falsey
- expect(pattern.could_match_children?('a/b')).to be_falsey
- expect(pattern.could_match_children?('/a')).to be_falsey
+ let(:pattern) { Chef::ChefFS::FilePattern.new("/") }
+ it "match?" do
+ expect(pattern.match?("/")).to be_truthy
+ expect(pattern.match?("")).to be_falsey
+ expect(pattern.match?("a")).to be_falsey
+ expect(pattern.match?("/a")).to be_falsey
+ end
+ it "exact_path" do
+ expect(pattern.exact_path).to eq("/")
+ end
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("")).to be_falsey
+ expect(pattern.could_match_children?("/")).to be_falsey
+ expect(pattern.could_match_children?("a")).to be_falsey
+ expect(pattern.could_match_children?("a/b")).to be_falsey
+ expect(pattern.could_match_children?("/a")).to be_falsey
end
end
context 'with simple pattern "abc"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('abc') }
- it 'match?' do
- expect(pattern.match?('abc')).to be_truthy
- expect(pattern.match?('a')).to be_falsey
- expect(pattern.match?('abcd')).to be_falsey
- expect(pattern.match?('/abc')).to be_falsey
- expect(pattern.match?('')).to be_falsey
- expect(pattern.match?('/')).to be_falsey
- end
- it 'exact_path' do
- expect(pattern.exact_path).to eq('abc')
- end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('')).to be_falsey
- expect(pattern.could_match_children?('abc')).to be_falsey
- expect(pattern.could_match_children?('/abc')).to be_falsey
+ let(:pattern) { Chef::ChefFS::FilePattern.new("abc") }
+ it "match?" do
+ expect(pattern.match?("abc")).to be_truthy
+ expect(pattern.match?("a")).to be_falsey
+ expect(pattern.match?("abcd")).to be_falsey
+ expect(pattern.match?("/abc")).to be_falsey
+ expect(pattern.match?("")).to be_falsey
+ expect(pattern.match?("/")).to be_falsey
+ end
+ it "exact_path" do
+ expect(pattern.exact_path).to eq("abc")
+ end
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("")).to be_falsey
+ expect(pattern.could_match_children?("abc")).to be_falsey
+ expect(pattern.could_match_children?("/abc")).to be_falsey
end
end
context 'with simple pattern "/abc"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('/abc') }
- it 'match?' do
- expect(pattern.match?('/abc')).to be_truthy
- expect(pattern.match?('abc')).to be_falsey
- expect(pattern.match?('a')).to be_falsey
- expect(pattern.match?('abcd')).to be_falsey
- expect(pattern.match?('')).to be_falsey
- expect(pattern.match?('/')).to be_falsey
- end
- it 'exact_path' do
- expect(pattern.exact_path).to eq('/abc')
- end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('abc')).to be_falsey
- expect(pattern.could_match_children?('/abc')).to be_falsey
- expect(pattern.could_match_children?('/')).to be_truthy
- expect(pattern.could_match_children?('')).to be_falsey
- end
- it 'exact_child_name_under' do
- expect(pattern.exact_child_name_under('/')).to eq('abc')
+ let(:pattern) { Chef::ChefFS::FilePattern.new("/abc") }
+ it "match?" do
+ expect(pattern.match?("/abc")).to be_truthy
+ expect(pattern.match?("abc")).to be_falsey
+ expect(pattern.match?("a")).to be_falsey
+ expect(pattern.match?("abcd")).to be_falsey
+ expect(pattern.match?("")).to be_falsey
+ expect(pattern.match?("/")).to be_falsey
+ end
+ it "exact_path" do
+ expect(pattern.exact_path).to eq("/abc")
+ end
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("abc")).to be_falsey
+ expect(pattern.could_match_children?("/abc")).to be_falsey
+ expect(pattern.could_match_children?("/")).to be_truthy
+ expect(pattern.could_match_children?("")).to be_falsey
+ end
+ it "exact_child_name_under" do
+ expect(pattern.exact_child_name_under("/")).to eq("abc")
end
end
context 'with simple pattern "abc/def/ghi"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('abc/def/ghi') }
- it 'match?' do
- expect(pattern.match?('abc/def/ghi')).to be_truthy
- expect(pattern.match?('/abc/def/ghi')).to be_falsey
- expect(pattern.match?('abc')).to be_falsey
- expect(pattern.match?('abc/def')).to be_falsey
- end
- it 'exact_path' do
- expect(pattern.exact_path).to eq('abc/def/ghi')
- end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('abc')).to be_truthy
- expect(pattern.could_match_children?('xyz')).to be_falsey
- expect(pattern.could_match_children?('/abc')).to be_falsey
- expect(pattern.could_match_children?('abc/def')).to be_truthy
- expect(pattern.could_match_children?('abc/xyz')).to be_falsey
- expect(pattern.could_match_children?('abc/def/ghi')).to be_falsey
- end
- it 'exact_child_name_under' do
- expect(pattern.exact_child_name_under('abc')).to eq('def')
- expect(pattern.exact_child_name_under('abc/def')).to eq('ghi')
+ let(:pattern) { Chef::ChefFS::FilePattern.new("abc/def/ghi") }
+ it "match?" do
+ expect(pattern.match?("abc/def/ghi")).to be_truthy
+ expect(pattern.match?("/abc/def/ghi")).to be_falsey
+ expect(pattern.match?("abc")).to be_falsey
+ expect(pattern.match?("abc/def")).to be_falsey
+ end
+ it "exact_path" do
+ expect(pattern.exact_path).to eq("abc/def/ghi")
+ end
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("abc")).to be_truthy
+ expect(pattern.could_match_children?("xyz")).to be_falsey
+ expect(pattern.could_match_children?("/abc")).to be_falsey
+ expect(pattern.could_match_children?("abc/def")).to be_truthy
+ expect(pattern.could_match_children?("abc/xyz")).to be_falsey
+ expect(pattern.could_match_children?("abc/def/ghi")).to be_falsey
+ end
+ it "exact_child_name_under" do
+ expect(pattern.exact_child_name_under("abc")).to eq("def")
+ expect(pattern.exact_child_name_under("abc/def")).to eq("ghi")
end
end
context 'with simple pattern "/abc/def/ghi"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('/abc/def/ghi') }
- it 'match?' do
- expect(pattern.match?('/abc/def/ghi')).to be_truthy
- expect(pattern.match?('abc/def/ghi')).to be_falsey
- expect(pattern.match?('/abc')).to be_falsey
- expect(pattern.match?('/abc/def')).to be_falsey
- end
- it 'exact_path' do
- expect(pattern.exact_path).to eq('/abc/def/ghi')
- end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('/abc')).to be_truthy
- expect(pattern.could_match_children?('/xyz')).to be_falsey
- expect(pattern.could_match_children?('abc')).to be_falsey
- expect(pattern.could_match_children?('/abc/def')).to be_truthy
- expect(pattern.could_match_children?('/abc/xyz')).to be_falsey
- expect(pattern.could_match_children?('/abc/def/ghi')).to be_falsey
- end
- it 'exact_child_name_under' do
- expect(pattern.exact_child_name_under('/')).to eq('abc')
- expect(pattern.exact_child_name_under('/abc')).to eq('def')
- expect(pattern.exact_child_name_under('/abc/def')).to eq('ghi')
+ let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/def/ghi") }
+ it "match?" do
+ expect(pattern.match?("/abc/def/ghi")).to be_truthy
+ expect(pattern.match?("abc/def/ghi")).to be_falsey
+ expect(pattern.match?("/abc")).to be_falsey
+ expect(pattern.match?("/abc/def")).to be_falsey
+ end
+ it "exact_path" do
+ expect(pattern.exact_path).to eq("/abc/def/ghi")
+ end
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("/abc")).to be_truthy
+ expect(pattern.could_match_children?("/xyz")).to be_falsey
+ expect(pattern.could_match_children?("abc")).to be_falsey
+ expect(pattern.could_match_children?("/abc/def")).to be_truthy
+ expect(pattern.could_match_children?("/abc/xyz")).to be_falsey
+ expect(pattern.could_match_children?("/abc/def/ghi")).to be_falsey
+ end
+ it "exact_child_name_under" do
+ expect(pattern.exact_child_name_under("/")).to eq("abc")
+ expect(pattern.exact_child_name_under("/abc")).to eq("def")
+ expect(pattern.exact_child_name_under("/abc/def")).to eq("ghi")
end
end
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
- expect(pattern.match?('ab')).to be_falsey
- expect(pattern.match?('acb')).to be_falsey
- expect(pattern.match?('ab')).to be_falsey
+ it "match?" do
+ expect(pattern.match?("a*b")).to be_truthy
+ expect(pattern.match?("ab")).to be_falsey
+ expect(pattern.match?("acb")).to be_falsey
+ expect(pattern.match?("ab")).to be_falsey
end
- it 'exact_path' do
- expect(pattern.exact_path).to eq('a*b')
+ it "exact_path" do
+ expect(pattern.exact_path).to eq("a*b")
end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('a/*b')).to be_falsey
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("a/*b")).to be_falsey
end
end
context 'with star pattern "/abc/*/ghi"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('/abc/*/ghi') }
- it 'match?' do
- expect(pattern.match?('/abc/def/ghi')).to be_truthy
- expect(pattern.match?('/abc/ghi')).to be_falsey
+ let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/*/ghi") }
+ it "match?" do
+ expect(pattern.match?("/abc/def/ghi")).to be_truthy
+ expect(pattern.match?("/abc/ghi")).to be_falsey
end
- it 'exact_path' do
+ it "exact_path" do
expect(pattern.exact_path).to be_nil
end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('/abc')).to be_truthy
- expect(pattern.could_match_children?('/xyz')).to be_falsey
- expect(pattern.could_match_children?('abc')).to be_falsey
- expect(pattern.could_match_children?('/abc/def')).to be_truthy
- expect(pattern.could_match_children?('/abc/xyz')).to be_truthy
- expect(pattern.could_match_children?('/abc/def/ghi')).to be_falsey
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("/abc")).to be_truthy
+ expect(pattern.could_match_children?("/xyz")).to be_falsey
+ expect(pattern.could_match_children?("abc")).to be_falsey
+ expect(pattern.could_match_children?("/abc/def")).to be_truthy
+ expect(pattern.could_match_children?("/abc/xyz")).to be_truthy
+ expect(pattern.could_match_children?("/abc/def/ghi")).to be_falsey
end
- it 'exact_child_name_under' do
- expect(pattern.exact_child_name_under('/')).to eq('abc')
- expect(pattern.exact_child_name_under('/abc')).to eq(nil)
- expect(pattern.exact_child_name_under('/abc/def')).to eq('ghi')
+ it "exact_child_name_under" do
+ expect(pattern.exact_child_name_under("/")).to eq("abc")
+ expect(pattern.exact_child_name_under("/abc")).to eq(nil)
+ expect(pattern.exact_child_name_under("/abc/def")).to eq("ghi")
end
end
context 'with star pattern "/abc/d*f/ghi"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('/abc/d*f/ghi') }
- it 'match?' do
- expect(pattern.match?('/abc/def/ghi')).to be_truthy
- expect(pattern.match?('/abc/dxf/ghi')).to be_truthy
- expect(pattern.match?('/abc/df/ghi')).to be_truthy
- expect(pattern.match?('/abc/dxyzf/ghi')).to be_truthy
- expect(pattern.match?('/abc/d/ghi')).to be_falsey
- expect(pattern.match?('/abc/f/ghi')).to be_falsey
- expect(pattern.match?('/abc/ghi')).to be_falsey
- expect(pattern.match?('/abc/xyz/ghi')).to be_falsey
- end
- it 'exact_path' do
+ let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/d*f/ghi") }
+ it "match?" do
+ expect(pattern.match?("/abc/def/ghi")).to be_truthy
+ expect(pattern.match?("/abc/dxf/ghi")).to be_truthy
+ expect(pattern.match?("/abc/df/ghi")).to be_truthy
+ expect(pattern.match?("/abc/dxyzf/ghi")).to be_truthy
+ expect(pattern.match?("/abc/d/ghi")).to be_falsey
+ expect(pattern.match?("/abc/f/ghi")).to be_falsey
+ expect(pattern.match?("/abc/ghi")).to be_falsey
+ expect(pattern.match?("/abc/xyz/ghi")).to be_falsey
+ end
+ it "exact_path" do
expect(pattern.exact_path).to be_nil
end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('/abc')).to be_truthy
- expect(pattern.could_match_children?('/xyz')).to be_falsey
- expect(pattern.could_match_children?('abc')).to be_falsey
- expect(pattern.could_match_children?('/abc/def')).to be_truthy
- expect(pattern.could_match_children?('/abc/xyz')).to be_falsey
- expect(pattern.could_match_children?('/abc/dxyzf')).to be_truthy
- expect(pattern.could_match_children?('/abc/df')).to be_truthy
- expect(pattern.could_match_children?('/abc/d')).to be_falsey
- expect(pattern.could_match_children?('/abc/f')).to be_falsey
- expect(pattern.could_match_children?('/abc/def/ghi')).to be_falsey
- end
- it 'exact_child_name_under' do
- expect(pattern.exact_child_name_under('/')).to eq('abc')
- expect(pattern.exact_child_name_under('/abc')).to eq(nil)
- expect(pattern.exact_child_name_under('/abc/def')).to eq('ghi')
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("/abc")).to be_truthy
+ expect(pattern.could_match_children?("/xyz")).to be_falsey
+ expect(pattern.could_match_children?("abc")).to be_falsey
+ expect(pattern.could_match_children?("/abc/def")).to be_truthy
+ expect(pattern.could_match_children?("/abc/xyz")).to be_falsey
+ expect(pattern.could_match_children?("/abc/dxyzf")).to be_truthy
+ expect(pattern.could_match_children?("/abc/df")).to be_truthy
+ expect(pattern.could_match_children?("/abc/d")).to be_falsey
+ expect(pattern.could_match_children?("/abc/f")).to be_falsey
+ expect(pattern.could_match_children?("/abc/def/ghi")).to be_falsey
+ end
+ it "exact_child_name_under" do
+ expect(pattern.exact_child_name_under("/")).to eq("abc")
+ expect(pattern.exact_child_name_under("/abc")).to eq(nil)
+ expect(pattern.exact_child_name_under("/abc/def")).to eq("ghi")
end
end
context 'with star pattern "/abc/d??f/ghi"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('/abc/d??f/ghi') }
- it 'match?' do
- expect(pattern.match?('/abc/deef/ghi')).to be_truthy
- expect(pattern.match?('/abc/deeef/ghi')).to be_falsey
- expect(pattern.match?('/abc/def/ghi')).to be_falsey
- expect(pattern.match?('/abc/df/ghi')).to be_falsey
- expect(pattern.match?('/abc/d/ghi')).to be_falsey
- expect(pattern.match?('/abc/f/ghi')).to be_falsey
- expect(pattern.match?('/abc/ghi')).to be_falsey
- end
- it 'exact_path' do
+ let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/d??f/ghi") }
+ it "match?" do
+ expect(pattern.match?("/abc/deef/ghi")).to be_truthy
+ expect(pattern.match?("/abc/deeef/ghi")).to be_falsey
+ expect(pattern.match?("/abc/def/ghi")).to be_falsey
+ expect(pattern.match?("/abc/df/ghi")).to be_falsey
+ expect(pattern.match?("/abc/d/ghi")).to be_falsey
+ expect(pattern.match?("/abc/f/ghi")).to be_falsey
+ expect(pattern.match?("/abc/ghi")).to be_falsey
+ end
+ it "exact_path" do
expect(pattern.exact_path).to be_nil
end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('/abc')).to be_truthy
- expect(pattern.could_match_children?('/xyz')).to be_falsey
- expect(pattern.could_match_children?('abc')).to be_falsey
- expect(pattern.could_match_children?('/abc/deef')).to be_truthy
- expect(pattern.could_match_children?('/abc/deeef')).to be_falsey
- expect(pattern.could_match_children?('/abc/def')).to be_falsey
- expect(pattern.could_match_children?('/abc/df')).to be_falsey
- expect(pattern.could_match_children?('/abc/d')).to be_falsey
- expect(pattern.could_match_children?('/abc/f')).to be_falsey
- expect(pattern.could_match_children?('/abc/deef/ghi')).to be_falsey
- end
- it 'exact_child_name_under' do
- expect(pattern.exact_child_name_under('/')).to eq('abc')
- expect(pattern.exact_child_name_under('/abc')).to eq(nil)
- expect(pattern.exact_child_name_under('/abc/deef')).to eq('ghi')
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("/abc")).to be_truthy
+ expect(pattern.could_match_children?("/xyz")).to be_falsey
+ expect(pattern.could_match_children?("abc")).to be_falsey
+ expect(pattern.could_match_children?("/abc/deef")).to be_truthy
+ expect(pattern.could_match_children?("/abc/deeef")).to be_falsey
+ expect(pattern.could_match_children?("/abc/def")).to be_falsey
+ expect(pattern.could_match_children?("/abc/df")).to be_falsey
+ expect(pattern.could_match_children?("/abc/d")).to be_falsey
+ expect(pattern.could_match_children?("/abc/f")).to be_falsey
+ expect(pattern.could_match_children?("/abc/deef/ghi")).to be_falsey
+ end
+ it "exact_child_name_under" do
+ expect(pattern.exact_child_name_under("/")).to eq("abc")
+ expect(pattern.exact_child_name_under("/abc")).to eq(nil)
+ expect(pattern.exact_child_name_under("/abc/deef")).to eq("ghi")
end
end
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
- expect(pattern.match?('/abc/deef/ghi')).to be_falsey
- expect(pattern.match?('/abc/d11f/ghi')).to be_falsey
- expect(pattern.match?('/abc/de11f/ghi')).to be_falsey
- expect(pattern.match?('/abc/dee1f/ghi')).to be_falsey
- expect(pattern.match?('/abc/df/ghi')).to be_falsey
- expect(pattern.match?('/abc/d/ghi')).to be_falsey
- expect(pattern.match?('/abc/f/ghi')).to be_falsey
- expect(pattern.match?('/abc/ghi')).to be_falsey
- end
- it 'exact_path' 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
+ expect(pattern.match?("/abc/deef/ghi")).to be_falsey
+ expect(pattern.match?("/abc/d11f/ghi")).to be_falsey
+ expect(pattern.match?("/abc/de11f/ghi")).to be_falsey
+ expect(pattern.match?("/abc/dee1f/ghi")).to be_falsey
+ expect(pattern.match?("/abc/df/ghi")).to be_falsey
+ expect(pattern.match?("/abc/d/ghi")).to be_falsey
+ expect(pattern.match?("/abc/f/ghi")).to be_falsey
+ expect(pattern.match?("/abc/ghi")).to be_falsey
+ end
+ it "exact_path" do
expect(pattern.exact_path).to be_nil
end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('/abc')).to be_truthy
- expect(pattern.could_match_children?('/xyz')).to be_falsey
- expect(pattern.could_match_children?('abc')).to be_falsey
- expect(pattern.could_match_children?('/abc/de1f')).to be_truthy
- expect(pattern.could_match_children?('/abc/deef')).to be_falsey
- expect(pattern.could_match_children?('/abc/d11f')).to be_falsey
- expect(pattern.could_match_children?('/abc/de11f')).to be_falsey
- expect(pattern.could_match_children?('/abc/dee1f')).to be_falsey
- expect(pattern.could_match_children?('/abc/def')).to be_falsey
- expect(pattern.could_match_children?('/abc/df')).to be_falsey
- expect(pattern.could_match_children?('/abc/d')).to be_falsey
- expect(pattern.could_match_children?('/abc/f')).to be_falsey
- expect(pattern.could_match_children?('/abc/de1f/ghi')).to be_falsey
- end
- it 'exact_child_name_under' do
- expect(pattern.exact_child_name_under('/')).to eq('abc')
- expect(pattern.exact_child_name_under('/abc')).to eq(nil)
- expect(pattern.exact_child_name_under('/abc/de1f')).to eq('ghi')
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("/abc")).to be_truthy
+ expect(pattern.could_match_children?("/xyz")).to be_falsey
+ expect(pattern.could_match_children?("abc")).to be_falsey
+ expect(pattern.could_match_children?("/abc/de1f")).to be_truthy
+ expect(pattern.could_match_children?("/abc/deef")).to be_falsey
+ expect(pattern.could_match_children?("/abc/d11f")).to be_falsey
+ expect(pattern.could_match_children?("/abc/de11f")).to be_falsey
+ expect(pattern.could_match_children?("/abc/dee1f")).to be_falsey
+ expect(pattern.could_match_children?("/abc/def")).to be_falsey
+ expect(pattern.could_match_children?("/abc/df")).to be_falsey
+ expect(pattern.could_match_children?("/abc/d")).to be_falsey
+ expect(pattern.could_match_children?("/abc/f")).to be_falsey
+ expect(pattern.could_match_children?("/abc/de1f/ghi")).to be_falsey
+ end
+ it "exact_child_name_under" do
+ expect(pattern.exact_child_name_under("/")).to eq("abc")
+ expect(pattern.exact_child_name_under("/abc")).to eq(nil)
+ expect(pattern.exact_child_name_under("/abc/de1f")).to eq("ghi")
end
end
context 'with star pattern "/abc/**/ghi"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('/abc/**/ghi') }
- it 'match?' do
- expect(pattern.match?('/abc/def/ghi')).to be_truthy
- expect(pattern.match?('/abc/d/e/f/ghi')).to be_truthy
- expect(pattern.match?('/abc/ghi')).to be_falsey
- expect(pattern.match?('/abcdef/d/ghi')).to be_falsey
- expect(pattern.match?('/abc/d/defghi')).to be_falsey
- expect(pattern.match?('/xyz')).to be_falsey
- end
- it 'exact_path' do
+ let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/**/ghi") }
+ it "match?" do
+ expect(pattern.match?("/abc/def/ghi")).to be_truthy
+ expect(pattern.match?("/abc/d/e/f/ghi")).to be_truthy
+ expect(pattern.match?("/abc/ghi")).to be_falsey
+ expect(pattern.match?("/abcdef/d/ghi")).to be_falsey
+ expect(pattern.match?("/abc/d/defghi")).to be_falsey
+ expect(pattern.match?("/xyz")).to be_falsey
+ end
+ it "exact_path" do
expect(pattern.exact_path).to be_nil
end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('/abc')).to be_truthy
- expect(pattern.could_match_children?('/abc/d')).to be_truthy
- expect(pattern.could_match_children?('/abc/d/e')).to be_truthy
- expect(pattern.could_match_children?('/abc/d/e/f')).to be_truthy
- expect(pattern.could_match_children?('/abc/def/ghi')).to be_truthy
- expect(pattern.could_match_children?('abc')).to be_falsey
- expect(pattern.could_match_children?('/xyz')).to be_falsey
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("/abc")).to be_truthy
+ expect(pattern.could_match_children?("/abc/d")).to be_truthy
+ expect(pattern.could_match_children?("/abc/d/e")).to be_truthy
+ expect(pattern.could_match_children?("/abc/d/e/f")).to be_truthy
+ expect(pattern.could_match_children?("/abc/def/ghi")).to be_truthy
+ expect(pattern.could_match_children?("abc")).to be_falsey
+ expect(pattern.could_match_children?("/xyz")).to be_falsey
end
- it 'exact_child_name_under' do
- expect(pattern.exact_child_name_under('/')).to eq('abc')
- expect(pattern.exact_child_name_under('/abc')).to eq(nil)
- expect(pattern.exact_child_name_under('/abc/def')).to eq(nil)
+ it "exact_child_name_under" do
+ expect(pattern.exact_child_name_under("/")).to eq("abc")
+ expect(pattern.exact_child_name_under("/abc")).to eq(nil)
+ expect(pattern.exact_child_name_under("/abc/def")).to eq(nil)
end
end
context 'with star pattern "/abc**/ghi"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('/abc**/ghi') }
- it 'match?' do
- expect(pattern.match?('/abc/def/ghi')).to be_truthy
- expect(pattern.match?('/abc/d/e/f/ghi')).to be_truthy
- expect(pattern.match?('/abc/ghi')).to be_truthy
- expect(pattern.match?('/abcdef/ghi')).to be_truthy
- expect(pattern.match?('/abc/defghi')).to be_falsey
- expect(pattern.match?('/xyz')).to be_falsey
- end
- it 'exact_path' do
+ let(:pattern) { Chef::ChefFS::FilePattern.new("/abc**/ghi") }
+ it "match?" do
+ expect(pattern.match?("/abc/def/ghi")).to be_truthy
+ expect(pattern.match?("/abc/d/e/f/ghi")).to be_truthy
+ expect(pattern.match?("/abc/ghi")).to be_truthy
+ expect(pattern.match?("/abcdef/ghi")).to be_truthy
+ expect(pattern.match?("/abc/defghi")).to be_falsey
+ expect(pattern.match?("/xyz")).to be_falsey
+ end
+ it "exact_path" do
expect(pattern.exact_path).to be_nil
end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('/abc')).to be_truthy
- expect(pattern.could_match_children?('/abcdef')).to be_truthy
- expect(pattern.could_match_children?('/abc/d/e')).to be_truthy
- expect(pattern.could_match_children?('/abc/d/e/f')).to be_truthy
- expect(pattern.could_match_children?('/abc/def/ghi')).to be_truthy
- expect(pattern.could_match_children?('abc')).to be_falsey
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("/abc")).to be_truthy
+ expect(pattern.could_match_children?("/abcdef")).to be_truthy
+ expect(pattern.could_match_children?("/abc/d/e")).to be_truthy
+ expect(pattern.could_match_children?("/abc/d/e/f")).to be_truthy
+ expect(pattern.could_match_children?("/abc/def/ghi")).to be_truthy
+ expect(pattern.could_match_children?("abc")).to be_falsey
end
- it 'exact_child_name_under' do
- expect(pattern.exact_child_name_under('/')).to eq(nil)
- expect(pattern.exact_child_name_under('/abc')).to eq(nil)
- expect(pattern.exact_child_name_under('/abc/def')).to eq(nil)
+ it "exact_child_name_under" do
+ expect(pattern.exact_child_name_under("/")).to eq(nil)
+ expect(pattern.exact_child_name_under("/abc")).to eq(nil)
+ expect(pattern.exact_child_name_under("/abc/def")).to eq(nil)
end
end
context 'with star pattern "/abc/**ghi"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('/abc/**ghi') }
- it 'match?' do
- expect(pattern.match?('/abc/def/ghi')).to be_truthy
- expect(pattern.match?('/abc/def/ghi/ghi')).to be_truthy
- expect(pattern.match?('/abc/def/ghi/jkl')).to be_falsey
- expect(pattern.match?('/abc/d/e/f/ghi')).to be_truthy
- expect(pattern.match?('/abc/ghi')).to be_truthy
- expect(pattern.match?('/abcdef/ghi')).to be_falsey
- expect(pattern.match?('/abc/defghi')).to be_truthy
- expect(pattern.match?('/xyz')).to be_falsey
- end
- it 'exact_path' do
+ let(:pattern) { Chef::ChefFS::FilePattern.new("/abc/**ghi") }
+ it "match?" do
+ expect(pattern.match?("/abc/def/ghi")).to be_truthy
+ expect(pattern.match?("/abc/def/ghi/ghi")).to be_truthy
+ expect(pattern.match?("/abc/def/ghi/jkl")).to be_falsey
+ expect(pattern.match?("/abc/d/e/f/ghi")).to be_truthy
+ expect(pattern.match?("/abc/ghi")).to be_truthy
+ expect(pattern.match?("/abcdef/ghi")).to be_falsey
+ expect(pattern.match?("/abc/defghi")).to be_truthy
+ expect(pattern.match?("/xyz")).to be_falsey
+ end
+ it "exact_path" do
expect(pattern.exact_path).to be_nil
end
- it 'could_match_children?' do
- expect(pattern.could_match_children?('/abc')).to be_truthy
- expect(pattern.could_match_children?('/abcdef')).to be_falsey
- expect(pattern.could_match_children?('/abc/d/e')).to be_truthy
- expect(pattern.could_match_children?('/abc/d/e/f')).to be_truthy
- expect(pattern.could_match_children?('/abc/def/ghi')).to be_truthy
- expect(pattern.could_match_children?('abc')).to be_falsey
- expect(pattern.could_match_children?('/xyz')).to be_falsey
+ it "could_match_children?" do
+ expect(pattern.could_match_children?("/abc")).to be_truthy
+ expect(pattern.could_match_children?("/abcdef")).to be_falsey
+ expect(pattern.could_match_children?("/abc/d/e")).to be_truthy
+ expect(pattern.could_match_children?("/abc/d/e/f")).to be_truthy
+ expect(pattern.could_match_children?("/abc/def/ghi")).to be_truthy
+ expect(pattern.could_match_children?("abc")).to be_falsey
+ expect(pattern.could_match_children?("/xyz")).to be_falsey
end
- it 'exact_child_name_under' do
- expect(pattern.exact_child_name_under('/')).to eq('abc')
- expect(pattern.exact_child_name_under('/abc')).to eq(nil)
- expect(pattern.exact_child_name_under('/abc/def')).to eq(nil)
+ it "exact_child_name_under" do
+ expect(pattern.exact_child_name_under("/")).to eq("abc")
+ expect(pattern.exact_child_name_under("/abc")).to eq(nil)
+ expect(pattern.exact_child_name_under("/abc/def")).to eq(nil)
end
end
context 'with star pattern "a**b**c"' do
- let(:pattern) { Chef::ChefFS::FilePattern.new('a**b**c') }
- it 'match?' do
- expect(pattern.match?('axybzwc')).to be_truthy
- expect(pattern.match?('abc')).to be_truthy
- expect(pattern.match?('axyzwc')).to be_falsey
- expect(pattern.match?('ac')).to be_falsey
- expect(pattern.match?('a/x/y/b/z/w/c')).to be_truthy
- end
- it 'exact_path' do
+ let(:pattern) { Chef::ChefFS::FilePattern.new("a**b**c") }
+ it "match?" do
+ expect(pattern.match?("axybzwc")).to be_truthy
+ expect(pattern.match?("abc")).to be_truthy
+ expect(pattern.match?("axyzwc")).to be_falsey
+ expect(pattern.match?("ac")).to be_falsey
+ expect(pattern.match?("a/x/y/b/z/w/c")).to be_truthy
+ end
+ it "exact_path" do
expect(pattern.exact_path).to be_nil
end
end
- context 'normalization tests' do
- it 'handles trailing slashes' do
- expect(p('abc/').normalized_pattern).to eq('abc')
- expect(p('abc/').exact_path).to eq('abc')
- expect(p('abc/').match?('abc')).to be_truthy
- expect(p('//').normalized_pattern).to eq('/')
- expect(p('//').exact_path).to eq('/')
- expect(p('//').match?('/')).to be_truthy
- expect(p('/./').normalized_pattern).to eq('/')
- expect(p('/./').exact_path).to eq('/')
- expect(p('/./').match?('/')).to be_truthy
- end
- it 'handles multiple slashes' do
- expect(p('abc//def').normalized_pattern).to eq('abc/def')
- expect(p('abc//def').exact_path).to eq('abc/def')
- expect(p('abc//def').match?('abc/def')).to be_truthy
- expect(p('abc//').normalized_pattern).to eq('abc')
- expect(p('abc//').exact_path).to eq('abc')
- expect(p('abc//').match?('abc')).to be_truthy
- end
- it 'handles dot' do
- expect(p('abc/./def').normalized_pattern).to eq('abc/def')
- expect(p('abc/./def').exact_path).to eq('abc/def')
- expect(p('abc/./def').match?('abc/def')).to be_truthy
- expect(p('./abc/def').normalized_pattern).to eq('abc/def')
- expect(p('./abc/def').exact_path).to eq('abc/def')
- expect(p('./abc/def').match?('abc/def')).to be_truthy
- expect(p('/.').normalized_pattern).to eq('/')
- expect(p('/.').exact_path).to eq('/')
- expect(p('/.').match?('/')).to be_truthy
- end
- it 'handles dotdot' do
- expect(p('abc/../def').normalized_pattern).to eq('def')
- expect(p('abc/../def').exact_path).to eq('def')
- expect(p('abc/../def').match?('def')).to be_truthy
- expect(p('abc/def/../..').normalized_pattern).to eq('')
- expect(p('abc/def/../..').exact_path).to eq('')
- expect(p('abc/def/../..').match?('')).to be_truthy
- expect(p('/*/../def').normalized_pattern).to eq('/def')
- expect(p('/*/../def').exact_path).to eq('/def')
- expect(p('/*/../def').match?('/def')).to be_truthy
- expect(p('/*/*/../def').normalized_pattern).to eq('/*/def')
- expect(p('/*/*/../def').exact_path).to be_nil
- expect(p('/*/*/../def').match?('/abc/def')).to be_truthy
- expect(p('/abc/def/../..').normalized_pattern).to eq('/')
- expect(p('/abc/def/../..').exact_path).to eq('/')
- expect(p('/abc/def/../..').match?('/')).to be_truthy
- expect(p('abc/../../def').normalized_pattern).to eq('../def')
- expect(p('abc/../../def').exact_path).to eq('../def')
- expect(p('abc/../../def').match?('../def')).to be_truthy
- end
- it 'handles dotdot with double star' do
- expect(p('abc**/def/../ghi').exact_path).to be_nil
- expect(p('abc**/def/../ghi').match?('abc/ghi')).to be_truthy
- expect(p('abc**/def/../ghi').match?('abc/x/y/z/ghi')).to be_truthy
- expect(p('abc**/def/../ghi').match?('ghi')).to be_falsey
- end
- it 'raises error on dotdot with overlapping double star' do
- expect { Chef::ChefFS::FilePattern.new('abc/**/../def').exact_path }.to raise_error(ArgumentError)
- expect { Chef::ChefFS::FilePattern.new('abc/**/abc/../../def').exact_path }.to raise_error(ArgumentError)
- end
- it 'handles leading dotdot' do
- expect(p('../abc/def').exact_path).to eq('../abc/def')
- expect(p('../abc/def').match?('../abc/def')).to be_truthy
- expect(p('/../abc/def').exact_path).to eq('/abc/def')
- expect(p('/../abc/def').match?('/abc/def')).to be_truthy
- expect(p('..').exact_path).to eq('..')
- expect(p('..').match?('..')).to be_truthy
- expect(p('/..').exact_path).to eq('/')
- expect(p('/..').match?('/')).to be_truthy
+ context "normalization tests" do
+ it "handles trailing slashes" do
+ expect(p("abc/").normalized_pattern).to eq("abc")
+ expect(p("abc/").exact_path).to eq("abc")
+ expect(p("abc/").match?("abc")).to be_truthy
+ expect(p("//").normalized_pattern).to eq("/")
+ expect(p("//").exact_path).to eq("/")
+ expect(p("//").match?("/")).to be_truthy
+ expect(p("/./").normalized_pattern).to eq("/")
+ expect(p("/./").exact_path).to eq("/")
+ expect(p("/./").match?("/")).to be_truthy
+ end
+ it "handles multiple slashes" do
+ expect(p("abc//def").normalized_pattern).to eq("abc/def")
+ expect(p("abc//def").exact_path).to eq("abc/def")
+ expect(p("abc//def").match?("abc/def")).to be_truthy
+ expect(p("abc//").normalized_pattern).to eq("abc")
+ expect(p("abc//").exact_path).to eq("abc")
+ expect(p("abc//").match?("abc")).to be_truthy
+ end
+ it "handles dot" do
+ expect(p("abc/./def").normalized_pattern).to eq("abc/def")
+ expect(p("abc/./def").exact_path).to eq("abc/def")
+ expect(p("abc/./def").match?("abc/def")).to be_truthy
+ expect(p("./abc/def").normalized_pattern).to eq("abc/def")
+ expect(p("./abc/def").exact_path).to eq("abc/def")
+ expect(p("./abc/def").match?("abc/def")).to be_truthy
+ expect(p("/.").normalized_pattern).to eq("/")
+ expect(p("/.").exact_path).to eq("/")
+ expect(p("/.").match?("/")).to be_truthy
+ end
+ it "handles dotdot" do
+ expect(p("abc/../def").normalized_pattern).to eq("def")
+ expect(p("abc/../def").exact_path).to eq("def")
+ expect(p("abc/../def").match?("def")).to be_truthy
+ expect(p("abc/def/../..").normalized_pattern).to eq("")
+ expect(p("abc/def/../..").exact_path).to eq("")
+ expect(p("abc/def/../..").match?("")).to be_truthy
+ expect(p("/*/../def").normalized_pattern).to eq("/def")
+ expect(p("/*/../def").exact_path).to eq("/def")
+ expect(p("/*/../def").match?("/def")).to be_truthy
+ expect(p("/*/*/../def").normalized_pattern).to eq("/*/def")
+ expect(p("/*/*/../def").exact_path).to be_nil
+ expect(p("/*/*/../def").match?("/abc/def")).to be_truthy
+ expect(p("/abc/def/../..").normalized_pattern).to eq("/")
+ expect(p("/abc/def/../..").exact_path).to eq("/")
+ expect(p("/abc/def/../..").match?("/")).to be_truthy
+ expect(p("abc/../../def").normalized_pattern).to eq("../def")
+ expect(p("abc/../../def").exact_path).to eq("../def")
+ expect(p("abc/../../def").match?("../def")).to be_truthy
+ end
+ it "handles dotdot with double star" do
+ expect(p("abc**/def/../ghi").exact_path).to be_nil
+ expect(p("abc**/def/../ghi").match?("abc/ghi")).to be_truthy
+ expect(p("abc**/def/../ghi").match?("abc/x/y/z/ghi")).to be_truthy
+ expect(p("abc**/def/../ghi").match?("ghi")).to be_falsey
+ end
+ it "raises error on dotdot with overlapping double star" do
+ expect { Chef::ChefFS::FilePattern.new("abc/**/../def").exact_path }.to raise_error(ArgumentError)
+ expect { Chef::ChefFS::FilePattern.new("abc/**/abc/../../def").exact_path }.to raise_error(ArgumentError)
+ end
+ it "handles leading dotdot" do
+ expect(p("../abc/def").exact_path).to eq("../abc/def")
+ expect(p("../abc/def").match?("../abc/def")).to be_truthy
+ expect(p("/../abc/def").exact_path).to eq("/abc/def")
+ expect(p("/../abc/def").match?("/abc/def")).to be_truthy
+ expect(p("..").exact_path).to eq("..")
+ expect(p("..").match?("..")).to be_truthy
+ expect(p("/..").exact_path).to eq("/")
+ expect(p("/..").match?("/")).to be_truthy
end
end
diff --git a/spec/unit/chef_fs/file_system/cookbook_subdir_spec.rb b/spec/unit/chef_fs/file_system/cookbook_subdir_spec.rb
index b98ec12161..56967eaa63 100644
--- a/spec/unit/chef_fs/file_system/cookbook_subdir_spec.rb
+++ b/spec/unit/chef_fs/file_system/cookbook_subdir_spec.rb
@@ -16,19 +16,19 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/chef_fs/file_system/chef_server/cookbook_subdir'
+require "spec_helper"
+require "chef/chef_fs/file_system/chef_server/cookbook_subdir"
describe Chef::ChefFS::FileSystem::ChefServer::CookbookSubdir do
let(:root) do
- Chef::ChefFS::FileSystem::BaseFSDir.new('', nil)
+ Chef::ChefFS::FileSystem::BaseFSDir.new("", nil)
end
let(:cookbook_subdir) do
- Chef::ChefFS::FileSystem::ChefServer::CookbookSubdir.new('test', root, false, true)
+ Chef::ChefFS::FileSystem::ChefServer::CookbookSubdir.new("test", root, false, true)
end
- it 'can get child' do
- cookbook_subdir.child('test')
+ it "can get child" do
+ cookbook_subdir.child("test")
end
end
diff --git a/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb b/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
index 142755a4f1..f3054d8158 100644
--- a/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
+++ b/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/chef_fs/file_system/operation_failed_error'
+require "spec_helper"
+require "chef/chef_fs/file_system/operation_failed_error"
describe Chef::ChefFS::FileSystem::OperationFailedError do
- context 'message' do
+ context "message" do
let(:error_message) { 'HTTP error writing: 400 "Bad Request"' }
- context 'has a cause attribute and HTTP result code is 400' do
- it 'include error cause' do
+ context "has a cause attribute and HTTP result code is 400" do
+ it "include error cause" do
allow_message_expectations_on_nil
response_body = '{"error":["Invalid key test in request body"]}'
allow(@response).to receive(:code).and_return("400")
@@ -36,8 +36,8 @@ describe Chef::ChefFS::FileSystem::OperationFailedError do
end
end
- context 'does not have a cause attribute' do
- it 'does not include error cause' do
+ context "does not have a cause attribute" do
+ it "does not include error cause" do
expect {
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self), error_message
}.to raise_error(Chef::ChefFS::FileSystem::OperationFailedError, error_message)
diff --git a/spec/unit/chef_fs/file_system_spec.rb b/spec/unit/chef_fs/file_system_spec.rb
index a765be61db..8b1c90b91c 100644
--- a/spec/unit/chef_fs/file_system_spec.rb
+++ b/spec/unit/chef_fs/file_system_spec.rb
@@ -16,132 +16,132 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/chef_fs/file_system'
-require 'chef/chef_fs/file_pattern'
+require "spec_helper"
+require "chef/chef_fs/file_system"
+require "chef/chef_fs/file_pattern"
describe Chef::ChefFS::FileSystem do
include FileSystemSupport
- context 'with empty filesystem' do
- let(:fs) { memory_fs('', {}) }
+ context "with empty filesystem" do
+ let(:fs) { memory_fs("", {}) }
- context 'list' do
- it '/' do
- list_should_yield_paths(fs, '/', '/')
+ context "list" do
+ it "/" do
+ list_should_yield_paths(fs, "/", "/")
end
- it '/a' do
- list_should_yield_paths(fs, '/a', '/a')
+ it "/a" do
+ list_should_yield_paths(fs, "/a", "/a")
end
- it '/a/b' do
- list_should_yield_paths(fs, '/a/b', '/a/b')
+ it "/a/b" do
+ list_should_yield_paths(fs, "/a/b", "/a/b")
end
- it '/*' do
- list_should_yield_paths(fs, '/*', '/')
+ it "/*" do
+ list_should_yield_paths(fs, "/*", "/")
end
end
- context 'resolve_path' do
- it '/' do
- expect(Chef::ChefFS::FileSystem.resolve_path(fs, '/').path).to eq('/')
+ context "resolve_path" do
+ it "/" do
+ expect(Chef::ChefFS::FileSystem.resolve_path(fs, "/").path).to eq("/")
end
- it 'nonexistent /a' do
- expect(Chef::ChefFS::FileSystem.resolve_path(fs, '/a').path).to eq('/a')
+ it "nonexistent /a" do
+ expect(Chef::ChefFS::FileSystem.resolve_path(fs, "/a").path).to eq("/a")
end
- it 'nonexistent /a/b' do
- expect(Chef::ChefFS::FileSystem.resolve_path(fs, '/a/b').path).to eq('/a/b')
+ it "nonexistent /a/b" do
+ expect(Chef::ChefFS::FileSystem.resolve_path(fs, "/a/b").path).to eq("/a/b")
end
end
end
- context 'with a populated filesystem' do
+ context "with a populated filesystem" do
let(:fs) {
- memory_fs('', {
+ memory_fs("", {
:a => {
:aa => {
- :c => '',
- :zz => '',
+ :c => "",
+ :zz => "",
},
:ab => {
- :c => ''
+ :c => ""
},
},
- :x => '',
+ :x => "",
:y => {},
},)
}
- context 'list' do
- it '/**' do
- list_should_yield_paths(fs, '/**', '/', '/a', '/x', '/y', '/a/aa', '/a/aa/c', '/a/aa/zz', '/a/ab', '/a/ab/c')
+ context "list" do
+ it "/**" do
+ list_should_yield_paths(fs, "/**", "/", "/a", "/x", "/y", "/a/aa", "/a/aa/c", "/a/aa/zz", "/a/ab", "/a/ab/c")
end
- it '/' do
- list_should_yield_paths(fs, '/', '/')
+ it "/" do
+ list_should_yield_paths(fs, "/", "/")
end
- it '/*' do
- list_should_yield_paths(fs, '/*', '/', '/a', '/x', '/y')
+ it "/*" do
+ list_should_yield_paths(fs, "/*", "/", "/a", "/x", "/y")
end
- it '/*/*' do
- list_should_yield_paths(fs, '/*/*', '/a/aa', '/a/ab')
+ it "/*/*" do
+ list_should_yield_paths(fs, "/*/*", "/a/aa", "/a/ab")
end
- it '/*/*/*' do
- list_should_yield_paths(fs, '/*/*/*', '/a/aa/c', '/a/aa/zz', '/a/ab/c')
+ it "/*/*/*" do
+ list_should_yield_paths(fs, "/*/*/*", "/a/aa/c", "/a/aa/zz", "/a/ab/c")
end
- it '/*/*/?' do
- list_should_yield_paths(fs, '/*/*/?', '/a/aa/c', '/a/ab/c')
+ it "/*/*/?" do
+ list_should_yield_paths(fs, "/*/*/?", "/a/aa/c", "/a/ab/c")
end
- it '/a/*/c' do
- list_should_yield_paths(fs, '/a/*/c', '/a/aa/c', '/a/ab/c')
+ it "/a/*/c" do
+ list_should_yield_paths(fs, "/a/*/c", "/a/aa/c", "/a/ab/c")
end
- it '/**b/c' do
- list_should_yield_paths(fs, '/**b/c', '/a/ab/c')
+ it "/**b/c" do
+ list_should_yield_paths(fs, "/**b/c", "/a/ab/c")
end
- it '/a/ab/c' do
+ it "/a/ab/c" do
no_blocking_calls_allowed
- list_should_yield_paths(fs, '/a/ab/c', '/a/ab/c')
+ list_should_yield_paths(fs, "/a/ab/c", "/a/ab/c")
end
- it 'nonexistent /a/ab/blah' do
+ it "nonexistent /a/ab/blah" do
no_blocking_calls_allowed
- list_should_yield_paths(fs, '/a/ab/blah', '/a/ab/blah')
+ list_should_yield_paths(fs, "/a/ab/blah", "/a/ab/blah")
end
- it 'nonexistent /a/ab/blah/bjork' do
+ it "nonexistent /a/ab/blah/bjork" do
no_blocking_calls_allowed
- list_should_yield_paths(fs, '/a/ab/blah/bjork', '/a/ab/blah/bjork')
+ list_should_yield_paths(fs, "/a/ab/blah/bjork", "/a/ab/blah/bjork")
end
end
- context 'resolve_path' do
+ context "resolve_path" do
before(:each) do
no_blocking_calls_allowed
end
- it 'resolves /' do
- expect(Chef::ChefFS::FileSystem.resolve_path(fs, '/').path).to eq('/')
+ it "resolves /" do
+ expect(Chef::ChefFS::FileSystem.resolve_path(fs, "/").path).to eq("/")
end
- it 'resolves /x' do
- expect(Chef::ChefFS::FileSystem.resolve_path(fs, '/x').path).to eq('/x')
+ it "resolves /x" do
+ expect(Chef::ChefFS::FileSystem.resolve_path(fs, "/x").path).to eq("/x")
end
- it 'resolves /a' do
- expect(Chef::ChefFS::FileSystem.resolve_path(fs, '/a').path).to eq('/a')
+ it "resolves /a" do
+ expect(Chef::ChefFS::FileSystem.resolve_path(fs, "/a").path).to eq("/a")
end
- it 'resolves /a/aa' do
- expect(Chef::ChefFS::FileSystem.resolve_path(fs, '/a/aa').path).to eq('/a/aa')
+ it "resolves /a/aa" do
+ expect(Chef::ChefFS::FileSystem.resolve_path(fs, "/a/aa").path).to eq("/a/aa")
end
- it 'resolves /a/aa/zz' do
- expect(Chef::ChefFS::FileSystem.resolve_path(fs, '/a/aa/zz').path).to eq('/a/aa/zz')
+ it "resolves /a/aa/zz" do
+ expect(Chef::ChefFS::FileSystem.resolve_path(fs, "/a/aa/zz").path).to eq("/a/aa/zz")
end
- it 'resolves nonexistent /q/x/w' do
- expect(Chef::ChefFS::FileSystem.resolve_path(fs, '/q/x/w').path).to eq('/q/x/w')
+ it "resolves nonexistent /q/x/w" do
+ expect(Chef::ChefFS::FileSystem.resolve_path(fs, "/q/x/w").path).to eq("/q/x/w")
end
end
- context 'empty?' do
- it 'is not empty /' do
- expect(Chef::ChefFS::FileSystem.resolve_path(fs, '/').empty?).to be false
+ context "empty?" do
+ it "is not empty /" do
+ expect(Chef::ChefFS::FileSystem.resolve_path(fs, "/").empty?).to be false
end
- it 'is empty /y' do
- expect(Chef::ChefFS::FileSystem.resolve_path(fs, '/y').empty?).to be true
+ it "is empty /y" do
+ expect(Chef::ChefFS::FileSystem.resolve_path(fs, "/y").empty?).to be true
end
it 'is not a directory and can\'t be tested /x' do
- expect { Chef::ChefFS::FileSystem.resolve_path(fs, '/x').empty? }.to raise_error(NoMethodError)
+ expect { Chef::ChefFS::FileSystem.resolve_path(fs, "/x").empty? }.to raise_error(NoMethodError)
end
end
end
diff --git a/spec/unit/chef_fs/parallelizer.rb b/spec/unit/chef_fs/parallelizer.rb
index 3ca4ee0092..0d667098a8 100644
--- a/spec/unit/chef_fs/parallelizer.rb
+++ b/spec/unit/chef_fs/parallelizer.rb
@@ -1,5 +1,5 @@
-require 'spec_helper'
-require 'chef/chef_fs/parallelizer'
+require "spec_helper"
+require "chef/chef_fs/parallelizer"
describe Chef::ChefFS::Parallelizer do
before :each do
@@ -14,7 +14,7 @@ describe Chef::ChefFS::Parallelizer do
parallelizer.kill
end
- context 'With a Parallelizer with 5 threads' do
+ context "With a Parallelizer with 5 threads" do
let :parallelizer do
Chef::ChefFS::Parallelizer.new(5)
end
@@ -44,7 +44,7 @@ describe Chef::ChefFS::Parallelizer do
it "10 sleep(0.2)s complete within 0.5 seconds" do
expect(parallelize(1.upto(10), :ordered => false) do |i|
sleep 0.2
- 'x'
+ "x"
end.to_a).to eq(%w(x x x x x x x x x x))
expect(elapsed_time).to be < 0.5
end
@@ -62,28 +62,28 @@ describe Chef::ChefFS::Parallelizer do
it "An exception in input is passed through but does NOT stop processing" do
input = TestEnumerable.new(0.5,0.3,0.1) do
- raise 'hi'
+ raise "hi"
end
enum = parallelize(input, :ordered => false) { |x| sleep(x); x }
results = []
- expect { enum.each { |value| results << value } }.to raise_error 'hi'
+ expect { enum.each { |value| results << value } }.to raise_error "hi"
expect(results).to eq([ 0.1, 0.3, 0.5 ])
expect(elapsed_time).to be < 0.6
end
it "Exceptions in output are raised after all processing is done" do
processed = 0
- enum = parallelize([1,2,'x',3], :ordered => false) do |x|
- if x == 'x'
+ enum = parallelize([1,2,"x",3], :ordered => false) do |x|
+ if x == "x"
sleep 0.1
- raise 'hi'
+ raise "hi"
end
sleep 0.2
processed += 1
x
end
results = []
- expect { enum.each { |value| results << value } }.to raise_error 'hi'
+ expect { enum.each { |value| results << value } }.to raise_error "hi"
expect(results.sort).to eq([ 1, 2, 3 ])
expect(elapsed_time).to be < 0.3
expect(processed).to eq(3)
@@ -91,16 +91,16 @@ 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|
- if x == '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'
+ raise "hi"
end
sleep(x)
processed += 1
x
end
- expect { parallelized.to_a }.to raise_error 'hi'
+ expect { parallelized.to_a }.to raise_error "hi"
expect(processed).to eq(4)
end
end
@@ -116,7 +116,7 @@ describe Chef::ChefFS::Parallelizer do
it "10 sleep(0.2)s complete within 0.5 seconds" do
expect(parallelize(1.upto(10), :ordered => true) do |i|
sleep 0.2
- 'x'
+ "x"
end.to_a).to eq(%w(x x x x x x x x x x))
expect(elapsed_time).to be < 0.5
end
@@ -134,28 +134,28 @@ describe Chef::ChefFS::Parallelizer do
it "Exceptions in input are raised in the correct sequence but do NOT stop processing" do
input = TestEnumerable.new(0.5,0.3,0.1) do
- raise 'hi'
+ raise "hi"
end
results = []
enum = parallelize(input) { |x| sleep(x); x }
- expect { enum.each { |value| results << value } }.to raise_error 'hi'
+ expect { enum.each { |value| results << value } }.to raise_error "hi"
expect(elapsed_time).to be < 0.6
expect(results).to eq([ 0.5, 0.3, 0.1 ])
end
it "Exceptions in output are raised in the correct sequence and running processes do NOT stop processing" do
processed = 0
- enum = parallelize([1,2,'x',3]) do |x|
- if x == 'x'
+ enum = parallelize([1,2,"x",3]) do |x|
+ if x == "x"
sleep(0.1)
- raise 'hi'
+ raise "hi"
end
sleep(0.2)
processed += 1
x
end
results = []
- expect { enum.each { |value| results << value } }.to raise_error 'hi'
+ expect { enum.each { |value| results << value } }.to raise_error "hi"
expect(results).to eq([ 1, 2 ])
expect(elapsed_time).to be < 0.3
expect(processed).to eq(3)
@@ -163,16 +163,16 @@ 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|
- if x == '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'
+ raise "hi"
end
sleep(x)
processed += 1
x
end
- expect { parallelized.to_a }.to raise_error 'hi'
+ expect { parallelized.to_a }.to raise_error "hi"
expect(processed).to eq(4)
end
end
diff --git a/spec/unit/chef_fs/path_util_spec.rb b/spec/unit/chef_fs/path_util_spec.rb
index 42eb126dfb..02d0de8857 100644
--- a/spec/unit/chef_fs/path_util_spec.rb
+++ b/spec/unit/chef_fs/path_util_spec.rb
@@ -16,93 +16,93 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/chef_fs/path_utils'
+require "spec_helper"
+require "chef/chef_fs/path_utils"
describe Chef::ChefFS::PathUtils do
- context 'invoking join' do
- it 'joins well-behaved distinct path elements' do
- expect(Chef::ChefFS::PathUtils.join('a', 'b', 'c')).to eq('a/b/c')
+ context "invoking join" do
+ it "joins well-behaved distinct path elements" do
+ expect(Chef::ChefFS::PathUtils.join("a", "b", "c")).to eq("a/b/c")
end
- it 'strips extraneous slashes in the middle of paths' do
- expect(Chef::ChefFS::PathUtils.join('a/', '/b', '/c/')).to eq('a/b/c')
- expect(Chef::ChefFS::PathUtils.join('a/', '/b', '///c/')).to eq('a/b/c')
+ it "strips extraneous slashes in the middle of paths" do
+ expect(Chef::ChefFS::PathUtils.join("a/", "/b", "/c/")).to eq("a/b/c")
+ expect(Chef::ChefFS::PathUtils.join("a/", "/b", "///c/")).to eq("a/b/c")
end
- it 'preserves the whether the first element was absolute or not' do
- expect(Chef::ChefFS::PathUtils.join('/a/', '/b', 'c/')).to eq('/a/b/c')
- expect(Chef::ChefFS::PathUtils.join('///a/', '/b', 'c/')).to eq('/a/b/c')
+ it "preserves the whether the first element was absolute or not" do
+ expect(Chef::ChefFS::PathUtils.join("/a/", "/b", "c/")).to eq("/a/b/c")
+ expect(Chef::ChefFS::PathUtils.join("///a/", "/b", "c/")).to eq("/a/b/c")
end
end
- context 'invoking is_absolute?' do
- it 'confirms that paths starting with / are absolute' do
- expect(Chef::ChefFS::PathUtils.is_absolute?('/foo/bar/baz')).to be true
- expect(Chef::ChefFS::PathUtils.is_absolute?('/foo')).to be true
+ context "invoking is_absolute?" do
+ it "confirms that paths starting with / are absolute" do
+ expect(Chef::ChefFS::PathUtils.is_absolute?("/foo/bar/baz")).to be true
+ expect(Chef::ChefFS::PathUtils.is_absolute?("/foo")).to be true
end
- it 'confirms that paths starting with // are absolute even though that looks like some windows network path' do
- expect(Chef::ChefFS::PathUtils.is_absolute?('//foo/bar/baz')).to be true
+ it "confirms that paths starting with // are absolute even though that looks like some windows network path" do
+ expect(Chef::ChefFS::PathUtils.is_absolute?("//foo/bar/baz")).to be true
end
- it 'confirms that root is indeed absolute' do
- expect(Chef::ChefFS::PathUtils.is_absolute?('/')).to be true
+ it "confirms that root is indeed absolute" do
+ expect(Chef::ChefFS::PathUtils.is_absolute?("/")).to be true
end
- it 'confirms that paths starting without / are relative' do
- expect(Chef::ChefFS::PathUtils.is_absolute?('foo/bar/baz')).to be false
- expect(Chef::ChefFS::PathUtils.is_absolute?('a')).to be false
+ it "confirms that paths starting without / are relative" do
+ expect(Chef::ChefFS::PathUtils.is_absolute?("foo/bar/baz")).to be false
+ expect(Chef::ChefFS::PathUtils.is_absolute?("a")).to be false
end
- it 'returns false for an empty path.' do
- expect(Chef::ChefFS::PathUtils.is_absolute?('')).to be false
+ it "returns false for an empty path." do
+ expect(Chef::ChefFS::PathUtils.is_absolute?("")).to be false
end
end
- context 'invoking realest_path' do
+ context "invoking realest_path" do
let(:good_path) { File.dirname(__FILE__) }
let(:parent_path) { File.dirname(good_path) }
- it 'handles paths with no wildcards or globs' do
+ it "handles paths with no wildcards or globs" do
expect(Chef::ChefFS::PathUtils.realest_path(good_path)).to eq(File.expand_path(good_path))
end
- it 'handles paths with .. and .' do
- expect(Chef::ChefFS::PathUtils.realest_path(good_path+'/../.')).to eq(File.expand_path(parent_path))
+ it "handles paths with .. and ." do
+ expect(Chef::ChefFS::PathUtils.realest_path(good_path+"/../.")).to eq(File.expand_path(parent_path))
end
- it 'handles paths with *' do
- expect(Chef::ChefFS::PathUtils.realest_path(good_path + '/*/foo')).to eq(File.expand_path(good_path + '/*/foo'))
+ it "handles paths with *" do
+ expect(Chef::ChefFS::PathUtils.realest_path(good_path + "/*/foo")).to eq(File.expand_path(good_path + "/*/foo"))
end
- it 'handles directories that do not exist' do
- expect(Chef::ChefFS::PathUtils.realest_path(good_path + '/something/or/other')).to eq(File.expand_path(good_path + '/something/or/other'))
+ it "handles directories that do not exist" do
+ expect(Chef::ChefFS::PathUtils.realest_path(good_path + "/something/or/other")).to eq(File.expand_path(good_path + "/something/or/other"))
end
- it 'handles root correctly' do
+ it "handles root correctly" do
if Chef::Platform.windows?
- expect(Chef::ChefFS::PathUtils.realest_path('C:/')).to eq('C:/')
+ expect(Chef::ChefFS::PathUtils.realest_path("C:/")).to eq("C:/")
else
- expect(Chef::ChefFS::PathUtils.realest_path('/')).to eq('/')
+ expect(Chef::ChefFS::PathUtils.realest_path("/")).to eq("/")
end
end
end
- context 'invoking descendant_path' do
- it 'handles paths with various casing on windows' do
+ context "invoking descendant_path" do
+ it "handles paths with various casing on windows" do
allow(Chef::ChefFS).to receive(:windows?) { true }
- expect(Chef::ChefFS::PathUtils.descendant_path('C:/ab/b/c', 'C:/AB/B')).to eq('c')
- expect(Chef::ChefFS::PathUtils.descendant_path('C:/ab/b/c', 'c:/ab/B')).to eq('c')
+ expect(Chef::ChefFS::PathUtils.descendant_path("C:/ab/b/c", "C:/AB/B")).to eq("c")
+ expect(Chef::ChefFS::PathUtils.descendant_path("C:/ab/b/c", "c:/ab/B")).to eq("c")
end
- it 'returns nil if the path does not have the given ancestor' do
- expect(Chef::ChefFS::PathUtils.descendant_path('/D/E/F', '/A/B/C')).to be_nil
- expect(Chef::ChefFS::PathUtils.descendant_path('/A/B/D', '/A/B/C')).to be_nil
+ it "returns nil if the path does not have the given ancestor" do
+ expect(Chef::ChefFS::PathUtils.descendant_path("/D/E/F", "/A/B/C")).to be_nil
+ expect(Chef::ChefFS::PathUtils.descendant_path("/A/B/D", "/A/B/C")).to be_nil
end
- it 'returns blank if the ancestor equals the path' do
- expect(Chef::ChefFS::PathUtils.descendant_path('/A/B/D', '/A/B/D')).to eq('')
+ it "returns blank if the ancestor equals the path" do
+ expect(Chef::ChefFS::PathUtils.descendant_path("/A/B/D", "/A/B/D")).to eq("")
end
end
end
diff --git a/spec/unit/chef_spec.rb b/spec/unit/chef_spec.rb
index 8a8d6c6c68..b2be2af5f3 100644
--- a/spec/unit/chef_spec.rb
+++ b/spec/unit/chef_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef do
it "should have a version defined" do
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index ca7440061e..e41c092ae5 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -18,13 +18,13 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'spec/support/shared/context/client'
-require 'spec/support/shared/examples/client'
+require "spec_helper"
+require "spec/support/shared/context/client"
+require "spec/support/shared/examples/client"
-require 'chef/run_context'
-require 'chef/server_api'
-require 'rbconfig'
+require "chef/run_context"
+require "chef/server_api"
+require "rbconfig"
class FooError < RuntimeError
end
@@ -157,7 +157,7 @@ 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
@@ -220,7 +220,7 @@ describe Chef::Client do
describe "when converge completes successfully" do
include_context "a client run"
include_context "converge completed"
- context 'when audit mode is enabled' do
+ context "when audit mode is enabled" do
describe "when audit phase errors" do
include_context "audit phase failed with error"
include_examples "a completed run with audit failure" do
@@ -500,7 +500,7 @@ describe Chef::Client do
allow_any_instance_of(Chef::RunLock).to receive(:save_pid).and_raise(NoMethodError)
end
- context 'when audit mode is enabled' do
+ context "when audit mode is enabled" do
before do
Chef::Config[:audit_mode] = :enabled
end
@@ -513,7 +513,7 @@ describe Chef::Client do
end
end
- context 'when audit mode is disabled' do
+ context "when audit mode is disabled" do
before do
Chef::Config[:audit_mode] = :disabled
end
diff --git a/spec/unit/config_fetcher_spec.rb b/spec/unit/config_fetcher_spec.rb
index 1b4a4903a8..417087d9a3 100644
--- a/spec/unit/config_fetcher_spec.rb
+++ b/spec/unit/config_fetcher_spec.rb
@@ -1,5 +1,5 @@
-require 'spec_helper'
-require 'chef/config_fetcher'
+require "spec_helper"
+require "chef/config_fetcher"
describe Chef::ConfigFetcher do
let(:valid_json) { Chef::JSONCompat.to_json({:a=>"b"}) }
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb
index 8d155c61ab..68cb589251 100644
--- a/spec/unit/config_spec.rb
+++ b/spec/unit/config_spec.rb
@@ -1,7 +1,7 @@
-require 'spec_helper'
+require "spec_helper"
-require 'chef/config'
+require "chef/config"
RSpec.describe Chef::Config do
diff --git a/spec/unit/cookbook/chefignore_spec.rb b/spec/unit/cookbook/chefignore_spec.rb
index 9f5546de28..9d81981dcf 100644
--- a/spec/unit/cookbook/chefignore_spec.rb
+++ b/spec/unit/cookbook/chefignore_spec.rb
@@ -15,11 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Cookbook::Chefignore do
before do
- @chefignore = Chef::Cookbook::Chefignore.new(File.join(CHEF_SPEC_DATA, 'cookbooks'))
+ @chefignore = Chef::Cookbook::Chefignore.new(File.join(CHEF_SPEC_DATA, "cookbooks"))
end
it "loads the globs in the chefignore file" do
@@ -32,14 +32,14 @@ describe Chef::Cookbook::Chefignore do
end
it "determines if a file is ignored" do
- expect(@chefignore.ignored?('ignored')).to be_truthy
- expect(@chefignore.ignored?('recipes/ignoreme.rb')).to be_truthy
- expect(@chefignore.ignored?('recipes/dontignoreme.rb')).to be_falsey
+ expect(@chefignore.ignored?("ignored")).to be_truthy
+ expect(@chefignore.ignored?("recipes/ignoreme.rb")).to be_truthy
+ expect(@chefignore.ignored?("recipes/dontignoreme.rb")).to be_falsey
end
context "when using the single cookbook pattern" do
before do
- @chefignore = Chef::Cookbook::Chefignore.new(File.join(CHEF_SPEC_DATA, 'standalone_cookbook'))
+ @chefignore = Chef::Cookbook::Chefignore.new(File.join(CHEF_SPEC_DATA, "standalone_cookbook"))
end
it "loads the globs in the chefignore file" do
diff --git a/spec/unit/cookbook/cookbook_version_loader_spec.rb b/spec/unit/cookbook/cookbook_version_loader_spec.rb
index 23ffc21f7f..1a0c1ddf94 100644
--- a/spec/unit/cookbook/cookbook_version_loader_spec.rb
+++ b/spec/unit/cookbook/cookbook_version_loader_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Cookbook::CookbookVersionLoader do
before do
@@ -58,8 +58,8 @@ describe Chef::Cookbook::CookbookVersionLoader do
end
it "loads libraries" do
- expect(loaded_cookbook.library_filenames).to include(full_path('/libraries/openldap.rb'))
- expect(loaded_cookbook.library_filenames).to include(full_path('/libraries/openldap/version.rb'))
+ expect(loaded_cookbook.library_filenames).to include(full_path("/libraries/openldap.rb"))
+ expect(loaded_cookbook.library_filenames).to include(full_path("/libraries/openldap/version.rb"))
end
it "loads static files in the files/ dir" do
diff --git a/spec/unit/cookbook/file_vendor_spec.rb b/spec/unit/cookbook/file_vendor_spec.rb
index 8bf2d3c2a3..2420718dea 100644
--- a/spec/unit/cookbook/file_vendor_spec.rb
+++ b/spec/unit/cookbook/file_vendor_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Cookbook::FileVendor do
diff --git a/spec/unit/cookbook/metadata_spec.rb b/spec/unit/cookbook/metadata_spec.rb
index 48b0b2a059..ad4863ad3d 100644
--- a/spec/unit/cookbook/metadata_spec.rb
+++ b/spec/unit/cookbook/metadata_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/cookbook/metadata'
+require "spec_helper"
+require "chef/cookbook/metadata"
describe Chef::Cookbook::Metadata do
@@ -142,11 +142,11 @@ describe Chef::Cookbook::Metadata do
end
it "has an empty source_url string" do
- expect(metadata.source_url).to eq('')
+ expect(metadata.source_url).to eq("")
end
it "has an empty issues_url string" do
- expect(metadata.issues_url).to eq('')
+ expect(metadata.issues_url).to eq("")
end
it "is not private" do
@@ -189,7 +189,7 @@ describe Chef::Cookbook::Metadata do
describe "adding a supported platform" do
it "should support adding a supported platform with a single expression" do
metadata.supports("ubuntu", ">= 8.04")
- expect(metadata.platforms["ubuntu"]).to eq('>= 8.04')
+ expect(metadata.platforms["ubuntu"]).to eq(">= 8.04")
end
end
@@ -311,17 +311,17 @@ describe Chef::Cookbook::Metadata do
end
it "strips out self-dependencies", :chef_lt_13_only do
- metadata.name('foo')
+ metadata.name("foo")
expect(Chef::Log).to receive(:warn).with(
"Ignoring self-dependency in cookbook foo, please remove it (in the future this will be fatal)."
)
- metadata.depends('foo')
+ metadata.depends("foo")
expect(metadata.dependencies).to eql({})
end
it "errors on self-dependencies", :chef_gte_13_only do
- metadata.name('foo')
- expect { metadata.depends('foo') }.to raise_error
+ metadata.name("foo")
+ expect { metadata.depends("foo") }.to raise_error
# FIXME: add the error type
end
end
@@ -462,10 +462,10 @@ describe Chef::Cookbook::Metadata do
attrs = {
"display_name" => "MySQL Databases",
"description" => "Description of MySQL",
- "choice" => ['dedicated', 'shared'],
+ "choice" => ["dedicated", "shared"],
"calculated" => false,
- "type" => 'string',
- "required" => 'recommended',
+ "type" => "string",
+ "required" => "recommended",
"recipes" => [ "mysql::server", "mysql::master" ],
"default" => [ ],
"source_url" => "http://example.com",
@@ -519,16 +519,16 @@ describe Chef::Cookbook::Metadata do
metadata.attribute("db/mysql/databases", :privacy => false)
}.not_to raise_error
expect {
- metadata.attribute("db/mysql/databases", :privacy => 'true')
+ metadata.attribute("db/mysql/databases", :privacy => "true")
}.to raise_error(ArgumentError)
end
it "should not accept anything but an array of strings for choice" do
expect {
- metadata.attribute("db/mysql/databases", :choice => ['dedicated', 'shared'])
+ metadata.attribute("db/mysql/databases", :choice => ["dedicated", "shared"])
}.not_to raise_error
expect {
- metadata.attribute("db/mysql/databases", :choice => [10, 'shared'])
+ metadata.attribute("db/mysql/databases", :choice => [10, "shared"])
}.to raise_error(ArgumentError)
expect {
metadata.attribute("db/mysql/databases", :choice => Hash.new)
@@ -586,13 +586,13 @@ describe Chef::Cookbook::Metadata do
it "should let required be required, recommended or optional" do
expect {
- metadata.attribute("db/mysql/databases", :required => 'required')
+ metadata.attribute("db/mysql/databases", :required => "required")
}.not_to raise_error
expect {
- metadata.attribute("db/mysql/databases", :required => 'recommended')
+ metadata.attribute("db/mysql/databases", :required => "recommended")
}.not_to raise_error
expect {
- metadata.attribute("db/mysql/databases", :required => 'optional')
+ metadata.attribute("db/mysql/databases", :required => "optional")
}.not_to raise_error
end
@@ -612,7 +612,7 @@ describe Chef::Cookbook::Metadata do
it "should set required to 'optional' by default" do
metadata.attribute("db/mysql/databases", {})
- expect(metadata.attributes["db/mysql/databases"][:required]).to eq('optional')
+ expect(metadata.attributes["db/mysql/databases"][:required]).to eq("optional")
end
it "should make sure recipes is an array" do
@@ -742,7 +742,7 @@ describe Chef::Cookbook::Metadata do
describe "recipes" do
let(:cookbook) do
- c = Chef::CookbookVersion.new('test_cookbook')
+ c = Chef::CookbookVersion.new("test_cookbook")
c.recipe_files = [ "default.rb", "enlighten.rb" ]
c
end
@@ -894,13 +894,13 @@ describe Chef::Cookbook::Metadata do
it "should transform deprecated greater than syntax for :#{to_check}" do
@hash[to_check.to_s]["foo::bar"] = ">> 0.2"
deserial = Chef::Cookbook::Metadata.from_hash(@hash)
- expect(deserial.send(to_check)["foo::bar"]).to eq('> 0.2')
+ expect(deserial.send(to_check)["foo::bar"]).to eq("> 0.2")
end
it "should transform deprecated less than syntax for :#{to_check}" do
@hash[to_check.to_s]["foo::bar"] = "<< 0.2"
deserial = Chef::Cookbook::Metadata.from_hash(@hash)
- expect(deserial.send(to_check)["foo::bar"]).to eq('< 0.2')
+ expect(deserial.send(to_check)["foo::bar"]).to eq("< 0.2")
end
it "should ignore multiple dependency constraints for :#{to_check}" do
diff --git a/spec/unit/cookbook/synchronizer_spec.rb b/spec/unit/cookbook/synchronizer_spec.rb
index 30ddaad1d7..17803a8392 100644
--- a/spec/unit/cookbook/synchronizer_spec.rb
+++ b/spec/unit/cookbook/synchronizer_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
-require 'chef/cookbook/synchronizer'
-require 'chef/cookbook_version'
+require "spec_helper"
+require "chef/cookbook/synchronizer"
+require "chef/cookbook_version"
describe Chef::CookbookCacheCleaner do
describe "when cleaning up unused cookbook components" do
@@ -164,8 +164,8 @@ describe Chef::CookbookSynchronizer do
valid_cached_cb_files = %w{cookbooks/valid1/recipes/default.rb cookbooks/valid2/recipes/default.rb}
obsolete_cb_files = %w{cookbooks/old1/recipes/default.rb cookbooks/old2/recipes/default.rb}
expect(file_cache).to receive(:find).with(File.join(%w{cookbooks ** {*,.*}})).and_return(valid_cached_cb_files + obsolete_cb_files)
- expect(file_cache).to receive(:delete).with('cookbooks/old1/recipes/default.rb')
- expect(file_cache).to receive(:delete).with('cookbooks/old2/recipes/default.rb')
+ expect(file_cache).to receive(:delete).with("cookbooks/old1/recipes/default.rb")
+ expect(file_cache).to receive(:delete).with("cookbooks/old2/recipes/default.rb")
allow(synchronizer).to receive(:cache).and_return(file_cache)
synchronizer.remove_old_cookbooks
end
@@ -186,7 +186,7 @@ describe Chef::CookbookSynchronizer do
expect(synchronizer).to receive(:have_cookbook?).with("valid1").at_least(:once).and_return(true)
# valid2 is a cookbook not in our run_list (we're simulating an override run_list where valid2 needs to be preserved)
expect(synchronizer).to receive(:have_cookbook?).with("valid2").at_least(:once).and_return(false)
- expect(file_cache).to receive(:delete).with('cookbooks/valid1/recipes/deleted.rb')
+ expect(file_cache).to receive(:delete).with("cookbooks/valid1/recipes/deleted.rb")
expect(synchronizer).to receive(:cookbook_segment).with("valid1", "recipes").at_least(:once).and_return([ { "path" => "recipes/default.rb" }])
allow(synchronizer).to receive(:cache).and_return(file_cache)
synchronizer.remove_deleted_files
@@ -224,7 +224,7 @@ describe Chef::CookbookSynchronizer do
# Fetch and copy default.rb recipe
expect(server_api).to receive(:streaming_request).
- with('http://chef.example.com/abc123').
+ with("http://chef.example.com/abc123").
and_return(cookbook_a_default_recipe_tempfile)
expect(file_cache).to receive(:move_to).
with("/tmp/cookbook_a_recipes_default_rb", "cookbooks/cookbook_a/recipes/default.rb")
@@ -234,7 +234,7 @@ describe Chef::CookbookSynchronizer do
# Fetch and copy default.rb attribute file
expect(server_api).to receive(:streaming_request).
- with('http://chef.example.com/abc456').
+ with("http://chef.example.com/abc456").
and_return(cookbook_a_default_attribute_tempfile)
expect(file_cache).to receive(:move_to).
with("/tmp/cookbook_a_attributes_default_rb", "cookbooks/cookbook_a/attributes/default.rb")
@@ -252,7 +252,7 @@ describe Chef::CookbookSynchronizer do
and_return(false)
expect(server_api).to receive(:streaming_request).
- with('http://chef.example.com/megaman.conf').
+ with("http://chef.example.com/megaman.conf").
and_return(cookbook_a_file_default_tempfile)
expect(file_cache).to receive(:move_to).
with("/tmp/cookbook_a_file_default_tempfile", "cookbooks/cookbook_a/files/default/megaman.conf")
@@ -261,7 +261,7 @@ describe Chef::CookbookSynchronizer do
and_return("/file-cache/cookbooks/cookbook_a/default/megaman.conf")
expect(server_api).to receive(:streaming_request).
- with('http://chef.example.com/ffffff').
+ with("http://chef.example.com/ffffff").
and_return(cookbook_a_template_default_tempfile)
expect(file_cache).to receive(:move_to).
with("/tmp/cookbook_a_template_default_tempfile", "cookbooks/cookbook_a/templates/default/apache2.conf.erb")
@@ -281,7 +281,7 @@ describe Chef::CookbookSynchronizer do
# Fetch and copy default.rb recipe
expect(server_api).to receive(:streaming_request).
- with('http://chef.example.com/abc123').
+ with("http://chef.example.com/abc123").
and_return(cookbook_a_default_recipe_tempfile)
expect(file_cache).to receive(:move_to).
with("/tmp/cookbook_a_recipes_default_rb", "cookbooks/cookbook_a/recipes/default.rb")
@@ -297,7 +297,7 @@ describe Chef::CookbookSynchronizer do
# Fetch and copy default.rb attribute file
expect(server_api).to receive(:streaming_request).
- with('http://chef.example.com/abc456').
+ with("http://chef.example.com/abc456").
and_return(cookbook_a_default_attribute_tempfile)
expect(file_cache).to receive(:move_to).
with("/tmp/cookbook_a_attributes_default_rb", "cookbooks/cookbook_a/attributes/default.rb")
@@ -323,7 +323,7 @@ describe Chef::CookbookSynchronizer do
# Fetch and copy megaman.conf
expect(server_api).to receive(:streaming_request).
- with('http://chef.example.com/megaman.conf').
+ with("http://chef.example.com/megaman.conf").
and_return(cookbook_a_file_default_tempfile)
expect(file_cache).to receive(:move_to).
with("/tmp/cookbook_a_file_default_tempfile", "cookbooks/cookbook_a/files/default/megaman.conf")
@@ -334,7 +334,7 @@ describe Chef::CookbookSynchronizer do
# Fetch and copy apache2.conf template
expect(server_api).to receive(:streaming_request).
- with('http://chef.example.com/ffffff').
+ with("http://chef.example.com/ffffff").
and_return(cookbook_a_template_default_tempfile)
expect(file_cache).to receive(:move_to).
with("/tmp/cookbook_a_template_default_tempfile", "cookbooks/cookbook_a/templates/default/apache2.conf.erb")
@@ -442,7 +442,7 @@ describe Chef::CookbookSynchronizer do
it "does not fetch templates or cookbook files" do
# Implicitly tested in previous test; this test is just for behavior specification.
expect(server_api).not_to receive(:streaming_request).
- with('http://chef.example.com/ffffff')
+ with("http://chef.example.com/ffffff")
synchronizer.sync_cookbooks
end
diff --git a/spec/unit/cookbook/syntax_check_spec.rb b/spec/unit/cookbook/syntax_check_spec.rb
index efdb5b7926..ad270ae712 100644
--- a/spec/unit/cookbook/syntax_check_spec.rb
+++ b/spec/unit/cookbook/syntax_check_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
require "chef/cookbook/syntax_check"
describe Chef::Cookbook::SyntaxCheck do
@@ -24,7 +24,7 @@ describe Chef::Cookbook::SyntaxCheck do
allow(ChefConfig).to receive(:windows?) { false }
end
- let(:cookbook_path) { File.join(CHEF_SPEC_DATA, 'cookbooks', 'openldap') }
+ let(:cookbook_path) { File.join(CHEF_SPEC_DATA, "cookbooks", "openldap") }
let(:syntax_check) { Chef::Cookbook::SyntaxCheck.new(cookbook_path) }
let(:open_ldap_cookbook_files) do
@@ -46,10 +46,10 @@ describe Chef::Cookbook::SyntaxCheck do
@original_log_level = Chef::Log.level
Chef::Log.level = :warn # suppress "Syntax OK" messages
- @attr_files = %w{default.rb smokey.rb}.map { |f| File.join(cookbook_path, 'attributes', f) }
- @libr_files = %w{openldap.rb openldap/version.rb}.map { |f| File.join(cookbook_path, 'libraries', f) }
- @defn_files = %w{client.rb server.rb}.map { |f| File.join(cookbook_path, 'definitions', f)}
- @recipes = %w{default.rb gigantor.rb one.rb return.rb}.map { |f| File.join(cookbook_path, 'recipes', f) }
+ @attr_files = %w{default.rb smokey.rb}.map { |f| File.join(cookbook_path, "attributes", f) }
+ @libr_files = %w{openldap.rb openldap/version.rb}.map { |f| File.join(cookbook_path, "libraries", f) }
+ @defn_files = %w{client.rb server.rb}.map { |f| File.join(cookbook_path, "definitions", f)}
+ @recipes = %w{default.rb gigantor.rb one.rb return.rb}.map { |f| File.join(cookbook_path, "recipes", f) }
@ruby_files = @attr_files + @libr_files + @defn_files + @recipes + [File.join(cookbook_path, "metadata.rb")]
basenames = %w{ helpers_via_partial_test.erb
helper_test.erb
@@ -62,7 +62,7 @@ describe Chef::Cookbook::SyntaxCheck do
some_windows_line_endings.erb
all_windows_line_endings.erb
no_windows_line_endings.erb }
- @template_files = basenames.map { |f| File.join(cookbook_path, 'templates', 'default', f)}
+ @template_files = basenames.map { |f| File.join(cookbook_path, "templates", "default", f)}
end
after do
@@ -77,18 +77,18 @@ describe Chef::Cookbook::SyntaxCheck do
end
it "creates a syntax checker given the cookbook name and cookbook_path" do
- syntax_check = Chef::Cookbook::SyntaxCheck.for_cookbook(:openldap, File.join(CHEF_SPEC_DATA, 'cookbooks'))
+ syntax_check = Chef::Cookbook::SyntaxCheck.for_cookbook(:openldap, File.join(CHEF_SPEC_DATA, "cookbooks"))
expect(syntax_check.cookbook_path).to eq(cookbook_path)
expect(syntax_check.ruby_files.sort).to eq(open_ldap_cookbook_files.sort)
end
context "when using a standalone cookbook" do
- let(:cookbook_path) { File.join(CHEF_SPEC_DATA, 'standalone_cookbook') }
+ let(:cookbook_path) { File.join(CHEF_SPEC_DATA, "standalone_cookbook") }
it "creates a syntax checker given the cookbook name and cookbook_path for a standalone cookbook" do
syntax_check = Chef::Cookbook::SyntaxCheck.for_cookbook(:standalone_cookbook, CHEF_SPEC_DATA)
expect(syntax_check.cookbook_path).to eq(cookbook_path)
- expect(syntax_check.ruby_files).to eq([File.join(cookbook_path, 'recipes/default.rb')])
+ expect(syntax_check.ruby_files).to eq([File.join(cookbook_path, "recipes/default.rb")])
end
end
@@ -128,13 +128,13 @@ describe Chef::Cookbook::SyntaxCheck do
end
it "removes a ruby file from the list of untested files after it is marked as validated" do
- recipe = File.join(cookbook_path, 'recipes', 'default.rb')
+ recipe = File.join(cookbook_path, "recipes", "default.rb")
syntax_check.validated(recipe)
expect(syntax_check.untested_ruby_files).not_to include(recipe)
end
it "removes a template file from the list of untested files after it is marked as validated" do
- template = File.join(cookbook_path, 'templates', 'default', 'test.erb')
+ template = File.join(cookbook_path, "templates", "default", "test.erb")
syntax_check.validated(template)
expect(syntax_check.untested_template_files).not_to include(template)
end
@@ -151,7 +151,7 @@ describe Chef::Cookbook::SyntaxCheck do
describe "and a file has a syntax error" do
before do
- cookbook_path = File.join(CHEF_SPEC_DATA, 'cookbooks', 'borken')
+ cookbook_path = File.join(CHEF_SPEC_DATA, "cookbooks", "borken")
syntax_check.cookbook_path.replace(cookbook_path)
end
@@ -160,9 +160,9 @@ describe Chef::Cookbook::SyntaxCheck do
end
it "does not remove the invalid file from the list of untested files" do
- expect(syntax_check.untested_ruby_files).to include(File.join(cookbook_path, 'recipes', 'default.rb'))
+ expect(syntax_check.untested_ruby_files).to include(File.join(cookbook_path, "recipes", "default.rb"))
syntax_check.validate_ruby_files
- expect(syntax_check.untested_ruby_files).to include(File.join(cookbook_path, 'recipes', 'default.rb'))
+ expect(syntax_check.untested_ruby_files).to include(File.join(cookbook_path, "recipes", "default.rb"))
end
it "indicates that a template file has a syntax error" do
@@ -170,7 +170,7 @@ describe Chef::Cookbook::SyntaxCheck do
end
it "does not remove the invalid template from the list of untested templates" do
- expect(syntax_check.untested_template_files).to include(File.join(cookbook_path, 'templates', 'default', 'borken.erb'))
+ expect(syntax_check.untested_template_files).to include(File.join(cookbook_path, "templates", "default", "borken.erb"))
expect {syntax_check.validate_templates}.not_to change(syntax_check, :untested_template_files)
end
@@ -178,10 +178,10 @@ describe Chef::Cookbook::SyntaxCheck do
describe "and an ignored file has a syntax error" do
before do
- cookbook_path = File.join(CHEF_SPEC_DATA, 'cookbooks', 'ignorken')
+ cookbook_path = File.join(CHEF_SPEC_DATA, "cookbooks", "ignorken")
Chef::Config[:cookbook_path] = File.dirname(cookbook_path)
syntax_check.cookbook_path.replace(cookbook_path)
- @ruby_files = [File.join(cookbook_path, 'metadata.rb'), File.join(cookbook_path, 'recipes/default.rb')]
+ @ruby_files = [File.join(cookbook_path, "metadata.rb"), File.join(cookbook_path, "recipes/default.rb")]
end
it "shows that ignored ruby files do not require a syntax check" do
diff --git a/spec/unit/cookbook_loader_spec.rb b/spec/unit/cookbook_loader_spec.rb
index 8d4413105d..36060cde99 100644
--- a/spec/unit/cookbook_loader_spec.rb
+++ b/spec/unit/cookbook_loader_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::CookbookLoader do
before do
@@ -223,7 +223,7 @@ describe Chef::CookbookLoader do
end
it "should not load the cookbook again when accessed" do
- expect(cookbook_loader).not_to receive('load_cookbook')
+ expect(cookbook_loader).not_to receive("load_cookbook")
cookbook_loader["openldap"]
end
diff --git a/spec/unit/cookbook_manifest_spec.rb b/spec/unit/cookbook_manifest_spec.rb
index f985942e09..8b7cf1fc7e 100644
--- a/spec/unit/cookbook_manifest_spec.rb
+++ b/spec/unit/cookbook_manifest_spec.rb
@@ -15,10 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
-require 'chef/cookbook_manifest'
-require 'chef/digester'
-require 'pathname'
+require "spec_helper"
+require "chef/cookbook_manifest"
+require "chef/digester"
+require "pathname"
describe Chef::CookbookManifest do
@@ -32,7 +32,7 @@ describe Chef::CookbookManifest do
end
end
- let(:cookbook_root) { '/tmp/blah' }
+ let(:cookbook_root) { "/tmp/blah" }
let(:cookbook_version) do
Chef::CookbookVersion.new("tatft", cookbook_root).tap do |c|
@@ -62,7 +62,7 @@ describe Chef::CookbookManifest do
end
it "delegates `root_paths' to cookbook_version" do
- expect(cookbook_manifest.root_paths).to eq(['/tmp/blah'])
+ expect(cookbook_manifest.root_paths).to eq(["/tmp/blah"])
end
it "delegates `metadata' to cookbook_version" do
@@ -121,18 +121,18 @@ describe Chef::CookbookManifest do
context "when given a cookbook with files" do
- let(:cookbook_root) { File.join(CHEF_SPEC_DATA, 'cb_version_cookbooks', 'tatft') }
-
- let(:attribute_filenames) { Dir[File.join(cookbook_root, 'attributes', '**', '*.rb')] }
- let(:definition_filenames) { Dir[File.join(cookbook_root, 'definitions', '**', '*.rb')] }
- let(:file_filenames) { Dir[File.join(cookbook_root, 'files', '**', '*.tgz')] }
- let(:recipe_filenames) { Dir[File.join(cookbook_root, 'recipes', '**', '*.rb')] }
- let(:template_filenames) { Dir[File.join(cookbook_root, 'templates', '**', '*.erb')] }
- let(:library_filenames) { Dir[File.join(cookbook_root, 'libraries', '**', '*.rb')] }
- let(:resource_filenames) { Dir[File.join(cookbook_root, 'resources', '**', '*.rb')] }
- let(:provider_filenames) { Dir[File.join(cookbook_root, 'providers', '**', '*.rb')] }
- let(:root_filenames) { Array(File.join(cookbook_root, 'README.rdoc')) }
- let(:metadata_filenames) { Array(File.join(cookbook_root, 'metadata.json')) }
+ let(:cookbook_root) { File.join(CHEF_SPEC_DATA, "cb_version_cookbooks", "tatft") }
+
+ let(:attribute_filenames) { Dir[File.join(cookbook_root, "attributes", "**", "*.rb")] }
+ let(:definition_filenames) { Dir[File.join(cookbook_root, "definitions", "**", "*.rb")] }
+ let(:file_filenames) { Dir[File.join(cookbook_root, "files", "**", "*.tgz")] }
+ let(:recipe_filenames) { Dir[File.join(cookbook_root, "recipes", "**", "*.rb")] }
+ let(:template_filenames) { Dir[File.join(cookbook_root, "templates", "**", "*.erb")] }
+ let(:library_filenames) { Dir[File.join(cookbook_root, "libraries", "**", "*.rb")] }
+ let(:resource_filenames) { Dir[File.join(cookbook_root, "resources", "**", "*.rb")] }
+ let(:provider_filenames) { Dir[File.join(cookbook_root, "providers", "**", "*.rb")] }
+ let(:root_filenames) { Array(File.join(cookbook_root, "README.rdoc")) }
+ let(:metadata_filenames) { Array(File.join(cookbook_root, "metadata.json")) }
let(:match_md5) { /[0-9a-f]{32}/ }
diff --git a/spec/unit/cookbook_site_streaming_uploader_spec.rb b/spec/unit/cookbook_site_streaming_uploader_spec.rb
index 07069810dd..bc01962a01 100644
--- a/spec/unit/cookbook_site_streaming_uploader_spec.rb
+++ b/spec/unit/cookbook_site_streaming_uploader_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/cookbook_site_streaming_uploader'
+require "chef/cookbook_site_streaming_uploader"
class FakeTempfile
def initialize(basename)
@@ -39,7 +39,7 @@ describe Chef::CookbookSiteStreamingUploader do
describe "create_build_dir" do
before(:each) do
- @cookbook_repo = File.expand_path(File.join(CHEF_SPEC_DATA, 'cookbooks'))
+ @cookbook_repo = File.expand_path(File.join(CHEF_SPEC_DATA, "cookbooks"))
@loader = Chef::CookbookLoader.new(@cookbook_repo)
@loader.load_cookbooks
allow(File).to receive(:unlink)
@@ -47,7 +47,7 @@ describe Chef::CookbookSiteStreamingUploader do
it "should create the cookbook tmp dir" do
cookbook = @loader[:openldap]
- files_count = Dir.glob(File.join(@cookbook_repo, cookbook.name.to_s, '**', '*'), File::FNM_DOTMATCH).count { |file| File.file?(file) }
+ files_count = Dir.glob(File.join(@cookbook_repo, cookbook.name.to_s, "**", "*"), File::FNM_DOTMATCH).count { |file| File.file?(file) }
expect(Tempfile).to receive(:new).with("chef-#{cookbook.name}-build").and_return(FakeTempfile.new("chef-#{cookbook.name}-build"))
expect(FileUtils).to receive(:mkdir_p).exactly(files_count + 1).times
@@ -61,25 +61,25 @@ describe Chef::CookbookSiteStreamingUploader do
before(:each) do
@uri = "http://cookbooks.dummy.com/api/v1/cookbooks"
- @secret_filename = File.join(CHEF_SPEC_DATA, 'ssl/private_key.pem')
+ @secret_filename = File.join(CHEF_SPEC_DATA, "ssl/private_key.pem")
@rsa_key = File.read(@secret_filename)
- response = Net::HTTPResponse.new('1.0', '200', 'OK')
+ response = Net::HTTPResponse.new("1.0", "200", "OK")
allow_any_instance_of(Net::HTTP).to receive(:request).and_return(response)
end
it "should send an http request" do
expect_any_instance_of(Net::HTTP).to receive(:request)
- Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, 'bill', @secret_filename)
+ Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, "bill", @secret_filename)
end
it "should read the private key file" do
expect(File).to receive(:read).with(@secret_filename).and_return(@rsa_key)
- Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, 'bill', @secret_filename)
+ Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, "bill", @secret_filename)
end
it "should add the authentication signed header" do
expect_any_instance_of(Mixlib::Authentication::SigningObject).to receive(:sign).and_return({})
- Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, 'bill', @secret_filename)
+ Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, "bill", @secret_filename)
end
it "should be able to send post requests" do
@@ -88,7 +88,7 @@ describe Chef::CookbookSiteStreamingUploader do
expect(Net::HTTP::Post).to receive(:new).once.and_return(post)
expect(Net::HTTP::Put).not_to receive(:new)
expect(Net::HTTP::Get).not_to receive(:new)
- Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, 'bill', @secret_filename)
+ Chef::CookbookSiteStreamingUploader.make_request(:post, @uri, "bill", @secret_filename)
end
it "should be able to send put requests" do
@@ -97,27 +97,27 @@ describe Chef::CookbookSiteStreamingUploader do
expect(Net::HTTP::Post).not_to receive(:new)
expect(Net::HTTP::Put).to receive(:new).once.and_return(put)
expect(Net::HTTP::Get).not_to receive(:new)
- Chef::CookbookSiteStreamingUploader.make_request(:put, @uri, 'bill', @secret_filename)
+ Chef::CookbookSiteStreamingUploader.make_request(:put, @uri, "bill", @secret_filename)
end
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
+ Chef::CookbookSiteStreamingUploader.make_request(:put, @uri, "bill", @secret_filename, {
+ :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'
+ Chef::CookbookSiteStreamingUploader.make_request(:put, @uri, "bill", @secret_filename, {
+ :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',
+ 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",
})
end
@@ -125,7 +125,7 @@ describe Chef::CookbookSiteStreamingUploader do
describe "StreamPart" do
before(:each) do
- @file = File.new(File.join(CHEF_SPEC_DATA, 'config.rb'))
+ @file = File.new(File.join(CHEF_SPEC_DATA, "config.rb"))
@stream_part = Chef::CookbookSiteStreamingUploader::StreamPart.new(@file, File.size(@file))
end
@@ -147,7 +147,7 @@ describe Chef::CookbookSiteStreamingUploader do
describe "StringPart" do
before(:each) do
- @str = 'What a boring string'
+ @str = "What a boring string"
@string_part = Chef::CookbookSiteStreamingUploader::StringPart.new(@str)
end
@@ -189,7 +189,7 @@ describe Chef::CookbookSiteStreamingUploader do
end
it "should read receiving destination buffer as second argument (CHEF-4456: Ruby 2 compat)" do
- dst_buf = ''
+ dst_buf = ""
@multipart_stream.read(10, dst_buf)
expect(dst_buf).to eql("#{@string1}#{@string2}"[0, 10])
end
diff --git a/spec/unit/cookbook_spec.rb b/spec/unit/cookbook_spec.rb
index f36b031309..dac65a4bf4 100644
--- a/spec/unit/cookbook_spec.rb
+++ b/spec/unit/cookbook_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::CookbookVersion do
# COOKBOOK_PATH = File.expand_path(File.join(File.dirname(__FILE__), "..", "data", "cookbooks", "openldap"))
diff --git a/spec/unit/cookbook_uploader_spec.rb b/spec/unit/cookbook_uploader_spec.rb
index b74d08f620..19fce12a52 100644
--- a/spec/unit/cookbook_uploader_spec.rb
+++ b/spec/unit/cookbook_uploader_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::CookbookUploader do
diff --git a/spec/unit/cookbook_version_file_specificity_spec.rb b/spec/unit/cookbook_version_file_specificity_spec.rb
index ff79573113..6aaf68b251 100644
--- a/spec/unit/cookbook_version_file_specificity_spec.rb
+++ b/spec/unit/cookbook_version_file_specificity_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::CookbookVersion, "file specificity" do
before(:each) do
@@ -444,7 +444,7 @@ describe Chef::CookbookVersion, "file specificity" do
expect(filenames).not_to be_nil
expect(filenames.size).to eq(2)
- expect(filenames.sort).to eq(['anotherfile1.rb.host', 'anotherfile2.rb.host'])
+ expect(filenames.sort).to eq(["anotherfile1.rb.host", "anotherfile2.rb.host"])
end
it "should return a list of relative paths based on priority preference: platform & full version" do
@@ -457,7 +457,7 @@ describe Chef::CookbookVersion, "file specificity" do
expect(filenames).not_to be_nil
expect(filenames.size).to eq(2)
- expect(filenames.sort).to eq(['anotherfile1.rb.platform-full-version', 'anotherfile2.rb.platform-full-version'])
+ expect(filenames.sort).to eq(["anotherfile1.rb.platform-full-version", "anotherfile2.rb.platform-full-version"])
end
it "should return a list of relative paths based on priority preference: platform & partial version" do
@@ -470,7 +470,7 @@ describe Chef::CookbookVersion, "file specificity" do
expect(filenames).not_to be_nil
expect(filenames.size).to eq(2)
- expect(filenames.sort).to eq(['anotherfile1.rb.platform-partial-version', 'anotherfile2.rb.platform-partial-version'])
+ expect(filenames.sort).to eq(["anotherfile1.rb.platform-partial-version", "anotherfile2.rb.platform-partial-version"])
end
it "should return a list of relative paths based on priority preference: platform only" do
@@ -483,7 +483,7 @@ describe Chef::CookbookVersion, "file specificity" do
expect(filenames).not_to be_nil
expect(filenames.size).to eq(2)
- expect(filenames.sort).to eq(['anotherfile1.rb.platform', 'anotherfile2.rb.platform'])
+ expect(filenames.sort).to eq(["anotherfile1.rb.platform", "anotherfile2.rb.platform"])
end
it "should return a list of relative paths based on priority preference: default" do
@@ -496,7 +496,7 @@ describe Chef::CookbookVersion, "file specificity" do
expect(filenames).not_to be_nil
expect(filenames.size).to eq(2)
- expect(filenames.sort).to eq(['anotherfile1.rb.default', 'anotherfile2.rb.default'])
+ expect(filenames.sort).to eq(["anotherfile1.rb.default", "anotherfile2.rb.default"])
end
it "should return a list of relative paths based on priority preference: platform & full version - platform_version variant 1" do
@@ -509,7 +509,7 @@ describe Chef::CookbookVersion, "file specificity" do
expect(filenames).not_to be_nil
expect(filenames.size).to eq(2)
- expect(filenames.sort).to eq(['anotherfile1.rb.platform-full-version', 'anotherfile2.rb.platform-full-version'])
+ expect(filenames.sort).to eq(["anotherfile1.rb.platform-full-version", "anotherfile2.rb.platform-full-version"])
end
it "should return a list of relative paths based on priority preference: platform & partial version - platform_version variant 1" do
@@ -522,7 +522,7 @@ describe Chef::CookbookVersion, "file specificity" do
expect(filenames).not_to be_nil
expect(filenames.size).to eq(2)
- expect(filenames.sort).to eq(['anotherfile1.rb.platform-partial-version', 'anotherfile2.rb.platform-partial-version'])
+ expect(filenames.sort).to eq(["anotherfile1.rb.platform-partial-version", "anotherfile2.rb.platform-partial-version"])
end
it "should return a list of relative paths based on priority preference: platform & full version - platform_version variant 2" do
@@ -535,7 +535,7 @@ describe Chef::CookbookVersion, "file specificity" do
expect(filenames).not_to be_nil
expect(filenames.size).to eq(2)
- expect(filenames.sort).to eq(['anotherfile1.rb.platform-full-version', 'anotherfile2.rb.platform-full-version'])
+ expect(filenames.sort).to eq(["anotherfile1.rb.platform-full-version", "anotherfile2.rb.platform-full-version"])
end
it "should return a list of relative paths based on priority preference: platform & full version - platform_version variant 3" do
@@ -548,7 +548,7 @@ describe Chef::CookbookVersion, "file specificity" do
expect(filenames).not_to be_nil
expect(filenames.size).to eq(2)
- expect(filenames.sort).to eq(['anotherfile1.rb.platform-full-version', 'anotherfile2.rb.platform-full-version'])
+ expect(filenames.sort).to eq(["anotherfile1.rb.platform-full-version", "anotherfile2.rb.platform-full-version"])
end
end
end
diff --git a/spec/unit/cookbook_version_spec.rb b/spec/unit/cookbook_version_spec.rb
index e248267eab..856dc00006 100644
--- a/spec/unit/cookbook_version_spec.rb
+++ b/spec/unit/cookbook_version_spec.rb
@@ -15,16 +15,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
+require "spec_helper"
describe Chef::CookbookVersion do
describe "when first created" do
before do
- @cookbook_version = Chef::CookbookVersion.new("tatft", '/tmp/blah')
+ @cookbook_version = Chef::CookbookVersion.new("tatft", "/tmp/blah")
end
it "has a name" do
- expect(@cookbook_version.name).to eq('tatft')
+ expect(@cookbook_version.name).to eq("tatft")
end
it "has no attribute files" do
@@ -80,26 +80,26 @@ describe Chef::CookbookVersion do
before do
@cookbook = Hash.new { |hash, key| hash[key] = [] }
- @cookbook_root = File.join(CHEF_SPEC_DATA, 'cb_version_cookbooks', 'tatft')
+ @cookbook_root = File.join(CHEF_SPEC_DATA, "cb_version_cookbooks", "tatft")
# Dunno if the paths here are representitive of what is set by CookbookLoader...
- @cookbook[:attribute_filenames] = Dir[File.join(@cookbook_root, 'attributes', '**', '*.rb')]
- @cookbook[:definition_filenames] = Dir[File.join(@cookbook_root, 'definitions', '**', '*.rb')]
- @cookbook[:file_filenames] = Dir[File.join(@cookbook_root, 'files', '**', '*.tgz')]
- @cookbook[:recipe_filenames] = Dir[File.join(@cookbook_root, 'recipes', '**', '*.rb')]
- @cookbook[:template_filenames] = Dir[File.join(@cookbook_root, 'templates', '**', '*.erb')]
- @cookbook[:library_filenames] = Dir[File.join(@cookbook_root, 'libraries', '**', '*.rb')]
- @cookbook[:resource_filenames] = Dir[File.join(@cookbook_root, 'resources', '**', '*.rb')]
- @cookbook[:provider_filenames] = Dir[File.join(@cookbook_root, 'providers', '**', '*.rb')]
- @cookbook[:root_filenames] = Array(File.join(@cookbook_root, 'README.rdoc'))
- @cookbook[:metadata_filenames] = Array(File.join(@cookbook_root, 'metadata.json'))
+ @cookbook[:attribute_filenames] = Dir[File.join(@cookbook_root, "attributes", "**", "*.rb")]
+ @cookbook[:definition_filenames] = Dir[File.join(@cookbook_root, "definitions", "**", "*.rb")]
+ @cookbook[:file_filenames] = Dir[File.join(@cookbook_root, "files", "**", "*.tgz")]
+ @cookbook[:recipe_filenames] = Dir[File.join(@cookbook_root, "recipes", "**", "*.rb")]
+ @cookbook[:template_filenames] = Dir[File.join(@cookbook_root, "templates", "**", "*.erb")]
+ @cookbook[:library_filenames] = Dir[File.join(@cookbook_root, "libraries", "**", "*.rb")]
+ @cookbook[:resource_filenames] = Dir[File.join(@cookbook_root, "resources", "**", "*.rb")]
+ @cookbook[:provider_filenames] = Dir[File.join(@cookbook_root, "providers", "**", "*.rb")]
+ @cookbook[:root_filenames] = Array(File.join(@cookbook_root, "README.rdoc"))
+ @cookbook[:metadata_filenames] = Array(File.join(@cookbook_root, "metadata.json"))
end
describe "and a cookbook with the same name" do
before do
# Currently the cookbook loader finds all the files then tells CookbookVersion
# where they are.
- @cookbook_version = Chef::CookbookVersion.new('tatft', @cookbook_root)
+ @cookbook_version = Chef::CookbookVersion.new("tatft", @cookbook_root)
@cookbook_version.attribute_filenames = @cookbook[:attribute_filenames]
@cookbook_version.definition_filenames = @cookbook[:definition_filenames]
@@ -154,25 +154,25 @@ describe Chef::CookbookVersion do
end
- describe 'with a cookbook directory named cookbook2 that has unscoped files' do
+ describe "with a cookbook directory named cookbook2 that has unscoped files" do
before do
@cookbook = Hash.new { |hash, key| hash[key] = [] }
- @cookbook_root = File.join(CHEF_SPEC_DATA, 'cb_version_cookbooks', 'cookbook2')
+ @cookbook_root = File.join(CHEF_SPEC_DATA, "cb_version_cookbooks", "cookbook2")
# Dunno if the paths here are representitive of what is set by CookbookLoader...
- @cookbook[:attribute_filenames] = Dir[File.join(@cookbook_root, 'attributes', '**', '*.rb')]
- @cookbook[:definition_filenames] = Dir[File.join(@cookbook_root, 'definitions', '**', '*.rb')]
- @cookbook[:file_filenames] = Dir[File.join(@cookbook_root, 'files', '**', '*.*')]
- @cookbook[:recipe_filenames] = Dir[File.join(@cookbook_root, 'recipes', '**', '*.rb')]
- @cookbook[:template_filenames] = Dir[File.join(@cookbook_root, 'templates', '**', '*.*')]
- @cookbook[:library_filenames] = Dir[File.join(@cookbook_root, 'libraries', '**', '*.rb')]
- @cookbook[:resource_filenames] = Dir[File.join(@cookbook_root, 'resources', '**', '*.rb')]
- @cookbook[:provider_filenames] = Dir[File.join(@cookbook_root, 'providers', '**', '*.rb')]
- @cookbook[:root_filenames] = Array(File.join(@cookbook_root, 'README.rdoc'))
- @cookbook[:metadata_filenames] = Array(File.join(@cookbook_root, 'metadata.json'))
-
- @cookbook_version = Chef::CookbookVersion.new('cookbook2', @cookbook_root)
+ @cookbook[:attribute_filenames] = Dir[File.join(@cookbook_root, "attributes", "**", "*.rb")]
+ @cookbook[:definition_filenames] = Dir[File.join(@cookbook_root, "definitions", "**", "*.rb")]
+ @cookbook[:file_filenames] = Dir[File.join(@cookbook_root, "files", "**", "*.*")]
+ @cookbook[:recipe_filenames] = Dir[File.join(@cookbook_root, "recipes", "**", "*.rb")]
+ @cookbook[:template_filenames] = Dir[File.join(@cookbook_root, "templates", "**", "*.*")]
+ @cookbook[:library_filenames] = Dir[File.join(@cookbook_root, "libraries", "**", "*.rb")]
+ @cookbook[:resource_filenames] = Dir[File.join(@cookbook_root, "resources", "**", "*.rb")]
+ @cookbook[:provider_filenames] = Dir[File.join(@cookbook_root, "providers", "**", "*.rb")]
+ @cookbook[:root_filenames] = Array(File.join(@cookbook_root, "README.rdoc"))
+ @cookbook[:metadata_filenames] = Array(File.join(@cookbook_root, "metadata.json"))
+
+ @cookbook_version = Chef::CookbookVersion.new("cookbook2", @cookbook_root)
@cookbook_version.attribute_filenames = @cookbook[:attribute_filenames]
@cookbook_version.definition_filenames = @cookbook[:definition_filenames]
@cookbook_version.recipe_filenames = @cookbook[:recipe_filenames]
@@ -252,8 +252,8 @@ describe Chef::CookbookVersion do
["1.2", "2.1"],
]
examples.each do |smaller, larger|
- sm = Chef::CookbookVersion.new("foo", '/tmp/blah')
- lg = Chef::CookbookVersion.new("foo", '/tmp/blah')
+ sm = Chef::CookbookVersion.new("foo", "/tmp/blah")
+ lg = Chef::CookbookVersion.new("foo", "/tmp/blah")
sm.version = smaller
lg.version = larger
expect(sm).to be < lg
@@ -263,8 +263,8 @@ describe Chef::CookbookVersion do
end
it "should equate versions 1.2 and 1.2.0" do
- a = Chef::CookbookVersion.new("foo", '/tmp/blah')
- b = Chef::CookbookVersion.new("foo", '/tmp/blah')
+ a = Chef::CookbookVersion.new("foo", "/tmp/blah")
+ b = Chef::CookbookVersion.new("foo", "/tmp/blah")
a.version = "1.2"
b.version = "1.2.0"
expect(a).to eq(b)
@@ -272,9 +272,9 @@ describe Chef::CookbookVersion do
it "should not allow you to sort cookbooks with different names" do
- apt = Chef::CookbookVersion.new "apt", '/tmp/blah'
+ apt = Chef::CookbookVersion.new "apt", "/tmp/blah"
apt.version = "1.0"
- god = Chef::CookbookVersion.new "god", '/tmp/blah'
+ god = Chef::CookbookVersion.new "god", "/tmp/blah"
god.version = "2.0"
expect {apt <=> god}.to raise_error(Chef::Exceptions::CookbookVersionNameMismatch)
end
@@ -282,7 +282,7 @@ describe Chef::CookbookVersion do
describe "when you set a version" do
before do
- @cbv = Chef::CookbookVersion.new("version validation", '/tmp/blah')
+ @cbv = Chef::CookbookVersion.new("version validation", "/tmp/blah")
end
it "should accept valid cookbook versions" do
good_versions = %w(1.2 1.2.3 1000.80.50000 0.300.25)
@@ -304,7 +304,7 @@ describe Chef::CookbookVersion do
describe "when deprecation warnings are errors" do
- subject(:cbv) { Chef::CookbookVersion.new("version validation", '/tmp/blah') }
+ subject(:cbv) { Chef::CookbookVersion.new("version validation", "/tmp/blah") }
it "errors on #status and #status=" do
expect { cbv.status = :wat }.to raise_error(Chef::Exceptions::DeprecatedFeatureError)
@@ -315,7 +315,7 @@ describe Chef::CookbookVersion do
describe "deprecated features" do
- subject(:cbv) { Chef::CookbookVersion.new("tatft", '/tmp/blah').tap { |c| c.version = "1.2.3" } }
+ subject(:cbv) { Chef::CookbookVersion.new("tatft", "/tmp/blah").tap { |c| c.version = "1.2.3" } }
before do
Chef::Config[:treat_deprecation_warnings_as_errors] = false
@@ -337,7 +337,7 @@ describe Chef::CookbookVersion do
include_examples "to_json equivalent to Chef::JSONCompat.to_json" do
- let(:jsonable) { Chef::CookbookVersion.new("tatft", '/tmp/blah') }
+ let(:jsonable) { Chef::CookbookVersion.new("tatft", "/tmp/blah") }
end
end
diff --git a/spec/unit/daemon_spec.rb b/spec/unit/daemon_spec.rb
index e020576a23..267fda77b5 100644
--- a/spec/unit/daemon_spec.rb
+++ b/spec/unit/daemon_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Daemon do
before do
@@ -74,7 +74,7 @@ describe Chef::Daemon do
before do
allow(Chef::Application).to receive(:fatal!).and_return(true)
- Chef::Config[:user] = 'aj'
+ Chef::Config[:user] = "aj"
allow(Dir).to receive(:chdir)
end
@@ -86,7 +86,7 @@ describe Chef::Daemon do
describe "when the user and group options are supplied" do
before do
- Chef::Config[:group] = 'staff'
+ Chef::Config[:group] = "staff"
end
it "should log an appropriate info message" do
diff --git a/spec/unit/data_bag_item_spec.rb b/spec/unit/data_bag_item_spec.rb
index 47042aa7ba..0329264718 100644
--- a/spec/unit/data_bag_item_spec.rb
+++ b/spec/unit/data_bag_item_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/data_bag_item'
+require "spec_helper"
+require "chef/data_bag_item"
describe Chef::DataBagItem do
let(:data_bag_item) { Chef::DataBagItem.new }
@@ -169,7 +169,7 @@ describe Chef::DataBagItem do
describe "when deserializing from JSON" do
let(:data_bag_item) {
data_bag_item = Chef::DataBagItem.new
- data_bag_item.data_bag('mars_volta')
+ data_bag_item.data_bag("mars_volta")
data_bag_item.raw_data = { "id" => "octahedron", "snooze" => { "finally" => :world_will } }
data_bag_item
}
@@ -200,8 +200,8 @@ describe Chef::DataBagItem do
describe "when converting to a string" do
it "converts to a string in the form data_bag_item[ID]" do
- data_bag_item['id'] = "heart of darkness"
- expect(data_bag_item.to_s).to eq('data_bag_item[heart of darkness]')
+ data_bag_item["id"] = "heart of darkness"
+ expect(data_bag_item.to_s).to eq("data_bag_item[heart of darkness]")
end
it "inspects as data_bag_item[BAG, ID, RAW_DATA]" do
@@ -218,7 +218,7 @@ describe Chef::DataBagItem do
let(:data_bag_item) {
data_bag_item = Chef::DataBagItem.new
- data_bag_item['id'] = "heart of darkness"
+ data_bag_item["id"] = "heart of darkness"
data_bag_item.raw_data = {"id" => "heart_of_darkness", "author" => "Conrad"}
data_bag_item.data_bag("books")
data_bag_item
@@ -263,7 +263,7 @@ describe Chef::DataBagItem do
let(:data_bag_item) {
data_bag_item = Chef::DataBagItem.new
- data_bag_item.data_bag('a_baggy_bag')
+ data_bag_item.data_bag("a_baggy_bag")
data_bag_item.raw_data = { "id" => "some_id" }
data_bag_item
}
@@ -314,8 +314,8 @@ describe Chef::DataBagItem do
end
it "converts the raw data to a data bag item" do
- expect(Chef::DataBag).to receive(:load).with('users').and_return({'charlie' => data_bag_item.to_hash})
- item = Chef::DataBagItem.load('users', 'charlie')
+ expect(Chef::DataBag).to receive(:load).with("users").and_return({"charlie" => data_bag_item.to_hash})
+ item = Chef::DataBagItem.load("users", "charlie")
expect(item).to be_a_kind_of(Chef::DataBagItem)
expect(item).to eq(data_bag_item)
end
diff --git a/spec/unit/data_bag_spec.rb b/spec/unit/data_bag_spec.rb
index a325b1260f..4e06a31911 100644
--- a/spec/unit/data_bag_spec.rb
+++ b/spec/unit/data_bag_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/data_bag'
+require "spec_helper"
+require "chef/data_bag"
describe Chef::DataBag do
before(:each) do
@@ -58,7 +58,7 @@ describe Chef::DataBag do
describe "deserialize" do
before(:each) do
- @data_bag.name('mars_volta')
+ @data_bag.name("mars_volta")
@deserial = Chef::JSONCompat.from_json(Chef::JSONCompat.to_json(@data_bag))
end
@@ -82,7 +82,7 @@ describe Chef::DataBag do
describe "when saving" do
before do
- @data_bag.name('piggly_wiggly')
+ @data_bag.name("piggly_wiggly")
@rest = double("Chef::ServerAPI")
allow(Chef::ServerAPI).to receive(:new).and_return(@rest)
end
@@ -115,21 +115,21 @@ describe Chef::DataBag do
describe "when loading" do
describe "from an API call" do
before do
- Chef::Config[:chef_server_url] = 'https://myserver.example.com'
- @http_client = double('Chef::ServerAPI')
+ Chef::Config[:chef_server_url] = "https://myserver.example.com"
+ @http_client = double("Chef::ServerAPI")
end
it "should get the data bag from the server" do
- expect(Chef::ServerAPI).to receive(:new).with('https://myserver.example.com').and_return(@http_client)
- expect(@http_client).to receive(:get).with('data/foo')
- Chef::DataBag.load('foo')
+ expect(Chef::ServerAPI).to receive(:new).with("https://myserver.example.com").and_return(@http_client)
+ expect(@http_client).to receive(:get).with("data/foo")
+ Chef::DataBag.load("foo")
end
it "should return the data bag" do
allow(Chef::ServerAPI).to receive(:new).and_return(@http_client)
- expect(@http_client).to receive(:get).with('data/foo').and_return({'bar' => 'https://myserver.example.com/data/foo/bar'})
- data_bag = Chef::DataBag.load('foo')
- expect(data_bag).to eq({'bar' => 'https://myserver.example.com/data/foo/bar'})
+ expect(@http_client).to receive(:get).with("data/foo").and_return({"bar" => "https://myserver.example.com/data/foo/bar"})
+ data_bag = Chef::DataBag.load("foo")
+ expect(data_bag).to eq({"bar" => "https://myserver.example.com/data/foo/bar"})
end
end
@@ -138,7 +138,7 @@ describe Chef::DataBag do
end
def dir_glob_stub(path, returns = [])
- expect(Dir).to receive(:glob).with(File.join(path, 'foo/*.json')).and_return(returns)
+ expect(Dir).to receive(:glob).with(File.join(path, "foo/*.json")).and_return(returns)
end
shared_examples_for "data bag in solo mode" do |data_bag_path|
@@ -157,7 +157,7 @@ describe Chef::DataBag do
file_dir_stub(path)
dir_glob_stub(path)
end
- Chef::DataBag.load('foo')
+ Chef::DataBag.load("foo")
end
it "should get the data bag from the data_bag_path by symbolic name" do
@@ -172,57 +172,57 @@ describe Chef::DataBag do
@paths.each do |path|
file_dir_stub(path)
if path == @paths.first
- dir_glob_stub(path, [File.join(path, 'foo/bar.json'), File.join(path, 'foo/baz.json')])
+ dir_glob_stub(path, [File.join(path, "foo/bar.json"), File.join(path, "foo/baz.json")])
else
dir_glob_stub(path)
end
end
- expect(IO).to receive(:read).with(File.join(@paths.first, 'foo/bar.json')).and_return('{"id": "bar", "name": "Bob Bar" }')
- expect(IO).to receive(:read).with(File.join(@paths.first, 'foo/baz.json')).and_return('{"id": "baz", "name": "John Baz" }')
- data_bag = Chef::DataBag.load('foo')
- expect(data_bag).to eq({ 'bar' => { 'id' => 'bar', 'name' => 'Bob Bar' }, 'baz' => { 'id' => 'baz', 'name' => 'John Baz' }})
+ expect(IO).to receive(:read).with(File.join(@paths.first, "foo/bar.json")).and_return('{"id": "bar", "name": "Bob Bar" }')
+ expect(IO).to receive(:read).with(File.join(@paths.first, "foo/baz.json")).and_return('{"id": "baz", "name": "John Baz" }')
+ data_bag = Chef::DataBag.load("foo")
+ expect(data_bag).to eq({ "bar" => { "id" => "bar", "name" => "Bob Bar" }, "baz" => { "id" => "baz", "name" => "John Baz" }})
end
it "should raise if data bag has items with similar names but different content" do
@paths.each do |path|
file_dir_stub(path)
item_with_different_content = "{\"id\": \"bar\", \"name\": \"Bob Bar\", \"path\": \"#{path}\"}"
- expect(IO).to receive(:read).with(File.join(path, 'foo/bar.json')).and_return(item_with_different_content)
+ expect(IO).to receive(:read).with(File.join(path, "foo/bar.json")).and_return(item_with_different_content)
if data_bag_path.is_a?(String)
- dir_glob_stub(path, [File.join(path, 'foo/bar.json'), File.join(path, 'foo/baz.json')])
+ dir_glob_stub(path, [File.join(path, "foo/bar.json"), File.join(path, "foo/baz.json")])
item_2_with_different_content = '{"id": "bar", "name": "John Baz"}'
- expect(IO).to receive(:read).with(File.join(path, 'foo/baz.json')).and_return(item_2_with_different_content)
+ expect(IO).to receive(:read).with(File.join(path, "foo/baz.json")).and_return(item_2_with_different_content)
else
- dir_glob_stub(path, [File.join(path, 'foo/bar.json')])
+ dir_glob_stub(path, [File.join(path, "foo/bar.json")])
end
end
- expect { Chef::DataBag.load('foo') }.to raise_error(Chef::Exceptions::DuplicateDataBagItem)
+ expect { Chef::DataBag.load("foo") }.to raise_error(Chef::Exceptions::DuplicateDataBagItem)
end
it "should return data bag if it has items with similar names and the same content" do
@paths.each do |path|
file_dir_stub(path)
- dir_glob_stub(path, [File.join(path, 'foo/bar.json'), File.join(path, 'foo/baz.json')])
+ dir_glob_stub(path, [File.join(path, "foo/bar.json"), File.join(path, "foo/baz.json")])
item_with_same_content = '{"id": "bar", "name": "Bob Bar"}'
- expect(IO).to receive(:read).with(File.join(path, 'foo/bar.json')).and_return(item_with_same_content)
- expect(IO).to receive(:read).with(File.join(path, 'foo/baz.json')).and_return(item_with_same_content)
+ expect(IO).to receive(:read).with(File.join(path, "foo/bar.json")).and_return(item_with_same_content)
+ expect(IO).to receive(:read).with(File.join(path, "foo/baz.json")).and_return(item_with_same_content)
end
- data_bag = Chef::DataBag.load('foo')
- test_data_bag = { 'bar' => { 'id' => 'bar', 'name' => 'Bob Bar'} }
+ data_bag = Chef::DataBag.load("foo")
+ test_data_bag = { "bar" => { "id" => "bar", "name" => "Bob Bar"} }
expect(data_bag).to eq(test_data_bag)
end
it "should merge data bag items if there are no conflicts" do
@paths.each_with_index do |path, index|
file_dir_stub(path)
- dir_glob_stub(path, [File.join(path, 'foo/bar.json'), File.join(path, 'foo/baz.json')])
+ dir_glob_stub(path, [File.join(path, "foo/bar.json"), File.join(path, "foo/baz.json")])
test_item_with_same_content = '{"id": "bar", "name": "Bob Bar"}'
- expect(IO).to receive(:read).with(File.join(path, 'foo/bar.json')).and_return(test_item_with_same_content)
+ expect(IO).to receive(:read).with(File.join(path, "foo/bar.json")).and_return(test_item_with_same_content)
test_uniq_item = "{\"id\": \"baz_#{index}\", \"name\": \"John Baz\", \"path\": \"#{path}\"}"
- expect(IO).to receive(:read).with(File.join(path, 'foo/baz.json')).and_return(test_uniq_item)
+ expect(IO).to receive(:read).with(File.join(path, "foo/baz.json")).and_return(test_uniq_item)
end
- data_bag = Chef::DataBag.load('foo')
- test_data_bag = { 'bar' => { 'id' => 'bar', 'name' => 'Bob Bar'} }
+ data_bag = Chef::DataBag.load("foo")
+ test_data_bag = { "bar" => { "id" => "bar", "name" => "Bob Bar"} }
@paths.each_with_index do |path, index|
test_data_bag["baz_#{index}"] = { "id" => "baz_#{index}", "name" => "John Baz", "path" => path }
end
@@ -232,17 +232,17 @@ describe Chef::DataBag do
it "should return the data bag list" do
@paths.each do |path|
file_dir_stub(path)
- expect(Dir).to receive(:glob).and_return([File.join(path, 'foo'), File.join(path, 'bar')])
+ expect(Dir).to receive(:glob).and_return([File.join(path, "foo"), File.join(path, "bar")])
end
data_bag_list = Chef::DataBag.list
- expect(data_bag_list).to eq({ 'bar' => 'bar', 'foo' => 'foo' })
+ expect(data_bag_list).to eq({ "bar" => "bar", "foo" => "foo" })
end
- it 'should raise an error if the configured data_bag_path is invalid' do
+ it "should raise an error if the configured data_bag_path is invalid" do
file_dir_stub(@paths.first, false)
expect {
- Chef::DataBag.load('foo')
+ Chef::DataBag.load("foo")
}.to raise_error Chef::Exceptions::InvalidDataBagPath, "Data bag path '/var/chef/data_bags' is invalid"
end
diff --git a/spec/unit/deprecation_spec.rb b/spec/unit/deprecation_spec.rb
index 674de5ec1d..f2f99e9ba6 100644
--- a/spec/unit/deprecation_spec.rb
+++ b/spec/unit/deprecation_spec.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/deprecation/warnings'
+require "spec_helper"
+require "chef/deprecation/warnings"
describe Chef::Deprecation do
# Support code for Chef::Deprecation
def self.class_from_string(str)
- str.split('::').inject(Object) do |mod, class_name|
+ str.split("::").inject(Object) do |mod, class_name|
mod.const_get(class_name)
end
end
@@ -59,33 +59,33 @@ describe Chef::Deprecation do
end
end
- context 'when Chef::Config[:treat_deprecation_warnings_as_errors] is off' do
+ context "when Chef::Config[:treat_deprecation_warnings_as_errors] is off" do
before do
Chef::Config[:treat_deprecation_warnings_as_errors] = false
end
- context 'deprecation warning messages' do
+ context "deprecation warning messages" do
RSpec::Matchers.define_negated_matcher :a_non_empty_array, :be_empty
- it 'should be enabled for deprecated methods' do
+ it "should be enabled for deprecated methods" do
expect(Chef::Log).to receive(:warn).with(a_non_empty_array)
TestClass.new.deprecated_method(10)
end
- it 'should contain stack trace' do
+ it "should contain stack trace" do
expect(Chef::Log).to receive(:warn).with(a_string_including(".rb"))
TestClass.new.deprecated_method(10)
end
end
- it 'deprecated methods should still be called' do
+ it "deprecated methods should still be called" do
test_instance = TestClass.new
test_instance.deprecated_method(10)
expect(test_instance.get_value).to eq(10)
end
end
- it 'should raise when deprecation warnings are treated as errors' do
+ it "should raise when deprecation warnings are treated as errors" do
# rspec should set this
expect(Chef::Config[:treat_deprecation_warnings_as_errors]).to be true
test_instance = TestClass.new
diff --git a/spec/unit/digester_spec.rb b/spec/unit/digester_spec.rb
index 51bcfbdde5..2dbbb5b25f 100644
--- a/spec/unit/digester_spec.rb
+++ b/spec/unit/digester_spec.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Digester do
before(:each) do
@@ -40,7 +40,7 @@ describe Chef::Digester do
it "generates a checksum from a non-file IO object" do
io = StringIO.new("riseofthemachines\nriseofthechefs\n")
- expected_md5 = '0e157ac1e2dd73191b76067fb6b4bceb'
+ expected_md5 = "0e157ac1e2dd73191b76067fb6b4bceb"
expect(@cache.generate_md5_checksum(io)).to eq(expected_md5)
end
diff --git a/spec/unit/dsl/audit_spec.rb b/spec/unit/dsl/audit_spec.rb
index 28b28e0a7c..df8dbc95c0 100644
--- a/spec/unit/dsl/audit_spec.rb
+++ b/spec/unit/dsl/audit_spec.rb
@@ -1,6 +1,6 @@
-require 'spec_helper'
-require 'chef/dsl/audit'
+require "spec_helper"
+require "chef/dsl/audit"
class AuditDSLTester < Chef::Recipe
include Chef::DSL::Audit
diff --git a/spec/unit/dsl/data_query_spec.rb b/spec/unit/dsl/data_query_spec.rb
index 7bca47af3e..34d4cfdba3 100644
--- a/spec/unit/dsl/data_query_spec.rb
+++ b/spec/unit/dsl/data_query_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/dsl/data_query'
+require "spec_helper"
+require "chef/dsl/data_query"
class DataQueryDSLTester
include Chef::DSL::DataQuery
diff --git a/spec/unit/dsl/platform_introspection_spec.rb b/spec/unit/dsl/platform_introspection_spec.rb
index 438dde126e..61a7d8ca82 100644
--- a/spec/unit/dsl/platform_introspection_spec.rb
+++ b/spec/unit/dsl/platform_introspection_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/dsl/platform_introspection'
+require "spec_helper"
+require "chef/dsl/platform_introspection"
class LanguageTester
attr_reader :node
@@ -39,16 +39,16 @@ end
describe Chef::DSL::PlatformIntrospection::PlatformDependentValue do
before do
platform_hash = {
- :openbsd => {:default => 'free, functional, secure'},
+ :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',
+ :ubuntu => {"10.04" => "using upstart more", :default => "using init more"},
+ :default => "bork da bork",
}
@platform_specific_value = Chef::DSL::PlatformIntrospection::PlatformDependentValue.new(platform_hash)
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
@@ -60,20 +60,20 @@ describe Chef::DSL::PlatformIntrospection::PlatformDependentValue do
end
it "returns a value for a specific platform version" do
- node = {:platform => 'ubuntu', :platform_version => '10.04'}
- expect(@platform_specific_value.value_for_node(node)).to eq('using upstart more')
+ 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' }
- expect(@platform_specific_value.value_for_node(node)).to eq('using init more')
+ node = {:platform => "ubuntu", :platform_version => "9.10" }
+ expect(@platform_specific_value.value_for_node(node)).to eq("using init more")
end
it "returns nil if there is no default and no platforms match" 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
@@ -98,7 +98,7 @@ 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
@@ -124,7 +124,7 @@ describe Chef::DSL::PlatformIntrospection::PlatformFamilyDependentValue do
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 6705820e17..49696f7cc3 100644
--- a/spec/unit/dsl/reboot_pending_spec.rb
+++ b/spec/unit/dsl/reboot_pending_spec.rb
@@ -30,13 +30,13 @@ describe Chef::DSL::RebootPending do
context "platform is windows" do
before do
- allow(recipe).to receive(:platform?).with('windows').and_return(true)
+ allow(recipe).to receive(:platform?).with("windows").and_return(true)
allow(recipe).to receive(:registry_key_exists?).and_return(false)
allow(recipe).to receive(:registry_value_exists?).and_return(false)
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
@@ -66,16 +66,16 @@ describe Chef::DSL::RebootPending do
context "platform is ubuntu" do
before do
- allow(recipe).to receive(:platform?).with('ubuntu').and_return(true)
+ allow(recipe).to receive(:platform?).with("ubuntu").and_return(true)
end
- it 'should return true if /var/run/reboot-required exists' do
- allow(File).to receive(:exists?).with('/var/run/reboot-required').and_return(true)
+ it "should return true if /var/run/reboot-required exists" do
+ allow(File).to receive(:exists?).with("/var/run/reboot-required").and_return(true)
expect(recipe.reboot_pending?).to be_truthy
end
- it 'should return false if /var/run/reboot-required does not exist' do
- allow(File).to receive(:exists?).with('/var/run/reboot-required').and_return(false)
+ it "should return false if /var/run/reboot-required does not exist" do
+ allow(File).to receive(:exists?).with("/var/run/reboot-required").and_return(false)
expect(recipe.reboot_pending?).to be_falsey
end
end
diff --git a/spec/unit/dsl/recipe_spec.rb b/spec/unit/dsl/recipe_spec.rb
index dfaad0b73e..108fe81d2b 100644
--- a/spec/unit/dsl/recipe_spec.rb
+++ b/spec/unit/dsl/recipe_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/dsl/recipe'
+require "spec_helper"
+require "chef/dsl/recipe"
RecipeDSLExampleClass = Struct.new(:cookbook_name, :recipe_name)
diff --git a/spec/unit/dsl/regsitry_helper_spec.rb b/spec/unit/dsl/regsitry_helper_spec.rb
index 6508a12b6f..8647b79020 100644
--- a/spec/unit/dsl/regsitry_helper_spec.rb
+++ b/spec/unit/dsl/regsitry_helper_spec.rb
@@ -33,22 +33,22 @@ describe Chef::Resource::RegistryKey do
context "tests registry dsl" do
it "resource can access registry_helper method registry_key_exists" do
- expect(@resource.respond_to?('registry_key_exists?')).to eq(true)
+ expect(@resource.respond_to?("registry_key_exists?")).to eq(true)
end
it "resource can access registry_helper method registry_get_values" do
- expect(@resource.respond_to?('registry_get_values')).to eq(true)
+ expect(@resource.respond_to?("registry_get_values")).to eq(true)
end
it "resource can access registry_helper method registry_has_subkey" do
- expect(@resource.respond_to?('registry_has_subkeys?')).to eq(true)
+ expect(@resource.respond_to?("registry_has_subkeys?")).to eq(true)
end
it "resource can access registry_helper method registry_get_subkeys" do
- expect(@resource.respond_to?('registry_get_subkeys')).to eq(true)
+ expect(@resource.respond_to?("registry_get_subkeys")).to eq(true)
end
it "resource can access registry_helper method registry_value_exists" do
- expect(@resource.respond_to?('registry_value_exists?')).to eq(true)
+ expect(@resource.respond_to?("registry_value_exists?")).to eq(true)
end
it "resource can access registry_helper method data_value_exists" do
- expect(@resource.respond_to?('registry_data_exists?')).to eq(true)
+ expect(@resource.respond_to?("registry_data_exists?")).to eq(true)
end
end
end
diff --git a/spec/unit/dsl/resources_spec.rb b/spec/unit/dsl/resources_spec.rb
index 581c835290..72ee23c8c9 100644
--- a/spec/unit/dsl/resources_spec.rb
+++ b/spec/unit/dsl/resources_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/dsl/resources'
+require "spec_helper"
+require "chef/dsl/resources"
describe Chef::DSL::Resources do
let(:declared_resources) { [] }
@@ -36,21 +36,21 @@ describe Chef::DSL::Resources do
described_class.remove_resource_dsl(:test_resource)
end
- context 'with a resource added' do
+ context "with a resource added" do
before do
Chef::DSL::Resources.add_resource_dsl(:test_resource)
test_class.new.instance_eval do
- test_resource 'test_name' do
+ test_resource "test_name" do
end
end
end
- it { is_expected.to eq [[:test_resource, 'test_name']]}
+ it { is_expected.to eq [[:test_resource, "test_name"]]}
end
- context 'with no resource added' do
+ context "with no resource added" do
subject do
test_class.new.instance_eval do
- test_resource 'test_name' do
+ test_resource "test_name" do
end
end
end
@@ -58,14 +58,14 @@ describe Chef::DSL::Resources do
it { expect { subject }.to raise_error NoMethodError }
end
- context 'with a resource added and removed' do
+ context "with a resource added and removed" do
before do
Chef::DSL::Resources.add_resource_dsl(:test_resource)
Chef::DSL::Resources.remove_resource_dsl(:test_resource)
end
subject do
test_class.new.instance_eval do
- test_resource 'test_name' do
+ test_resource "test_name" do
end
end
end
@@ -73,7 +73,7 @@ describe Chef::DSL::Resources do
it { expect { subject }.to raise_error NoMethodError }
end
- context 'with a nameless resource' do
+ context "with a nameless resource" do
before do
Chef::DSL::Resources.add_resource_dsl(:test_resource)
test_class.new.instance_eval do
diff --git a/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb b/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
index 1090f46745..fc5a7276fb 100644
--- a/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
+++ b/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/encrypted_data_bag_item/check_encrypted'
+require "spec_helper"
+require "chef/encrypted_data_bag_item/check_encrypted"
class CheckEncryptedTester
include Chef::EncryptedDataBagItem::CheckEncrypted
diff --git a/spec/unit/encrypted_data_bag_item_spec.rb b/spec/unit/encrypted_data_bag_item_spec.rb
index 26501684c8..796ad8ff5b 100644
--- a/spec/unit/encrypted_data_bag_item_spec.rb
+++ b/spec/unit/encrypted_data_bag_item_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/encrypted_data_bag_item'
+require "spec_helper"
+require "chef/encrypted_data_bag_item"
module Version0Encryptor
def self.encrypt_value(plaintext_data, key)
diff --git a/spec/unit/environment_spec.rb b/spec/unit/environment_spec.rb
index 4a8f94e770..0f3ee17872 100644
--- a/spec/unit/environment_spec.rb
+++ b/spec/unit/environment_spec.rb
@@ -19,8 +19,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/environment'
+require "spec_helper"
+require "chef/environment"
describe Chef::Environment do
before(:each) do
@@ -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
@@ -393,7 +393,7 @@ describe Chef::Environment do
describe "in solo mode" do
before do
Chef::Config[:solo] = true
- Chef::Config[:environment_path] = '/var/chef/environments'
+ Chef::Config[:environment_path] = "/var/chef/environments"
end
after do
@@ -402,17 +402,17 @@ describe Chef::Environment do
it "should get the environment from the environment_path" do
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], 'foo.json')).and_return(false)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], 'foo.rb')).exactly(2).times.and_return(true)
- expect(File).to receive(:readable?).with(File.join(Chef::Config[:environment_path], 'foo.rb')).and_return(true)
+ expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
+ expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(2).times.and_return(true)
+ expect(File).to receive(:readable?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
role_dsl="name \"foo\"\ndescription \"desc\"\n"
- expect(IO).to receive(:read).with(File.join(Chef::Config[:environment_path], 'foo.rb')).and_return(role_dsl)
- Chef::Environment.load('foo')
+ expect(IO).to receive(:read).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(role_dsl)
+ Chef::Environment.load("foo")
end
it "should return a Chef::Environment object from JSON" do
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], 'foo.json')).and_return(true)
+ expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(true)
environment_hash = {
"name" => "foo",
"default_attributes" => {
@@ -424,44 +424,44 @@ describe Chef::Environment do
"description" => "desc",
"chef_type" => "environment",
}
- expect(IO).to receive(:read).with(File.join(Chef::Config[:environment_path], 'foo.json')).and_return(Chef::JSONCompat.to_json(environment_hash))
- environment = Chef::Environment.load('foo')
+ expect(IO).to receive(:read).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(Chef::JSONCompat.to_json(environment_hash))
+ environment = Chef::Environment.load("foo")
expect(environment).to be_a_kind_of(Chef::Environment)
- expect(environment.name).to eq(environment_hash['name'])
- expect(environment.description).to eq(environment_hash['description'])
- expect(environment.default_attributes).to eq(environment_hash['default_attributes'])
+ expect(environment.name).to eq(environment_hash["name"])
+ expect(environment.description).to eq(environment_hash["description"])
+ expect(environment.default_attributes).to eq(environment_hash["default_attributes"])
end
it "should return a Chef::Environment object from Ruby DSL" do
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], 'foo.json')).and_return(false)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], 'foo.rb')).exactly(2).times.and_return(true)
- expect(File).to receive(:readable?).with(File.join(Chef::Config[:environment_path], 'foo.rb')).and_return(true)
+ expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
+ expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(2).times.and_return(true)
+ expect(File).to receive(:readable?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
role_dsl="name \"foo\"\ndescription \"desc\"\n"
- expect(IO).to receive(:read).with(File.join(Chef::Config[:environment_path], 'foo.rb')).and_return(role_dsl)
- environment = Chef::Environment.load('foo')
+ expect(IO).to receive(:read).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(role_dsl)
+ environment = Chef::Environment.load("foo")
expect(environment).to be_a_kind_of(Chef::Environment)
- expect(environment.name).to eq('foo')
- expect(environment.description).to eq('desc')
+ expect(environment.name).to eq("foo")
+ expect(environment.description).to eq("desc")
end
- it 'should raise an error if the configured environment_path is invalid' do
+ it "should raise an error if the configured environment_path is invalid" do
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(false)
expect {
- Chef::Environment.load('foo')
+ Chef::Environment.load("foo")
}.to raise_error Chef::Exceptions::InvalidEnvironmentPath, "Environment path '/var/chef/environments' is invalid"
end
- it 'should raise an error if the file does not exist' do
+ it "should raise an error if the file does not exist" do
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], 'foo.json')).and_return(false)
- expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], 'foo.rb')).and_return(false)
+ expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
+ expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(false)
expect {
- Chef::Environment.load('foo')
+ Chef::Environment.load("foo")
}.to raise_error Chef::Exceptions::EnvironmentNotFound, "Environment 'foo' could not be loaded from disk"
end
end
diff --git a/spec/unit/event_dispatch/dispatcher_spec.rb b/spec/unit/event_dispatch/dispatcher_spec.rb
index 5a06e1d6d1..eaeb164414 100644
--- a/spec/unit/event_dispatch/dispatcher_spec.rb
+++ b/spec/unit/event_dispatch/dispatcher_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/event_dispatch/dispatcher'
+require "spec_helper"
+require "chef/event_dispatch/dispatcher"
describe Chef::EventDispatch::Dispatcher do
diff --git a/spec/unit/event_dispatch/dsl_spec.rb b/spec/unit/event_dispatch/dsl_spec.rb
index 0f7adce7a8..7c74e6738c 100644
--- a/spec/unit/event_dispatch/dsl_spec.rb
+++ b/spec/unit/event_dispatch/dsl_spec.rb
@@ -16,8 +16,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/event_dispatch/dsl'
+require "spec_helper"
+require "chef/event_dispatch/dsl"
describe Chef::EventDispatch::DSL do
let(:events) do
@@ -32,25 +32,25 @@ describe Chef::EventDispatch::DSL do
Chef.set_run_context(run_context)
end
- subject{ described_class.new('test') }
+ subject{ described_class.new("test") }
- it 'set handler name' do
+ it "set handler name" do
subject.on(:run_started) {}
- expect(events.subscribers.first.name).to eq('test')
+ expect(events.subscribers.first.name).to eq("test")
end
- it 'raise error when invalid event type is supplied' do
+ it "raise error when invalid event type is supplied" do
expect do
subject.on(:foo_bar) {}
end.to raise_error(Chef::Exceptions::InvalidEventType)
end
- it 'register user hooks against valid event type' do
- subject.on(:run_failed) {'testhook'}
- expect(events.subscribers.first.run_failed).to eq('testhook')
+ it "register user hooks against valid event type" do
+ subject.on(:run_failed) {"testhook"}
+ expect(events.subscribers.first.run_failed).to eq("testhook")
end
- it 'preserve state across event hooks' do
+ it "preserve state across event hooks" do
calls = []
Chef.event_handler do
on :resource_updated do
@@ -60,13 +60,13 @@ describe Chef::EventDispatch::DSL do
calls << :started
end
end
- resource = Chef::Resource::RubyBlock.new('foo', run_context)
+ resource = Chef::Resource::RubyBlock.new("foo", run_context)
resource.block { }
resource.run_action(:run)
expect(calls).to eq([:started, :updated])
end
- it 'preserve instance variables across handler callbacks' do
+ it "preserve instance variables across handler callbacks" do
Chef.event_handler do
on :resource_action_start do
@ivar = [1]
@@ -75,7 +75,7 @@ describe Chef::EventDispatch::DSL do
@ivar << 2
end
end
- resource = Chef::Resource::RubyBlock.new('foo', run_context)
+ resource = Chef::Resource::RubyBlock.new("foo", run_context)
resource.block { }
resource.run_action(:run)
expect(events.subscribers.first.instance_variable_get(:@ivar)).to eq([1, 2])
diff --git a/spec/unit/exceptions_spec.rb b/spec/unit/exceptions_spec.rb
index c738bcf840..881fad4c20 100644
--- a/spec/unit/exceptions_spec.rb
+++ b/spec/unit/exceptions_spec.rb
@@ -19,7 +19,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Exceptions do
exception_to_super_class = {
diff --git a/spec/unit/file_access_control_spec.rb b/spec/unit/file_access_control_spec.rb
index 2c68792c63..724c2385c7 100644
--- a/spec/unit/file_access_control_spec.rb
+++ b/spec/unit/file_access_control_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::FileAccessControl do
describe "Unix" do
@@ -27,14 +27,14 @@ describe Chef::FileAccessControl do
# platform specific module is mixed in
@node = Chef::Node.new
load File.join(File.dirname(__FILE__), "..", "..", "lib", "chef", "file_access_control.rb")
- @resource = Chef::Resource::File.new('/tmp/a_file.txt')
- @resource.owner('toor')
- @resource.group('wheel')
- @resource.mode('0400')
+ @resource = Chef::Resource::File.new("/tmp/a_file.txt")
+ @resource.owner("toor")
+ @resource.group("wheel")
+ @resource.mode("0400")
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @current_resource = Chef::Resource::File.new('/tmp/different_file.txt')
+ @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)
@@ -42,7 +42,7 @@ describe Chef::FileAccessControl do
end
end
- describe 'class methods' do
+ describe "class methods" do
it 'responds to #writable?' do
expect(Chef::FileAccessControl).to respond_to(:writable?)
end
@@ -53,7 +53,7 @@ describe Chef::FileAccessControl do
end
it "has a file to manage" do
- expect(@fac.file).to eq('/tmp/different_file.txt')
+ expect(@fac.file).to eq("/tmp/different_file.txt")
end
it "is not modified yet" do
@@ -61,12 +61,12 @@ 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
it "raises a Chef::Exceptions::UserIDNotFound error when Etc can't find the user's name" do
- expect(Etc).to receive(:getpwnam).with('toor').and_raise(ArgumentError)
+ expect(Etc).to receive(:getpwnam).with("toor").and_raise(ArgumentError)
expect { @fac.target_uid ; @provider_requirements.run(:create) }.to raise_error(Chef::Exceptions::UserIDNotFound, "cannot determine user id for 'toor', does the user exist on this system?")
end
@@ -98,16 +98,16 @@ describe Chef::FileAccessControl do
# complement (i.e., it wraps around the maximum size of C unsigned int) of these
# 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)))
+ @resource.owner("nobody")
+ expect(Etc).to receive(:getpwnam).with("nobody").and_return(OpenStruct.new(:uid => (4294967294)))
expect(@fac.target_uid).to eq(-2)
end
it "does not wrap uids to their negative complements beyond -9" 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)))
+ @resource.owner("bigdude")
+ expect(Etc).to receive(:getpwnam).with("bigdude").and_return(OpenStruct.new(:uid => (4294967286)))
expect(@fac.target_uid).to eq(4294967286)
end
@@ -133,7 +133,7 @@ describe Chef::FileAccessControl do
it "sets the file's owner as specified in the resource when the current owner is incorrect" do
@resource.owner(2342)
- expect(File).to receive(:chown).with(2342, nil, '/tmp/different_file.txt')
+ expect(File).to receive(:chown).with(2342, nil, "/tmp/different_file.txt")
@fac.set_owner
expect(@fac).to be_modified
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
@@ -163,18 +163,18 @@ describe Chef::FileAccessControl do
end
it "raises a Chef::Exceptions::GroupIDNotFound error when Etc can't find the user's name" do
- expect(Etc).to receive(:getgrnam).with('wheel').and_raise(ArgumentError)
+ expect(Etc).to receive(:getgrnam).with("wheel").and_raise(ArgumentError)
expect { @fac.target_gid; @provider_requirements.run(:create) }.to raise_error(Chef::Exceptions::GroupIDNotFound, "cannot determine group id for 'wheel', does the group exist on this system?")
end
it "does not attempt to resolve a gid when none is supplied" do
- resource = Chef::Resource::File.new('crab')
+ resource = Chef::Resource::File.new("crab")
fac = Chef::FileAccessControl.new(@current_resource, resource, @provider)
expect(fac.target_gid).to be_nil
end
it "does not want to update the group when no target group is specified" do
- resource = Chef::Resource::File.new('crab')
+ resource = Chef::Resource::File.new("crab")
fac = Chef::FileAccessControl.new(@current_resource, resource, @provider)
expect(fac.should_update_group?).to be_falsey
end
@@ -197,7 +197,7 @@ describe Chef::FileAccessControl do
end
it "includes updating the group in the list of changes" do
- resource = Chef::Resource::File.new('crab')
+ resource = Chef::Resource::File.new("crab")
resource.group(2342)
@current_resource.group(815)
fac = Chef::FileAccessControl.new(@current_resource, resource, @provider)
@@ -208,7 +208,7 @@ describe Chef::FileAccessControl do
@resource.group(2342)
@current_resource.group(815)
- expect(File).to receive(:chown).with(nil, 2342, '/tmp/different_file.txt')
+ expect(File).to receive(:chown).with(nil, 2342, "/tmp/different_file.txt")
@fac.set_group
expect(@fac).to be_modified
end
@@ -230,7 +230,7 @@ describe Chef::FileAccessControl do
end
it "uses the supplied mode as octal when it's a string" do
- @resource.mode('444')
+ @resource.mode("444")
expect(@fac.target_mode).to eq(292) # octal 444 => decimal 292
end
@@ -240,13 +240,13 @@ describe Chef::FileAccessControl do
end
it "does not try to determine the mode when none is given" do
- resource = Chef::Resource::File.new('blahblah')
+ resource = Chef::Resource::File.new("blahblah")
fac = Chef::FileAccessControl.new(@current_resource, resource, @provider)
expect(fac.target_mode).to be_nil
end
it "doesn't want to update the mode when no target mode is given" do
- resource = Chef::Resource::File.new('blahblah')
+ resource = Chef::Resource::File.new("blahblah")
fac = Chef::FileAccessControl.new(@current_resource, resource, @provider)
expect(fac.should_update_mode?).to be_falsey
end
@@ -264,7 +264,7 @@ describe Chef::FileAccessControl do
end
it "includes changing the mode in the list of desired changes" do
- resource = Chef::Resource::File.new('blahblah')
+ resource = Chef::Resource::File.new("blahblah")
resource.mode("0750")
@current_resource.mode("0444")
fac = Chef::FileAccessControl.new(@current_resource, resource, @provider)
@@ -275,7 +275,7 @@ describe Chef::FileAccessControl do
# stat returns modes like 0100644 (octal) => 33188 (decimal)
#@fac.stub(:stat).and_return(OpenStruct.new(:mode => 33188))
@current_resource.mode("0644")
- expect(File).to receive(:chmod).with(256, '/tmp/different_file.txt')
+ expect(File).to receive(:chmod).with(256, "/tmp/different_file.txt")
@fac.set_mode
expect(@fac).to be_modified
end
@@ -298,9 +298,9 @@ describe Chef::FileAccessControl do
@resource.mode(0400)
@resource.owner(0)
@resource.group(0)
- expect(File).to receive(:chmod).with(0400, '/tmp/different_file.txt')
- expect(File).to receive(:chown).with(0, nil, '/tmp/different_file.txt')
- expect(File).to receive(:chown).with(nil, 0, '/tmp/different_file.txt')
+ expect(File).to receive(:chmod).with(0400, "/tmp/different_file.txt")
+ expect(File).to receive(:chown).with(0, nil, "/tmp/different_file.txt")
+ expect(File).to receive(:chown).with(nil, 0, "/tmp/different_file.txt")
@fac.set_all
expect(@fac).to be_modified
end
diff --git a/spec/unit/file_cache_spec.rb b/spec/unit/file_cache_spec.rb
index a24c3d3b97..1b273c9adf 100644
--- a/spec/unit/file_cache_spec.rb
+++ b/spec/unit/file_cache_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::FileCache do
before do
@@ -32,11 +32,11 @@ describe Chef::FileCache do
describe "when the relative path to the cache file doesn't exist" do
it "creates intermediate directories as needed" do
Chef::FileCache.store("whiz/bang", "I found a poop")
- expect(File).to exist(File.join(@file_cache_path, 'whiz'))
+ expect(File).to exist(File.join(@file_cache_path, "whiz"))
end
it "creates the cached file at the correct relative path" do
- expect(File).to receive(:open).with(File.join(@file_cache_path, 'whiz', 'bang'), "w",416).and_yield(@io)
+ expect(File).to receive(:open).with(File.join(@file_cache_path, "whiz", "bang"), "w",416).and_yield(@io)
Chef::FileCache.store("whiz/bang", "borkborkbork")
end
@@ -56,35 +56,35 @@ describe Chef::FileCache do
describe "when loading cached files" do
it "finds and reads the cached file" do
- FileUtils.mkdir_p(File.join(@file_cache_path, 'whiz'))
- File.open(File.join(@file_cache_path, 'whiz', 'bang'), 'w') { |f| f.print("borkborkbork") }
- expect(Chef::FileCache.load('whiz/bang')).to eq('borkborkbork')
+ FileUtils.mkdir_p(File.join(@file_cache_path, "whiz"))
+ File.open(File.join(@file_cache_path, "whiz", "bang"), "w") { |f| f.print("borkborkbork") }
+ expect(Chef::FileCache.load("whiz/bang")).to eq("borkborkbork")
end
it "should raise a Chef::Exceptions::FileNotFound if the file doesn't exist" do
- expect { Chef::FileCache.load('whiz/bang') }.to raise_error(Chef::Exceptions::FileNotFound)
+ expect { Chef::FileCache.load("whiz/bang") }.to raise_error(Chef::Exceptions::FileNotFound)
end
end
describe "when deleting cached files" do
before(:each) do
- FileUtils.mkdir_p(File.join(@file_cache_path, 'whiz'))
- File.open(File.join(@file_cache_path, 'whiz', 'bang'), 'w') { |f| f.print("borkborkbork") }
+ FileUtils.mkdir_p(File.join(@file_cache_path, "whiz"))
+ File.open(File.join(@file_cache_path, "whiz", "bang"), "w") { |f| f.print("borkborkbork") }
end
it "unlinks the file" do
Chef::FileCache.delete("whiz/bang")
- expect(File).not_to exist(File.join(@file_cache_path, 'whiz', 'bang'))
+ expect(File).not_to exist(File.join(@file_cache_path, "whiz", "bang"))
end
end
describe "when listing files in the cache" do
before(:each) do
- FileUtils.mkdir_p(File.join(@file_cache_path, 'whiz'))
- FileUtils.touch(File.join(@file_cache_path, 'whiz', 'bang'))
- FileUtils.mkdir_p(File.join(@file_cache_path, 'snappy'))
- FileUtils.touch(File.join(@file_cache_path, 'snappy', 'patter'))
+ FileUtils.mkdir_p(File.join(@file_cache_path, "whiz"))
+ FileUtils.touch(File.join(@file_cache_path, "whiz", "bang"))
+ FileUtils.mkdir_p(File.join(@file_cache_path, "snappy"))
+ FileUtils.touch(File.join(@file_cache_path, "snappy", "patter"))
end
it "should return the relative paths" do
@@ -92,18 +92,18 @@ describe Chef::FileCache do
end
it "searches for cached files by globbing" do
- expect(Chef::FileCache.find('snappy/**/*')).to eq(%w{snappy/patter})
+ expect(Chef::FileCache.find("snappy/**/*")).to eq(%w{snappy/patter})
end
end
describe "when checking for the existence of a file" do
before do
- FileUtils.mkdir_p(File.join(@file_cache_path, 'whiz'))
+ FileUtils.mkdir_p(File.join(@file_cache_path, "whiz"))
end
it "has a key if the corresponding cache file exists" do
- FileUtils.touch(File.join(@file_cache_path, 'whiz', 'bang'))
+ FileUtils.touch(File.join(@file_cache_path, "whiz", "bang"))
expect(Chef::FileCache).to have_key("whiz/bang")
end
diff --git a/spec/unit/file_content_management/deploy/cp_spec.rb b/spec/unit/file_content_management/deploy/cp_spec.rb
index 5c6583e8a6..d99839710a 100644
--- a/spec/unit/file_content_management/deploy/cp_spec.rb
+++ b/spec/unit/file_content_management/deploy/cp_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::FileContentManagement::Deploy::Cp do
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 4511f91180..bebde96295 100644
--- a/spec/unit/file_content_management/deploy/mv_unix_spec.rb
+++ b/spec/unit/file_content_management/deploy/mv_unix_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::FileContentManagement::Deploy::MvUnix 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 2d1981befc..7deeacf7ea 100644
--- a/spec/unit/file_content_management/deploy/mv_windows_spec.rb
+++ b/spec/unit/file_content_management/deploy/mv_windows_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
unless Chef::Platform.windows?
class Chef
@@ -31,7 +31,7 @@ unless Chef::Platform.windows?
end
end
-require 'chef/file_content_management/deploy/mv_windows'
+require "chef/file_content_management/deploy/mv_windows"
describe Chef::FileContentManagement::Deploy::MvWindows do
diff --git a/spec/unit/formatters/base_spec.rb b/spec/unit/formatters/base_spec.rb
index 6a843ea775..9fe8109e98 100644
--- a/spec/unit/formatters/base_spec.rb
+++ b/spec/unit/formatters/base_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Formatters::Base do
let(:out) { double("out") }
diff --git a/spec/unit/formatters/doc_spec.rb b/spec/unit/formatters/doc_spec.rb
index b0be913304..d622b27bf9 100644
--- a/spec/unit/formatters/doc_spec.rb
+++ b/spec/unit/formatters/doc_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Formatters::Base do
diff --git a/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb b/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb
index 6f90ea0b27..b417c76f8a 100644
--- a/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb
+++ b/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/formatters/error_inspectors/api_error_formatting'
+require "spec_helper"
+require "chef/formatters/error_inspectors/api_error_formatting"
describe Chef::Formatters::APIErrorFormatting do
let(:class_instance) { (Class.new { include Chef::Formatters::APIErrorFormatting }).new }
@@ -43,7 +43,7 @@ describe Chef::Formatters::APIErrorFormatting do
before do
# mock out the header
- allow(response).to receive(:[]).with('x-ops-server-api-version').and_return(Chef::JSONCompat.to_json(return_hash))
+ allow(response).to receive(:[]).with("x-ops-server-api-version").and_return(Chef::JSONCompat.to_json(return_hash))
end
it "prints an error about client and server API version incompatibility with a min API version" do
@@ -65,7 +65,7 @@ describe Chef::Formatters::APIErrorFormatting do
context "when response.body['error'] != 'invalid-x-ops-server-api-version'" do
before do
- allow(response).to receive(:[]).with('x-ops-server-api-version').and_return(nil)
+ allow(response).to receive(:[]).with("x-ops-server-api-version").and_return(nil)
end
it "forwards the error_description to describe_http_error" do
diff --git a/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb
index 6cea22680b..d6138f4c11 100644
--- a/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb
+++ b/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
BAD_RECIPE=<<-E
#
diff --git a/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb
index 7e4d89f144..9c4d63a2e8 100644
--- a/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb
+++ b/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector do
diff --git a/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb
index 775a1838f3..0fac218eb5 100644
--- a/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb
+++ b/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Formatters::ErrorInspectors::CookbookSyncErrorInspector do
before do
diff --git a/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb
index d2bbffafee..8d882b045e 100644
--- a/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb
+++ b/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
# spec_helper loads the shared examples already.
#require 'support/shared/unit/api_error_inspector_spec'
diff --git a/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb
index 4c21dadd82..0a8918d158 100644
--- a/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb
+++ b/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
# spec_helper loads the shared examples already.
#require 'support/shared/unit/api_error_inspector_spec'
diff --git a/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb b/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb
index 5594d6e18a..d4185c2f5c 100644
--- a/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb
+++ b/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do
include Chef::DSL::Recipe
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 1cd97596a7..786b3e0c37 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
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector do
before do
diff --git a/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb b/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb
index acf1b15fd8..518610c13a 100644
--- a/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb
+++ b/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::GuardInterpreter::ResourceGuardInterpreter do
let(:node) do
@@ -24,7 +24,7 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do
node.default["kernel"] = Hash.new
node.default["kernel"][:machine] = :x86_64.to_s
- node.automatic[:os] = 'windows'
+ node.automatic[:os] = "windows"
node
end
@@ -52,7 +52,7 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do
it "raises an exception if guard_interpreter is set to a resource not derived from Chef::Resource::Script" do
parent_resource.guard_interpreter(:file)
- expect { guard_interpreter }.to raise_error(ArgumentError, 'Specified guard interpreter class Chef::Resource::File must be a kind of Chef::Resource::Execute resource')
+ expect { guard_interpreter }.to raise_error(ArgumentError, "Specified guard interpreter class Chef::Resource::File must be a kind of Chef::Resource::Execute resource")
end
context "when the resource cannot be found for the platform" do
@@ -62,7 +62,7 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do
it "raises an exception" do
parent_resource.guard_interpreter(:foobar)
- expect { guard_interpreter }.to raise_error(ArgumentError, 'Specified guard_interpreter resource foobar unknown for this platform')
+ expect { guard_interpreter }.to raise_error(ArgumentError, "Specified guard_interpreter resource foobar unknown for this platform")
end
end
diff --git a/spec/unit/guard_interpreter_spec.rb b/spec/unit/guard_interpreter_spec.rb
index a7fe064948..10084a156e 100644
--- a/spec/unit/guard_interpreter_spec.rb
+++ b/spec/unit/guard_interpreter_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::GuardInterpreter do
describe "#for_resource" do
diff --git a/spec/unit/handler/json_file_spec.rb b/spec/unit/handler/json_file_spec.rb
index f6c14a166e..76098e2522 100644
--- a/spec/unit/handler/json_file_spec.rb
+++ b/spec/unit/handler/json_file_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'spec_helper'
+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
@@ -28,8 +28,8 @@ describe Chef::Handler::JsonFile do
end
it "creates the directory where the reports will be saved" do
- expect(FileUtils).to receive(:mkdir_p).with('/tmp/foobarbazqux')
- expect(File).to receive(:chmod).with(00700, '/tmp/foobarbazqux')
+ expect(FileUtils).to receive(:mkdir_p).with("/tmp/foobarbazqux")
+ expect(File).to receive(:chmod).with(00700, "/tmp/foobarbazqux")
@handler.build_report_dir
end
@@ -54,10 +54,10 @@ describe Chef::Handler::JsonFile do
expect(@handler).to receive(:build_report_dir)
@handler.run_report_unsafe(@run_status)
reported_data = Chef::JSONCompat.from_json(@file_mock.string)
- expect(reported_data['exception']).to eq("Exception: Boy howdy!")
- expect(reported_data['start_time']).to eq(@expected_time.to_s)
- expect(reported_data['end_time']).to eq((@expected_time + 5).to_s)
- expect(reported_data['elapsed_time']).to eq(5)
+ expect(reported_data["exception"]).to eq("Exception: Boy howdy!")
+ expect(reported_data["start_time"]).to eq(@expected_time.to_s)
+ expect(reported_data["end_time"]).to eq((@expected_time + 5).to_s)
+ expect(reported_data["elapsed_time"]).to eq(5)
end
end
diff --git a/spec/unit/handler_spec.rb b/spec/unit/handler_spec.rb
index e7f67405fc..f3e527b69d 100644
--- a/spec/unit/handler_spec.rb
+++ b/spec/unit/handler_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Handler do
before(:each) do
@@ -36,7 +36,7 @@ describe Chef::Handler do
@exception.set_backtrace(@backtrace)
@run_status.exception = @exception
@run_context = Chef::RunContext.new(@node, {}, @events)
- @all_resources = [Chef::Resource::Cat.new('lolz'), Chef::Resource::ZenMaster.new('tzu')]
+ @all_resources = [Chef::Resource::Cat.new("lolz"), Chef::Resource::ZenMaster.new("tzu")]
@all_resources.first.updated = true
@run_context.resource_collection.all_resources.replace(@all_resources)
@run_status.run_context = @run_context
@@ -117,7 +117,7 @@ describe Chef::Handler do
describe "when running a report handler" do
before do
@run_context = Chef::RunContext.new(@node, {}, @events)
- @all_resources = [Chef::Resource::Cat.new('foo'), Chef::Resource::ZenMaster.new('moo')]
+ @all_resources = [Chef::Resource::Cat.new("foo"), Chef::Resource::ZenMaster.new("moo")]
@all_resources.first.updated = true
@run_context.resource_collection.all_resources.replace(@all_resources)
@run_status.run_context = @run_context
diff --git a/spec/unit/http/authenticator_spec.rb b/spec/unit/http/authenticator_spec.rb
index 48bbdcf76c..1289ebb61e 100644
--- a/spec/unit/http/authenticator_spec.rb
+++ b/spec/unit/http/authenticator_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/http/authenticator'
+require "spec_helper"
+require "chef/http/authenticator"
describe Chef::HTTP::Authenticator do
let(:class_instance) { Chef::HTTP::Authenticator.new }
@@ -35,15 +35,15 @@ describe Chef::HTTP::Authenticator do
it "merges the default version of X-Ops-Server-API-Version into the headers" do
# headers returned
expect(class_instance.handle_request(method, url, headers, data)[2]).
- to include({'X-Ops-Server-API-Version' => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION})
+ to include({"X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION})
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]).
- to include({'X-Ops-Server-API-Version' => '-10'})
+ to include({"X-Ops-Server-API-Version" => "-10"})
end
end
end
diff --git a/spec/unit/http/basic_client_spec.rb b/spec/unit/http/basic_client_spec.rb
index 16f62f8d97..4abdb52620 100644
--- a/spec/unit/http/basic_client_spec.rb
+++ b/spec/unit/http/basic_client_spec.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/http/basic_client'
+require "spec_helper"
+require "chef/http/basic_client"
describe "HTTP Connection" do
diff --git a/spec/unit/http/http_request_spec.rb b/spec/unit/http/http_request_spec.rb
index 3bba201963..33da210c36 100644
--- a/spec/unit/http/http_request_spec.rb
+++ b/spec/unit/http/http_request_spec.rb
@@ -16,40 +16,40 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::HTTP::HTTPRequest do
context "with HTTP url scheme" do
it "should not include port 80 in Host header" do
- request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com'), '')
+ request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com"), "")
- expect(request.headers['Host']).to eql('dummy.com')
+ expect(request.headers["Host"]).to eql("dummy.com")
end
it "should not include explicit port 80 in Host header" do
- request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com:80'), '')
+ request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com:80"), "")
- expect(request.headers['Host']).to eql('dummy.com')
+ expect(request.headers["Host"]).to eql("dummy.com")
end
it "should include explicit port 8000 in Host header" do
- request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com:8000'), '')
+ request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com:8000"), "")
- expect(request.headers['Host']).to eql('dummy.com:8000')
+ expect(request.headers["Host"]).to eql("dummy.com:8000")
end
it "should include explicit 443 port in Host header" do
- request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com:443'), '')
+ request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com:443"), "")
- expect(request.headers['Host']).to eql('dummy.com:443')
+ expect(request.headers["Host"]).to eql("dummy.com:443")
end
it "should pass on explicit Host header unchanged" do
- request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com:8000'), '', { 'Host' => 'yourhost.com:8888' })
+ request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com:8000"), "", { "Host" => "yourhost.com:8888" })
- expect(request.headers['Host']).to eql('yourhost.com:8888')
+ expect(request.headers["Host"]).to eql("yourhost.com:8888")
end
end
@@ -57,35 +57,35 @@ describe Chef::HTTP::HTTPRequest do
context "with HTTPS url scheme" do
it "should not include port 443 in Host header" do
- request = Chef::HTTP::HTTPRequest.new(:GET, URI('https://dummy.com'), '')
+ request = Chef::HTTP::HTTPRequest.new(:GET, URI("https://dummy.com"), "")
- expect(request.headers['Host']).to eql('dummy.com')
+ expect(request.headers["Host"]).to eql("dummy.com")
end
it "should include explicit port 80 in Host header" do
- request = Chef::HTTP::HTTPRequest.new(:GET, URI('https://dummy.com:80'), '')
+ request = Chef::HTTP::HTTPRequest.new(:GET, URI("https://dummy.com:80"), "")
- expect(request.headers['Host']).to eql('dummy.com:80')
+ expect(request.headers["Host"]).to eql("dummy.com:80")
end
it "should include explicit port 8000 in Host header" do
- request = Chef::HTTP::HTTPRequest.new(:GET, URI('https://dummy.com:8000'), '')
+ request = Chef::HTTP::HTTPRequest.new(:GET, URI("https://dummy.com:8000"), "")
- expect(request.headers['Host']).to eql('dummy.com:8000')
+ expect(request.headers["Host"]).to eql("dummy.com:8000")
end
it "should not include explicit port 443 in Host header" do
- request = Chef::HTTP::HTTPRequest.new(:GET, URI('https://dummy.com:443'), '')
+ request = Chef::HTTP::HTTPRequest.new(:GET, URI("https://dummy.com:443"), "")
- expect(request.headers['Host']).to eql('dummy.com')
+ expect(request.headers["Host"]).to eql("dummy.com")
end
end
it "should pass on explicit Host header unchanged" do
- request = Chef::HTTP::HTTPRequest.new(:GET, URI('http://dummy.com:8000'), '', { 'Host' => 'myhost.com:80' })
+ request = Chef::HTTP::HTTPRequest.new(:GET, URI("http://dummy.com:8000"), "", { "Host" => "myhost.com:80" })
- expect(request.headers['Host']).to eql('myhost.com:80')
+ expect(request.headers["Host"]).to eql("myhost.com:80")
end
end
diff --git a/spec/unit/http/json_input_spec.rb b/spec/unit/http/json_input_spec.rb
index fbf8f22503..6bc2bbf018 100644
--- a/spec/unit/http/json_input_spec.rb
+++ b/spec/unit/http/json_input_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/http/json_input'
+require "spec_helper"
+require "chef/http/json_input"
describe Chef::HTTP::JSONInput do
diff --git a/spec/unit/http/simple_spec.rb b/spec/unit/http/simple_spec.rb
index c8fb52e8b2..f132f1a890 100644
--- a/spec/unit/http/simple_spec.rb
+++ b/spec/unit/http/simple_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::HTTP::Simple do
it "should have content length validation middleware after compressor middleware" do
diff --git a/spec/unit/http/socketless_chef_zero_client_spec.rb b/spec/unit/http/socketless_chef_zero_client_spec.rb
index 963cc9e8c4..b65deafe53 100644
--- a/spec/unit/http/socketless_chef_zero_client_spec.rb
+++ b/spec/unit/http/socketless_chef_zero_client_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/http/socketless_chef_zero_client'
+require "chef/http/socketless_chef_zero_client"
describe Chef::HTTP::SocketlessChefZeroClient do
diff --git a/spec/unit/http/ssl_policies_spec.rb b/spec/unit/http/ssl_policies_spec.rb
index 5ebebf39b1..98f1fa9c37 100644
--- a/spec/unit/http/ssl_policies_spec.rb
+++ b/spec/unit/http/ssl_policies_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/http/ssl_policies'
+require "spec_helper"
+require "chef/http/ssl_policies"
describe "HTTP SSL Policy" do
@@ -68,8 +68,8 @@ describe "HTTP SSL Policy" do
end
it "should set the CA file if that is set in the configuration" do
- Chef::Config[:ssl_ca_file] = CHEF_SPEC_DATA + '/ssl/5e707473.0'
- expect(http_client.ca_file).to eq(CHEF_SPEC_DATA + '/ssl/5e707473.0')
+ Chef::Config[:ssl_ca_file] = CHEF_SPEC_DATA + "/ssl/5e707473.0"
+ expect(http_client.ca_file).to eq(CHEF_SPEC_DATA + "/ssl/5e707473.0")
end
end
@@ -89,12 +89,12 @@ describe "HTTP SSL Policy" do
it "raises ConfigurationError if the certificate file doesn't exist" do
Chef::Config[:ssl_client_cert] = "/dev/null/nothing_here"
- Chef::Config[:ssl_client_key] = CHEF_SPEC_DATA + '/ssl/chef-rspec.key'
+ Chef::Config[:ssl_client_key] = CHEF_SPEC_DATA + "/ssl/chef-rspec.key"
expect {http_client}.to raise_error(Chef::Exceptions::ConfigurationError)
end
it "raises ConfigurationError if the certificate file doesn't exist" do
- Chef::Config[:ssl_client_cert] = CHEF_SPEC_DATA + '/ssl/chef-rspec.cert'
+ Chef::Config[:ssl_client_cert] = CHEF_SPEC_DATA + "/ssl/chef-rspec.cert"
Chef::Config[:ssl_client_key] = "/dev/null/nothing_here"
expect {http_client}.to raise_error(Chef::Exceptions::ConfigurationError)
end
@@ -106,10 +106,10 @@ describe "HTTP SSL Policy" do
end
it "configures the HTTP client's cert and private key" do
- Chef::Config[:ssl_client_cert] = CHEF_SPEC_DATA + '/ssl/chef-rspec.cert'
- Chef::Config[:ssl_client_key] = CHEF_SPEC_DATA + '/ssl/chef-rspec.key'
- expect(http_client.cert.to_s).to eq(OpenSSL::X509::Certificate.new(IO.read(CHEF_SPEC_DATA + '/ssl/chef-rspec.cert')).to_s)
- expect(http_client.key.to_s).to eq(IO.read(CHEF_SPEC_DATA + '/ssl/chef-rspec.key'))
+ Chef::Config[:ssl_client_cert] = CHEF_SPEC_DATA + "/ssl/chef-rspec.cert"
+ Chef::Config[:ssl_client_key] = CHEF_SPEC_DATA + "/ssl/chef-rspec.key"
+ expect(http_client.cert.to_s).to eq(OpenSSL::X509::Certificate.new(IO.read(CHEF_SPEC_DATA + "/ssl/chef-rspec.cert")).to_s)
+ expect(http_client.key.to_s).to eq(IO.read(CHEF_SPEC_DATA + "/ssl/chef-rspec.key"))
end
end
diff --git a/spec/unit/http/validate_content_length_spec.rb b/spec/unit/http/validate_content_length_spec.rb
index 16eede1859..18b0bead70 100644
--- a/spec/unit/http/validate_content_length_spec.rb
+++ b/spec/unit/http/validate_content_length_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'stringio'
+require "spec_helper"
+require "stringio"
describe Chef::HTTP::ValidateContentLength do
class TestClient < Chef::HTTP
@@ -44,7 +44,7 @@ describe Chef::HTTP::ValidateContentLength do
}
let(:response) {
- m = double('HttpResponse', :body => response_body)
+ m = double("HttpResponse", :body => response_body)
allow(m).to receive(:[]) do |key|
response_headers[key]
end
diff --git a/spec/unit/http_spec.rb b/spec/unit/http_spec.rb
index ebb96d25e1..c35f8baaeb 100644
--- a/spec/unit/http_spec.rb
+++ b/spec/unit/http_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/http'
-require 'chef/http/basic_client'
-require 'chef/http/socketless_chef_zero_client'
+require "chef/http"
+require "chef/http/basic_client"
+require "chef/http/socketless_chef_zero_client"
class Chef::HTTP
public :create_url
@@ -43,26 +43,26 @@ describe Chef::HTTP do
describe "create_url" do
- it 'should return a correctly formatted url 1/3 CHEF-5261' do
- http = Chef::HTTP.new('http://www.getchef.com')
- expect(http.create_url('api/endpoint')).to eql(URI.parse('http://www.getchef.com/api/endpoint'))
+ it "should return a correctly formatted url 1/3 CHEF-5261" do
+ http = Chef::HTTP.new("http://www.getchef.com")
+ expect(http.create_url("api/endpoint")).to eql(URI.parse("http://www.getchef.com/api/endpoint"))
end
- it 'should return a correctly formatted url 2/3 CHEF-5261' do
- http = Chef::HTTP.new('http://www.getchef.com/')
- expect(http.create_url('/organization/org/api/endpoint/')).to eql(URI.parse('http://www.getchef.com/organization/org/api/endpoint/'))
+ it "should return a correctly formatted url 2/3 CHEF-5261" do
+ http = Chef::HTTP.new("http://www.getchef.com/")
+ expect(http.create_url("/organization/org/api/endpoint/")).to eql(URI.parse("http://www.getchef.com/organization/org/api/endpoint/"))
end
- it 'should return a correctly formatted url 3/3 CHEF-5261' do
- http = Chef::HTTP.new('http://www.getchef.com/organization/org///')
- expect(http.create_url('///api/endpoint?url=http://foo.bar')).to eql(URI.parse('http://www.getchef.com/organization/org/api/endpoint?url=http://foo.bar'))
+ it "should return a correctly formatted url 3/3 CHEF-5261" do
+ http = Chef::HTTP.new("http://www.getchef.com/organization/org///")
+ expect(http.create_url("///api/endpoint?url=http://foo.bar")).to eql(URI.parse("http://www.getchef.com/organization/org/api/endpoint?url=http://foo.bar"))
end
# As per: https://github.com/opscode/chef/issues/2500
- it 'should treat scheme part of the URI in a case-insensitive manner' do
+ it "should treat scheme part of the URI in a case-insensitive manner" do
http = Chef::HTTP.allocate # Calling Chef::HTTP::new sets @url, don't want that.
- expect { http.create_url('HTTP://www1.chef.io/') }.not_to raise_error
- expect(http.create_url('HTTP://www2.chef.io/')).to eql(URI.parse('http://www2.chef.io/'))
+ expect { http.create_url("HTTP://www1.chef.io/") }.not_to raise_error
+ expect(http.create_url("HTTP://www2.chef.io/")).to eql(URI.parse("http://www2.chef.io/"))
end
end # create_url
@@ -117,7 +117,7 @@ describe Chef::HTTP do
end
it "retries the request 5 times" do
- http.get('/')
+ http.get("/")
end
end
diff --git a/spec/unit/json_compat_spec.rb b/spec/unit/json_compat_spec.rb
index fd6469c146..524b71f09a 100644
--- a/spec/unit/json_compat_spec.rb
+++ b/spec/unit/json_compat_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require File.expand_path('../../spec_helper', __FILE__)
-require 'chef/json_compat'
+require File.expand_path("../../spec_helper", __FILE__)
+require "chef/json_compat"
describe Chef::JSONCompat do
@@ -46,7 +46,7 @@ describe Chef::JSONCompat do
end
describe 'with JSON containing "Chef::Sandbox" as a json_class value' do
- require 'chef/sandbox' # Only needed for this test
+ require "chef/sandbox" # Only needed for this test
let(:json) { '{"json_class": "Chef::Sandbox", "arbitrary": "data"}' }
@@ -58,7 +58,7 @@ describe Chef::JSONCompat do
describe "when pretty printing an object that defines #to_json" do
class Foo
def to_json(*a)
- Chef::JSONCompat.to_json({'foo' => 1234, 'bar' => {'baz' => 5678}}, *a)
+ Chef::JSONCompat.to_json({"foo" => 1234, "bar" => {"baz" => 5678}}, *a)
end
end
@@ -73,7 +73,7 @@ describe Chef::JSONCompat do
end
describe "with the file with 252 or less nested entries" do
- let(:json) { IO.read(File.join(CHEF_SPEC_DATA, 'nested.json')) }
+ let(:json) { IO.read(File.join(CHEF_SPEC_DATA, "nested.json")) }
let(:hash) { Chef::JSONCompat.from_json(json) }
describe "when the 252 json file is loaded" do
@@ -83,9 +83,9 @@ describe Chef::JSONCompat do
it "should has 'test' as a 252 nested value" do
v = 252.times.inject(hash) do |memo, _|
- memo['key']
+ memo["key"]
end
- expect(v).to eq('test')
+ expect(v).to eq("test")
end
end
end
diff --git a/spec/unit/key_spec.rb b/spec/unit/key_spec.rb
index 64601cfbab..95124b5e8f 100644
--- a/spec/unit/key_spec.rb
+++ b/spec/unit/key_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/key'
+require "chef/key"
describe Chef::Key do
# whether user or client irrelevent to these tests
@@ -341,7 +341,7 @@ EOS
let(:rest) do
Chef::Config[:chef_server_root] = "http://www.example.com"
Chef::Config[:chef_server_url] = "http://www.example.com/organizations/test_org"
- r = double('rest')
+ r = double("rest")
allow(Chef::ServerAPI).to receive(:new).and_return(r)
r
end
diff --git a/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb b/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
index 75e0ff6b00..4bdd994906 100644
--- a/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
+++ b/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::Bootstrap::ChefVaultHandler do
@@ -57,29 +57,29 @@ describe Chef::Knife::Bootstrap::ChefVaultHandler do
context "from knife_config[:bootstrap_vault_item]" do
it "sets a single item as a scalar" do
- knife_config[:bootstrap_vault_item] = { 'vault' => 'item1' }
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
+ knife_config[:bootstrap_vault_item] = { "vault" => "item1" }
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
it "sets a single item as an array" do
- knife_config[:bootstrap_vault_item] = { 'vault' => [ 'item1' ] }
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
+ knife_config[:bootstrap_vault_item] = { "vault" => [ "item1" ] }
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
it "sets two items as an array" do
- knife_config[:bootstrap_vault_item] = { 'vault' => [ 'item1', 'item2' ] }
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item2').and_return(bootstrap_vault_item)
+ knife_config[:bootstrap_vault_item] = { "vault" => [ "item1", "item2" ] }
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item2").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
it "sets two vaults from different hash keys" do
- knife_config[:bootstrap_vault_item] = { 'vault' => [ 'item1', 'item2' ], 'vault2' => [ 'item3' ] }
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item2').and_return(bootstrap_vault_item)
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault2', 'item3').and_return(bootstrap_vault_item)
+ knife_config[:bootstrap_vault_item] = { "vault" => [ "item1", "item2" ], "vault2" => [ "item3" ] }
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item2").and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault2", "item3").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
end
@@ -87,28 +87,28 @@ describe Chef::Knife::Bootstrap::ChefVaultHandler do
context "from knife_config[:bootstrap_vault_json]" do
it "sets a single item as a scalar" do
knife_config[:bootstrap_vault_json] = '{ "vault": "item1" }'
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
it "sets a single item as an array" do
knife_config[:bootstrap_vault_json] = '{ "vault": [ "item1" ] }'
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
it "sets two items as an array" do
knife_config[:bootstrap_vault_json] = '{ "vault": [ "item1", "item2" ] }'
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item2').and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item2").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
it "sets two vaults from different hash keys" do
knife_config[:bootstrap_vault_json] = '{ "vault": [ "item1", "item2" ], "vault2": [ "item3" ] }'
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item2').and_return(bootstrap_vault_item)
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault2', 'item3').and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item2").and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault2", "item3").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
end
@@ -123,28 +123,28 @@ describe Chef::Knife::Bootstrap::ChefVaultHandler do
it "sets a single item as a scalar" do
setup_file_contents('{ "vault": "item1" }')
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
it "sets a single item as an array" do
setup_file_contents('{ "vault": [ "item1" ] }')
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
it "sets two items as an array" do
setup_file_contents('{ "vault": [ "item1", "item2" ] }')
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item2').and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item2").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
it "sets two vaults from different hash keys" do
setup_file_contents('{ "vault": [ "item1", "item2" ], "vault2": [ "item3" ] }')
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item1').and_return(bootstrap_vault_item)
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault', 'item2').and_return(bootstrap_vault_item)
- expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with('vault2', 'item3').and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item1").and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault", "item2").and_return(bootstrap_vault_item)
+ expect(chef_vault_handler).to receive(:load_chef_bootstrap_vault_item).with("vault2", "item3").and_return(bootstrap_vault_item)
chef_vault_handler.run(client)
end
end
diff --git a/spec/unit/knife/bootstrap/client_builder_spec.rb b/spec/unit/knife/bootstrap/client_builder_spec.rb
index 6812a24c91..791b84b9c3 100644
--- a/spec/unit/knife/bootstrap/client_builder_spec.rb
+++ b/spec/unit/knife/bootstrap/client_builder_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::Bootstrap::ClientBuilder do
@@ -42,7 +42,7 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
}
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
@@ -54,14 +54,14 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
it "exits when the node exists and the user does not want to delete" do
expect(rest).to receive(:get).with("nodes/#{node_name}")
- expect(ui.stdin).to receive(:readline).and_return('n')
+ expect(ui.stdin).to receive(:readline).and_return("n")
expect { client_builder.run }.to raise_error(SystemExit)
end
it "exits when the client exists and the user does not want to delete" do
expect(rest).to receive(:get).with("nodes/#{node_name}").and_raise(exception_404)
expect(rest).to receive(:get).with("clients/#{node_name}")
- expect(ui.stdin).to receive(:readline).and_return('n')
+ expect(ui.stdin).to receive(:readline).and_return("n")
expect { client_builder.run }.to raise_error(SystemExit)
end
end
@@ -81,7 +81,7 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
it "when we are allowed to delete an old node" do
expect(rest).to receive(:get).with("nodes/#{node_name}")
- expect(ui.stdin).to receive(:readline).and_return('y')
+ expect(ui.stdin).to receive(:readline).and_return("y")
expect(rest).to receive(:get).with("clients/#{node_name}").and_raise(exception_404)
expect(rest).to receive(:delete).with("nodes/#{node_name}")
expect { client_builder.run }.not_to raise_error
@@ -90,7 +90,7 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
it "when we are allowed to delete an old client" do
expect(rest).to receive(:get).with("nodes/#{node_name}").and_raise(exception_404)
expect(rest).to receive(:get).with("clients/#{node_name}")
- expect(ui.stdin).to receive(:readline).and_return('y')
+ expect(ui.stdin).to receive(:readline).and_return("y")
expect(rest).to receive(:delete).with("clients/#{node_name}")
expect { client_builder.run }.not_to raise_error
end
@@ -98,7 +98,7 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
it "when we are are allowed to delete both an old client and node" do
expect(rest).to receive(:get).with("nodes/#{node_name}")
expect(rest).to receive(:get).with("clients/#{node_name}")
- expect(ui.stdin).to receive(:readline).twice.and_return('y')
+ expect(ui.stdin).to receive(:readline).twice.and_return("y")
expect(rest).to receive(:delete).with("nodes/#{node_name}")
expect(rest).to receive(:delete).with("clients/#{node_name}")
expect { client_builder.run }.not_to raise_error
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index b4babdc14f..c64b2e49ea 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
Chef::Knife::Bootstrap.load_deps
-require 'net/ssh'
+require "net/ssh"
describe Chef::Knife::Bootstrap do
before do
@@ -102,7 +102,7 @@ describe Chef::Knife::Bootstrap do
context "when :bootstrap_template config is set to a template name" do
let(:bootstrap_template) { "example" }
- let(:builtin_template_path) { File.expand_path(File.join(File.dirname(__FILE__), '../../../lib/chef/knife/bootstrap/templates', "example.erb"))}
+ let(:builtin_template_path) { File.expand_path(File.join(File.dirname(__FILE__), "../../../lib/chef/knife/bootstrap/templates", "example.erb"))}
let(:chef_config_dir_template_path) { "/knife/chef/config/bootstrap/example.erb" }
@@ -237,7 +237,7 @@ describe Chef::Knife::Bootstrap do
context "with bootstrap_attribute options" do
let(:jsonfile) {
- file = Tempfile.new (['node', '.json'])
+ file = Tempfile.new (["node", ".json"])
File.open(file.path, "w") {|f| f.puts '{"foo":{"bar":"baz"}}' }
file
}
@@ -385,7 +385,7 @@ describe Chef::Knife::Bootstrap do
end
describe "when transferring trusted certificates" do
- let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(File.dirname(__FILE__), '../../data/trusted_certs')) }
+ let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(File.dirname(__FILE__), "../../data/trusted_certs")) }
let(:rendered_template) do
knife.merge_configs
@@ -509,15 +509,15 @@ describe Chef::Knife::Bootstrap do
end
it "configures the ssh user" do
- expect(knife_ssh.config[:ssh_user]).to eq('rooty')
+ expect(knife_ssh.config[:ssh_user]).to eq("rooty")
end
it "configures the ssh password" do
- expect(knife_ssh.config[:ssh_password]).to eq('open_sesame')
+ expect(knife_ssh.config[:ssh_password]).to eq("open_sesame")
end
it "configures the ssh port" do
- expect(knife_ssh.config[:ssh_port]).to eq('4001')
+ expect(knife_ssh.config[:ssh_port]).to eq("4001")
end
it "configures the ssh agent forwarding" do
@@ -525,7 +525,7 @@ describe Chef::Knife::Bootstrap do
end
it "configures the ssh identity file" do
- expect(knife_ssh.config[:ssh_identity_file]).to eq('~/.ssh/me.rsa')
+ expect(knife_ssh.config[:ssh_identity_file]).to eq("~/.ssh/me.rsa")
end
end
@@ -537,8 +537,8 @@ describe Chef::Knife::Bootstrap do
it "use_sudo_password contains description and long params for help" do
expect(knife.options).to have_key(:use_sudo_password) \
- and expect(knife.options[:use_sudo_password][:description].to_s).not_to eq('')\
- and expect(knife.options[:use_sudo_password][:long].to_s).not_to eq('')
+ and expect(knife.options[:use_sudo_password][:description].to_s).not_to eq("")\
+ and expect(knife.options[:use_sudo_password][:long].to_s).not_to eq("")
end
it "uses the password from --ssh-password for sudo when --use-sudo-password is set" do
@@ -570,11 +570,11 @@ describe Chef::Knife::Bootstrap do
end
it "configures the ssh user" do
- expect(knife_ssh.config[:ssh_user]).to eq('curiosity')
+ expect(knife_ssh.config[:ssh_user]).to eq("curiosity")
end
it "configures the ssh port" do
- expect(knife_ssh.config[:ssh_port]).to eq('2430')
+ expect(knife_ssh.config[:ssh_port]).to eq("2430")
end
it "configures the ssh agent forwarding" do
@@ -582,11 +582,11 @@ describe Chef::Knife::Bootstrap do
end
it "configures the ssh identity file" do
- expect(knife_ssh.config[:ssh_identity_file]).to eq('~/.ssh/you.rsa')
+ expect(knife_ssh.config[:ssh_identity_file]).to eq("~/.ssh/you.rsa")
end
it "configures the ssh gateway" do
- expect(knife_ssh.config[:ssh_gateway]).to eq('towel.blinkenlights.nl')
+ expect(knife_ssh.config[:ssh_gateway]).to eq("towel.blinkenlights.nl")
end
it "configures the host key verify mode" do
@@ -601,13 +601,13 @@ describe Chef::Knife::Bootstrap do
knife.config[:ssh_identity_file] = "~/.ssh/me.rsa"
allow(knife).to receive(:render_template).and_return("")
k = knife.knife_ssh
- allow(k).to receive(:get_password).and_return('typed_in_password')
+ allow(k).to receive(:get_password).and_return("typed_in_password")
allow(knife).to receive(:knife_ssh).and_return(k)
knife.knife_ssh_with_password_auth
end
it "prompts the user for a password " do
- expect(knife_ssh_with_password_auth.config[:ssh_password]).to eq('typed_in_password')
+ expect(knife_ssh_with_password_auth.config[:ssh_password]).to eq("typed_in_password")
end
it "configures knife not to use the identity file that didn't work previously" do
diff --git a/spec/unit/knife/client_bulk_delete_spec.rb b/spec/unit/knife/client_bulk_delete_spec.rb
index 1a6317ac00..30bd8b5b97 100644
--- a/spec/unit/knife/client_bulk_delete_spec.rb
+++ b/spec/unit/knife/client_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::ClientBulkDelete do
let(:stdout_io) { StringIO.new }
diff --git a/spec/unit/knife/client_create_spec.rb b/spec/unit/knife/client_create_spec.rb
index 9066505dfd..359271672e 100644
--- a/spec/unit/knife/client_create_spec.rb
+++ b/spec/unit/knife/client_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
Chef::Knife::ClientCreate.load_deps
@@ -61,13 +61,13 @@ describe Chef::Knife::ClientCreate do
# from spec/support/shared/unit/knife_shared.rb
it_should_behave_like "mandatory field missing" do
let(:name_args) { [] }
- let(:fieldname) { 'client name' }
+ let(:fieldname) { "client name" }
end
end
context "when clientname is passed" do
before do
- knife.name_args = ['adam']
+ knife.name_args = ["adam"]
end
context "when public_key and prevent_keygen are passed" do
@@ -131,7 +131,7 @@ describe Chef::Knife::ClientCreate do
it "should write the private key to a file" do
knife.config[:file] = "/tmp/monkeypants"
filehandle = double("Filehandle")
- expect(filehandle).to receive(:print).with('woot')
+ expect(filehandle).to receive(:print).with("woot")
expect(File).to receive(:open).with("/tmp/monkeypants", "w").and_yield(filehandle)
knife.run
end
@@ -150,14 +150,14 @@ describe Chef::Knife::ClientCreate do
describe "with -p or --public-key" do
before do
- knife.config[:public_key] = 'some_key'
- allow(File).to receive(:read).and_return('some_key')
+ knife.config[:public_key] = "some_key"
+ allow(File).to receive(:read).and_return("some_key")
allow(File).to receive(:expand_path)
end
it "sets the public key" do
knife.run
- expect(client.public_key).to eq('some_key')
+ expect(client.public_key).to eq("some_key")
end
end
diff --git a/spec/unit/knife/client_delete_spec.rb b/spec/unit/knife/client_delete_spec.rb
index 619009979b..e08a9c59c8 100644
--- a/spec/unit/knife/client_delete_spec.rb
+++ b/spec/unit/knife/client_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::ClientDelete do
before(:each) do
@@ -25,16 +25,16 @@ describe Chef::Knife::ClientDelete do
@knife.config = {
:delete_validators => false
}
- @knife.name_args = [ 'adam' ]
+ @knife.name_args = [ "adam" ]
end
- describe 'run' do
- it 'should delete the client' do
- expect(@knife).to receive(:delete_object).with(Chef::ApiClientV1, 'adam', 'client')
+ describe "run" do
+ it "should delete the client" do
+ expect(@knife).to receive(:delete_object).with(Chef::ApiClientV1, "adam", "client")
@knife.run
end
- it 'should print usage and exit when a client name is not provided' do
+ it "should print usage and exit when a client name is not provided" do
@knife.name_args = []
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal)
@@ -42,7 +42,7 @@ describe Chef::Knife::ClientDelete do
end
end
- describe 'with a validator' do
+ describe "with a validator" do
before(:each) do
allow(Chef::Knife::UI).to receive(:confirm).and_return(true)
allow(@knife).to receive(:confirm).and_return(true)
@@ -50,7 +50,7 @@ describe Chef::Knife::ClientDelete do
expect(Chef::ApiClientV1).to receive(:load).and_return(@client)
end
- it 'should delete non-validator client if --delete-validators is not set' do
+ it "should delete non-validator client if --delete-validators is not set" do
@knife.config[:delete_validators] = false
expect(@client).to receive(:destroy).and_return(@client)
expect(@knife).to receive(:msg)
@@ -58,7 +58,7 @@ describe Chef::Knife::ClientDelete do
@knife.run
end
- it 'should delete non-validator client if --delete-validators is set' do
+ it "should delete non-validator client if --delete-validators is set" do
@knife.config[:delete_validators] = true
expect(@client).to receive(:destroy).and_return(@client)
expect(@knife).to receive(:msg)
@@ -66,13 +66,13 @@ describe Chef::Knife::ClientDelete do
@knife.run
end
- it 'should not delete validator client if --delete-validators is not set' do
+ it "should not delete validator client if --delete-validators is not set" do
@client.validator(true)
expect(@knife.ui).to receive(:fatal)
expect { @knife.run}.to raise_error(SystemExit)
end
- it 'should delete validator client if --delete-validators is set' do
+ it "should delete validator client if --delete-validators is set" do
@knife.config[:delete_validators] = true
expect(@client).to receive(:destroy).and_return(@client)
expect(@knife).to receive(:msg)
diff --git a/spec/unit/knife/client_edit_spec.rb b/spec/unit/knife/client_edit_spec.rb
index 75b0ef8c92..876dfc5770 100644
--- a/spec/unit/knife/client_edit_spec.rb
+++ b/spec/unit/knife/client_edit_spec.rb
@@ -16,17 +16,17 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/api_client_v1'
+require "spec_helper"
+require "chef/api_client_v1"
describe Chef::Knife::ClientEdit do
before(:each) do
@knife = Chef::Knife::ClientEdit.new
- @knife.name_args = [ 'adam' ]
+ @knife.name_args = [ "adam" ]
@knife.config[:disable_editing] = true
end
- describe 'run' do
+ describe "run" do
let(:data) {
{
"name" => "adam",
@@ -37,13 +37,13 @@ describe Chef::Knife::ClientEdit do
}
}
- it 'should edit the client' do
- allow(Chef::ApiClientV1).to receive(:load).with('adam').and_return(data)
+ it "should edit the client" do
+ allow(Chef::ApiClientV1).to receive(:load).with("adam").and_return(data)
expect(@knife).to receive(:edit_data).with(data).and_return(data)
@knife.run
end
- it 'should print usage and exit when a client name is not provided' do
+ it "should print usage and exit when a client name is not provided" do
@knife.name_args = []
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal)
diff --git a/spec/unit/knife/client_list_spec.rb b/spec/unit/knife/client_list_spec.rb
index ce0fa4f5e8..03d87022db 100644
--- a/spec/unit/knife/client_list_spec.rb
+++ b/spec/unit/knife/client_list_spec.rb
@@ -16,16 +16,16 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::ClientList do
before(:each) do
@knife = Chef::Knife::ClientList.new
- @knife.name_args = [ 'adam' ]
+ @knife.name_args = [ "adam" ]
end
- describe 'run' do
- it 'should list the clients' do
+ describe "run" do
+ it "should list the clients" do
expect(Chef::ApiClientV1).to receive(:list)
expect(@knife).to receive(:format_list_for_display)
@knife.run
diff --git a/spec/unit/knife/client_reregister_spec.rb b/spec/unit/knife/client_reregister_spec.rb
index 7e763242e4..da1f4314b6 100644
--- a/spec/unit/knife/client_reregister_spec.rb
+++ b/spec/unit/knife/client_reregister_spec.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
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")
+ @knife.name_args = [ "adam" ]
+ @client_mock = double("client_mock", :private_key => "foo_key")
@stdout = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
end
@@ -32,28 +32,28 @@ describe Chef::Knife::ClientReregister do
@knife.name_args = []
end
- it 'should print usage and exit when a client name is not provided' do
+ it "should print usage and exit when a client name is not provided" do
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal)
expect { @knife.run }.to raise_error(SystemExit)
end
end
- context 'when not configured for file output' do
- it 'reregisters the client and prints the key' do
- expect(Chef::ApiClientV1).to receive(:reregister).with('adam').and_return(@client_mock)
+ context "when not configured for file output" do
+ it "reregisters the client and prints the key" do
+ expect(Chef::ApiClientV1).to receive(:reregister).with("adam").and_return(@client_mock)
@knife.run
expect(@stdout.string).to match( /foo_key/ )
end
end
- context 'when configured for file output' do
- it 'should write the private key to a file' do
- expect(Chef::ApiClientV1).to receive(:reregister).with('adam').and_return(@client_mock)
+ context "when configured for file output" do
+ it "should write the private key to a file" do
+ expect(Chef::ApiClientV1).to receive(:reregister).with("adam").and_return(@client_mock)
- @knife.config[:file] = '/tmp/monkeypants'
+ @knife.config[:file] = "/tmp/monkeypants"
filehandle = StringIO.new
- expect(File).to receive(:open).with('/tmp/monkeypants', 'w').and_yield(filehandle)
+ expect(File).to receive(:open).with("/tmp/monkeypants", "w").and_yield(filehandle)
@knife.run
expect(filehandle.string).to eq("foo_key")
end
diff --git a/spec/unit/knife/client_show_spec.rb b/spec/unit/knife/client_show_spec.rb
index 73a876cee0..96a7653d92 100644
--- a/spec/unit/knife/client_show_spec.rb
+++ b/spec/unit/knife/client_show_spec.rb
@@ -16,33 +16,33 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::ClientShow do
before(:each) do
@knife = Chef::Knife::ClientShow.new
- @knife.name_args = [ 'adam' ]
- @client_mock = double('client_mock')
+ @knife.name_args = [ "adam" ]
+ @client_mock = double("client_mock")
end
- describe 'run' do
- it 'should list the client' do
- expect(Chef::ApiClientV1).to receive(:load).with('adam').and_return(@client_mock)
+ describe "run" do
+ it "should list the client" do
+ expect(Chef::ApiClientV1).to receive(:load).with("adam").and_return(@client_mock)
expect(@knife).to receive(:format_for_display).with(@client_mock)
@knife.run
end
- it 'should pretty print json' do
- @knife.config[:format] = 'json'
+ it "should pretty print json" do
+ @knife.config[:format] = "json"
@stdout = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
fake_client_contents = {"foo"=>"bar", "baz"=>"qux"}
- expect(Chef::ApiClientV1).to receive(:load).with('adam').and_return(fake_client_contents)
+ expect(Chef::ApiClientV1).to receive(:load).with("adam").and_return(fake_client_contents)
@knife.run
expect(@stdout.string).to eql("{\n \"foo\": \"bar\",\n \"baz\": \"qux\"\n}\n")
end
- it 'should print usage and exit when a client name is not provided' do
+ it "should print usage and exit when a client name is not provided" do
@knife.name_args = []
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal)
diff --git a/spec/unit/knife/configure_client_spec.rb b/spec/unit/knife/configure_client_spec.rb
index 363743f8cc..a825384785 100644
--- a/spec/unit/knife/configure_client_spec.rb
+++ b/spec/unit/knife/configure_client_spec.rb
@@ -16,21 +16,21 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::ConfigureClient do
before do
@knife = Chef::Knife::ConfigureClient.new
- Chef::Config[:chef_server_url] = 'https://chef.example.com'
- Chef::Config[:validation_client_name] = 'chef-validator'
- Chef::Config[:validation_key] = '/etc/chef/validation.pem'
+ Chef::Config[:chef_server_url] = "https://chef.example.com"
+ Chef::Config[:validation_client_name] = "chef-validator"
+ Chef::Config[:validation_key] = "/etc/chef/validation.pem"
@stderr = StringIO.new
allow(@knife.ui).to receive(:stderr).and_return(@stderr)
end
- describe 'run' do
- it 'should print usage and exit when a directory is not provided' do
+ describe "run" do
+ it "should print usage and exit when a directory is not provided" do
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal).with(/must provide the directory/)
expect {
@@ -38,24 +38,24 @@ describe Chef::Knife::ConfigureClient do
}.to raise_error SystemExit
end
- describe 'when specifing a directory' do
+ describe "when specifing a directory" do
before do
- @knife.name_args = ['/home/bob/.chef']
+ @knife.name_args = ["/home/bob/.chef"]
@client_file = StringIO.new
@validation_file = StringIO.new
- expect(File).to receive(:open).with('/home/bob/.chef/client.rb', 'w').
+ expect(File).to receive(:open).with("/home/bob/.chef/client.rb", "w").
and_yield(@client_file)
- expect(File).to receive(:open).with('/home/bob/.chef/validation.pem', 'w').
+ expect(File).to receive(:open).with("/home/bob/.chef/validation.pem", "w").
and_yield(@validation_file)
- expect(IO).to receive(:read).and_return('foo_bar_baz')
+ expect(IO).to receive(:read).and_return("foo_bar_baz")
end
- it 'should recursively create the directory' do
- expect(FileUtils).to receive(:mkdir_p).with('/home/bob/.chef')
+ it "should recursively create the directory" do
+ expect(FileUtils).to receive(:mkdir_p).with("/home/bob/.chef")
@knife.run
end
- it 'should write out the config file' do
+ it "should write out the config file" do
allow(FileUtils).to receive(:mkdir_p)
@knife.run
expect(@client_file.string).to match /log_level\s+\:info/
@@ -64,13 +64,13 @@ describe Chef::Knife::ConfigureClient do
expect(@client_file.string).to match /validation_client_name\s+'chef-validator'/
end
- it 'should write out the validation.pem file' do
+ it "should write out the validation.pem file" do
allow(FileUtils).to receive(:mkdir_p)
@knife.run
expect(@validation_file.string).to match /foo_bar_baz/
end
- it 'should print information on what is being configured' do
+ it "should print information on what is being configured" do
allow(FileUtils).to receive(:mkdir_p)
@knife.run
expect(@stderr.string).to match /creating client configuration/i
diff --git a/spec/unit/knife/configure_spec.rb b/spec/unit/knife/configure_spec.rb
index 89874cfdf9..6c1d98c2f5 100644
--- a/spec/unit/knife/configure_spec.rb
+++ b/spec/unit/knife/configure_spec.rb
@@ -1,4 +1,4 @@
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::Configure do
before do
@@ -11,7 +11,7 @@ describe Chef::Knife::Configure do
@out = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@out)
- @knife.config[:config_file] = '/home/you/.chef/knife.rb'
+ @knife.config[:config_file] = "/home/you/.chef/knife.rb"
@in = StringIO.new("\n" * 7)
allow(@knife.ui).to receive(:stdin).and_return(@in)
@@ -58,11 +58,11 @@ describe Chef::Knife::Configure do
it "should not ask the user for the clientname they want for the new client if -i and --node_name are specified" do
@knife.config[:initial] = true
- @knife.config[:node_name] = 'testnode'
+ @knife.config[:node_name] = "testnode"
allow(Etc).to receive(:getlogin).and_return("a-new-user")
@knife.ask_user_for_config
expect(@out.string).not_to match(Regexp.escape("Please enter a name for the new user"))
- expect(@knife.new_client_name).to eq('testnode')
+ expect(@knife.new_client_name).to eq("testnode")
end
it "asks the user for the existing API username or clientname if -i is not specified" do
@@ -76,21 +76,21 @@ describe Chef::Knife::Configure do
@knife.config[:initial] = true
@knife.ask_user_for_config
expect(@out.string).to match(Regexp.escape("Please enter the existing admin name: [admin]"))
- expect(@knife.admin_client_name).to eq('admin')
+ expect(@knife.admin_client_name).to eq("admin")
end
it "should not ask the user for the existing admin client's name if -i and --admin-client_name are specified" do
@knife.config[:initial] = true
- @knife.config[:admin_client_name] = 'my-webui'
+ @knife.config[:admin_client_name] = "my-webui"
@knife.ask_user_for_config
expect(@out.string).not_to match(Regexp.escape("Please enter the existing admin:"))
- expect(@knife.admin_client_name).to eq('my-webui')
+ expect(@knife.admin_client_name).to eq("my-webui")
end
it "should not ask the user for the existing admin client's name if -i is not specified" do
@knife.ask_user_for_config
expect(@out.string).not_to match(Regexp.escape("Please enter the existing admin: [admin]"))
- expect(@knife.admin_client_name).not_to eq('admin')
+ expect(@knife.admin_client_name).not_to eq("admin")
end
it "asks the user for the location of the existing admin key if -i is specified" do
@@ -106,13 +106,13 @@ describe Chef::Knife::Configure do
it "should not ask the user for the location of the existing admin key if -i and --admin_client_key are specified" do
@knife.config[:initial] = true
- @knife.config[:admin_client_key] = '/home/you/.chef/my-webui.pem'
+ @knife.config[:admin_client_key] = "/home/you/.chef/my-webui.pem"
@knife.ask_user_for_config
expect(@out.string).not_to match(Regexp.escape("Please enter the location of the existing admin client's private key:"))
if windows?
expect(@knife.admin_client_key).to match %r{^[A-Za-z]:/home/you/\.chef/my-webui\.pem$}
else
- expect(@knife.admin_client_key).to eq('/home/you/.chef/my-webui.pem')
+ expect(@knife.admin_client_key).to eq("/home/you/.chef/my-webui.pem")
end
end
@@ -129,20 +129,20 @@ describe Chef::Knife::Configure do
it "asks the user for the location of a chef repo" do
@knife.ask_user_for_config
expect(@out.string).to match(Regexp.escape("Please enter the path to a chef repository (or leave blank):"))
- expect(@knife.chef_repo).to eq('')
+ expect(@knife.chef_repo).to eq("")
end
it "asks the users for the name of the validation client" do
@knife.ask_user_for_config
expect(@out.string).to match(Regexp.escape("Please enter the validation clientname: [chef-validator]"))
- expect(@knife.validation_client_name).to eq('chef-validator')
+ expect(@knife.validation_client_name).to eq("chef-validator")
end
it "should not ask the users for the name of the validation client if --validation_client_name is specified" do
- @knife.config[:validation_client_name] = 'my-validator'
+ @knife.config[:validation_client_name] = "my-validator"
@knife.ask_user_for_config
expect(@out.string).not_to match(Regexp.escape("Please enter the validation clientname:"))
- expect(@knife.validation_client_name).to eq('my-validator')
+ expect(@knife.validation_client_name).to eq("my-validator")
end
it "asks the users for the location of the validation key" do
@@ -156,45 +156,45 @@ describe Chef::Knife::Configure do
end
it "should not ask the users for the location of the validation key if --validation_key is specified" do
- @knife.config[:validation_key] = '/home/you/.chef/my-validation.pem'
+ @knife.config[:validation_key] = "/home/you/.chef/my-validation.pem"
@knife.ask_user_for_config
expect(@out.string).not_to match(Regexp.escape("Please enter the location of the validation key:"))
if windows?
expect(@knife.validation_key).to match %r{^[A-Za-z]:/home/you/\.chef/my-validation\.pem$}
else
- expect(@knife.validation_key).to eq('/home/you/.chef/my-validation.pem')
+ expect(@knife.validation_key).to eq("/home/you/.chef/my-validation.pem")
end
end
it "should not ask the user for anything if -i and all other properties are specified" do
@knife.config[:initial] = true
- @knife.config[:chef_server_url] = 'http://localhost:5000'
- @knife.config[:node_name] = 'testnode'
- @knife.config[:admin_client_name] = 'my-webui'
- @knife.config[:admin_client_key] = '/home/you/.chef/my-webui.pem'
- @knife.config[:validation_client_name] = 'my-validator'
- @knife.config[:validation_key] = '/home/you/.chef/my-validation.pem'
- @knife.config[:repository] = ''
- @knife.config[:client_key] = '/home/you/a-new-user.pem'
- allow(Etc).to receive(:getlogin).and_return('a-new-user')
+ @knife.config[:chef_server_url] = "http://localhost:5000"
+ @knife.config[:node_name] = "testnode"
+ @knife.config[:admin_client_name] = "my-webui"
+ @knife.config[:admin_client_key] = "/home/you/.chef/my-webui.pem"
+ @knife.config[:validation_client_name] = "my-validator"
+ @knife.config[:validation_key] = "/home/you/.chef/my-validation.pem"
+ @knife.config[:repository] = ""
+ @knife.config[:client_key] = "/home/you/a-new-user.pem"
+ allow(Etc).to receive(:getlogin).and_return("a-new-user")
@knife.ask_user_for_config
expect(@out.string).to match(/\s*/)
- expect(@knife.new_client_name).to eq('testnode')
- expect(@knife.chef_server).to eq('http://localhost:5000')
- expect(@knife.admin_client_name).to eq('my-webui')
+ expect(@knife.new_client_name).to eq("testnode")
+ expect(@knife.chef_server).to eq("http://localhost:5000")
+ expect(@knife.admin_client_name).to eq("my-webui")
if windows?
expect(@knife.admin_client_key).to match %r{^[A-Za-z]:/home/you/\.chef/my-webui\.pem$}
expect(@knife.validation_key).to match %r{^[A-Za-z]:/home/you/\.chef/my-validation\.pem$}
expect(@knife.new_client_key).to match %r{^[A-Za-z]:/home/you/a-new-user\.pem$}
else
- expect(@knife.admin_client_key).to eq('/home/you/.chef/my-webui.pem')
- expect(@knife.validation_key).to eq('/home/you/.chef/my-validation.pem')
- expect(@knife.new_client_key).to eq('/home/you/a-new-user.pem')
+ expect(@knife.admin_client_key).to eq("/home/you/.chef/my-webui.pem")
+ expect(@knife.validation_key).to eq("/home/you/.chef/my-validation.pem")
+ expect(@knife.new_client_key).to eq("/home/you/a-new-user.pem")
end
- expect(@knife.validation_client_name).to eq('my-validator')
- expect(@knife.chef_repo).to eq('')
+ expect(@knife.validation_client_name).to eq("my-validator")
+ expect(@knife.chef_repo).to eq("")
end
it "writes the new data to a config file" do
@@ -205,7 +205,7 @@ describe Chef::Knife::Configure do
expect(FileUtils).to receive(:mkdir_p).with("/home/you/.chef")
config_file = StringIO.new
expect(::File).to receive(:open).with("/home/you/.chef/knife.rb", "w").and_yield config_file
- @knife.config[:repository] = '/home/you/chef-repo'
+ @knife.config[:repository] = "/home/you/chef-repo"
@knife.run
expect(config_file.string).to match(/^node_name[\s]+'#{Etc.getlogin}'$/)
expect(config_file.string).to match(%r{^client_key[\s]+'/home/you/.chef/#{Etc.getlogin}.pem'$})
diff --git a/spec/unit/knife/cookbook_bulk_delete_spec.rb b/spec/unit/knife/cookbook_bulk_delete_spec.rb
index 7d6e851589..6ef01bc0bb 100644
--- a/spec/unit/knife/cookbook_bulk_delete_spec.rb
+++ b/spec/unit/knife/cookbook_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::CookbookBulkDelete do
before(:each) do
@@ -48,12 +48,12 @@ describe Chef::Knife::CookbookBulkDelete do
describe "when there are several cookbooks on the server" do
before do
- @cheezburger = {'cheezburger' => {"url" => "file:///dev/null", "versions" => [{"url" => "file:///dev/null-cheez", "version" => "1.0.0"}]}}
- allow(@rest).to receive(:get).with('cookbooks/cheezburger').and_return(@cheezburger)
- @pizza = {'pizza' => {"url" => "file:///dev/null", "versions" => [{"url" => "file:///dev/null-pizza", "version" => "2.0.0"}]}}
- allow(@rest).to receive(:get).with('cookbooks/pizza').and_return(@pizza)
- @lasagna = {'lasagna' => {"url" => "file:///dev/null", "versions" => [{"url" => "file:///dev/null-lasagna", "version" => "3.0.0"}]}}
- allow(@rest).to receive(:get).with('cookbooks/lasagna').and_return(@lasagna)
+ @cheezburger = {"cheezburger" => {"url" => "file:///dev/null", "versions" => [{"url" => "file:///dev/null-cheez", "version" => "1.0.0"}]}}
+ allow(@rest).to receive(:get).with("cookbooks/cheezburger").and_return(@cheezburger)
+ @pizza = {"pizza" => {"url" => "file:///dev/null", "versions" => [{"url" => "file:///dev/null-pizza", "version" => "2.0.0"}]}}
+ allow(@rest).to receive(:get).with("cookbooks/pizza").and_return(@pizza)
+ @lasagna = {"lasagna" => {"url" => "file:///dev/null", "versions" => [{"url" => "file:///dev/null-lasagna", "version" => "3.0.0"}]}}
+ allow(@rest).to receive(:get).with("cookbooks/lasagna").and_return(@lasagna)
end
it "should print the cookbooks you are about to delete" do
@@ -68,7 +68,7 @@ describe Chef::Knife::CookbookBulkDelete do
end
it "should delete each cookbook" do
- {"cheezburger" => "1.0.0", "pizza" => "2.0.0", "lasagna" => '3.0.0'}.each do |cookbook_name, version|
+ {"cheezburger" => "1.0.0", "pizza" => "2.0.0", "lasagna" => "3.0.0"}.each do |cookbook_name, version|
expect(@rest).to receive(:delete).with("cookbooks/#{cookbook_name}/#{version}")
end
@knife.run
@@ -76,7 +76,7 @@ describe Chef::Knife::CookbookBulkDelete do
it "should only delete cookbooks that match the regex" do
@knife.name_args = ["cheezburger"]
- expect(@rest).to receive(:delete).with('cookbooks/cheezburger/1.0.0')
+ expect(@rest).to receive(:delete).with("cookbooks/cheezburger/1.0.0")
@knife.run
end
end
diff --git a/spec/unit/knife/cookbook_create_spec.rb b/spec/unit/knife/cookbook_create_spec.rb
index 8619c8f64b..27bdc303c2 100644
--- a/spec/unit/knife/cookbook_create_spec.rb
+++ b/spec/unit/knife/cookbook_create_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tmpdir'
+require "spec_helper"
+require "tmpdir"
describe Chef::Knife::CookbookCreate do
before(:each) do
diff --git a/spec/unit/knife/cookbook_delete_spec.rb b/spec/unit/knife/cookbook_delete_spec.rb
index e9085e9512..aed5f197b9 100644
--- a/spec/unit/knife/cookbook_delete_spec.rb
+++ b/spec/unit/knife/cookbook_delete_spec.rb
@@ -16,51 +16,51 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::CookbookDelete do
before(:each) do
@knife = Chef::Knife::CookbookDelete.new
- @knife.name_args = ['foobar']
- @knife.cookbook_name = 'foobar'
+ @knife.name_args = ["foobar"]
+ @knife.cookbook_name = "foobar"
@stdout = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
@stderr = StringIO.new
allow(@knife.ui).to receive(:stderr).and_return(@stderr)
end
- describe 'run' do
- it 'should print usage and exit when a cookbook name is not provided' do
+ describe "run" do
+ it "should print usage and exit when a cookbook name is not provided" do
@knife.name_args = []
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal)
expect { @knife.run }.to raise_error(SystemExit)
end
- describe 'when specifying a cookbook name' do
- it 'should delete the cookbook without a specific version' do
+ describe "when specifying a cookbook name" do
+ it "should delete the cookbook without a specific version" do
expect(@knife).to receive(:delete_without_explicit_version)
@knife.run
end
- describe 'and a version' do
- it 'should delete the specific version of the cookbook' do
- @knife.name_args << '1.0.0'
+ describe "and a version" do
+ it "should delete the specific version of the cookbook" do
+ @knife.name_args << "1.0.0"
expect(@knife).to receive(:delete_explicit_version)
@knife.run
end
end
- describe 'with -a or --all' do
- it 'should delete all versions of the cookbook' do
+ describe "with -a or --all" do
+ it "should delete all versions of the cookbook" do
@knife.config[:all] = true
expect(@knife).to receive(:delete_all_versions)
@knife.run
end
end
- describe 'with -p or --purge' do
- it 'should prompt to purge the files' do
+ describe "with -p or --purge" do
+ it "should prompt to purge the files" do
@knife.config[:purge] = true
expect(@knife).to receive(:confirm).
with(/.+Are you sure you want to purge files.+/)
@@ -71,30 +71,30 @@ describe Chef::Knife::CookbookDelete do
end
end
- describe 'delete_explicit_version' do
- it 'should delete the specific cookbook version' do
- @knife.cookbook_name = 'foobar'
- @knife.version = '1.0.0'
+ describe "delete_explicit_version" do
+ it "should delete the specific cookbook version" do
+ @knife.cookbook_name = "foobar"
+ @knife.version = "1.0.0"
expect(@knife).to receive(:delete_object).with(Chef::CookbookVersion,
- 'foobar version 1.0.0',
- 'cookbook').and_yield()
- expect(@knife).to receive(:delete_request).with('cookbooks/foobar/1.0.0')
+ "foobar version 1.0.0",
+ "cookbook").and_yield()
+ expect(@knife).to receive(:delete_request).with("cookbooks/foobar/1.0.0")
@knife.delete_explicit_version
end
end
- describe 'delete_all_versions' do
- it 'should prompt to delete all versions of the cookbook' do
- @knife.cookbook_name = 'foobar'
- expect(@knife).to receive(:confirm).with('Do you really want to delete all versions of foobar')
+ describe "delete_all_versions" do
+ it "should prompt to delete all versions of the cookbook" do
+ @knife.cookbook_name = "foobar"
+ expect(@knife).to receive(:confirm).with("Do you really want to delete all versions of foobar")
expect(@knife).to receive(:delete_all_without_confirmation)
@knife.delete_all_versions
end
end
- describe 'delete_all_without_confirmation' do
- it 'should delete all versions without confirmation' do
- versions = ['1.0.0', '1.1.0']
+ describe "delete_all_without_confirmation" do
+ it "should delete all versions without confirmation" do
+ versions = ["1.0.0", "1.1.0"]
expect(@knife).to receive(:available_versions).and_return(versions)
versions.each do |v|
expect(@knife).to receive(:delete_version_without_confirmation).with(v)
@@ -103,43 +103,43 @@ describe Chef::Knife::CookbookDelete do
end
end
- describe 'delete_without_explicit_version' do
- it 'should exit if there are no available versions' do
+ describe "delete_without_explicit_version" do
+ it "should exit if there are no available versions" do
expect(@knife).to receive(:available_versions).and_return(nil)
expect { @knife.delete_without_explicit_version }.to raise_error(SystemExit)
end
- it 'should delete the version if only one is found' do
- expect(@knife).to receive(:available_versions).at_least(:once).and_return(['1.0.0'])
+ it "should delete the version if only one is found" do
+ expect(@knife).to receive(:available_versions).at_least(:once).and_return(["1.0.0"])
expect(@knife).to receive(:delete_explicit_version)
@knife.delete_without_explicit_version
end
- it 'should ask which version(s) to delete if multiple are found' do
- expect(@knife).to receive(:available_versions).at_least(:once).and_return(['1.0.0', '1.1.0'])
- expect(@knife).to receive(:ask_which_versions_to_delete).and_return(['1.0.0', '1.1.0'])
- expect(@knife).to receive(:delete_versions_without_confirmation).with(['1.0.0', '1.1.0'])
+ it "should ask which version(s) to delete if multiple are found" do
+ expect(@knife).to receive(:available_versions).at_least(:once).and_return(["1.0.0", "1.1.0"])
+ expect(@knife).to receive(:ask_which_versions_to_delete).and_return(["1.0.0", "1.1.0"])
+ expect(@knife).to receive(:delete_versions_without_confirmation).with(["1.0.0", "1.1.0"])
@knife.delete_without_explicit_version
end
end
- describe 'available_versions' do
+ describe "available_versions" do
before(:each) do
- @rest_mock = double('rest')
+ @rest_mock = double("rest")
expect(@knife).to receive(:rest).and_return(@rest_mock)
- @cookbook_data = { 'foobar' => { 'versions' => [{'version' => '1.0.0'},
- {'version' => '1.1.0'},
- {'version' => '2.0.0'} ]}
+ @cookbook_data = { "foobar" => { "versions" => [{"version" => "1.0.0"},
+ {"version" => "1.1.0"},
+ {"version" => "2.0.0"} ]}
}
end
- it 'should return the list of versions of the cookbook' do
- expect(@rest_mock).to receive(:get).with('cookbooks/foobar').and_return(@cookbook_data)
- expect(@knife.available_versions).to eq(['1.0.0', '1.1.0', '2.0.0'])
+ it "should return the list of versions of the cookbook" do
+ expect(@rest_mock).to receive(:get).with("cookbooks/foobar").and_return(@cookbook_data)
+ expect(@knife.available_versions).to eq(["1.0.0", "1.1.0", "2.0.0"])
end
- it 'should raise if an error other than HTTP 404 is returned' do
- exception = Net::HTTPServerException.new('500 Internal Server Error', '500')
+ it "should raise if an error other than HTTP 404 is returned" do
+ exception = Net::HTTPServerException.new("500 Internal Server Error", "500")
expect(@rest_mock).to receive(:get).and_raise(exception)
expect { @knife.available_versions }.to raise_error Net::HTTPServerException
end
@@ -147,88 +147,88 @@ describe Chef::Knife::CookbookDelete do
describe "if the cookbook can't be found" do
before(:each) do
expect(@rest_mock).to receive(:get).
- and_raise(Net::HTTPServerException.new('404 Not Found', '404'))
+ and_raise(Net::HTTPServerException.new("404 Not Found", "404"))
end
- it 'should print an error' do
+ it "should print an error" do
@knife.available_versions
expect(@stderr.string).to match /error.+cannot find a cookbook named foobar/i
end
- it 'should return nil' do
+ it "should return nil" do
expect(@knife.available_versions).to eq(nil)
end
end
end
- describe 'ask_which_version_to_delete' do
+ describe "ask_which_version_to_delete" do
before(:each) do
- allow(@knife).to receive(:available_versions).and_return(['1.0.0', '1.1.0', '2.0.0'])
+ allow(@knife).to receive(:available_versions).and_return(["1.0.0", "1.1.0", "2.0.0"])
end
- it 'should prompt the user to select a version' do
+ it "should prompt the user to select a version" do
prompt = /Which version\(s\) do you want to delete\?.+1\. foobar 1\.0\.0.+2\. foobar 1\.1\.0.+3\. foobar 2\.0\.0.+4\. All versions.+/m
- expect(@knife).to receive(:ask_question).with(prompt).and_return('1')
+ expect(@knife).to receive(:ask_question).with(prompt).and_return("1")
@knife.ask_which_versions_to_delete
end
it "should print an error and exit if a version wasn't specified" do
- expect(@knife).to receive(:ask_question).and_return('')
+ expect(@knife).to receive(:ask_question).and_return("")
expect(@knife.ui).to receive(:error).with(/no versions specified/i)
expect { @knife.ask_which_versions_to_delete }.to raise_error(SystemExit)
end
- it 'should print an error if an invalid choice was selected' do
- expect(@knife).to receive(:ask_question).and_return('100')
+ it "should print an error if an invalid choice was selected" do
+ expect(@knife).to receive(:ask_question).and_return("100")
expect(@knife.ui).to receive(:error).with(/100 is not a valid choice/i)
@knife.ask_which_versions_to_delete
end
- it 'should return the selected versions' do
- expect(@knife).to receive(:ask_question).and_return('1, 3')
- expect(@knife.ask_which_versions_to_delete).to eq(['1.0.0', '2.0.0'])
+ it "should return the selected versions" do
+ expect(@knife).to receive(:ask_question).and_return("1, 3")
+ expect(@knife.ask_which_versions_to_delete).to eq(["1.0.0", "2.0.0"])
end
it "should return all of the versions if 'all' was selected" do
- expect(@knife).to receive(:ask_question).and_return('4')
+ expect(@knife).to receive(:ask_question).and_return("4")
expect(@knife.ask_which_versions_to_delete).to eq([:all])
end
end
- describe 'delete_version_without_confirmation' do
- it 'should delete the cookbook version' do
- expect(@knife).to receive(:delete_request).with('cookbooks/foobar/1.0.0')
- @knife.delete_version_without_confirmation('1.0.0')
+ describe "delete_version_without_confirmation" do
+ it "should delete the cookbook version" do
+ expect(@knife).to receive(:delete_request).with("cookbooks/foobar/1.0.0")
+ @knife.delete_version_without_confirmation("1.0.0")
end
- it 'should output that the cookbook was deleted' do
+ it "should output that the cookbook was deleted" do
allow(@knife).to receive(:delete_request)
- @knife.delete_version_without_confirmation('1.0.0')
+ @knife.delete_version_without_confirmation("1.0.0")
expect(@stderr.string).to match /deleted cookbook\[foobar\]\[1.0.0\]/im
end
- describe 'with --print-after' do
- it 'should display the cookbook data' do
- object = ''
+ describe "with --print-after" do
+ it "should display the cookbook data" do
+ object = ""
@knife.config[:print_after] = true
allow(@knife).to receive(:delete_request).and_return(object)
expect(@knife).to receive(:format_for_display).with(object)
- @knife.delete_version_without_confirmation('1.0.0')
+ @knife.delete_version_without_confirmation("1.0.0")
end
end
end
- describe 'delete_versions_without_confirmation' do
- it 'should delete each version without confirmation' do
- versions = ['1.0.0', '1.1.0']
+ describe "delete_versions_without_confirmation" do
+ it "should delete each version without confirmation" do
+ versions = ["1.0.0", "1.1.0"]
versions.each do |v|
expect(@knife).to receive(:delete_version_without_confirmation).with(v)
end
@knife.delete_versions_without_confirmation(versions)
end
- describe 'with -a or --all' do
- it 'should delete all versions without confirmation' do
+ describe "with -a or --all" do
+ it "should delete all versions without confirmation" do
versions = [:all]
expect(@knife).to receive(:delete_all_without_confirmation)
@knife.delete_versions_without_confirmation(versions)
diff --git a/spec/unit/knife/cookbook_download_spec.rb b/spec/unit/knife/cookbook_download_spec.rb
index 64b754d173..baa8acc6f4 100644
--- a/spec/unit/knife/cookbook_download_spec.rb
+++ b/spec/unit/knife/cookbook_download_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::CookbookDownload do
before(:each) do
@@ -25,66 +25,66 @@ describe Chef::Knife::CookbookDownload do
allow(@knife.ui).to receive(:stderr).and_return(@stderr)
end
- describe 'run' do
- it 'should print usage and exit when a cookbook name is not provided' do
+ describe "run" do
+ it "should print usage and exit when a cookbook name is not provided" do
@knife.name_args = []
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal).with(/must specify a cookbook name/)
expect { @knife.run }.to raise_error(SystemExit)
end
- it 'should exit with a fatal error when there is no cookbook on the server' do
- @knife.name_args = ['foobar', nil]
+ it "should exit with a fatal error when there is no cookbook on the server" do
+ @knife.name_args = ["foobar", nil]
expect(@knife).to receive(:determine_version).and_return(nil)
- expect(@knife.ui).to receive(:fatal).with('No such cookbook found')
+ expect(@knife.ui).to receive(:fatal).with("No such cookbook found")
expect { @knife.run }.to raise_error(SystemExit)
end
- describe 'with a cookbook name' do
+ describe "with a cookbook name" do
before(:each) do
- @knife.name_args = ['foobar']
- @knife.config[:download_directory] = '/var/tmp/chef'
- @rest_mock = double('rest')
+ @knife.name_args = ["foobar"]
+ @knife.config[:download_directory] = "/var/tmp/chef"
+ @rest_mock = double("rest")
allow(@knife).to receive(:rest).and_return(@rest_mock)
@manifest_data = {
:recipes => [
- {'path' => 'recipes/foo.rb',
- 'url' => 'http://example.org/files/foo.rb'},
- {'path' => 'recipes/bar.rb',
- 'url' => 'http://example.org/files/bar.rb'},
+ {"path" => "recipes/foo.rb",
+ "url" => "http://example.org/files/foo.rb"},
+ {"path" => "recipes/bar.rb",
+ "url" => "http://example.org/files/bar.rb"},
],
:templates => [
- {'path' => 'templates/default/foo.erb',
- 'url' => 'http://example.org/files/foo.erb'},
- {'path' => 'templates/default/bar.erb',
- 'url' => 'http://example.org/files/bar.erb'},
+ {"path" => "templates/default/foo.erb",
+ "url" => "http://example.org/files/foo.erb"},
+ {"path" => "templates/default/bar.erb",
+ "url" => "http://example.org/files/bar.erb"},
],
:attributes => [
- {'path' => 'attributes/default.rb',
- 'url' => 'http://example.org/files/default.rb'},
+ {"path" => "attributes/default.rb",
+ "url" => "http://example.org/files/default.rb"},
],
}
- @cookbook_mock = double('cookbook')
- allow(@cookbook_mock).to receive(:version).and_return('1.0.0')
+ @cookbook_mock = double("cookbook")
+ allow(@cookbook_mock).to receive(:version).and_return("1.0.0")
allow(@cookbook_mock).to receive(:manifest).and_return(@manifest_data)
expect(Chef::CookbookVersion).to receive(:load).with("foobar", "1.0.0").
and_return(@cookbook_mock)
end
- it 'should determine which version if one was not explicitly specified'do
+ it "should determine which version if one was not explicitly specified"do
allow(@cookbook_mock).to receive(:manifest).and_return({})
- expect(@knife).to receive(:determine_version).and_return('1.0.0')
- expect(File).to receive(:exists?).with('/var/tmp/chef/foobar-1.0.0').and_return(false)
+ expect(@knife).to receive(:determine_version).and_return("1.0.0")
+ expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
allow(Chef::CookbookVersion).to receive(:COOKBOOK_SEGEMENTS).and_return([])
@knife.run
end
- describe 'and a version' do
+ describe "and a version" do
before(:each) do
- @knife.name_args << '1.0.0'
- @files = @manifest_data.values.map { |v| v.map { |i| i['path'] } }.flatten.uniq
+ @knife.name_args << "1.0.0"
+ @files = @manifest_data.values.map { |v| v.map { |i| i["path"] } }.flatten.uniq
@files_mocks = {}
@files.map { |f| File.basename(f) }.flatten.uniq.each do |f|
@files_mocks[f] = double("#{f}_mock")
@@ -92,13 +92,13 @@ describe Chef::Knife::CookbookDownload do
end
end
- it 'should print an error and exit if the cookbook download directory already exists' do
- expect(File).to receive(:exists?).with('/var/tmp/chef/foobar-1.0.0').and_return(true)
+ it "should print an error and exit if the cookbook download directory already exists" do
+ expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
expect(@knife.ui).to receive(:fatal).with(/\/var\/tmp\/chef\/foobar-1\.0\.0 exists/i)
expect { @knife.run }.to raise_error(SystemExit)
end
- describe 'when downloading the cookbook' do
+ describe "when downloading the cookbook" do
before(:each) do
@files.map { |f| File.dirname(f) }.flatten.uniq.each do |dir|
expect(FileUtils).to receive(:mkdir_p).with("/var/tmp/chef/foobar-1.0.0/#{dir}").
@@ -117,20 +117,20 @@ describe Chef::Knife::CookbookDownload do
end
it "should download the cookbook when the cookbook download directory doesn't exist" do
- expect(File).to receive(:exists?).with('/var/tmp/chef/foobar-1.0.0').and_return(false)
+ expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
@knife.run
- ['attributes', 'recipes', 'templates'].each do |segment|
+ ["attributes", "recipes", "templates"].each do |segment|
expect(@stderr.string).to match /downloading #{segment}/im
end
expect(@stderr.string).to match /downloading foobar cookbook version 1\.0\.0/im
expect(@stderr.string).to match /cookbook downloaded to \/var\/tmp\/chef\/foobar-1\.0\.0/im
end
- describe 'with -f or --force' do
- it 'should remove the existing the cookbook download directory if it exists' do
+ describe "with -f or --force" do
+ it "should remove the existing the cookbook download directory if it exists" do
@knife.config[:force] = true
- expect(File).to receive(:exists?).with('/var/tmp/chef/foobar-1.0.0').and_return(true)
- expect(FileUtils).to receive(:rm_rf).with('/var/tmp/chef/foobar-1.0.0')
+ expect(File).to receive(:exists?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
+ expect(FileUtils).to receive(:rm_rf).with("/var/tmp/chef/foobar-1.0.0")
@knife.run
end
end
@@ -141,94 +141,94 @@ describe Chef::Knife::CookbookDownload do
end
- describe 'determine_version' do
+ describe "determine_version" do
- it 'should return nil if there are no versions' do
+ it "should return nil if there are no versions" do
expect(@knife).to receive(:available_versions).and_return(nil)
expect(@knife.determine_version).to eq(nil)
expect(@knife.version).to eq(nil)
end
- it 'should return and set the version if there is only one version' do
- expect(@knife).to receive(:available_versions).at_least(:once).and_return(['1.0.0'])
- expect(@knife.determine_version).to eq('1.0.0')
- expect(@knife.version).to eq('1.0.0')
+ it "should return and set the version if there is only one version" do
+ expect(@knife).to receive(:available_versions).at_least(:once).and_return(["1.0.0"])
+ expect(@knife.determine_version).to eq("1.0.0")
+ expect(@knife.version).to eq("1.0.0")
end
- it 'should ask which version to download and return it if there is more than one' do
- expect(@knife).to receive(:available_versions).at_least(:once).and_return(['1.0.0', '2.0.0'])
- expect(@knife).to receive(:ask_which_version).and_return('1.0.0')
- expect(@knife.determine_version).to eq('1.0.0')
+ it "should ask which version to download and return it if there is more than one" do
+ expect(@knife).to receive(:available_versions).at_least(:once).and_return(["1.0.0", "2.0.0"])
+ expect(@knife).to receive(:ask_which_version).and_return("1.0.0")
+ expect(@knife.determine_version).to eq("1.0.0")
end
- describe 'with -N or --latest' do
- it 'should return and set the version to the latest version' do
+ describe "with -N or --latest" do
+ it "should return and set the version to the latest version" do
@knife.config[:latest] = true
expect(@knife).to receive(:available_versions).at_least(:once).
- and_return(['1.0.0', '1.1.0', '2.0.0'])
+ and_return(["1.0.0", "1.1.0", "2.0.0"])
@knife.determine_version
- expect(@knife.version.to_s).to eq('2.0.0')
+ expect(@knife.version.to_s).to eq("2.0.0")
end
end
end
- describe 'available_versions' do
+ describe "available_versions" do
before(:each) do
- @knife.cookbook_name = 'foobar'
+ @knife.cookbook_name = "foobar"
end
- it 'should return nil if there are no versions' do
+ it "should return nil if there are no versions" do
expect(Chef::CookbookVersion).to receive(:available_versions).
- with('foobar').
+ with("foobar").
and_return(nil)
expect(@knife.available_versions).to eq(nil)
end
- it 'should return the available versions' do
+ it "should return the available versions" do
expect(Chef::CookbookVersion).to receive(:available_versions).
- with('foobar').
- and_return(['1.1.0', '2.0.0', '1.0.0'])
- expect(@knife.available_versions).to eq([Chef::Version.new('1.0.0'),
- Chef::Version.new('1.1.0'),
- Chef::Version.new('2.0.0')])
+ with("foobar").
+ and_return(["1.1.0", "2.0.0", "1.0.0"])
+ expect(@knife.available_versions).to eq([Chef::Version.new("1.0.0"),
+ Chef::Version.new("1.1.0"),
+ Chef::Version.new("2.0.0")])
end
- it 'should avoid multiple API calls to the server' do
+ it "should avoid multiple API calls to the server" do
expect(Chef::CookbookVersion).to receive(:available_versions).
once.
- with('foobar').
- and_return(['1.1.0', '2.0.0', '1.0.0'])
+ with("foobar").
+ and_return(["1.1.0", "2.0.0", "1.0.0"])
@knife.available_versions
@knife.available_versions
end
end
- describe 'ask_which_version' do
+ describe "ask_which_version" do
before(:each) do
- @knife.cookbook_name = 'foobar'
- allow(@knife).to receive(:available_versions).and_return(['1.0.0', '1.1.0', '2.0.0'])
+ @knife.cookbook_name = "foobar"
+ allow(@knife).to receive(:available_versions).and_return(["1.0.0", "1.1.0", "2.0.0"])
end
- it 'should prompt the user to select a version' do
+ it "should prompt the user to select a version" do
prompt = /Which version do you want to download\?.+1\. foobar 1\.0\.0.+2\. foobar 1\.1\.0.+3\. foobar 2\.0\.0.+/m
- expect(@knife).to receive(:ask_question).with(prompt).and_return('1')
+ expect(@knife).to receive(:ask_question).with(prompt).and_return("1")
@knife.ask_which_version
end
it "should set the version to the user's selection" do
- expect(@knife).to receive(:ask_question).and_return('1')
+ expect(@knife).to receive(:ask_question).and_return("1")
@knife.ask_which_version
- expect(@knife.version).to eq('1.0.0')
+ expect(@knife.version).to eq("1.0.0")
end
it "should print an error and exit if a version wasn't specified" do
- expect(@knife).to receive(:ask_question).and_return('')
+ expect(@knife).to receive(:ask_question).and_return("")
expect(@knife.ui).to receive(:error).with(/is not a valid value/i)
expect { @knife.ask_which_version }.to raise_error(SystemExit)
end
- it 'should print an error if an invalid choice was selected' do
- expect(@knife).to receive(:ask_question).and_return('100')
+ it "should print an error if an invalid choice was selected" do
+ expect(@knife).to receive(:ask_question).and_return("100")
expect(@knife.ui).to receive(:error).with(/'100' is not a valid value/i)
expect { @knife.ask_which_version }.to raise_error(SystemExit)
end
diff --git a/spec/unit/knife/cookbook_list_spec.rb b/spec/unit/knife/cookbook_list_spec.rb
index fc07c8af3f..124c4bca8e 100644
--- a/spec/unit/knife/cookbook_list_spec.rb
+++ b/spec/unit/knife/cookbook_list_spec.rb
@@ -16,28 +16,28 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::CookbookList do
before do
@knife = Chef::Knife::CookbookList.new
- @rest_mock = double('rest')
+ @rest_mock = double("rest")
allow(@knife).to receive(:rest).and_return(@rest_mock)
- @cookbook_names = ['apache2', 'mysql']
- @base_url = 'https://server.example.com/cookbooks'
+ @cookbook_names = ["apache2", "mysql"]
+ @base_url = "https://server.example.com/cookbooks"
@cookbook_data = {}
@cookbook_names.each do |item|
- @cookbook_data[item] = {'url' => "#{@base_url}/#{item}",
- 'versions' => [{'version' => '1.0.1',
- 'url' => "#{@base_url}/#{item}/1.0.1"}]}
+ @cookbook_data[item] = {"url" => "#{@base_url}/#{item}",
+ "versions" => [{"version" => "1.0.1",
+ "url" => "#{@base_url}/#{item}/1.0.1"}]}
end
@stdout = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
end
- describe 'run' do
- it 'should display the latest version of the cookbooks' do
- expect(@rest_mock).to receive(:get).with('/cookbooks?num_versions=1').
+ describe "run" do
+ it "should display the latest version of the cookbooks" do
+ expect(@rest_mock).to receive(:get).with("/cookbooks?num_versions=1").
and_return(@cookbook_data)
@knife.run
@cookbook_names.each do |item|
@@ -45,16 +45,16 @@ describe Chef::Knife::CookbookList do
end
end
- it 'should query cookbooks for the configured environment' do
- @knife.config[:environment] = 'production'
+ it "should query cookbooks for the configured environment" do
+ @knife.config[:environment] = "production"
expect(@rest_mock).to receive(:get).
- with('/environments/production/cookbooks?num_versions=1').
+ with("/environments/production/cookbooks?num_versions=1").
and_return(@cookbook_data)
@knife.run
end
- describe 'with -w or --with-uri' do
- it 'should display the cookbook uris' do
+ describe "with -w or --with-uri" do
+ it "should display the cookbook uris" do
@knife.config[:with_uri] = true
allow(@rest_mock).to receive(:get).and_return(@cookbook_data)
@knife.run
@@ -65,17 +65,17 @@ describe Chef::Knife::CookbookList do
end
end
- describe 'with -a or --all' do
+ describe "with -a or --all" do
before do
@cookbook_names.each do |item|
- @cookbook_data[item]['versions'] << {'version' => '1.0.0',
- 'url' => "#{@base_url}/#{item}/1.0.0"}
+ @cookbook_data[item]["versions"] << {"version" => "1.0.0",
+ "url" => "#{@base_url}/#{item}/1.0.0"}
end
end
- it 'should display all versions of the cookbooks' do
+ it "should display all versions of the cookbooks" do
@knife.config[:all_versions] = true
- expect(@rest_mock).to receive(:get).with('/cookbooks?num_versions=all').
+ expect(@rest_mock).to receive(:get).with("/cookbooks?num_versions=all").
and_return(@cookbook_data)
@knife.run
@cookbook_names.each do |item|
diff --git a/spec/unit/knife/cookbook_metadata_from_file_spec.rb b/spec/unit/knife/cookbook_metadata_from_file_spec.rb
index 456e378ca2..852258e8a0 100644
--- a/spec/unit/knife/cookbook_metadata_from_file_spec.rb
+++ b/spec/unit/knife/cookbook_metadata_from_file_spec.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::CookbookMetadataFromFile do
before(:each) do
diff --git a/spec/unit/knife/cookbook_metadata_spec.rb b/spec/unit/knife/cookbook_metadata_spec.rb
index bd54d4278b..1dcc840611 100644
--- a/spec/unit/knife/cookbook_metadata_spec.rb
+++ b/spec/unit/knife/cookbook_metadata_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::CookbookMetadata do
before(:each) do
@knife = Chef::Knife::CookbookMetadata.new
- @knife.name_args = ['foobar']
+ @knife.name_args = ["foobar"]
@cookbook_dir = Dir.mktmpdir
@json_data = '{ "version": "1.0.0" }'
@stdout = StringIO.new
@@ -30,50 +30,50 @@ describe Chef::Knife::CookbookMetadata do
allow(@knife.ui).to receive(:stderr).and_return(@stderr)
end
- describe 'run' do
- it 'should print an error and exit if a cookbook name was not provided' do
+ describe "run" do
+ it "should print an error and exit if a cookbook name was not provided" do
@knife.name_args = []
expect(@knife.ui).to receive(:error).with(/you must specify the cookbook.+use the --all/i)
expect { @knife.run }.to raise_error(SystemExit)
end
- it 'should print an error and exit if an empty cookbook name was provided' do
- @knife.name_args = ['']
+ it "should print an error and exit if an empty cookbook name was provided" do
+ @knife.name_args = [""]
expect(@knife.ui).to receive(:error).with(/you must specify the cookbook.+use the --all/i)
expect { @knife.run }.to raise_error(SystemExit)
end
- it 'should generate the metadata for the cookbook' do
- expect(@knife).to receive(:generate_metadata).with('foobar')
+ it "should generate the metadata for the cookbook" do
+ expect(@knife).to receive(:generate_metadata).with("foobar")
@knife.run
end
- describe 'with -a or --all' do
+ describe "with -a or --all" do
before(:each) do
@knife.config[:all] = true
- @foo = Chef::CookbookVersion.new('foo', '/tmp/blah')
- @foo.version = '1.0.0'
- @bar = Chef::CookbookVersion.new('bar', '/tmp/blah')
- @bar.version = '2.0.0'
+ @foo = Chef::CookbookVersion.new("foo", "/tmp/blah")
+ @foo.version = "1.0.0"
+ @bar = Chef::CookbookVersion.new("bar", "/tmp/blah")
+ @bar.version = "2.0.0"
@cookbook_loader = {
"foo" => @foo,
"bar" => @bar,
}
expect(@cookbook_loader).to receive(:load_cookbooks).and_return(@cookbook_loader)
- expect(@knife).to receive(:generate_metadata).with('foo')
- expect(@knife).to receive(:generate_metadata).with('bar')
+ expect(@knife).to receive(:generate_metadata).with("foo")
+ expect(@knife).to receive(:generate_metadata).with("bar")
end
- it 'should generate the metadata for each cookbook' do
+ it "should generate the metadata for each cookbook" do
Chef::Config[:cookbook_path] = @cookbook_dir
expect(Chef::CookbookLoader).to receive(:new).with(@cookbook_dir).and_return(@cookbook_loader)
@knife.run
end
- describe 'and with -o or --cookbook-path' do
- it 'should look in the provided path and generate cookbook metadata' do
- @knife.config[:cookbook_path] = '/opt/chef/cookbooks'
- expect(Chef::CookbookLoader).to receive(:new).with('/opt/chef/cookbooks').and_return(@cookbook_loader)
+ describe "and with -o or --cookbook-path" do
+ it "should look in the provided path and generate cookbook metadata" do
+ @knife.config[:cookbook_path] = "/opt/chef/cookbooks"
+ expect(Chef::CookbookLoader).to receive(:new).with("/opt/chef/cookbooks").and_return(@cookbook_loader)
@knife.run
end
end
@@ -81,55 +81,55 @@ describe Chef::Knife::CookbookMetadata do
end
- describe 'generate_metadata' do
+ describe "generate_metadata" do
before(:each) do
@knife.config[:cookbook_path] = @cookbook_dir
allow(File).to receive(:expand_path).with("#{@cookbook_dir}/foobar/metadata.rb").
and_return("#{@cookbook_dir}/foobar/metadata.rb")
end
- it 'should generate the metadata from metadata.rb if it exists' do
+ it "should generate the metadata from metadata.rb if it exists" do
expect(File).to receive(:exists?).with("#{@cookbook_dir}/foobar/metadata.rb").
and_return(true)
- expect(@knife).to receive(:generate_metadata_from_file).with('foobar', "#{@cookbook_dir}/foobar/metadata.rb")
+ expect(@knife).to receive(:generate_metadata_from_file).with("foobar", "#{@cookbook_dir}/foobar/metadata.rb")
@knife.run
end
- it 'should validate the metadata json if metadata.rb does not exist' do
+ it "should validate the metadata json if metadata.rb does not exist" do
expect(File).to receive(:exists?).with("#{@cookbook_dir}/foobar/metadata.rb").
and_return(false)
- expect(@knife).to receive(:validate_metadata_json).with(@cookbook_dir, 'foobar')
+ expect(@knife).to receive(:validate_metadata_json).with(@cookbook_dir, "foobar")
@knife.run
end
end
- describe 'generate_metadata_from_file' do
+ describe "generate_metadata_from_file" do
before(:each) do
- @metadata_mock = double('metadata')
- @json_file_mock = double('json_file')
+ @metadata_mock = double("metadata")
+ @json_file_mock = double("json_file")
end
- it 'should generate the metatdata json from metatdata.rb' do
+ it "should generate the metatdata json from metatdata.rb" do
allow(Chef::Cookbook::Metadata).to receive(:new).and_return(@metadata_mock)
- expect(@metadata_mock).to receive(:name).with('foobar')
+ expect(@metadata_mock).to receive(:name).with("foobar")
expect(@metadata_mock).to receive(:from_file).with("#{@cookbook_dir}/foobar/metadata.rb")
- expect(File).to receive(:open).with("#{@cookbook_dir}/foobar/metadata.json", 'w').
+ expect(File).to receive(:open).with("#{@cookbook_dir}/foobar/metadata.json", "w").
and_yield(@json_file_mock)
expect(@json_file_mock).to receive(:write).with(@json_data)
expect(Chef::JSONCompat).to receive(:to_json_pretty).with(@metadata_mock).
and_return(@json_data)
- @knife.generate_metadata_from_file('foobar', "#{@cookbook_dir}/foobar/metadata.rb")
+ @knife.generate_metadata_from_file("foobar", "#{@cookbook_dir}/foobar/metadata.rb")
expect(@stderr.string).to match /generating metadata for foobar from #{@cookbook_dir}\/foobar\/metadata\.rb/im
end
- { Chef::Exceptions::ObsoleteDependencySyntax => 'obsolote dependency',
- Chef::Exceptions::InvalidVersionConstraint => 'invalid version constraint',
+ { Chef::Exceptions::ObsoleteDependencySyntax => "obsolote dependency",
+ Chef::Exceptions::InvalidVersionConstraint => "invalid version constraint",
}.each_pair do |klass, description|
it "should print an error and exit when an #{description} syntax exception is encountered" do
exception = klass.new("#{description} blah")
allow(Chef::Cookbook::Metadata).to receive(:new).and_raise(exception)
expect {
- @knife.generate_metadata_from_file('foobar', "#{@cookbook_dir}/foobar/metadata.rb")
+ @knife.generate_metadata_from_file("foobar", "#{@cookbook_dir}/foobar/metadata.rb")
}.to raise_error(SystemExit)
expect(@stderr.string).to match /error: the cookbook 'foobar' contains invalid or obsolete metadata syntax/im
expect(@stderr.string).to match /in #{@cookbook_dir}\/foobar\/metadata\.rb/im
@@ -138,26 +138,26 @@ describe Chef::Knife::CookbookMetadata do
end
end
- describe 'validate_metadata_json' do
- it 'should validate the metadata json' do
+ describe "validate_metadata_json" do
+ it "should validate the metadata json" do
expect(File).to receive(:exist?).with("#{@cookbook_dir}/foobar/metadata.json").
and_return(true)
expect(IO).to receive(:read).with("#{@cookbook_dir}/foobar/metadata.json").
and_return(@json_data)
expect(Chef::Cookbook::Metadata).to receive(:validate_json).with(@json_data)
- @knife.validate_metadata_json(@cookbook_dir, 'foobar')
+ @knife.validate_metadata_json(@cookbook_dir, "foobar")
end
- it 'should not try to validate the metadata json if the file does not exist' do
+ it "should not try to validate the metadata json if the file does not exist" do
expect(File).to receive(:exist?).with("#{@cookbook_dir}/foobar/metadata.json").
and_return(false)
expect(IO).not_to receive(:read)
expect(Chef::Cookbook::Metadata).not_to receive(:validate_json)
- @knife.validate_metadata_json(@cookbook_dir, 'foobar')
+ @knife.validate_metadata_json(@cookbook_dir, "foobar")
end
- { Chef::Exceptions::ObsoleteDependencySyntax => 'obsolote dependency',
- Chef::Exceptions::InvalidVersionConstraint => 'invalid version constraint',
+ { Chef::Exceptions::ObsoleteDependencySyntax => "obsolote dependency",
+ Chef::Exceptions::InvalidVersionConstraint => "invalid version constraint",
}.each_pair do |klass, description|
it "should print an error and exit when an #{description} syntax exception is encountered" do
expect(File).to receive(:exist?).with("#{@cookbook_dir}/foobar/metadata.json").
@@ -167,7 +167,7 @@ describe Chef::Knife::CookbookMetadata do
exception = klass.new("#{description} blah")
allow(Chef::Cookbook::Metadata).to receive(:validate_json).and_raise(exception)
expect {
- @knife.validate_metadata_json(@cookbook_dir, 'foobar')
+ @knife.validate_metadata_json(@cookbook_dir, "foobar")
}.to raise_error(SystemExit)
expect(@stderr.string).to match /error: the cookbook 'foobar' contains invalid or obsolete metadata syntax/im
expect(@stderr.string).to match /in #{@cookbook_dir}\/foobar\/metadata\.json/im
diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb
index 6c77db013f..bde33b0689 100644
--- a/spec/unit/knife/cookbook_show_spec.rb
+++ b/spec/unit/knife/cookbook_show_spec.rb
@@ -17,7 +17,7 @@
#
# rename to cookbook not coookbook
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::CookbookShow do
before(:each) do
@@ -33,7 +33,7 @@ describe Chef::Knife::CookbookShow do
describe "run" do
describe "with 0 arguments: help" do
- it 'should should print usage and exit when given no arguments' do
+ it "should should print usage and exit when given no arguments" do
@knife.name_args = []
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal)
diff --git a/spec/unit/knife/cookbook_site_download_spec.rb b/spec/unit/knife/cookbook_site_download_spec.rb
index 35c6544d58..52e82a7f0b 100644
--- a/spec/unit/knife/cookbook_site_download_spec.rb
+++ b/spec/unit/knife/cookbook_site_download_spec.rb
@@ -16,22 +16,22 @@
# limitations under the License.
#
-require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
+require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
describe Chef::Knife::CookbookSiteDownload do
- describe 'run' do
+ describe "run" do
before do
@knife = Chef::Knife::CookbookSiteDownload.new
- @knife.name_args = ['apache2']
- @noauth_rest = double('no auth rest')
+ @knife.name_args = ["apache2"]
+ @noauth_rest = double("no auth rest")
@stderr = StringIO.new
- @cookbook_api_url = 'https://supermarket.chef.io/api/v1/cookbooks'
- @version = '1.0.2'
- @version_us = @version.gsub '.', '_'
- @current_data = { 'deprecated' => false,
- 'latest_version' => "#{@cookbook_api_url}/apache2/versions/#{@version_us}",
- 'replacement' => 'other_apache2' }
+ @cookbook_api_url = "https://supermarket.chef.io/api/v1/cookbooks"
+ @version = "1.0.2"
+ @version_us = @version.gsub ".", "_"
+ @current_data = { "deprecated" => false,
+ "latest_version" => "#{@cookbook_api_url}/apache2/versions/#{@version_us}",
+ "replacement" => "other_apache2" }
allow(@knife.ui).to receive(:stderr).and_return(@stderr)
allow(@knife).to receive(:noauth_rest).and_return(@noauth_rest)
@@ -40,12 +40,12 @@ describe Chef::Knife::CookbookSiteDownload do
and_return(@current_data)
end
- context 'when the cookbook is deprecated and not forced' do
+ context "when the cookbook is deprecated and not forced" do
before do
- @current_data['deprecated'] = true
+ @current_data["deprecated"] = true
end
- it 'should warn with info about the replacement' do
+ it "should warn with info about the replacement" do
expect(@knife.ui).to receive(:warn).
with(/.+deprecated.+replaced by other_apache2.+/i)
expect(@knife.ui).to receive(:warn).
@@ -54,33 +54,33 @@ describe Chef::Knife::CookbookSiteDownload do
end
end
- context 'when' do
+ context "when" do
before do
- @cookbook_data = { 'version' => @version,
- 'file' => "http://example.com/apache2_#{@version_us}.tgz" }
+ @cookbook_data = { "version" => @version,
+ "file" => "http://example.com/apache2_#{@version_us}.tgz" }
@temp_file = double( :path => "/tmp/apache2_#{@version_us}.tgz" )
@file = File.join(Dir.pwd, "apache2-#{@version}.tar.gz")
expect(@noauth_rest).to receive(:sign_on_redirect=).with(false)
end
- context 'downloading the latest version' do
+ context "downloading the latest version" do
before do
expect(@noauth_rest).to receive(:get).
- with(@current_data['latest_version']).
+ with(@current_data["latest_version"]).
and_return(@cookbook_data)
expect(@noauth_rest).to receive(:get).
- with(@cookbook_data['file'], true).
+ with(@cookbook_data["file"], true).
and_return(@temp_file)
end
- context 'and it is deprecated and with --force' do
+ context "and it is deprecated and with --force" do
before do
- @current_data['deprecated'] = true
+ @current_data["deprecated"] = true
@knife.config[:force] = true
end
- it 'should download the latest version' do
+ it "should download the latest version" do
expect(@knife.ui).to receive(:warn).
with(/.+deprecated.+replaced by other_apache2.+/i)
expect(FileUtils).to receive(:cp).with(@temp_file.path, @file)
@@ -91,51 +91,51 @@ describe Chef::Knife::CookbookSiteDownload do
end
- it 'should download the latest version' do
+ it "should download the latest version" do
expect(FileUtils).to receive(:cp).with(@temp_file.path, @file)
@knife.run
expect(@stderr.string).to match /downloading apache2.+version.+#{Regexp.escape(@version)}/i
expect(@stderr.string).to match /cookbook save.+#{Regexp.escape(@file)}/i
end
- context 'with -f or --file' do
+ context "with -f or --file" do
before do
- @file = '/opt/chef/cookbooks/apache2.tar.gz'
+ @file = "/opt/chef/cookbooks/apache2.tar.gz"
@knife.config[:file] = @file
expect(FileUtils).to receive(:cp).with(@temp_file.path, @file)
end
- it 'should download the cookbook to the desired file' do
+ it "should download the cookbook to the desired file" do
@knife.run
expect(@stderr.string).to match /downloading apache2.+version.+#{Regexp.escape(@version)}/i
expect(@stderr.string).to match /cookbook save.+#{Regexp.escape(@file)}/i
end
end
- it 'should provide an accessor to the version' do
+ it "should provide an accessor to the version" do
allow(FileUtils).to receive(:cp).and_return(true)
expect(@knife.version).to eq(@version)
@knife.run
end
end
- context 'downloading a cookbook of a specific version' do
+ context "downloading a cookbook of a specific version" do
before do
- @version = '1.0.1'
- @version_us = @version.gsub '.', '_'
- @cookbook_data = { 'version' => @version,
- 'file' => "http://example.com/apache2_#{@version_us}.tgz" }
+ @version = "1.0.1"
+ @version_us = @version.gsub ".", "_"
+ @cookbook_data = { "version" => @version,
+ "file" => "http://example.com/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
- it 'should download the desired version' do
+ it "should download the desired version" do
expect(@noauth_rest).to receive(:get).
with("#{@cookbook_api_url}/apache2/versions/#{@version_us}").
and_return(@cookbook_data)
expect(@noauth_rest).to receive(:get).
- with(@cookbook_data['file'], true).
+ with(@cookbook_data["file"], true).
and_return(@temp_file)
expect(FileUtils).to receive(:cp).with(@temp_file.path, @file)
@knife.run
diff --git a/spec/unit/knife/cookbook_site_install_spec.rb b/spec/unit/knife/cookbook_site_install_spec.rb
index 9779de4a64..c2ffe4bb14 100644
--- a/spec/unit/knife/cookbook_site_install_spec.rb
+++ b/spec/unit/knife/cookbook_site_install_spec.rb
@@ -28,14 +28,14 @@ describe Chef::Knife::CookbookSiteInstall do
:merge_updates_from => true) }
let(:install_path) {
if Chef::Platform.windows?
- 'C:/tmp/chef'
+ "C:/tmp/chef"
else
- '/var/tmp/chef'
+ "/var/tmp/chef"
end
}
before(:each) do
- require 'chef/knife/core/cookbook_scm_repo'
+ require "chef/knife/core/cookbook_scm_repo"
allow(knife.ui).to receive(:stdout).and_return(stdout)
knife.config = {}
diff --git a/spec/unit/knife/cookbook_site_share_spec.rb b/spec/unit/knife/cookbook_site_share_spec.rb
index 14ade10e09..5cd90bc0c4 100644
--- a/spec/unit/knife/cookbook_site_share_spec.rb
+++ b/spec/unit/knife/cookbook_site_share_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/cookbook_uploader'
-require 'chef/cookbook_site_streaming_uploader'
+require "chef/cookbook_uploader"
+require "chef/cookbook_site_streaming_uploader"
describe Chef::Knife::CookbookSiteShare do
@@ -27,11 +27,11 @@ describe Chef::Knife::CookbookSiteShare do
@knife = Chef::Knife::CookbookSiteShare.new
# Merge default settings in.
@knife.merge_configs
- @knife.name_args = ['cookbook_name', 'AwesomeSausage']
+ @knife.name_args = ["cookbook_name", "AwesomeSausage"]
- @cookbook = Chef::CookbookVersion.new('cookbook_name')
+ @cookbook = Chef::CookbookVersion.new("cookbook_name")
- @cookbook_loader = double('Chef::CookbookLoader')
+ @cookbook_loader = double("Chef::CookbookLoader")
allow(@cookbook_loader).to receive(:cookbook_exists?).and_return(true)
allow(@cookbook_loader).to receive(:[]).and_return(@cookbook)
allow(Chef::CookbookLoader).to receive(:new).and_return(@cookbook_loader)
@@ -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)
@@ -49,7 +49,7 @@ describe Chef::Knife::CookbookSiteShare do
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
end
- describe 'run' do
+ describe "run" do
before(:each) do
allow(@knife).to receive(:do_upload).and_return(true)
@@ -65,39 +65,39 @@ describe Chef::Knife::CookbookSiteShare do
}
end
- it 'should set true to config[:dry_run] as default' do
+ it "should set true to config[:dry_run] as default" do
expect(@knife.config[:dry_run]).to be_falsey
end
- it 'should should print usage and exit when given no arguments' do
+ it "should should print usage and exit when given no arguments" do
@knife.name_args = []
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal)
expect { @knife.run }.to raise_error(SystemExit)
end
- it 'should not fail when given only 1 argument and can determine category' do
- @knife.name_args = ['cookbook_name']
+ it "should not fail when given only 1 argument and can determine category" do
+ @knife.name_args = ["cookbook_name"]
expect(@noauth_rest).to receive(:get).with("https://supermarket.chef.io/api/v1/cookbooks/cookbook_name").and_return(@category_response)
expect(@knife).to receive(:do_upload)
@knife.run
end
- it 'should print error and exit when given only 1 argument and cannot determine category' do
- @knife.name_args = ['cookbook_name']
+ it "should print error and exit when given only 1 argument and cannot determine category" do
+ @knife.name_args = ["cookbook_name"]
expect(@noauth_rest).to receive(:get).with("https://supermarket.chef.io/api/v1/cookbooks/cookbook_name").and_return(@bad_category_response)
expect(@knife.ui).to receive(:fatal)
expect { @knife.run }.to raise_error(SystemExit)
end
- it 'should print error and exit when given only 1 argument and Chef::ServerAPI throws an exception' do
- @knife.name_args = ['cookbook_name']
+ it "should print error and exit when given only 1 argument and Chef::ServerAPI throws an exception" do
+ @knife.name_args = ["cookbook_name"]
expect(@noauth_rest).to receive(:get).with("https://supermarket.chef.io/api/v1/cookbooks/cookbook_name") { raise Errno::ECONNREFUSED, "Connection refused" }
expect(@knife.ui).to receive(:fatal)
expect { @knife.run }.to raise_error(SystemExit)
end
- it 'should check if the cookbook exists' do
+ it "should check if the cookbook exists" do
expect(@cookbook_loader).to receive(:cookbook_exists?)
@knife.run
end
@@ -108,15 +108,15 @@ describe Chef::Knife::CookbookSiteShare do
expect { @knife.run }.to raise_error(SystemExit)
end
- if File.exists?('/usr/bin/gnutar') || File.exists?('/bin/gnutar')
- it 'should use gnutar to make a tarball of the cookbook' do
+ if File.exists?("/usr/bin/gnutar") || File.exists?("/bin/gnutar")
+ it "should use gnutar to make a tarball of the cookbook" do
expect(@knife).to receive(:shell_out!) do |args|
expect(args.to_s).to match(/gnutar -czf/)
end
@knife.run
end
else
- it 'should make a tarball of the cookbook' do
+ it "should make a tarball of the cookbook" do
expect(@knife).to receive(:shell_out!) do |args|
expect(args.to_s).to match(/tar -czf/)
end
@@ -124,13 +124,13 @@ describe Chef::Knife::CookbookSiteShare do
end
end
- it 'should exit and log to error when the tarball creation fails' do
+ it "should exit and log to error when the tarball creation fails" do
allow(@knife).to receive(:shell_out!).and_raise(Chef::Exceptions::Exec)
expect(@knife.ui).to receive(:error)
expect { @knife.run }.to raise_error(SystemExit)
end
- it 'should upload the cookbook and clean up the tarball' do
+ it "should upload the cookbook and clean up the tarball" do
expect(@knife).to receive(:do_upload)
expect(FileUtils).to receive(:rm_rf)
@knife.run
@@ -140,7 +140,7 @@ describe Chef::Knife::CookbookSiteShare do
before do
allow(Chef::CookbookSiteStreamingUploader).to receive(:create_build_dir).and_return("/var/tmp/dummy")
@knife.config = { :dry_run => true }
- allow(@knife).to receive_message_chain(:shell_out!, :stdout).and_return('file')
+ allow(@knife).to receive_message_chain(:shell_out!, :stdout).and_return("file")
end
it "should list files in the tarball" do
@@ -158,10 +158,10 @@ describe Chef::Knife::CookbookSiteShare do
end
end
- describe 'do_upload' do
+ describe "do_upload" do
before(:each) do
- @upload_response = double('Net::HTTPResponse')
+ @upload_response = double("Net::HTTPResponse")
allow(Chef::CookbookSiteStreamingUploader).to receive(:post).and_return(@upload_response)
@stdout = StringIO.new
@@ -172,22 +172,22 @@ 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())
@knife.run
end
- it 'should alert the user when a version already exists' do
- response_text = Chef::JSONCompat.to_json({:error_messages => ['Version already exists']})
+ it "should alert the user when a version already exists" do
+ 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)
expect(@stderr.string).to match(/ERROR(.+)cookbook already exists/)
end
- it 'should pass any errors on to the user' do
+ it "should pass any errors on to the user" do
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)
@@ -195,7 +195,7 @@ describe Chef::Knife::CookbookSiteShare do
expect(@stderr.string).to match("ERROR(.*)You're holding it wrong")
end
- it 'should print the body if no errors are exposed on failure' do
+ 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"})
allow(@upload_response).to receive(:body).and_return(response_text)
allow(@upload_response).to receive(:code).and_return(500)
diff --git a/spec/unit/knife/cookbook_site_unshare_spec.rb b/spec/unit/knife/cookbook_site_unshare_spec.rb
index aafb7c1507..d8c67aae20 100644
--- a/spec/unit/knife/cookbook_site_unshare_spec.rb
+++ b/spec/unit/knife/cookbook_site_unshare_spec.rb
@@ -17,26 +17,26 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::CookbookSiteUnshare do
before(:each) do
@knife = Chef::Knife::CookbookSiteUnshare.new
- @knife.name_args = ['cookbook_name']
+ @knife.name_args = ["cookbook_name"]
allow(@knife).to receive(:confirm).and_return(true)
- @rest = double('Chef::ServerAPI')
+ @rest = double("Chef::ServerAPI")
allow(@rest).to receive(:delete).and_return(true)
allow(@knife).to receive(:rest).and_return(@rest)
@stdout = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
end
- describe 'run' do
+ describe "run" do
- describe 'with no cookbook argument' do
- it 'should print the usage and exit' do
+ describe "with no cookbook argument" do
+ it "should print the usage and exit" do
@knife.name_args = []
expect(@knife.ui).to receive(:fatal)
expect(@knife).to receive(:show_usage)
@@ -44,30 +44,30 @@ describe Chef::Knife::CookbookSiteUnshare do
end
end
- it 'should confirm you want to unshare the cookbook' do
+ it "should confirm you want to unshare the cookbook" do
expect(@knife).to receive(:confirm)
@knife.run
end
- it 'should send a delete request to the cookbook site' do
+ it "should send a delete request to the cookbook site" do
expect(@rest).to receive(:delete)
@knife.run
end
- it 'should log an error and exit when forbidden' do
- exception = double('403 "Forbidden"', :code => '403')
+ it "should log an error and exit when forbidden" do
+ 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')
+ it "should re-raise any non-forbidden errors on delete" do
+ 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
- it 'should log a success message' do
+ it "should log a success message" do
expect(@knife.ui).to receive(:info)
@knife.run
end
diff --git a/spec/unit/knife/cookbook_test_spec.rb b/spec/unit/knife/cookbook_test_spec.rb
index ce74bcaa5d..3587de0c78 100644
--- a/spec/unit/knife/cookbook_test_spec.rb
+++ b/spec/unit/knife/cookbook_test_spec.rb
@@ -18,14 +18,14 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
Chef::Knife::CookbookTest.load_deps
describe Chef::Knife::CookbookTest do
before(:each) do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::CookbookTest.new
- @knife.config[:cookbook_path] = File.join(CHEF_SPEC_DATA,'cookbooks')
+ @knife.config[:cookbook_path] = File.join(CHEF_SPEC_DATA,"cookbooks")
allow(@knife.cookbook_loader).to receive(:cookbook_exists?).and_return(true)
@cookbooks = []
%w{tats central_market jimmy_johns pho}.each do |cookbook_name|
diff --git a/spec/unit/knife/cookbook_upload_spec.rb b/spec/unit/knife/cookbook_upload_spec.rb
index ecee34f308..666974a817 100644
--- a/spec/unit/knife/cookbook_upload_spec.rb
+++ b/spec/unit/knife/cookbook_upload_spec.rb
@@ -19,11 +19,11 @@
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
-require 'chef/cookbook_uploader'
-require 'timeout'
+require "chef/cookbook_uploader"
+require "timeout"
describe Chef::Knife::CookbookUpload do
- let(:cookbook) { Chef::CookbookVersion.new('test_cookbook', '/tmp/blah.txt') }
+ let(:cookbook) { Chef::CookbookVersion.new("test_cookbook", "/tmp/blah.txt") }
let(:cookbooks_by_name) do
{cookbook.name => cookbook}
@@ -40,7 +40,7 @@ describe Chef::Knife::CookbookUpload do
let(:output) { StringIO.new }
- let(:name_args) { ['test_cookbook'] }
+ let(:name_args) { ["test_cookbook"] }
let(:knife) do
k = Chef::Knife::CookbookUpload.new
@@ -54,11 +54,11 @@ describe Chef::Knife::CookbookUpload do
allow(Chef::CookbookLoader).to receive(:new).and_return(cookbook_loader)
end
- describe 'with --concurrency' do
- it 'should upload cookbooks with predefined concurrency' do
+ describe "with --concurrency" do
+ it "should upload cookbooks with predefined concurrency" do
allow(Chef::CookbookVersion).to receive(:list_all_versions).and_return({})
knife.config[:concurrency] = 3
- test_cookbook = Chef::CookbookVersion.new('test_cookbook', '/tmp/blah')
+ test_cookbook = Chef::CookbookVersion.new("test_cookbook", "/tmp/blah")
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).
@@ -68,35 +68,35 @@ describe Chef::Knife::CookbookUpload do
end
end
- describe 'run' do
+ describe "run" do
before(:each) do
allow(Chef::CookbookUploader).to receive_messages(:new => cookbook_uploader)
allow(Chef::CookbookVersion).to receive(:list_all_versions).and_return({})
end
- it 'should print usage and exit when a cookbook name is not provided' do
+ it "should print usage and exit when a cookbook name is not provided" do
knife.name_args = []
expect(knife).to receive(:show_usage)
expect(knife.ui).to receive(:fatal)
expect { knife.run }.to raise_error(SystemExit)
end
- describe 'when specifying a cookbook name' do
- it 'should upload the cookbook' do
+ describe "when specifying a cookbook name" do
+ it "should upload the cookbook" do
expect(knife).to receive(:upload).once
knife.run
end
- it 'should report on success' do
+ it "should report on success" do
expect(knife).to receive(:upload).once
expect(knife.ui).to receive(:info).with(/Uploaded 1 cookbook/)
knife.run
end
end
- describe 'when specifying the same cookbook name twice' do
- it 'should upload the cookbook only once' do
- knife.name_args = ['test_cookbook', 'test_cookbook']
+ describe "when specifying the same cookbook name twice" do
+ it "should upload the cookbook only once" do
+ knife.name_args = ["test_cookbook", "test_cookbook"]
expect(knife).to receive(:upload).once
knife.run
end
@@ -105,9 +105,9 @@ describe Chef::Knife::CookbookUpload do
context "when uploading a cookbook that uses deprecated overlays" do
before do
- allow(cookbook_loader).to receive(:merged_cookbooks).and_return(['test_cookbook'])
+ allow(cookbook_loader).to receive(:merged_cookbooks).and_return(["test_cookbook"])
allow(cookbook_loader).to receive(:merged_cookbook_paths).
- and_return({'test_cookbook' => %w{/path/one/test_cookbook /path/two/test_cookbook}})
+ and_return({"test_cookbook" => %w{/path/one/test_cookbook /path/two/test_cookbook}})
end
it "emits a warning" do
@@ -127,19 +127,19 @@ E
end
end
- describe 'when specifying a cookbook name among many' do
- let(:name_args) { ['test_cookbook1'] }
+ describe "when specifying a cookbook name among many" do
+ let(:name_args) { ["test_cookbook1"] }
let(:cookbooks_by_name) do
{
- 'test_cookbook1' => Chef::CookbookVersion.new('test_cookbook1', '/tmp/blah'),
- 'test_cookbook2' => Chef::CookbookVersion.new('test_cookbook2', '/tmp/blah'),
- 'test_cookbook3' => Chef::CookbookVersion.new('test_cookbook3', '/tmp/blah'),
+ "test_cookbook1" => Chef::CookbookVersion.new("test_cookbook1", "/tmp/blah"),
+ "test_cookbook2" => Chef::CookbookVersion.new("test_cookbook2", "/tmp/blah"),
+ "test_cookbook3" => Chef::CookbookVersion.new("test_cookbook3", "/tmp/blah"),
}
end
it "should read only one cookbook" do
- expect(cookbook_loader).to receive(:[]).once.with('test_cookbook1').and_call_original
+ expect(cookbook_loader).to receive(:[]).once.with("test_cookbook1").and_call_original
knife.run
end
@@ -155,7 +155,7 @@ E
end
# This is testing too much. We should break it up.
- describe 'when specifying a cookbook name with dependencies' do
+ describe "when specifying a cookbook name with dependencies" do
let(:name_args) { ["test_cookbook2"] }
let(:cookbooks_by_name) do
@@ -164,16 +164,16 @@ E
"test_cookbook3" => test_cookbook3 }
end
- let(:test_cookbook1) { Chef::CookbookVersion.new('test_cookbook1', '/tmp/blah') }
+ let(:test_cookbook1) { Chef::CookbookVersion.new("test_cookbook1", "/tmp/blah") }
let(:test_cookbook2) do
- c = Chef::CookbookVersion.new('test_cookbook2')
+ c = Chef::CookbookVersion.new("test_cookbook2")
c.metadata.depends("test_cookbook3")
c
end
let(:test_cookbook3) do
- c = Chef::CookbookVersion.new('test_cookbook3')
+ c = Chef::CookbookVersion.new("test_cookbook3")
c.metadata.depends("test_cookbook1")
c.metadata.depends("test_cookbook2")
c
@@ -191,8 +191,8 @@ E
end
end
- describe 'when specifying a cookbook name with missing dependencies' do
- let(:cookbook_dependency) { Chef::CookbookVersion.new('dependency', '/tmp/blah') }
+ describe "when specifying a cookbook name with missing dependencies" do
+ let(:cookbook_dependency) { Chef::CookbookVersion.new("dependency", "/tmp/blah") }
before(:each) do
cookbook.metadata.depends("dependency")
@@ -205,22 +205,22 @@ E
knife.ui = Chef::Knife::UI.new(@stdout, @stderr, @stdin, {})
end
- it 'should exit and not upload the cookbook' do
- expect(cookbook_loader).to receive(:[]).once.with('test_cookbook')
+ it "should exit and not upload the cookbook" do
+ expect(cookbook_loader).to receive(:[]).once.with("test_cookbook")
expect(cookbook_loader).not_to receive(:load_cookbooks)
expect(cookbook_uploader).not_to receive(:upload_cookbooks)
expect {knife.run}.to raise_error(SystemExit)
end
- it 'should output a message for a single missing dependency' do
+ it "should output a message for a single missing dependency" do
expect {knife.run}.to raise_error(SystemExit)
- expect(@stderr.string).to include('Cookbook test_cookbook depends on cookbooks which are not currently')
- expect(@stderr.string).to include('being uploaded and cannot be found on the server.')
+ expect(@stderr.string).to include("Cookbook test_cookbook depends on cookbooks which are not currently")
+ expect(@stderr.string).to include("being uploaded and cannot be found on the server.")
expect(@stderr.string).to include("The missing cookbook(s) are: 'dependency' version '>= 0.0.0'")
end
- it 'should output a message for a multiple missing dependencies which are concatenated' do
- cookbook_dependency2 = Chef::CookbookVersion.new('dependency2')
+ it "should output a message for a multiple missing dependencies which are concatenated" do
+ cookbook_dependency2 = Chef::CookbookVersion.new("dependency2")
cookbook.metadata.depends("dependency2")
allow(cookbook_loader).to receive(:[]) do |ckbk|
{ "test_cookbook" => cookbook,
@@ -229,8 +229,8 @@ E
end
allow(knife).to receive(:cookbook_names).and_return(["dependency", "dependency2", "test_cookbook"])
expect {knife.run}.to raise_error(SystemExit)
- expect(@stderr.string).to include('Cookbook test_cookbook depends on cookbooks which are not currently')
- expect(@stderr.string).to include('being uploaded and cannot be found on the server.')
+ expect(@stderr.string).to include("Cookbook test_cookbook depends on cookbooks which are not currently")
+ expect(@stderr.string).to include("being uploaded and cannot be found on the server.")
expect(@stderr.string).to include("The missing cookbook(s) are:")
expect(@stderr.string).to include("'dependency' version '>= 0.0.0'")
expect(@stderr.string).to include("'dependency2' version '>= 0.0.0'")
@@ -243,31 +243,31 @@ E
knife.run
end
- describe 'with -a or --all' do
+ describe "with -a or --all" do
before(:each) do
knife.config[:all] = true
end
- context 'when cookbooks exist in the cookbook path' do
+ context "when cookbooks exist in the cookbook path" do
before(:each) do
- @test_cookbook1 = Chef::CookbookVersion.new('test_cookbook1', '/tmp/blah')
- @test_cookbook2 = Chef::CookbookVersion.new('test_cookbook2', '/tmp/blah')
+ @test_cookbook1 = Chef::CookbookVersion.new("test_cookbook1", "/tmp/blah")
+ @test_cookbook2 = Chef::CookbookVersion.new("test_cookbook2", "/tmp/blah")
allow(cookbook_loader).to receive(:each).and_yield("test_cookbook1", @test_cookbook1).and_yield("test_cookbook2", @test_cookbook2)
allow(cookbook_loader).to receive(:cookbook_names).and_return(["test_cookbook1", "test_cookbook2"])
end
- it 'should upload all cookbooks' do
+ it "should upload all cookbooks" do
expect(knife).to receive(:upload).once
knife.run
end
- it 'should report on success' do
+ it "should report on success" do
expect(knife).to receive(:upload).once
expect(knife.ui).to receive(:info).with(/Uploaded all cookbooks/)
knife.run
end
- it 'should update the version constraints for an environment' do
+ it "should update the version constraints for an environment" do
allow(knife).to receive(:assert_environment_valid!).and_return(true)
knife.config[:environment] = "production"
expect(knife).to receive(:update_version_constraints).once
@@ -275,28 +275,28 @@ E
end
end
- context 'when no cookbooks exist in the cookbook path' do
+ context "when no cookbooks exist in the cookbook path" do
before(:each) do
allow(cookbook_loader).to receive(:each)
end
- it 'should not upload any cookbooks' do
+ it "should not upload any cookbooks" do
expect(knife).to_not receive(:upload)
knife.run
end
- context 'when cookbook path is an array' do
- it 'should warn users that no cookbooks exist' do
- knife.config[:cookbook_path] = ['/chef-repo/cookbooks', '/home/user/cookbooks']
+ context "when cookbook path is an array" do
+ it "should warn users that no cookbooks exist" do
+ knife.config[:cookbook_path] = ["/chef-repo/cookbooks", "/home/user/cookbooks"]
expect(knife.ui).to receive(:warn).with(
/Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path].join(', ')}\. Use --cookbook-path to specify the desired path\./)
knife.run
end
end
- context 'when cookbook path is a string' do
- it 'should warn users that no cookbooks exist' do
- knife.config[:cookbook_path] = '/chef-repo/cookbooks'
+ context "when cookbook path is a string" do
+ it "should warn users that no cookbooks exist" do
+ knife.config[:cookbook_path] = "/chef-repo/cookbooks"
expect(knife.ui).to receive(:warn).with(
/Could not find any cookbooks in your cookbook path: #{knife.config[:cookbook_path]}\. Use --cookbook-path to specify the desired path\./)
knife.run
@@ -305,8 +305,8 @@ E
end
end
- describe 'when a frozen cookbook exists on the server' do
- it 'should fail to replace it' do
+ describe "when a frozen cookbook exists on the server" do
+ it "should fail to replace it" do
exception = Chef::Exceptions::CookbookFrozen.new
expect(cookbook_uploader).to receive(:upload_cookbooks).
and_raise(exception)
@@ -315,7 +315,7 @@ E
expect { knife.run }.to raise_error(SystemExit)
end
- it 'should not update the version constraints for an environment' do
+ it "should not update the version constraints for an environment" do
allow(knife).to receive(:assert_environment_valid!).and_return(true)
knife.config[:environment] = "production"
allow(knife).to receive(:upload).and_raise(Chef::Exceptions::CookbookFrozen)
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb
index 1d93f64e32..7ecade338a 100644
--- a/spec/unit/knife/core/bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/bootstrap_context_spec.rb
@@ -16,17 +16,17 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/knife/core/bootstrap_context'
+require "spec_helper"
+require "chef/knife/core/bootstrap_context"
describe Chef::Knife::Core::BootstrapContext do
let(:config) { {:foo => :bar, :color => true} }
- let(:run_list) { Chef::RunList.new('recipe[tmux]', 'role[base]') }
+ let(:run_list) { Chef::RunList.new("recipe[tmux]", "role[base]") }
let(:chef_config) do
{
- :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',
+ :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
@@ -57,7 +57,7 @@ describe Chef::Knife::Core::BootstrapContext do
end
it "reads the validation key" do
- expect(bootstrap_context.validation_key).to eq IO.read(File.join(CHEF_SPEC_DATA, 'ssl', 'private_key.pem'))
+ expect(bootstrap_context.validation_key).to eq IO.read(File.join(CHEF_SPEC_DATA, "ssl", "private_key.pem"))
end
it "generates the config file data" do
@@ -75,23 +75,23 @@ 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']))
+ 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"]))
bootstrap_context.validation_key
end
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
@@ -100,7 +100,7 @@ EXPECTED
describe "when bootstrapping into a specific environment" do
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')
+ expect(bootstrap_context.start_chef).to eq("chef-client -j /etc/chef/first-boot.json -E prodtastic")
end
end
diff --git a/spec/unit/knife/core/cookbook_scm_repo_spec.rb b/spec/unit/knife/core/cookbook_scm_repo_spec.rb
index 2d66df31c1..b29091188e 100644
--- a/spec/unit/knife/core/cookbook_scm_repo_spec.rb
+++ b/spec/unit/knife/core/cookbook_scm_repo_spec.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/knife/core/cookbook_scm_repo'
+require "spec_helper"
+require "chef/knife/core/cookbook_scm_repo"
describe Chef::Knife::CookbookSCMRepo do
before do
- @repo_path = File.join(CHEF_SPEC_DATA, 'cookbooks')
+ @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)
@@ -43,7 +43,7 @@ BRANCHES
end
it "has a default branch" do
- expect(@cookbook_repo.default_branch).to eq('master')
+ expect(@cookbook_repo.default_branch).to eq("master")
end
describe "when sanity checking the repo" do
@@ -64,12 +64,12 @@ BRANCHES
describe "and the repo is a git repo" do
before do
- allow(::File).to receive(:directory?).with(File.join(@repo_path, '.git')).and_return(true)
+ allow(::File).to receive(:directory?).with(File.join(@repo_path, ".git")).and_return(true)
end
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
@@ -85,14 +85,14 @@ BRANCHES
@dirty_status.stdout.replace(<<-DIRTY)
M chef/lib/chef/knife/cookbook_site_vendor.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,15 +143,15 @@ 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
- expect(@cookbook_repo.updated?('apache2')).to be_falsey
+ expect(@cookbook_repo.updated?("apache2")).to be_falsey
end
it "does nothing to finalize the updates" do
- expect(@cookbook_repo.finalize_updates_to('apache2', '1.2.3')).to be_falsey
+ expect(@cookbook_repo.finalize_updates_to("apache2", "1.2.3")).to be_falsey
end
end
@@ -159,11 +159,11 @@ 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
- expect(@cookbook_repo.updated?('apache2')).to be_truthy
+ expect(@cookbook_repo.updated?("apache2")).to be_truthy
end
it "commits the changes to the repo and tags the commit" do
@@ -176,11 +176,11 @@ DIRTY
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/custom_manifest_loader_spec.rb b/spec/unit/knife/core/custom_manifest_loader_spec.rb
index 1edbedd3c8..f15710274c 100644
--- a/spec/unit/knife/core/custom_manifest_loader_spec.rb
+++ b/spec/unit/knife/core/custom_manifest_loader_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::SubcommandLoader::CustomManifestLoader do
let(:ec2_server_create_plugin) { "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_server_create.rb" }
@@ -30,7 +30,7 @@ describe Chef::Knife::SubcommandLoader::CustomManifestLoader do
}
end
let(:loader) do
- Chef::Knife::SubcommandLoader::CustomManifestLoader.new(File.join(CHEF_SPEC_DATA, 'knife-site-subcommands'),
+ Chef::Knife::SubcommandLoader::CustomManifestLoader.new(File.join(CHEF_SPEC_DATA, "knife-site-subcommands"),
manifest_content)
end
diff --git a/spec/unit/knife/core/gem_glob_loader_spec.rb b/spec/unit/knife/core/gem_glob_loader_spec.rb
index 89de9f98e4..671fabf695 100644
--- a/spec/unit/knife/core/gem_glob_loader_spec.rb
+++ b/spec/unit/knife/core/gem_glob_loader_spec.rb
@@ -15,12 +15,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::SubcommandLoader::GemGlobLoader do
- let(:loader) { Chef::Knife::SubcommandLoader::GemGlobLoader.new(File.join(CHEF_SPEC_DATA, 'knife-site-subcommands')) }
- let(:home) { File.join(CHEF_SPEC_DATA, 'knife-home') }
- let(:plugin_dir) { File.join(home, '.chef', 'plugins', 'knife') }
+ let(:loader) { Chef::Knife::SubcommandLoader::GemGlobLoader.new(File.join(CHEF_SPEC_DATA, "knife-site-subcommands")) }
+ let(:home) { File.join(CHEF_SPEC_DATA, "knife-home") }
+ let(:plugin_dir) { File.join(home, ".chef", "plugins", "knife") }
before do
allow(ChefConfig).to receive(:windows?) { false }
@@ -39,15 +39,15 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do
end
it "finds files installed via rubygems" do
- expect(loader.find_subcommands_via_rubygems).to include('chef/knife/node_create')
+ expect(loader.find_subcommands_via_rubygems).to include("chef/knife/node_create")
loader.find_subcommands_via_rubygems.each {|rel_path, abs_path| expect(abs_path).to match(%r[chef/knife/.+])}
end
it "finds files from latest version of installed gems" do
- gems = [ double('knife-ec2-0.5.12') ]
+ gems = [ double("knife-ec2-0.5.12") ]
gem_files = [
- '/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_base.rb',
- '/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_otherstuff.rb',
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_base.rb",
+ "/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/ec2_otherstuff.rb",
]
expect($LOAD_PATH).to receive(:map).and_return([])
if Gem::Specification.respond_to? :latest_specs
@@ -55,26 +55,26 @@ describe Chef::Knife::SubcommandLoader::GemGlobLoader do
expect(gems[0]).to receive(:matches_for_glob).with(/chef\/knife\/\*\.rb\{(.*),\.rb,(.*)\}/).and_return(gem_files)
else
expect(Gem.source_index).to receive(:latest_specs).with(true).and_return(gems)
- expect(gems[0]).to receive(:require_paths).twice.and_return(['lib'])
- expect(gems[0]).to receive(:full_gem_path).and_return('/usr/lib/ruby/gems/knife-ec2-0.5.12')
- expect(Dir).to receive(:[]).with('/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/*.rb').and_return(gem_files)
+ expect(gems[0]).to receive(:require_paths).twice.and_return(["lib"])
+ expect(gems[0]).to receive(:full_gem_path).and_return("/usr/lib/ruby/gems/knife-ec2-0.5.12")
+ expect(Dir).to receive(:[]).with("/usr/lib/ruby/gems/knife-ec2-0.5.12/lib/chef/knife/*.rb").and_return(gem_files)
end
expect(loader).to receive(:find_subcommands_via_dirglob).and_return({})
expect(loader.subcommand_files.select { |file| file =~ /knife-ec2/ }.sort).to eq(gem_files)
end
it "finds files using a dirglob when rubygems is not available" do
- expect(loader.find_subcommands_via_dirglob).to include('chef/knife/node_create')
+ expect(loader.find_subcommands_via_dirglob).to include("chef/knife/node_create")
loader.find_subcommands_via_dirglob.each {|rel_path, abs_path| expect(abs_path).to match(%r[chef/knife/.+])}
end
it "finds user-specific subcommands in the user's ~/.chef directory" do
- expected_command = File.join(home, '.chef', 'plugins', 'knife', 'example_home_subcommand.rb')
+ expected_command = File.join(home, ".chef", "plugins", "knife", "example_home_subcommand.rb")
expect(loader.site_subcommands).to include(expected_command)
end
it "finds repo specific subcommands by searching for a .chef directory" do
- expected_command = File.join(CHEF_SPEC_DATA, 'knife-site-subcommands', 'plugins', 'knife', 'example_subcommand.rb')
+ expected_command = File.join(CHEF_SPEC_DATA, "knife-site-subcommands", "plugins", "knife", "example_subcommand.rb")
expect(loader.site_subcommands).to include(expected_command)
end
diff --git a/spec/unit/knife/core/hashed_command_loader_spec.rb b/spec/unit/knife/core/hashed_command_loader_spec.rb
index 1a6c2f42b7..45ee377ac6 100644
--- a/spec/unit/knife/core/hashed_command_loader_spec.rb
+++ b/spec/unit/knife/core/hashed_command_loader_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
before do
@@ -42,7 +42,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
}
let(:loader) { Chef::Knife::SubcommandLoader::HashedCommandLoader.new(
- File.join(CHEF_SPEC_DATA, 'knife-site-subcommands'),
+ File.join(CHEF_SPEC_DATA, "knife-site-subcommands"),
plugin_manifest)}
describe "#list_commands" do
diff --git a/spec/unit/knife/core/node_editor_spec.rb b/spec/unit/knife/core/node_editor_spec.rb
index 52e3aeadd5..2c1beb6ccb 100644
--- a/spec/unit/knife/core/node_editor_spec.rb
+++ b/spec/unit/knife/core/node_editor_spec.rb
@@ -16,34 +16,34 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/knife/core/node_editor'
+require "spec_helper"
+require "chef/knife/core/node_editor"
describe Chef::Knife::NodeEditor do
let(:node_data) do
- { 'name' => 'test_node',
- 'chef_environment' => 'production',
- 'automatic' => { 'foo' => 'bar' },
- 'default' => { 'alpha' => { 'bravo' => 'charlie', 'delta' => 'echo' } },
- 'normal' => { 'alpha' => { 'bravo' => 'hotel' }, 'tags' => [] },
- 'override' => { 'alpha' => { 'bravo' => 'foxtrot', 'delta' => 'golf' } },
- 'policy_name' => nil,
- 'policy_group' => nil,
- 'run_list' => %w(role[comedy] role[drama] recipe[mystery])
+ { "name" => "test_node",
+ "chef_environment" => "production",
+ "automatic" => { "foo" => "bar" },
+ "default" => { "alpha" => { "bravo" => "charlie", "delta" => "echo" } },
+ "normal" => { "alpha" => { "bravo" => "hotel" }, "tags" => [] },
+ "override" => { "alpha" => { "bravo" => "foxtrot", "delta" => "golf" } },
+ "policy_name" => nil,
+ "policy_group" => nil,
+ "run_list" => %w(role[comedy] role[drama] recipe[mystery]),
}
end
let(:node) { Chef::Node.from_hash(node_data) }
- let(:ui) { double 'ui' }
- let(:base_config) { { editor: 'cat' } }
+ let(:ui) { double "ui" }
+ let(:base_config) { { editor: "cat" } }
let(:config) { base_config.merge(all_attributes: false) }
subject { described_class.new(node, ui, config) }
describe '#view' do
- it 'returns a Hash with only the name, chef_environment, normal, ' +
- 'policy_name, policy_group, and run_list properties' do
+ it "returns a Hash with only the name, chef_environment, normal, " +
+ "policy_name, policy_group, and run_list properties" do
expected = node_data.select do |key,|
%w[ name chef_environment normal
policy_name policy_group run_list ].include?(key)
@@ -52,7 +52,7 @@ describe Chef::Knife::NodeEditor do
expect(subject.view).to eq(expected)
end
- context 'when config[:all_attributes] == true' do
+ context "when config[:all_attributes] == true" do
let(:config) { base_config.merge(all_attributes: true) }
it 'returns a Hash with all of the node\'s properties' do
@@ -62,49 +62,49 @@ describe Chef::Knife::NodeEditor do
end
describe '#apply_updates' do
- context 'when the node name is changed' do
+ context "when the node name is changed" do
before(:each) do
allow(ui).to receive(:warn)
allow(ui).to receive(:confirm).and_return(true)
end
- it 'emits a warning and prompts for confirmation' do
- data = subject.view.merge('name' => 'foo_new_name_node')
+ it "emits a warning and prompts for confirmation" do
+ data = subject.view.merge("name" => "foo_new_name_node")
updated_node = subject.apply_updates(data)
expect(ui).to have_received(:warn)
- .with 'Changing the name of a node results in a new node being ' +
- 'created, test_node will not be modified or removed.'
+ .with "Changing the name of a node results in a new node being " +
+ "created, test_node will not be modified or removed."
expect(ui).to have_received(:confirm)
- .with('Proceed with creation of new node')
+ .with("Proceed with creation of new node")
expect(updated_node).to be_a(Chef::Node)
end
end
- context 'when config[:all_attributes] == false' do
+ context "when config[:all_attributes] == false" do
let(:config) { base_config.merge(all_attributes: false) }
let(:updated_data) do
subject.view.merge(
- 'normal' => { 'alpha' => { 'bravo' => 'hotel2' }, 'tags' => [ 'xyz' ] },
- 'policy_name' => 'mypolicy',
- 'policy_group' => 'prod',
- 'run_list' => %w(role[drama] recipe[mystery])
+ "normal" => { "alpha" => { "bravo" => "hotel2" }, "tags" => [ "xyz" ] },
+ "policy_name" => "mypolicy",
+ "policy_group" => "prod",
+ "run_list" => %w(role[drama] recipe[mystery]),
)
end
- it 'returns a node with run_list and normal_attrs changed' do
+ it "returns a node with run_list and normal_attrs changed" do
updated_node = subject.apply_updates(updated_data)
expect(updated_node).to be_a(Chef::Node)
# Expected to have been changed
- expect(updated_node.chef_environment).to eql(updated_data['chef_environment'])
- expect(updated_node.normal_attrs).to eql(updated_data['normal'])
- expect(updated_node.policy_name).to eql(updated_data['policy_name'])
- expect(updated_node.policy_group).to eql(updated_data['policy_group'])
- expect(updated_node.run_list.map(&:to_s)).to eql(updated_data['run_list'])
+ expect(updated_node.chef_environment).to eql(updated_data["chef_environment"])
+ expect(updated_node.normal_attrs).to eql(updated_data["normal"])
+ expect(updated_node.policy_name).to eql(updated_data["policy_name"])
+ expect(updated_node.policy_group).to eql(updated_data["policy_group"])
+ expect(updated_node.run_list.map(&:to_s)).to eql(updated_data["run_list"])
# Expected not to have changed
expect(updated_node.default_attrs).to eql(node.default_attrs)
@@ -113,57 +113,57 @@ describe Chef::Knife::NodeEditor do
end
end
- context 'when config[:all_attributes] == true' do
+ context "when config[:all_attributes] == true" do
let(:config) { base_config.merge(all_attributes: true) }
let(:updated_data) do
subject.view.merge(
- 'default' => { 'alpha' => { 'bravo' => 'charlie2', 'delta' => 'echo2' } },
- 'normal' => { 'alpha' => { 'bravo' => 'hotel2' }, 'tags' => [ 'xyz' ] },
- 'override' => { 'alpha' => { 'bravo' => 'foxtrot2', 'delta' => 'golf2' } },
- 'policy_name' => 'mypolicy',
- 'policy_group' => 'prod',
- 'run_list' => %w(role[drama] recipe[mystery])
+ "default" => { "alpha" => { "bravo" => "charlie2", "delta" => "echo2" } },
+ "normal" => { "alpha" => { "bravo" => "hotel2" }, "tags" => [ "xyz" ] },
+ "override" => { "alpha" => { "bravo" => "foxtrot2", "delta" => "golf2" } },
+ "policy_name" => "mypolicy",
+ "policy_group" => "prod",
+ "run_list" => %w(role[drama] recipe[mystery]),
)
end
- it 'returns a node with all editable properties changed' do
+ it "returns a node with all editable properties changed" do
updated_node = subject.apply_updates(updated_data)
expect(updated_node).to be_a(Chef::Node)
- expect(updated_node.chef_environment).to eql(updated_data['chef_environment'])
- expect(updated_node.automatic_attrs).to eql(updated_data['automatic'])
- expect(updated_node.normal_attrs).to eql(updated_data['normal'])
- expect(updated_node.default_attrs).to eql(updated_data['default'])
- expect(updated_node.override_attrs).to eql(updated_data['override'])
- expect(updated_node.policy_name).to eql(updated_data['policy_name'])
- expect(updated_node.policy_group).to eql(updated_data['policy_group'])
- expect(updated_node.run_list.map(&:to_s)).to eql(updated_data['run_list'])
+ expect(updated_node.chef_environment).to eql(updated_data["chef_environment"])
+ expect(updated_node.automatic_attrs).to eql(updated_data["automatic"])
+ expect(updated_node.normal_attrs).to eql(updated_data["normal"])
+ expect(updated_node.default_attrs).to eql(updated_data["default"])
+ expect(updated_node.override_attrs).to eql(updated_data["override"])
+ expect(updated_node.policy_name).to eql(updated_data["policy_name"])
+ expect(updated_node.policy_group).to eql(updated_data["policy_group"])
+ expect(updated_node.run_list.map(&:to_s)).to eql(updated_data["run_list"])
end
end
end
describe '#updated?' do
- context 'before the node has been edited' do
- it 'returns false' do
+ context "before the node has been edited" do
+ it "returns false" do
expect(subject.updated?).to be false
end
end
- context 'after the node has been edited' do
- context 'and changes were made' do
+ context "after the node has been edited" do
+ context "and changes were made" do
let(:updated_data) do
subject.view.merge(
- 'default' => { 'alpha' => { 'bravo' => 'charlie2', 'delta' => 'echo2' } },
- 'normal' => { 'alpha' => { 'bravo' => 'hotel2' }, 'tags' => [ 'xyz' ] },
- 'override' => { 'alpha' => { 'bravo' => 'foxtrot2', 'delta' => 'golf2' } },
- 'policy_name' => 'mypolicy',
- 'policy_group' => 'prod',
- 'run_list' => %w(role[drama] recipe[mystery])
+ "default" => { "alpha" => { "bravo" => "charlie2", "delta" => "echo2" } },
+ "normal" => { "alpha" => { "bravo" => "hotel2" }, "tags" => [ "xyz" ] },
+ "override" => { "alpha" => { "bravo" => "foxtrot2", "delta" => "golf2" } },
+ "policy_name" => "mypolicy",
+ "policy_group" => "prod",
+ "run_list" => %w(role[drama] recipe[mystery]),
)
end
- context 'and changes affect only editable properties' do
+ context "and changes affect only editable properties" do
before(:each) do
allow(ui).to receive(:edit_data)
.with(subject.view)
@@ -172,14 +172,14 @@ describe Chef::Knife::NodeEditor do
subject.edit_node
end
- it 'returns an array of the changed property names' do
+ it "returns an array of the changed property names" do
expect(subject.updated?).to eql %w[ normal policy_name policy_group run_list ]
end
end
- context 'and the changes include non-editable properties' do
+ context "and the changes include non-editable properties" do
before(:each) do
- data = updated_data.merge('bad_property' => 'bad_value')
+ data = updated_data.merge("bad_property" => "bad_value")
allow(ui).to receive(:edit_data)
.with(subject.view)
@@ -189,13 +189,13 @@ describe Chef::Knife::NodeEditor do
end
it 'returns an array of property names that doesn\'t include ' +
- 'the non-editable properties' do
+ "the non-editable properties" do
expect(subject.updated?).to eql %w[ normal policy_name policy_group run_list ]
end
end
end
- context 'and changes were not made' do
+ context "and changes were not made" do
before(:each) do
allow(ui).to receive(:edit_data)
.with(subject.view)
diff --git a/spec/unit/knife/core/object_loader_spec.rb b/spec/unit/knife/core/object_loader_spec.rb
index 0b572cc1f0..50f358379e 100644
--- a/spec/unit/knife/core/object_loader_spec.rb
+++ b/spec/unit/knife/core/object_loader_spec.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/knife/core/object_loader'
+require "spec_helper"
+require "chef/knife/core/object_loader"
describe Chef::Knife::Core::ObjectLoader do
before(:each) do
@knife = Chef::Knife.new
@stdout = StringIO.new
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
- Dir.chdir(File.join(CHEF_SPEC_DATA, 'object_loader'))
+ Dir.chdir(File.join(CHEF_SPEC_DATA, "object_loader"))
end
shared_examples_for "Chef object" do |chef_class|
@@ -34,14 +34,14 @@ describe Chef::Knife::Core::ObjectLoader do
end
it "should has a attribute 'name'" do
- expect(@object.name).to eql('test')
+ expect(@object.name).to eql("test")
end
end
{
- 'nodes' => Chef::Node,
- 'roles' => Chef::Role,
- 'environments' => Chef::Environment,
+ "nodes" => Chef::Node,
+ "roles" => Chef::Role,
+ "environments" => Chef::Environment,
}.each do |repo_location, chef_class|
describe "when the file is a #{chef_class}" do
@@ -51,7 +51,7 @@ describe Chef::Knife::Core::ObjectLoader do
describe "when the file is a Ruby" do
before do
- @object = @loader.load_from(repo_location, 'test.rb')
+ @object = @loader.load_from(repo_location, "test.rb")
end
it_behaves_like "Chef object", chef_class
@@ -61,7 +61,7 @@ describe Chef::Knife::Core::ObjectLoader do
describe "when the file is a JSON" do
describe "and it has defined 'json_class'" do
before do
- @object = @loader.load_from(repo_location, 'test_json_class.json')
+ @object = @loader.load_from(repo_location, "test_json_class.json")
end
it_behaves_like "Chef object", chef_class
@@ -69,7 +69,7 @@ describe Chef::Knife::Core::ObjectLoader do
describe "and it has not defined 'json_class'" do
before do
- @object = @loader.load_from(repo_location, 'test.json')
+ @object = @loader.load_from(repo_location, "test.json")
end
it_behaves_like "Chef object", chef_class
diff --git a/spec/unit/knife/core/subcommand_loader_spec.rb b/spec/unit/knife/core/subcommand_loader_spec.rb
index 2386465c75..c1712c297e 100644
--- a/spec/unit/knife/core/subcommand_loader_spec.rb
+++ b/spec/unit/knife/core/subcommand_loader_spec.rb
@@ -15,12 +15,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::SubcommandLoader do
- let(:loader) { Chef::Knife::SubcommandLoader.new(File.join(CHEF_SPEC_DATA, 'knife-site-subcommands')) }
- let(:home) { File.join(CHEF_SPEC_DATA, 'knife-home') }
- let(:plugin_dir) { File.join(home, '.chef', 'plugins', 'knife') }
+ let(:loader) { Chef::Knife::SubcommandLoader.new(File.join(CHEF_SPEC_DATA, "knife-site-subcommands")) }
+ let(:home) { File.join(CHEF_SPEC_DATA, "knife-home") }
+ let(:plugin_dir) { File.join(home, ".chef", "plugins", "knife") }
before do
allow(ChefConfig).to receive(:windows?) { false }
@@ -31,29 +31,29 @@ describe Chef::Knife::SubcommandLoader do
Chef::Util::PathHelper.class_variable_set(:@@home_dir, nil)
end
- let(:config_dir) { File.join(CHEF_SPEC_DATA, 'knife-site-subcommands') }
+ let(:config_dir) { File.join(CHEF_SPEC_DATA, "knife-site-subcommands") }
describe "#for_config" do
context "when ~/.chef/plugin_manifest.json exists" do
before do
- allow(File).to receive(:exist?).with(File.join(home, '.chef', 'plugin_manifest.json')).and_return(true)
+ allow(File).to receive(:exist?).with(File.join(home, ".chef", "plugin_manifest.json")).and_return(true)
end
it "creates a HashedCommandLoader with the manifest has _autogenerated_command_paths" do
- allow(File).to receive(:read).with(File.join(home, '.chef', 'plugin_manifest.json')).and_return("{ \"_autogenerated_command_paths\": {}}")
+ allow(File).to receive(:read).with(File.join(home, ".chef", "plugin_manifest.json")).and_return("{ \"_autogenerated_command_paths\": {}}")
expect(Chef::Knife::SubcommandLoader.for_config(config_dir)).to be_a Chef::Knife::SubcommandLoader::HashedCommandLoader
end
it "creates a CustomManifestLoader with then manifest has a key other than _autogenerated_command_paths" do
Chef::Config[:treat_deprecation_warnings_as_errors] = false
- allow(File).to receive(:read).with(File.join(home, '.chef', 'plugin_manifest.json')).and_return("{ \"plugins\": {}}")
+ allow(File).to receive(:read).with(File.join(home, ".chef", "plugin_manifest.json")).and_return("{ \"plugins\": {}}")
expect(Chef::Knife::SubcommandLoader.for_config(config_dir)).to be_a Chef::Knife::SubcommandLoader::CustomManifestLoader
end
end
context "when ~/.chef/plugin_manifest.json does not exist" do
before do
- allow(File).to receive(:exist?).with(File.join(home, '.chef', 'plugin_manifest.json')).and_return(false)
+ allow(File).to receive(:exist?).with(File.join(home, ".chef", "plugin_manifest.json")).and_return(false)
end
it "creates a GemGlobLoader" do
diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb
index 2c3b067e4f..b5b6a0a179 100644
--- a/spec/unit/knife/core/ui_spec.rb
+++ b/spec/unit/knife/core/ui_spec.rb
@@ -19,7 +19,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::UI do
before do
@@ -33,10 +33,10 @@ describe Chef::Knife::UI do
end
describe "edit" do
- ruby_for_json = { 'foo' => 'bar' }
+ ruby_for_json = { "foo" => "bar" }
json_from_ruby = "{\n \"foo\": \"bar\"\n}"
json_from_editor = "{\n \"bar\": \"foo\"\n}"
- ruby_from_editor = { 'bar' => 'foo' }
+ ruby_from_editor = { "bar" => "foo" }
my_editor = "veeeye"
temp_path = "/tmp/bar/baz"
@@ -66,12 +66,12 @@ describe Chef::Knife::UI do
before do
@ui.config[:disable_editing] = false
@ui.config[:editor] = my_editor
- @mock = double('Tempfile')
+ @mock = double("Tempfile")
expect(@mock).to receive(:sync=).with(true)
expect(@mock).to receive(:puts).with(json_from_ruby)
expect(@mock).to receive(:close)
expect(@mock).to receive(:path).at_least(:once).and_return(temp_path)
- expect(Tempfile).to receive(:open).with([ 'knife-edit-', '.json' ]).and_yield(@mock)
+ expect(Tempfile).to receive(:open).with([ "knife-edit-", ".json" ]).and_yield(@mock)
end
context "and the editor works" do
before do
@@ -114,8 +114,8 @@ describe Chef::Knife::UI do
before do
@ui.config[:disable_editing] = false
@ui.config[:editor] = my_editor
- @tempfile = Tempfile.new([ 'knife-edit-', '.json' ])
- expect(Tempfile).to receive(:open).with([ 'knife-edit-', '.json' ]).and_yield(@tempfile)
+ @tempfile = Tempfile.new([ "knife-edit-", ".json" ])
+ expect(Tempfile).to receive(:open).with([ "knife-edit-", ".json" ]).and_yield(@tempfile)
end
context "and the editor works" do
@@ -192,7 +192,7 @@ describe Chef::Knife::UI do
end
it "formats hashes appropriately" do
- @ui.output({'hi' => 'a', 'lo' => 'b' })
+ @ui.output({"hi" => "a", "lo" => "b" })
expect(@out.string).to eq <<EOM
hi: a
lo: b
@@ -205,7 +205,7 @@ EOM
end
it "formats arrays appropriately" do
- @ui.output([ 'a', 'b' ])
+ @ui.output([ "a", "b" ])
expect(@out.string).to eq <<EOM
a
b
@@ -218,17 +218,17 @@ EOM
end
it "formats single-member arrays appropriately" do
- @ui.output([ 'a' ])
+ @ui.output([ "a" ])
expect(@out.string).to eq("a\n")
end
it "formats nested single-member arrays appropriately" do
- @ui.output([ [ 'a' ] ])
+ @ui.output([ [ "a" ] ])
expect(@out.string).to eq("a\n")
end
it "formats nested arrays appropriately" do
- @ui.output([ [ 'a', 'b' ], [ 'c', 'd' ]])
+ @ui.output([ [ "a", "b" ], [ "c", "d" ]])
expect(@out.string).to eq <<EOM
a
b
@@ -239,7 +239,7 @@ EOM
end
it "formats nested arrays with single- and empty subarrays appropriately" do
- @ui.output([ [ 'a', 'b' ], [ 'c' ], [], [ 'd', 'e' ]])
+ @ui.output([ [ "a", "b" ], [ "c" ], [], [ "d", "e" ]])
expect(@out.string).to eq <<EOM
a
b
@@ -253,7 +253,7 @@ EOM
end
it "formats arrays of hashes with extra lines in between for readability" do
- @ui.output([ { 'a' => 'b', 'c' => 'd' }, { 'x' => 'y' }, { 'm' => 'n', 'o' => 'p' }])
+ @ui.output([ { "a" => "b", "c" => "d" }, { "x" => "y" }, { "m" => "n", "o" => "p" }])
expect(@out.string).to eq <<EOM
a: b
c: d
@@ -266,7 +266,7 @@ EOM
end
it "formats hashes with empty array members appropriately" do
- @ui.output({ 'a' => [], 'b' => 'c' })
+ @ui.output({ "a" => [], "b" => "c" })
expect(@out.string).to eq <<EOM
a:
b: c
@@ -274,7 +274,7 @@ EOM
end
it "formats hashes with single-member array values appropriately" do
- @ui.output({ 'a' => [ 'foo' ], 'b' => 'c' })
+ @ui.output({ "a" => [ "foo" ], "b" => "c" })
expect(@out.string).to eq <<EOM
a: foo
b: c
@@ -282,7 +282,7 @@ EOM
end
it "formats hashes with array members appropriately" do
- @ui.output({ 'a' => [ 'foo', 'bar' ], 'b' => 'c' })
+ @ui.output({ "a" => [ "foo", "bar" ], "b" => "c" })
expect(@out.string).to eq <<EOM
a:
foo
@@ -292,7 +292,7 @@ EOM
end
it "formats hashes with single-member nested array values appropriately" do
- @ui.output({ 'a' => [ [ 'foo' ] ], 'b' => 'c' })
+ @ui.output({ "a" => [ [ "foo" ] ], "b" => "c" })
expect(@out.string).to eq <<EOM
a:
foo
@@ -301,14 +301,14 @@ EOM
end
it "formats hashes with nested array values appropriately" do
- @ui.output({ 'a' => [ [ 'foo', 'bar' ], [ 'baz', 'bjork' ] ], 'b' => 'c' })
+ @ui.output({ "a" => [ [ "foo", "bar" ], [ "baz", "bjork" ] ], "b" => "c" })
# XXX: using a HEREDOC at this point results in a line with required spaces which auto-whitespace removal settings
# on editors will remove and will break this test.
expect(@out.string).to eq("a:\n foo\n bar\n \n baz\n bjork\nb: c\n")
end
it "formats hashes with hash values appropriately" do
- @ui.output({ 'a' => { 'aa' => 'bb', 'cc' => 'dd' }, 'b' => 'c' })
+ @ui.output({ "a" => { "aa" => "bb", "cc" => "dd" }, "b" => "c" })
expect(@out.string).to eq <<EOM
a:
aa: bb
@@ -318,7 +318,7 @@ EOM
end
it "formats hashes with empty hash values appropriately" do
- @ui.output({ 'a' => { }, 'b' => 'c' })
+ @ui.output({ "a" => { }, "b" => "c" })
expect(@out.string).to eq <<EOM
a:
b: c
@@ -432,7 +432,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
@@ -464,7 +464,7 @@ EOM
let(:output) {stdout.string}
let(:question) { "monkeys rule" }
- let(:answer) { 'y' }
+ let(:answer) { "y" }
let(:default_choice) { nil }
let(:append_instructions) { true }
@@ -583,7 +583,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 d022cc7f7d..3cca61be6b 100644
--- a/spec/unit/knife/data_bag_create_spec.rb
+++ b/spec/unit/knife/data_bag_create_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tempfile'
+require "spec_helper"
+require "tempfile"
describe Chef::Knife::DataBagCreate do
let(:knife) do
@@ -47,7 +47,7 @@ describe Chef::Knife::DataBagCreate do
end
it "tries to create a data bag with an invalid name when given one argument" do
- knife.name_args = ['invalid&char']
+ knife.name_args = ["invalid&char"]
expect(Chef::DataBag).to receive(:validate_name!).with(knife.name_args[0]).and_raise(Chef::Exceptions::InvalidDataBagName)
expect {knife.run}.to exit_with_code(1)
end
@@ -75,7 +75,7 @@ describe Chef::Knife::DataBagCreate do
it "creates a data bag item" do
expect(knife).to receive(:create_object).and_yield(raw_hash)
expect(knife).to receive(:encryption_secret_provided?).and_return(false)
- expect(rest).to receive(:post).with("data", {'name' => bag_name}).ordered
+ expect(rest).to receive(:post).with("data", {"name" => bag_name}).ordered
expect(rest).to receive(:post).with("data/#{bag_name}", item).ordered
knife.run
diff --git a/spec/unit/knife/data_bag_edit_spec.rb b/spec/unit/knife/data_bag_edit_spec.rb
index f1bcae990b..4e55a9386e 100644
--- a/spec/unit/knife/data_bag_edit_spec.rb
+++ b/spec/unit/knife/data_bag_edit_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tempfile'
+require "spec_helper"
+require "tempfile"
describe Chef::Knife::DataBagEdit do
before do
diff --git a/spec/unit/knife/data_bag_from_file_spec.rb b/spec/unit/knife/data_bag_from_file_spec.rb
index ddf877d9f7..387dfc7554 100644
--- a/spec/unit/knife/data_bag_from_file_spec.rb
+++ b/spec/unit/knife/data_bag_from_file_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/data_bag_item'
-require 'chef/encrypted_data_bag_item'
-require 'tempfile'
+require "chef/data_bag_item"
+require "chef/encrypted_data_bag_item"
+require "tempfile"
Chef::Knife::DataBagFromFile.load_deps
diff --git a/spec/unit/knife/data_bag_secret_options_spec.rb b/spec/unit/knife/data_bag_secret_options_spec.rb
index 0a2d8ca4bf..71a6bf7af5 100644
--- a/spec/unit/knife/data_bag_secret_options_spec.rb
+++ b/spec/unit/knife/data_bag_secret_options_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/knife'
-require 'chef/config'
-require 'tempfile'
+require "spec_helper"
+require "chef/knife"
+require "chef/config"
+require "tempfile"
class ExampleDataBagCommand < Chef::Knife
include Chef::Knife::DataBagSecretOptions
diff --git a/spec/unit/knife/data_bag_show_spec.rb b/spec/unit/knife/data_bag_show_spec.rb
index 48a0071b49..427d3e4d1b 100644
--- a/spec/unit/knife/data_bag_show_spec.rb
+++ b/spec/unit/knife/data_bag_show_spec.rb
@@ -17,12 +17,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/data_bag_item'
-require 'chef/encrypted_data_bag_item'
-require 'chef/json_compat'
-require 'tempfile'
+require "chef/data_bag_item"
+require "chef/encrypted_data_bag_item"
+require "chef/json_compat"
+require "tempfile"
describe Chef::Knife::DataBagShow do
diff --git a/spec/unit/knife/environment_compare_spec.rb b/spec/unit/knife/environment_compare_spec.rb
index 14dc5c52cf..bf2c2c15f0 100644
--- a/spec/unit/knife/environment_compare_spec.rb
+++ b/spec/unit/knife/environment_compare_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::EnvironmentCompare do
before(:each) do
@@ -40,15 +40,15 @@ describe Chef::Knife::EnvironmentCompare do
allow(@knife).to receive(:cookbook_list).and_return(@cookbooks)
- @rest_double = double('rest')
+ @rest_double = double("rest")
allow(@knife).to receive(:rest).and_return(@rest_double)
- @cookbook_names = ['apache2', 'mysql', 'foo', 'bar', 'dummy', 'chef_handler']
- @base_url = 'https://server.example.com/cookbooks'
+ @cookbook_names = ["apache2", "mysql", "foo", "bar", "dummy", "chef_handler"]
+ @base_url = "https://server.example.com/cookbooks"
@cookbook_data = {}
@cookbook_names.each do |item|
- @cookbook_data[item] = {'url' => "#{@base_url}/#{item}",
- 'versions' => [{'version' => '1.0.1',
- 'url' => "#{@base_url}/#{item}/1.0.1"}]}
+ @cookbook_data[item] = {"url" => "#{@base_url}/#{item}",
+ "versions" => [{"version" => "1.0.1",
+ "url" => "#{@base_url}/#{item}/1.0.1"}]}
end
allow(@rest_double).to receive(:get).with("/cookbooks?num_versions=1").and_return(@cookbook_data)
@@ -57,25 +57,25 @@ describe Chef::Knife::EnvironmentCompare do
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
end
- describe 'run' do
- it 'should display only cookbooks with version constraints' do
- @knife.config[:format] = 'summary'
+ describe "run" do
+ it "should display only cookbooks with version constraints" do
+ @knife.config[:format] = "summary"
@knife.run
@environments.each do |item, url|
expect(@stdout.string).to match /#{item}/ and expect(@stdout.string.lines.count).to be 4
end
end
- it 'should display 4 number of lines' do
- @knife.config[:format] = 'summary'
+ it "should display 4 number of lines" do
+ @knife.config[:format] = "summary"
@knife.run
expect(@stdout.string.lines.count).to be 4
end
end
- describe 'with -m or --mismatch' do
- it 'should display only cookbooks that have mismatching version constraints' do
- @knife.config[:format] = 'summary'
+ describe "with -m or --mismatch" do
+ it "should display only cookbooks that have mismatching version constraints" do
+ @knife.config[:format] = "summary"
@knife.config[:mismatch] = true
@knife.run
@constraints.each do |item, ver|
@@ -83,17 +83,17 @@ describe Chef::Knife::EnvironmentCompare do
end
end
- it 'should display 3 number of lines' do
- @knife.config[:format] = 'summary'
+ it "should display 3 number of lines" do
+ @knife.config[:format] = "summary"
@knife.config[:mismatch] = true
@knife.run
expect(@stdout.string.lines.count).to be 3
end
end
- describe 'with -a or --all' do
- it 'should display all cookbooks' do
- @knife.config[:format] = 'summary'
+ describe "with -a or --all" do
+ it "should display all cookbooks" do
+ @knife.config[:format] = "summary"
@knife.config[:all] = true
@knife.run
@constraints.each do |item, ver|
@@ -101,8 +101,8 @@ describe Chef::Knife::EnvironmentCompare do
end
end
- it 'should display 8 number of lines' do
- @knife.config[:format] = 'summary'
+ it "should display 8 number of lines" do
+ @knife.config[:format] = "summary"
@knife.config[:all] = true
@knife.run
expect(@stdout.string.lines.count).to be 8
diff --git a/spec/unit/knife/environment_create_spec.rb b/spec/unit/knife/environment_create_spec.rb
index 04e45048ef..7cee275499 100644
--- a/spec/unit/knife/environment_create_spec.rb
+++ b/spec/unit/knife/environment_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::EnvironmentCreate do
before(:each) do
diff --git a/spec/unit/knife/environment_delete_spec.rb b/spec/unit/knife/environment_delete_spec.rb
index 95df6e15fe..262c87dcc6 100644
--- a/spec/unit/knife/environment_delete_spec.rb
+++ b/spec/unit/knife/environment_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::EnvironmentDelete do
before(:each) do
diff --git a/spec/unit/knife/environment_edit_spec.rb b/spec/unit/knife/environment_edit_spec.rb
index 61c2663a41..d23aa7234c 100644
--- a/spec/unit/knife/environment_edit_spec.rb
+++ b/spec/unit/knife/environment_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::EnvironmentEdit do
before(:each) do
diff --git a/spec/unit/knife/environment_from_file_spec.rb b/spec/unit/knife/environment_from_file_spec.rb
index 11ad23c919..9ff2aceb6a 100644
--- a/spec/unit/knife/environment_from_file_spec.rb
+++ b/spec/unit/knife/environment_from_file_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
Chef::Knife::EnvironmentFromFile.load_deps
@@ -39,7 +39,7 @@ describe Chef::Knife::EnvironmentFromFile do
describe "run" do
it "loads the environment data from a file and saves it" do
- expect(@knife.loader).to receive(:load_from).with('environments', 'spec.rb').and_return(@environment)
+ expect(@knife.loader).to receive(:load_from).with("environments", "spec.rb").and_return(@environment)
expect(@environment).to receive(:save)
@knife.run
end
diff --git a/spec/unit/knife/environment_list_spec.rb b/spec/unit/knife/environment_list_spec.rb
index 1d5462257d..b01c0e57ed 100644
--- a/spec/unit/knife/environment_list_spec.rb
+++ b/spec/unit/knife/environment_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::EnvironmentList do
before(:each) do
diff --git a/spec/unit/knife/environment_show_spec.rb b/spec/unit/knife/environment_show_spec.rb
index caac958f8e..1c9d687d8c 100644
--- a/spec/unit/knife/environment_show_spec.rb
+++ b/spec/unit/knife/environment_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::EnvironmentShow do
before(:each) do
diff --git a/spec/unit/knife/index_rebuild_spec.rb b/spec/unit/knife/index_rebuild_spec.rb
index 6c1ff7b98e..187f77ee1c 100644
--- a/spec/unit/knife/index_rebuild_spec.rb
+++ b/spec/unit/knife/index_rebuild_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::IndexRebuild do
diff --git a/spec/unit/knife/key_create_spec.rb b/spec/unit/knife/key_create_spec.rb
index 039dba7a44..4958f20321 100644
--- a/spec/unit/knife/key_create_spec.rb
+++ b/spec/unit/knife/key_create_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/knife/user_key_create'
-require 'chef/knife/client_key_create'
-require 'chef/knife/key_create'
-require 'chef/key'
+require "spec_helper"
+require "chef/knife/user_key_create"
+require "chef/knife/client_key_create"
+require "chef/knife/key_create"
+require "chef/key"
describe "key create commands that inherit knife" do
shared_examples_for "a key create command" do
diff --git a/spec/unit/knife/key_delete_spec.rb b/spec/unit/knife/key_delete_spec.rb
index 1d4b9f825f..65250df69f 100644
--- a/spec/unit/knife/key_delete_spec.rb
+++ b/spec/unit/knife/key_delete_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/knife/user_key_delete'
-require 'chef/knife/client_key_delete'
-require 'chef/knife/key_delete'
-require 'chef/key'
+require "spec_helper"
+require "chef/knife/user_key_delete"
+require "chef/knife/client_key_delete"
+require "chef/knife/key_delete"
+require "chef/key"
describe "key delete commands that inherit knife" do
shared_examples_for "a key delete command" do
diff --git a/spec/unit/knife/key_edit_spec.rb b/spec/unit/knife/key_edit_spec.rb
index 06b31ce71c..18f2cd45be 100644
--- a/spec/unit/knife/key_edit_spec.rb
+++ b/spec/unit/knife/key_edit_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/knife/user_key_edit'
-require 'chef/knife/client_key_edit'
-require 'chef/knife/key_edit'
-require 'chef/key'
+require "spec_helper"
+require "chef/knife/user_key_edit"
+require "chef/knife/client_key_edit"
+require "chef/knife/key_edit"
+require "chef/key"
describe "key edit commands that inherit knife" do
shared_examples_for "a key edit command" do
diff --git a/spec/unit/knife/key_helper.rb b/spec/unit/knife/key_helper.rb
index 36ababc09a..6a972d1e7b 100644
--- a/spec/unit/knife/key_helper.rb
+++ b/spec/unit/knife/key_helper.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
shared_examples_for "a knife key command" do
let(:stderr) { StringIO.new }
diff --git a/spec/unit/knife/key_list_spec.rb b/spec/unit/knife/key_list_spec.rb
index 775a7cdfb1..70caa249bb 100644
--- a/spec/unit/knife/key_list_spec.rb
+++ b/spec/unit/knife/key_list_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/knife/user_key_list'
-require 'chef/knife/client_key_list'
-require 'chef/knife/key_list'
-require 'chef/key'
+require "spec_helper"
+require "chef/knife/user_key_list"
+require "chef/knife/client_key_list"
+require "chef/knife/key_list"
+require "chef/key"
describe "key list commands that inherit knife" do
shared_examples_for "a key list command" do
diff --git a/spec/unit/knife/key_show_spec.rb b/spec/unit/knife/key_show_spec.rb
index f4923ef235..03b3062e62 100644
--- a/spec/unit/knife/key_show_spec.rb
+++ b/spec/unit/knife/key_show_spec.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/knife/user_key_show'
-require 'chef/knife/client_key_show'
-require 'chef/knife/key_show'
-require 'chef/key'
+require "spec_helper"
+require "chef/knife/user_key_show"
+require "chef/knife/client_key_show"
+require "chef/knife/key_show"
+require "chef/key"
describe "key show commands that inherit knife" do
shared_examples_for "a key show command" do
@@ -113,14 +113,14 @@ describe Chef::Knife::KeyShow do
context "when load_method is :load_by_user" do
it_should_behave_like "key show run command" do
let(:load_method) { :load_by_user }
- let(:actor_field_name) { 'user' }
+ let(:actor_field_name) { "user" }
end
end
context "when load_method is :load_by_client" do
it_should_behave_like "key show run command" do
let(:load_method) { :load_by_client }
- let(:actor_field_name) { 'user' }
+ let(:actor_field_name) { "user" }
end
end
end
diff --git a/spec/unit/knife/knife_help.rb b/spec/unit/knife/knife_help.rb
index 293bae17f4..d357239e6a 100644
--- a/spec/unit/knife/knife_help.rb
+++ b/spec/unit/knife/knife_help.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::Help do
before(:each) do
diff --git a/spec/unit/knife/node_bulk_delete_spec.rb b/spec/unit/knife/node_bulk_delete_spec.rb
index 57a8d0bf64..7106fdfc7b 100644
--- a/spec/unit/knife/node_bulk_delete_spec.rb
+++ b/spec/unit/knife/node_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::NodeBulkDelete do
before(:each) do
@@ -78,10 +78,10 @@ describe Chef::Knife::NodeBulkDelete do
end
it "should only delete nodes that match the regex" do
- @knife.name_args = ['adam']
- expect(@inflatedish_list['adam']).to receive(:destroy)
- expect(@inflatedish_list['brent']).not_to receive(:destroy)
- expect(@inflatedish_list['jacob']).not_to receive(:destroy)
+ @knife.name_args = ["adam"]
+ expect(@inflatedish_list["adam"]).to receive(:destroy)
+ expect(@inflatedish_list["brent"]).not_to receive(:destroy)
+ expect(@inflatedish_list["jacob"]).not_to receive(:destroy)
@knife.run
end
diff --git a/spec/unit/knife/node_delete_spec.rb b/spec/unit/knife/node_delete_spec.rb
index 0941d850e5..b2fd54219c 100644
--- a/spec/unit/knife/node_delete_spec.rb
+++ b/spec/unit/knife/node_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::NodeDelete do
before(:each) do
diff --git a/spec/unit/knife/node_edit_spec.rb b/spec/unit/knife/node_edit_spec.rb
index be42a15ee7..c7a99517a4 100644
--- a/spec/unit/knife/node_edit_spec.rb
+++ b/spec/unit/knife/node_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
Chef::Knife::NodeEdit.load_deps
describe Chef::Knife::NodeEdit do
@@ -30,7 +30,7 @@ describe Chef::Knife::NodeEdit do
Chef::Config[:node_name] = "webmonkey.example.com"
@knife = Chef::Knife::NodeEdit.new
@knife.config = {
- :editor => 'cat',
+ :editor => "cat",
:attribute => nil,
:print_after => nil,
}
diff --git a/spec/unit/knife/node_environment_set_spec.rb b/spec/unit/knife/node_environment_set_spec.rb
index 10267915d7..0888af05e9 100644
--- a/spec/unit/knife/node_environment_set_spec.rb
+++ b/spec/unit/knife/node_environment_set_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::NodeEnvironmentSet do
before(:each) do
@@ -39,7 +39,7 @@ describe Chef::Knife::NodeEnvironmentSet do
it "should update the environment" do
@knife.run
- expect(@node.chef_environment).to eq('bar')
+ expect(@node.chef_environment).to eq("bar")
end
it "should save the node" do
diff --git a/spec/unit/knife/node_from_file_spec.rb b/spec/unit/knife/node_from_file_spec.rb
index 623904753e..19ee8b52ff 100644
--- a/spec/unit/knife/node_from_file_spec.rb
+++ b/spec/unit/knife/node_from_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
Chef::Knife::NodeFromFile.load_deps
@@ -39,7 +39,7 @@ describe Chef::Knife::NodeFromFile do
describe "run" do
it "should load from a file" do
- expect(@knife.loader).to receive(:load_from).with('nodes', 'adam.rb').and_return(@node)
+ expect(@knife.loader).to receive(:load_from).with("nodes", "adam.rb").and_return(@node)
@knife.run
end
diff --git a/spec/unit/knife/node_list_spec.rb b/spec/unit/knife/node_list_spec.rb
index ec694cb040..c043d47b29 100644
--- a/spec/unit/knife/node_list_spec.rb
+++ b/spec/unit/knife/node_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::NodeList do
before(:each) do
diff --git a/spec/unit/knife/node_run_list_add_spec.rb b/spec/unit/knife/node_run_list_add_spec.rb
index 92fbfd23fe..e309878a22 100644
--- a/spec/unit/knife/node_run_list_add_spec.rb
+++ b/spec/unit/knife/node_run_list_add_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::NodeRunListAdd do
before(:each) do
@@ -40,7 +40,7 @@ describe Chef::Knife::NodeRunListAdd do
it "should add to the run list" do
@knife.run
- expect(@node.run_list[0]).to eq('role[monkey]')
+ expect(@node.run_list[0]).to eq("role[monkey]")
end
it "should save the node" do
diff --git a/spec/unit/knife/node_run_list_remove_spec.rb b/spec/unit/knife/node_run_list_remove_spec.rb
index a279a59635..f450dd8016 100644
--- a/spec/unit/knife/node_run_list_remove_spec.rb
+++ b/spec/unit/knife/node_run_list_remove_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::NodeRunListRemove do
before(:each) do
@@ -43,7 +43,7 @@ describe Chef::Knife::NodeRunListRemove do
it "should remove the item from the run list" do
@knife.run
- expect(@node.run_list[0]).not_to eq('role[monkey]')
+ expect(@node.run_list[0]).not_to eq("role[monkey]")
end
it "should save the node" do
@@ -53,50 +53,50 @@ describe Chef::Knife::NodeRunListRemove do
it "should print the run list" do
@knife.config[:print_after] = true
- expect(@knife.ui).to receive(:output).with({ "knifetest-node" => { 'run_list' => [] } })
+ expect(@knife.ui).to receive(:output).with({ "knifetest-node" => { "run_list" => [] } })
@knife.run
end
describe "run with a list of roles and recipes" do
it "should remove the items from the run list" do
- @node.run_list << 'role[monkey]'
- @node.run_list << 'recipe[duck::type]'
- @knife.name_args = [ 'adam', 'role[monkey],recipe[duck::type]' ]
+ @node.run_list << "role[monkey]"
+ @node.run_list << "recipe[duck::type]"
+ @knife.name_args = [ "adam", "role[monkey],recipe[duck::type]" ]
@knife.run
- expect(@node.run_list).not_to include('role[monkey]')
- expect(@node.run_list).not_to include('recipe[duck::type]')
+ expect(@node.run_list).not_to include("role[monkey]")
+ expect(@node.run_list).not_to include("recipe[duck::type]")
end
it "should remove the items from the run list when name args contains whitespace" do
- @node.run_list << 'role[monkey]'
- @node.run_list << 'recipe[duck::type]'
- @knife.name_args = [ 'adam', 'role[monkey], recipe[duck::type]' ]
+ @node.run_list << "role[monkey]"
+ @node.run_list << "recipe[duck::type]"
+ @knife.name_args = [ "adam", "role[monkey], recipe[duck::type]" ]
@knife.run
- expect(@node.run_list).not_to include('role[monkey]')
- expect(@node.run_list).not_to include('recipe[duck::type]')
+ expect(@node.run_list).not_to include("role[monkey]")
+ expect(@node.run_list).not_to include("recipe[duck::type]")
end
it "should remove the items from the run list when name args contains multiple run lists" do
- @node.run_list << 'role[blah]'
- @node.run_list << 'recipe[duck::type]'
- @knife.name_args = [ 'adam', 'role[monkey], recipe[duck::type]', 'role[blah]' ]
+ @node.run_list << "role[blah]"
+ @node.run_list << "recipe[duck::type]"
+ @knife.name_args = [ "adam", "role[monkey], recipe[duck::type]", "role[blah]" ]
@knife.run
- expect(@node.run_list).not_to include('role[monkey]')
- expect(@node.run_list).not_to include('recipe[duck::type]')
+ expect(@node.run_list).not_to include("role[monkey]")
+ expect(@node.run_list).not_to include("recipe[duck::type]")
end
it "should warn when the thing to remove is not in the runlist" do
- @node.run_list << 'role[blah]'
- @node.run_list << 'recipe[duck::type]'
- @knife.name_args = [ 'adam', 'role[blork]' ]
+ @node.run_list << "role[blah]"
+ @node.run_list << "recipe[duck::type]"
+ @knife.name_args = [ "adam", "role[blork]" ]
expect(@knife.ui).to receive(:warn).with("role[blork] is not in the run list")
@knife.run
end
it "should warn even more when the thing to remove is not in the runlist and unqualified" do
- @node.run_list << 'role[blah]'
- @node.run_list << 'recipe[duck::type]'
- @knife.name_args = [ 'adam', 'blork' ]
+ @node.run_list << "role[blah]"
+ @node.run_list << "recipe[duck::type]"
+ @knife.name_args = [ "adam", "blork" ]
expect(@knife.ui).to receive(:warn).with("blork is not in the run list")
expect(@knife.ui).to receive(:warn).with(/did you forget recipe\[\] or role\[\]/)
@knife.run
diff --git a/spec/unit/knife/node_run_list_set_spec.rb b/spec/unit/knife/node_run_list_set_spec.rb
index 68daaafd70..75eecfeb27 100644
--- a/spec/unit/knife/node_run_list_set_spec.rb
+++ b/spec/unit/knife/node_run_list_set_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::NodeRunListSet do
before(:each) do
@@ -38,7 +38,7 @@ describe Chef::Knife::NodeRunListSet do
it "should set the run list" do
@knife.run
- expect(@node.run_list[0]).to eq('role[monkey]')
+ expect(@node.run_list[0]).to eq("role[monkey]")
end
it "should save the node" do
diff --git a/spec/unit/knife/node_show_spec.rb b/spec/unit/knife/node_show_spec.rb
index 4806354b60..afc90dc1ed 100644
--- a/spec/unit/knife/node_show_spec.rb
+++ b/spec/unit/knife/node_show_spec.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::NodeShow do
let(:node) do
node = Chef::Node.new()
node.name("adam")
- node.run_list = ['role[base]']
+ node.run_list = ["role[base]"]
node
end
@@ -54,10 +54,10 @@ describe Chef::Knife::NodeShow do
end
it "should pretty print json" do
- knife.config[:format] = 'json'
+ knife.config[:format] = "json"
stdout = StringIO.new
allow(knife.ui).to receive(:stdout).and_return(stdout)
- expect(Chef::Node).to receive(:load).with('adam').and_return(node)
+ expect(Chef::Node).to receive(:load).with("adam").and_return(node)
knife.run
expect(stdout.string).to eql("{\n \"name\": \"adam\",\n \"chef_environment\": \"_default\",\n \"run_list\": [\n\n]\n,\n \"normal\": {\n\n }\n}\n")
end
diff --git a/spec/unit/knife/osc_user_create_spec.rb b/spec/unit/knife/osc_user_create_spec.rb
index e4ed78fe2b..006d50484d 100644
--- a/spec/unit/knife/osc_user_create_spec.rb
+++ b/spec/unit/knife/osc_user_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
Chef::Knife::OscUserCreate.load_deps
@@ -34,13 +34,13 @@ describe Chef::Knife::OscUserCreate do
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
allow(@knife.ui).to receive(:stderr).and_return(@stderr)
- @knife.name_args = [ 'a_user' ]
+ @knife.name_args = [ "a_user" ]
@knife.config[:user_password] = "foobar"
@user = Chef::User.new
@user.name "a_user"
@user_with_private_key = Chef::User.new
@user_with_private_key.name "a_user"
- @user_with_private_key.private_key 'private_key'
+ @user_with_private_key.private_key "private_key"
allow(@user).to receive(:create).and_return(@user_with_private_key)
allow(Chef::User).to receive(:new).and_return(@user)
allow(Chef::User).to receive(:from_hash).and_return(@user)
@@ -61,7 +61,7 @@ describe Chef::Knife::OscUserCreate do
end
it "exits with an error if password is blank" do
- @knife.config[:user_password] = ''
+ @knife.config[:user_password] = ""
expect { @knife.run }.to raise_error SystemExit
expect(@stderr.string).to match /You must specify a non-blank password/
end
@@ -86,7 +86,7 @@ describe Chef::Knife::OscUserCreate do
it "writes the private key to a file when --file is specified" do
@knife.config[:file] = "/tmp/a_file"
filehandle = double("filehandle")
- expect(filehandle).to receive(:print).with('private_key')
+ expect(filehandle).to receive(:print).with("private_key")
expect(File).to receive(:open).with("/tmp/a_file", "w").and_yield(filehandle)
@knife.run
end
diff --git a/spec/unit/knife/osc_user_delete_spec.rb b/spec/unit/knife/osc_user_delete_spec.rb
index 4a3ec4228f..c0e3b0fbf9 100644
--- a/spec/unit/knife/osc_user_delete_spec.rb
+++ b/spec/unit/knife/osc_user_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
# DEPRECATION NOTE
# This code only remains to support users still operating with
@@ -27,15 +27,15 @@ describe Chef::Knife::OscUserDelete do
before(:each) do
Chef::Knife::OscUserDelete.load_deps
@knife = Chef::Knife::OscUserDelete.new
- @knife.name_args = [ 'my_user' ]
+ @knife.name_args = [ "my_user" ]
end
- it 'deletes the user' do
- expect(@knife).to receive(:delete_object).with(Chef::User, 'my_user')
+ it "deletes the user" do
+ expect(@knife).to receive(:delete_object).with(Chef::User, "my_user")
@knife.run
end
- it 'prints usage and exits when a user name is not provided' do
+ it "prints usage and exits when a user name is not provided" do
@knife.name_args = []
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal)
diff --git a/spec/unit/knife/osc_user_edit_spec.rb b/spec/unit/knife/osc_user_edit_spec.rb
index 279f2e30ef..55574bdc38 100644
--- a/spec/unit/knife/osc_user_edit_spec.rb
+++ b/spec/unit/knife/osc_user_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
# DEPRECATION NOTE
# This code only remains to support users still operating with
@@ -32,18 +32,18 @@ describe Chef::Knife::OscUserEdit do
@knife = Chef::Knife::OscUserEdit.new
allow(@knife.ui).to receive(:stderr).and_return(@stderr)
allow(@knife.ui).to receive(:stdout).and_return(@stdout)
- @knife.name_args = [ 'my_user' ]
+ @knife.name_args = [ "my_user" ]
@knife.config[:disable_editing] = true
end
- it 'loads and edits the user' do
+ it "loads and edits the user" do
data = { :name => "my_user" }
allow(Chef::User).to receive(:load).with("my_user").and_return(data)
expect(@knife).to receive(:edit_data).with(data).and_return(data)
@knife.run
end
- it 'prints usage and exits when a user name is not provided' do
+ it "prints usage and exits when a user name is not provided" do
@knife.name_args = []
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal)
diff --git a/spec/unit/knife/osc_user_list_spec.rb b/spec/unit/knife/osc_user_list_spec.rb
index f496a414b8..bc86e4ce97 100644
--- a/spec/unit/knife/osc_user_list_spec.rb
+++ b/spec/unit/knife/osc_user_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
# DEPRECATION NOTE
# This code only remains to support users still operating with
@@ -29,7 +29,7 @@ describe Chef::Knife::OscUserList do
@knife = Chef::Knife::OscUserList.new
end
- it 'lists the users' do
+ it "lists the users" do
expect(Chef::User).to receive(:list)
expect(@knife).to receive(:format_list_for_display)
@knife.run
diff --git a/spec/unit/knife/osc_user_reregister_spec.rb b/spec/unit/knife/osc_user_reregister_spec.rb
index 989eb180f1..95fa2c2dc8 100644
--- a/spec/unit/knife/osc_user_reregister_spec.rb
+++ b/spec/unit/knife/osc_user_reregister_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
# DEPRECATION NOTE
# This code only remains to support users still operating with
@@ -27,31 +27,31 @@ describe Chef::Knife::OscUserReregister do
before(:each) 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")
+ @knife.name_args = [ "a_user" ]
+ @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)
end
- it 'prints usage and exits when a user name is not provided' do
+ it "prints usage and exits when a user name is not provided" do
@knife.name_args = []
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal)
expect { @knife.run }.to raise_error(SystemExit)
end
- it 'reregisters the user and prints the key' do
+ it "reregisters the user and prints the key" do
expect(@user_mock).to receive(:reregister).and_return(@user_mock)
@knife.run
expect(@stdout.string).to match( /private_key/ )
end
- it 'writes the private key to a file when --file is specified' do
+ it "writes the private key to a file when --file is specified" do
expect(@user_mock).to receive(:reregister).and_return(@user_mock)
- @knife.config[:file] = '/tmp/a_file'
+ @knife.config[:file] = "/tmp/a_file"
filehandle = StringIO.new
- expect(File).to receive(:open).with('/tmp/a_file', 'w').and_yield(filehandle)
+ expect(File).to receive(:open).with("/tmp/a_file", "w").and_yield(filehandle)
@knife.run
expect(filehandle.string).to eq("private_key")
end
diff --git a/spec/unit/knife/osc_user_show_spec.rb b/spec/unit/knife/osc_user_show_spec.rb
index 18d2086099..12f3bb069e 100644
--- a/spec/unit/knife/osc_user_show_spec.rb
+++ b/spec/unit/knife/osc_user_show_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
# DEPRECATION NOTE
# This code only remains to support users still operating with
@@ -27,17 +27,17 @@ describe Chef::Knife::OscUserShow do
before(:each) do
Chef::Knife::OscUserShow.load_deps
@knife = Chef::Knife::OscUserShow.new
- @knife.name_args = [ 'my_user' ]
- @user_mock = double('user_mock')
+ @knife.name_args = [ "my_user" ]
+ @user_mock = double("user_mock")
end
- it 'loads and displays the user' do
- expect(Chef::User).to receive(:load).with('my_user').and_return(@user_mock)
+ it "loads and displays the user" do
+ expect(Chef::User).to receive(:load).with("my_user").and_return(@user_mock)
expect(@knife).to receive(:format_for_display).with(@user_mock)
@knife.run
end
- it 'prints usage and exits when a user name is not provided' do
+ it "prints usage and exits when a user name is not provided" do
@knife.name_args = []
expect(@knife).to receive(:show_usage)
expect(@knife.ui).to receive(:fatal)
diff --git a/spec/unit/knife/raw_spec.rb b/spec/unit/knife/raw_spec.rb
index ab929abd39..14cdfbd614 100644
--- a/spec/unit/knife/raw_spec.rb
+++ b/spec/unit/knife/raw_spec.rb
@@ -15,11 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::Raw do
let(:rest) do
- r = double('Chef::Knife::Raw::RawInputServerAPI')
+ r = double("Chef::Knife::Raw::RawInputServerAPI")
allow(Chef::Knife::Raw::RawInputServerAPI).to receive(:new).and_return(r)
r
end
@@ -35,8 +35,8 @@ describe Chef::Knife::Raw do
it "should set the x-ops-request-source header when --proxy-auth is set" do
knife.config[:proxy_auth] = true
expect(rest).to receive(:request).with(:GET, "/nodes",
- { 'Content-Type' => 'application/json',
- 'x-ops-request-source' => 'web'}, false)
+ { "Content-Type" => "application/json",
+ "x-ops-request-source" => "web"}, false)
knife.run
end
end
diff --git a/spec/unit/knife/role_bulk_delete_spec.rb b/spec/unit/knife/role_bulk_delete_spec.rb
index 5b79e52a04..55bf05e806 100644
--- a/spec/unit/knife/role_bulk_delete_spec.rb
+++ b/spec/unit/knife/role_bulk_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleBulkDelete do
before(:each) do
diff --git a/spec/unit/knife/role_create_spec.rb b/spec/unit/knife/role_create_spec.rb
index fb748c51f6..23c747efc9 100644
--- a/spec/unit/knife/role_create_spec.rb
+++ b/spec/unit/knife/role_create_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleCreate do
before(:each) do
diff --git a/spec/unit/knife/role_delete_spec.rb b/spec/unit/knife/role_delete_spec.rb
index b1a0d90410..6d7d0d964e 100644
--- a/spec/unit/knife/role_delete_spec.rb
+++ b/spec/unit/knife/role_delete_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleDelete do
before(:each) do
diff --git a/spec/unit/knife/role_edit_spec.rb b/spec/unit/knife/role_edit_spec.rb
index 0975c6458d..8026d8a21d 100644
--- a/spec/unit/knife/role_edit_spec.rb
+++ b/spec/unit/knife/role_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleEdit do
before(:each) do
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 f286d5fd0d..743aa55d9d 100644
--- a/spec/unit/knife/role_env_run_list_add_spec.rb
+++ b/spec/unit/knife/role_env_run_list_add_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleEnvRunListAdd do
before(:each) do
@@ -48,7 +48,7 @@ describe Chef::Knife::RoleEnvRunListAdd do
it "should have a QA environment" do
@knife.run
- expect(@role.active_run_list_for('QA')).to eq('QA')
+ expect(@role.active_run_list_for("QA")).to eq("QA")
end
it "should load the role named will" do
@@ -58,7 +58,7 @@ describe Chef::Knife::RoleEnvRunListAdd do
it "should be able to add an environment specific run list" do
@knife.run
- expect(@role.run_list_for('QA')[0]).to eq('role[monkey]')
+ expect(@role.run_list_for("QA")[0]).to eq("role[monkey]")
end
it "should save the role" do
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 525376c358..6a5157d5d4 100644
--- a/spec/unit/knife/role_env_run_list_clear_spec.rb
+++ b/spec/unit/knife/role_env_run_list_clear_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleEnvRunListClear do
before(:each) do
@@ -60,7 +60,7 @@ describe Chef::Knife::RoleEnvRunListClear do
it "should remove the item from the run list" do
@setup.run
@knife.run
- expect(@role.run_list_for('QA')[0]).to be_nil
+ expect(@role.run_list_for("QA")[0]).to be_nil
expect(@role.run_list[0]).to be_nil
end
@@ -82,15 +82,15 @@ describe Chef::Knife::RoleEnvRunListClear do
@setup.run
@setup.name_args = [ "will", "PRD", "recipe[orange::chicken]", "role[monkey]", "recipe[duck::type]", "role[person]", "role[bird]", "role[town]" ]
@setup.run
- @knife.name_args = [ 'will', 'QA' ]
+ @knife.name_args = [ "will", "QA" ]
@knife.run
- expect(@role.run_list_for('QA')[0]).to be_nil
- expect(@role.run_list_for('PRD')[0]).to eq('recipe[orange::chicken]')
- expect(@role.run_list_for('PRD')[1]).to eq('role[monkey]')
- expect(@role.run_list_for('PRD')[2]).to eq('recipe[duck::type]')
- expect(@role.run_list_for('PRD')[3]).to eq('role[person]')
- expect(@role.run_list_for('PRD')[4]).to eq('role[bird]')
- expect(@role.run_list_for('PRD')[5]).to eq('role[town]')
+ expect(@role.run_list_for("QA")[0]).to be_nil
+ expect(@role.run_list_for("PRD")[0]).to eq("recipe[orange::chicken]")
+ expect(@role.run_list_for("PRD")[1]).to eq("role[monkey]")
+ expect(@role.run_list_for("PRD")[2]).to eq("recipe[duck::type]")
+ expect(@role.run_list_for("PRD")[3]).to eq("role[person]")
+ expect(@role.run_list_for("PRD")[4]).to eq("role[bird]")
+ expect(@role.run_list_for("PRD")[5]).to eq("role[town]")
end
end
end
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 a15d0af691..329ac2aff0 100644
--- a/spec/unit/knife/role_env_run_list_remove_spec.rb
+++ b/spec/unit/knife/role_env_run_list_remove_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleEnvRunListRemove do
before(:each) do
@@ -60,8 +60,8 @@ describe Chef::Knife::RoleEnvRunListRemove do
it "should remove the item from the run list" do
@setup.run
@knife.run
- expect(@role.run_list_for('QA')[0]).not_to eq('role[monkey]')
- expect(@role.run_list_for('QA')[0]).to eq('role[person]')
+ expect(@role.run_list_for("QA")[0]).not_to eq("role[monkey]")
+ expect(@role.run_list_for("QA")[0]).to eq("role[person]")
expect(@role.run_list[0]).to be_nil
end
@@ -83,22 +83,22 @@ describe Chef::Knife::RoleEnvRunListRemove do
@setup.run
@setup.name_args = [ "will", "PRD", "recipe[orange::chicken]", "role[monkey]", "recipe[duck::type]", "role[person]", "role[bird]", "role[town]" ]
@setup.run
- @knife.name_args = [ 'will', 'QA', 'role[monkey]' ]
+ @knife.name_args = [ "will", "QA", "role[monkey]" ]
@knife.run
- @knife.name_args = [ 'will', 'QA', 'recipe[duck::type]' ]
+ @knife.name_args = [ "will", "QA", "recipe[duck::type]" ]
@knife.run
- expect(@role.run_list_for('QA')).not_to include('role[monkey]')
- expect(@role.run_list_for('QA')).not_to include('recipe[duck::type]')
- expect(@role.run_list_for('QA')[0]).to eq('recipe[orange::chicken]')
- expect(@role.run_list_for('QA')[1]).to eq('role[person]')
- expect(@role.run_list_for('QA')[2]).to eq('role[bird]')
- expect(@role.run_list_for('QA')[3]).to eq('role[town]')
- expect(@role.run_list_for('PRD')[0]).to eq('recipe[orange::chicken]')
- expect(@role.run_list_for('PRD')[1]).to eq('role[monkey]')
- expect(@role.run_list_for('PRD')[2]).to eq('recipe[duck::type]')
- expect(@role.run_list_for('PRD')[3]).to eq('role[person]')
- expect(@role.run_list_for('PRD')[4]).to eq('role[bird]')
- expect(@role.run_list_for('PRD')[5]).to eq('role[town]')
+ expect(@role.run_list_for("QA")).not_to include("role[monkey]")
+ expect(@role.run_list_for("QA")).not_to include("recipe[duck::type]")
+ expect(@role.run_list_for("QA")[0]).to eq("recipe[orange::chicken]")
+ expect(@role.run_list_for("QA")[1]).to eq("role[person]")
+ expect(@role.run_list_for("QA")[2]).to eq("role[bird]")
+ expect(@role.run_list_for("QA")[3]).to eq("role[town]")
+ expect(@role.run_list_for("PRD")[0]).to eq("recipe[orange::chicken]")
+ expect(@role.run_list_for("PRD")[1]).to eq("role[monkey]")
+ expect(@role.run_list_for("PRD")[2]).to eq("recipe[duck::type]")
+ expect(@role.run_list_for("PRD")[3]).to eq("role[person]")
+ expect(@role.run_list_for("PRD")[4]).to eq("role[bird]")
+ expect(@role.run_list_for("PRD")[5]).to eq("role[town]")
end
end
end
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 ea48601b8d..bb7b79e3f0 100644
--- a/spec/unit/knife/role_env_run_list_replace_spec.rb
+++ b/spec/unit/knife/role_env_run_list_replace_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleEnvRunListReplace do
before(:each) do
@@ -60,8 +60,8 @@ describe Chef::Knife::RoleEnvRunListReplace do
it "should remove the item from the run list" do
@setup.run
@knife.run
- expect(@role.run_list_for('QA')[1]).not_to eq('role[dude]')
- expect(@role.run_list_for('QA')[1]).to eq('role[person]')
+ expect(@role.run_list_for("QA")[1]).not_to eq("role[dude]")
+ expect(@role.run_list_for("QA")[1]).to eq("role[person]")
expect(@role.run_list[0]).to be_nil
end
@@ -83,24 +83,24 @@ describe Chef::Knife::RoleEnvRunListReplace do
@setup.run
@setup.name_args = [ "will", "PRD", "recipe[orange::chicken]", "role[monkey]", "recipe[duck::type]", "role[person]", "role[bird]", "role[town]" ]
@setup.run
- @knife.name_args = [ 'will', 'QA', 'role[monkey]', 'role[gibbon]' ]
+ @knife.name_args = [ "will", "QA", "role[monkey]", "role[gibbon]" ]
@knife.run
- @knife.name_args = [ 'will', 'QA', 'recipe[duck::type]', 'recipe[duck::mallard]' ]
+ @knife.name_args = [ "will", "QA", "recipe[duck::type]", "recipe[duck::mallard]" ]
@knife.run
- expect(@role.run_list_for('QA')).not_to include('role[monkey]')
- expect(@role.run_list_for('QA')).not_to include('recipe[duck::type]')
- expect(@role.run_list_for('QA')[0]).to eq('recipe[orange::chicken]')
- expect(@role.run_list_for('QA')[1]).to eq('role[gibbon]')
- expect(@role.run_list_for('QA')[2]).to eq('recipe[duck::mallard]')
- expect(@role.run_list_for('QA')[3]).to eq('role[person]')
- expect(@role.run_list_for('QA')[4]).to eq('role[bird]')
- expect(@role.run_list_for('QA')[5]).to eq('role[town]')
- expect(@role.run_list_for('PRD')[0]).to eq('recipe[orange::chicken]')
- expect(@role.run_list_for('PRD')[1]).to eq('role[monkey]')
- expect(@role.run_list_for('PRD')[2]).to eq('recipe[duck::type]')
- expect(@role.run_list_for('PRD')[3]).to eq('role[person]')
- expect(@role.run_list_for('PRD')[4]).to eq('role[bird]')
- expect(@role.run_list_for('PRD')[5]).to eq('role[town]')
+ expect(@role.run_list_for("QA")).not_to include("role[monkey]")
+ expect(@role.run_list_for("QA")).not_to include("recipe[duck::type]")
+ expect(@role.run_list_for("QA")[0]).to eq("recipe[orange::chicken]")
+ expect(@role.run_list_for("QA")[1]).to eq("role[gibbon]")
+ expect(@role.run_list_for("QA")[2]).to eq("recipe[duck::mallard]")
+ expect(@role.run_list_for("QA")[3]).to eq("role[person]")
+ expect(@role.run_list_for("QA")[4]).to eq("role[bird]")
+ expect(@role.run_list_for("QA")[5]).to eq("role[town]")
+ expect(@role.run_list_for("PRD")[0]).to eq("recipe[orange::chicken]")
+ expect(@role.run_list_for("PRD")[1]).to eq("role[monkey]")
+ expect(@role.run_list_for("PRD")[2]).to eq("recipe[duck::type]")
+ expect(@role.run_list_for("PRD")[3]).to eq("role[person]")
+ expect(@role.run_list_for("PRD")[4]).to eq("role[bird]")
+ expect(@role.run_list_for("PRD")[5]).to eq("role[town]")
expect(@role.run_list[0]).to be_nil
end
end
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 f3abb86fcf..0932b07ffd 100644
--- a/spec/unit/knife/role_env_run_list_set_spec.rb
+++ b/spec/unit/knife/role_env_run_list_set_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleEnvRunListSet do
before(:each) do
@@ -60,9 +60,9 @@ describe Chef::Knife::RoleEnvRunListSet do
it "should replace all the items in the runlist with what is specified" do
@setup.run
@knife.run
- expect(@role.run_list_for('QA')[0]).to eq("role[owen]")
- expect(@role.run_list_for('QA')[1]).to eq("role[mauntel]")
- expect(@role.run_list_for('QA')[2]).to be_nil
+ expect(@role.run_list_for("QA")[0]).to eq("role[owen]")
+ expect(@role.run_list_for("QA")[1]).to eq("role[mauntel]")
+ expect(@role.run_list_for("QA")[2]).to be_nil
expect(@role.run_list[0]).to be_nil
end
@@ -86,15 +86,15 @@ describe Chef::Knife::RoleEnvRunListSet do
@setup.run
@knife.name_args = [ "will", "QA", "role[coke]", "role[pepsi]" ]
@knife.run
- expect(@role.run_list_for('QA')[0]).to eq("role[coke]")
- expect(@role.run_list_for('QA')[1]).to eq("role[pepsi]")
- expect(@role.run_list_for('QA')[2]).to be_nil
- expect(@role.run_list_for('PRD')[0]).to eq('recipe[orange::chicken]')
- expect(@role.run_list_for('PRD')[1]).to eq('role[monkey]')
- expect(@role.run_list_for('PRD')[2]).to eq('recipe[duck::type]')
- expect(@role.run_list_for('PRD')[3]).to eq('role[person]')
- expect(@role.run_list_for('PRD')[4]).to eq('role[bird]')
- expect(@role.run_list_for('PRD')[5]).to eq('role[town]')
+ expect(@role.run_list_for("QA")[0]).to eq("role[coke]")
+ expect(@role.run_list_for("QA")[1]).to eq("role[pepsi]")
+ expect(@role.run_list_for("QA")[2]).to be_nil
+ expect(@role.run_list_for("PRD")[0]).to eq("recipe[orange::chicken]")
+ expect(@role.run_list_for("PRD")[1]).to eq("role[monkey]")
+ expect(@role.run_list_for("PRD")[2]).to eq("recipe[duck::type]")
+ expect(@role.run_list_for("PRD")[3]).to eq("role[person]")
+ expect(@role.run_list_for("PRD")[4]).to eq("role[bird]")
+ expect(@role.run_list_for("PRD")[5]).to eq("role[town]")
expect(@role.run_list[0]).to be_nil
end
end
diff --git a/spec/unit/knife/role_from_file_spec.rb b/spec/unit/knife/role_from_file_spec.rb
index 9379f08de3..b08d4bfc59 100644
--- a/spec/unit/knife/role_from_file_spec.rb
+++ b/spec/unit/knife/role_from_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
Chef::Knife::RoleFromFile.load_deps
@@ -39,7 +39,7 @@ describe Chef::Knife::RoleFromFile do
describe "run" do
it "should load from a file" do
- expect(@knife.loader).to receive(:load_from).with('roles', 'adam.rb').and_return(@role)
+ expect(@knife.loader).to receive(:load_from).with("roles", "adam.rb").and_return(@role)
@knife.run
end
@@ -60,8 +60,8 @@ describe Chef::Knife::RoleFromFile do
describe "run with multiple arguments" do
it "should load each file" do
@knife.name_args = [ "adam.rb", "caleb.rb" ]
- expect(@knife.loader).to receive(:load_from).with('roles', 'adam.rb').and_return(@role)
- expect(@knife.loader).to receive(:load_from).with('roles', 'caleb.rb').and_return(@role)
+ expect(@knife.loader).to receive(:load_from).with("roles", "adam.rb").and_return(@role)
+ expect(@knife.loader).to receive(:load_from).with("roles", "caleb.rb").and_return(@role)
@knife.run
end
end
diff --git a/spec/unit/knife/role_list_spec.rb b/spec/unit/knife/role_list_spec.rb
index 65c4f94ff2..0cb4e08337 100644
--- a/spec/unit/knife/role_list_spec.rb
+++ b/spec/unit/knife/role_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleList do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_add_spec.rb b/spec/unit/knife/role_run_list_add_spec.rb
index d61c114912..425dd0a9a1 100644
--- a/spec/unit/knife/role_run_list_add_spec.rb
+++ b/spec/unit/knife/role_run_list_add_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleRunListAdd do
before(:each) do
diff --git a/spec/unit/knife/role_run_list_clear_spec.rb b/spec/unit/knife/role_run_list_clear_spec.rb
index e5a6e18673..42980467e2 100644
--- a/spec/unit/knife/role_run_list_clear_spec.rb
+++ b/spec/unit/knife/role_run_list_clear_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleRunListClear do
before(:each) do
@@ -78,7 +78,7 @@ describe Chef::Knife::RoleRunListClear do
it "should remove the items from the run list" do
@setup.name_args = [ "will", "recipe[orange::chicken]", "role[monkey]", "recipe[duck::type]", "role[person]", "role[bird]", "role[town]" ]
@setup.run
- @knife.name_args = [ 'will' ]
+ @knife.name_args = [ "will" ]
@knife.run
expect(@role.run_list[0]).to be_nil
end
diff --git a/spec/unit/knife/role_run_list_remove_spec.rb b/spec/unit/knife/role_run_list_remove_spec.rb
index 0f4adf253b..5c3da5c3f7 100644
--- a/spec/unit/knife/role_run_list_remove_spec.rb
+++ b/spec/unit/knife/role_run_list_remove_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleRunListRemove do
before(:each) do
@@ -59,7 +59,7 @@ describe Chef::Knife::RoleRunListRemove do
it "should remove the item from the run list" do
@setup.run
@knife.run
- expect(@role.run_list[0]).to eq('role[person]')
+ expect(@role.run_list[0]).to eq("role[person]")
expect(@role.run_list[1]).to be_nil
end
@@ -79,16 +79,16 @@ describe Chef::Knife::RoleRunListRemove do
it "should remove the items from the run list" do
@setup.name_args = [ "will", "recipe[orange::chicken]", "role[monkey]", "recipe[duck::type]", "role[person]", "role[bird]", "role[town]" ]
@setup.run
- @knife.name_args = [ 'will', 'role[monkey]' ]
+ @knife.name_args = [ "will", "role[monkey]" ]
@knife.run
- @knife.name_args = [ 'will', 'recipe[duck::type]' ]
+ @knife.name_args = [ "will", "recipe[duck::type]" ]
@knife.run
- expect(@role.run_list).not_to include('role[monkey]')
- expect(@role.run_list).not_to include('recipe[duck::type]')
- expect(@role.run_list[0]).to eq('recipe[orange::chicken]')
- expect(@role.run_list[1]).to eq('role[person]')
- expect(@role.run_list[2]).to eq('role[bird]')
- expect(@role.run_list[3]).to eq('role[town]')
+ expect(@role.run_list).not_to include("role[monkey]")
+ expect(@role.run_list).not_to include("recipe[duck::type]")
+ expect(@role.run_list[0]).to eq("recipe[orange::chicken]")
+ expect(@role.run_list[1]).to eq("role[person]")
+ expect(@role.run_list[2]).to eq("role[bird]")
+ expect(@role.run_list[3]).to eq("role[town]")
end
end
end
diff --git a/spec/unit/knife/role_run_list_replace_spec.rb b/spec/unit/knife/role_run_list_replace_spec.rb
index 2ff38f573c..44fb3caabc 100644
--- a/spec/unit/knife/role_run_list_replace_spec.rb
+++ b/spec/unit/knife/role_run_list_replace_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleRunListReplace do
before(:each) do
@@ -59,10 +59,10 @@ describe Chef::Knife::RoleRunListReplace do
it "should remove the item from the run list" do
@setup.run
@knife.run
- expect(@role.run_list[0]).to eq('role[monkey]')
- expect(@role.run_list[1]).not_to eq('role[dude]')
- expect(@role.run_list[1]).to eq('role[person]')
- expect(@role.run_list[2]).to eq('role[fixer]')
+ expect(@role.run_list[0]).to eq("role[monkey]")
+ expect(@role.run_list[1]).not_to eq("role[dude]")
+ expect(@role.run_list[1]).to eq("role[person]")
+ expect(@role.run_list[2]).to eq("role[fixer]")
expect(@role.run_list[3]).to be_nil
end
@@ -82,18 +82,18 @@ describe Chef::Knife::RoleRunListReplace do
it "should replace the items from the run list" do
@setup.name_args = [ "will", "recipe[orange::chicken]", "role[monkey]", "recipe[duck::type]", "role[person]", "role[bird]", "role[town]" ]
@setup.run
- @knife.name_args = [ 'will', 'role[monkey]', 'role[gibbon]' ]
+ @knife.name_args = [ "will", "role[monkey]", "role[gibbon]" ]
@knife.run
- @knife.name_args = [ 'will', 'recipe[duck::type]', 'recipe[duck::mallard]' ]
+ @knife.name_args = [ "will", "recipe[duck::type]", "recipe[duck::mallard]" ]
@knife.run
- expect(@role.run_list).not_to include('role[monkey]')
- expect(@role.run_list).not_to include('recipe[duck::type]')
- expect(@role.run_list[0]).to eq('recipe[orange::chicken]')
- expect(@role.run_list[1]).to eq('role[gibbon]')
- expect(@role.run_list[2]).to eq('recipe[duck::mallard]')
- expect(@role.run_list[3]).to eq('role[person]')
- expect(@role.run_list[4]).to eq('role[bird]')
- expect(@role.run_list[5]).to eq('role[town]')
+ expect(@role.run_list).not_to include("role[monkey]")
+ expect(@role.run_list).not_to include("recipe[duck::type]")
+ expect(@role.run_list[0]).to eq("recipe[orange::chicken]")
+ expect(@role.run_list[1]).to eq("role[gibbon]")
+ expect(@role.run_list[2]).to eq("recipe[duck::mallard]")
+ expect(@role.run_list[3]).to eq("role[person]")
+ expect(@role.run_list[4]).to eq("role[bird]")
+ expect(@role.run_list[5]).to eq("role[town]")
expect(@role.run_list[6]).to be_nil
end
end
diff --git a/spec/unit/knife/role_run_list_set_spec.rb b/spec/unit/knife/role_run_list_set_spec.rb
index 1350741f10..73d42cf2a2 100644
--- a/spec/unit/knife/role_run_list_set_spec.rb
+++ b/spec/unit/knife/role_run_list_set_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleRunListSet do
before(:each) do
diff --git a/spec/unit/knife/role_show_spec.rb b/spec/unit/knife/role_show_spec.rb
index b086136186..2b5b0eec18 100644
--- a/spec/unit/knife/role_show_spec.rb
+++ b/spec/unit/knife/role_show_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::RoleShow do
- let(:role) { 'base' }
+ let(:role) { "base" }
let(:knife) do
knife = Chef::Knife::RoleShow.new
@@ -27,21 +27,21 @@ describe Chef::Knife::RoleShow do
knife
end
- let(:role_mock) { double('role_mock') }
+ let(:role_mock) { double("role_mock") }
- describe 'run' do
- it 'should list the role' do
- expect(Chef::Role).to receive(:load).with('base').and_return(role_mock)
+ describe "run" do
+ it "should list the role" do
+ expect(Chef::Role).to receive(:load).with("base").and_return(role_mock)
expect(knife).to receive(:format_for_display).with(role_mock)
knife.run
end
- it 'should pretty print json' do
- knife.config[:format] = 'json'
+ it "should pretty print json" do
+ knife.config[:format] = "json"
stdout = StringIO.new
allow(knife.ui).to receive(:stdout).and_return(stdout)
fake_role_contents = {"foo"=>"bar", "baz"=>"qux"}
- expect(Chef::Role).to receive(:load).with('base').and_return(fake_role_contents)
+ expect(Chef::Role).to receive(:load).with("base").and_return(fake_role_contents)
knife.run
expect(stdout.string).to eql("{\n \"foo\": \"bar\",\n \"baz\": \"qux\"\n}\n")
end
@@ -49,7 +49,7 @@ describe Chef::Knife::RoleShow do
context "without a role name" do
let(:role) { }
- it 'should print usage and exit when a role name is not provided' do
+ it "should print usage and exit when a role name is not provided" do
expect(knife).to receive(:show_usage)
expect(knife.ui).to receive(:fatal)
expect { knife.run }.to raise_error(SystemExit)
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 197dc4ca77..adaa8829a5 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'net/ssh'
-require 'net/ssh/multi'
+require "spec_helper"
+require "net/ssh"
+require "net/ssh/multi"
describe Chef::Knife::Ssh do
before(:each) do
@@ -54,7 +54,7 @@ describe Chef::Knife::Ssh do
@knife.config[:attribute] = "ipaddress"
Chef::Config[:knife][:ssh_attribute] = "ipaddress" # this value will be in the config file
configure_query([@node_foo, @node_bar])
- expect(@knife).to receive(:session_from_list).with([['10.0.0.1', nil], ['10.0.0.2', nil]])
+ expect(@knife).to receive(:session_from_list).with([["10.0.0.1", nil], ["10.0.0.2", nil]])
@knife.configure_session
end
@@ -62,7 +62,7 @@ describe Chef::Knife::Ssh do
Chef::Config[:knife][:ssh_attribute] = "config_file" # this value will be in the config file
@knife.config[:attribute] = "ipaddress" # this is the value of the command line via #configure_attribute
configure_query([@node_foo, @node_bar])
- expect(@knife).to receive(:session_from_list).with([['10.0.0.1', nil], ['10.0.0.2', nil]])
+ expect(@knife).to receive(:session_from_list).with([["10.0.0.1", nil], ["10.0.0.2", nil]])
@knife.configure_session
end
end
@@ -70,8 +70,8 @@ describe Chef::Knife::Ssh do
it "searchs for and returns an array of fqdns" do
configure_query([@node_foo, @node_bar])
expect(@knife).to receive(:session_from_list).with([
- ['foo.example.org', nil],
- ['bar.example.org', nil],
+ ["foo.example.org", nil],
+ ["bar.example.org", nil],
])
@knife.configure_session
end
@@ -86,8 +86,8 @@ describe Chef::Knife::Ssh do
it "returns an array of cloud public hostnames" do
configure_query([@node_foo, @node_bar])
expect(@knife).to receive(:session_from_list).with([
- ['ec2-10-0-0-1.compute-1.amazonaws.com', nil],
- ['ec2-10-0-0-2.compute-1.amazonaws.com', nil],
+ ["ec2-10-0-0-1.compute-1.amazonaws.com", nil],
+ ["ec2-10-0-0-2.compute-1.amazonaws.com", nil],
])
@knife.configure_session
end
@@ -97,15 +97,15 @@ describe Chef::Knife::Ssh do
context "when cloud hostnames are available but empty" do
before do
- @node_foo.automatic_attrs[:cloud][:public_hostname] = ''
- @node_bar.automatic_attrs[:cloud][:public_hostname] = ''
+ @node_foo.automatic_attrs[:cloud][:public_hostname] = ""
+ @node_bar.automatic_attrs[:cloud][:public_hostname] = ""
end
it "returns an array of fqdns" do
configure_query([@node_foo, @node_bar])
expect(@knife).to receive(:session_from_list).with([
- ['foo.example.org', nil],
- ['bar.example.org', nil],
+ ["foo.example.org", nil],
+ ["bar.example.org", nil],
])
@knife.configure_session
end
@@ -143,7 +143,7 @@ describe Chef::Knife::Ssh do
it "returns an array of provided values" do
@knife.instance_variable_set(:@name_args, ["foo.example.org bar.example.org"])
- expect(@knife).to receive(:session_from_list).with(['foo.example.org', 'bar.example.org'])
+ expect(@knife).to receive(:session_from_list).with(["foo.example.org", "bar.example.org"])
@knife.configure_session
end
end
@@ -159,7 +159,7 @@ describe Chef::Knife::Ssh do
Chef::Config[:knife][:ssh_attribute] = nil
@knife.config[:attribute] = nil
@node_foo.automatic_attrs[:cloud][:public_hostname] = "ec2-10-0-0-1.compute-1.amazonaws.com"
- @node_bar.automatic_attrs[:cloud][:public_hostname] = ''
+ @node_bar.automatic_attrs[:cloud][:public_hostname] = ""
end
it "should return fqdn by default" do
@@ -190,21 +190,21 @@ describe Chef::Knife::Ssh do
before :each do
@knife.instance_variable_set(:@longest, 0)
ssh_config = {:timeout => 50, :user => "locutus", :port => 23 }
- allow(Net::SSH).to receive(:configuration_for).with('the.b.org').and_return(ssh_config)
+ allow(Net::SSH).to receive(:configuration_for).with("the.b.org").and_return(ssh_config)
end
it "uses the port from an ssh config file" do
- @knife.session_from_list([['the.b.org', nil]])
+ @knife.session_from_list([["the.b.org", nil]])
expect(@knife.session.servers[0].port).to eq(23)
end
it "uses the port from a cloud attr" do
- @knife.session_from_list([['the.b.org', 123]])
+ @knife.session_from_list([["the.b.org", 123]])
expect(@knife.session.servers[0].port).to eq(123)
end
it "uses the user from an ssh config file" do
- @knife.session_from_list([['the.b.org', 123]])
+ @knife.session_from_list([["the.b.org", 123]])
expect(@knife.session.servers[0].user).to eq("locutus")
end
end
@@ -279,7 +279,7 @@ describe Chef::Knife::Ssh do
expect(@query).to receive(:search).and_return([[@node_foo]])
allow(Chef::Search::Query).to receive(:new).and_return(@query)
allow(@knife).to receive(:ssh_command).and_return(exit_code)
- @knife.name_args = ['*:*', 'false']
+ @knife.name_args = ["*:*", "false"]
end
context "with an error" do
diff --git a/spec/unit/knife/ssl_check_spec.rb b/spec/unit/knife/ssl_check_spec.rb
index feeb85c8af..5fe1b18cb7 100644
--- a/spec/unit/knife/ssl_check_spec.rb
+++ b/spec/unit/knife/ssl_check_spec.rb
@@ -17,7 +17,7 @@
#
require "spec_helper"
-require 'stringio'
+require "stringio"
describe Chef::Knife::SslCheck do
diff --git a/spec/unit/knife/ssl_fetch_spec.rb b/spec/unit/knife/ssl_fetch_spec.rb
index 5982ed9470..be098e4834 100644
--- a/spec/unit/knife/ssl_fetch_spec.rb
+++ b/spec/unit/knife/ssl_fetch_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/knife/ssl_fetch'
+require "spec_helper"
+require "chef/knife/ssl_fetch"
describe Chef::Knife::SslFetch do
diff --git a/spec/unit/knife/status_spec.rb b/spec/unit/knife/status_spec.rb
index 11728a6f9b..c2866dc0f6 100644
--- a/spec/unit/knife/status_spec.rb
+++ b/spec/unit/knife/status_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::Status do
before(:each) do
diff --git a/spec/unit/knife/tag_create_spec.rb b/spec/unit/knife/tag_create_spec.rb
index 586ec118bd..6a3ced3f5b 100644
--- a/spec/unit/knife/tag_create_spec.rb
+++ b/spec/unit/knife/tag_create_spec.rb
@@ -1,4 +1,4 @@
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::TagCreate do
before(:each) do
diff --git a/spec/unit/knife/tag_delete_spec.rb b/spec/unit/knife/tag_delete_spec.rb
index e7fa108947..3095eda191 100644
--- a/spec/unit/knife/tag_delete_spec.rb
+++ b/spec/unit/knife/tag_delete_spec.rb
@@ -1,4 +1,4 @@
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::TagDelete do
before(:each) do
diff --git a/spec/unit/knife/tag_list_spec.rb b/spec/unit/knife/tag_list_spec.rb
index 9c71d22f06..97cd8e7efa 100644
--- a/spec/unit/knife/tag_list_spec.rb
+++ b/spec/unit/knife/tag_list_spec.rb
@@ -1,4 +1,4 @@
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::TagList do
before(:each) do
diff --git a/spec/unit/knife/user_create_spec.rb b/spec/unit/knife/user_create_spec.rb
index fa5c8324b4..e05d518c1a 100644
--- a/spec/unit/knife/user_create_spec.rb
+++ b/spec/unit/knife/user_create_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
Chef::Knife::UserCreate.load_deps
@@ -41,7 +41,7 @@ describe Chef::Knife::UserCreate do
# delete this once OSC11 support is gone
context "when only one name_arg is passed" do
before do
- knife.name_args = ['some_user']
+ knife.name_args = ["some_user"]
allow(knife).to receive(:run_osc_11_user_create).and_raise(SystemExit)
end
@@ -61,7 +61,7 @@ describe Chef::Knife::UserCreate do
# from spec/support/shared/unit/knife_shared.rb
it_should_behave_like "mandatory field missing" do
let(:name_args) { [] }
- let(:fieldname) { 'username' }
+ let(:fieldname) { "username" }
end
end
@@ -79,38 +79,38 @@ describe Chef::Knife::UserCreate do
context "when FIRST_NAME isn't specified" do
# from spec/support/shared/unit/knife_shared.rb
it_should_behave_like "mandatory field missing" do
- let(:name_args) { ['some_user', 'some_display_name'] }
- let(:fieldname) { 'first name' }
+ let(:name_args) { ["some_user", "some_display_name"] }
+ let(:fieldname) { "first name" }
end
end
context "when LAST_NAME isn't specified" do
# from spec/support/shared/unit/knife_shared.rb
it_should_behave_like "mandatory field missing" do
- let(:name_args) { ['some_user', 'some_display_name', 'some_first_name'] }
- let(:fieldname) { 'last name' }
+ let(:name_args) { ["some_user", "some_display_name", "some_first_name"] }
+ let(:fieldname) { "last name" }
end
end
context "when EMAIL isn't specified" do
# from spec/support/shared/unit/knife_shared.rb
it_should_behave_like "mandatory field missing" do
- let(:name_args) { ['some_user', 'some_display_name', 'some_first_name', 'some_last_name'] }
- let(:fieldname) { 'email' }
+ let(:name_args) { ["some_user", "some_display_name", "some_first_name", "some_last_name"] }
+ let(:fieldname) { "email" }
end
end
context "when PASSWORD isn't specified" do
# from spec/support/shared/unit/knife_shared.rb
it_should_behave_like "mandatory field missing" do
- let(:name_args) { ['some_user', 'some_display_name', 'some_first_name', 'some_last_name', 'some_email'] }
- let(:fieldname) { 'password' }
+ let(:name_args) { ["some_user", "some_display_name", "some_first_name", "some_last_name", "some_email"] }
+ let(:fieldname) { "password" }
end
end
context "when all mandatory fields are validly specified" do
before do
- knife.name_args = ['some_user', 'some_display_name', 'some_first_name', 'some_last_name', 'some_email', 'some_password']
+ knife.name_args = ["some_user", "some_display_name", "some_first_name", "some_last_name", "some_email", "some_password"]
allow(knife).to receive(:edit_data).and_return(knife.user.to_hash)
allow(knife).to receive(:create_user_from_hash).and_return(knife.user)
end
@@ -122,12 +122,12 @@ describe Chef::Knife::UserCreate do
it "sets all the mandatory fields" do
knife.run
- expect(knife.user.username).to eq('some_user')
- expect(knife.user.display_name).to eq('some_display_name')
- expect(knife.user.first_name).to eq('some_first_name')
- expect(knife.user.last_name).to eq('some_last_name')
- expect(knife.user.email).to eq('some_email')
- expect(knife.user.password).to eq('some_password')
+ expect(knife.user.username).to eq("some_user")
+ expect(knife.user.display_name).to eq("some_display_name")
+ expect(knife.user.first_name).to eq("some_first_name")
+ expect(knife.user.last_name).to eq("some_last_name")
+ expect(knife.user.email).to eq("some_email")
+ expect(knife.user.password).to eq("some_password")
end
context "when user_key and prevent_keygen are passed" do
@@ -166,14 +166,14 @@ describe Chef::Knife::UserCreate do
context "when --user-key is passed" do
before do
- knife.config[:user_key] = 'some_key'
- allow(File).to receive(:read).and_return('some_key')
+ knife.config[:user_key] = "some_key"
+ allow(File).to receive(:read).and_return("some_key")
allow(File).to receive(:expand_path)
end
it "sets user.public_key" do
knife.run
- expect(knife.user.public_key).to eq('some_key')
+ expect(knife.user.public_key).to eq("some_key")
end
end
@@ -191,20 +191,20 @@ describe Chef::Knife::UserCreate do
context "when --file is passed" do
before do
- knife.config[:file] = '/some/path'
+ knife.config[:file] = "/some/path"
end
it "creates a new file of the path passed" do
- filehandle = double('filehandle')
- expect(filehandle).to receive(:print).with('some_private_key')
- expect(File).to receive(:open).with('/some/path', 'w').and_yield(filehandle)
+ filehandle = double("filehandle")
+ expect(filehandle).to receive(:print).with("some_private_key")
+ expect(File).to receive(:open).with("/some/path", "w").and_yield(filehandle)
knife.run
end
end
context "when --file is not passed" do
it "prints the private key to stdout" do
- expect(knife.ui).to receive(:msg).with('some_private_key')
+ expect(knife.ui).to receive(:msg).with("some_private_key")
knife.run
end
end
diff --git a/spec/unit/knife/user_delete_spec.rb b/spec/unit/knife/user_delete_spec.rb
index a24160624a..f2f8b1537d 100644
--- a/spec/unit/knife/user_delete_spec.rb
+++ b/spec/unit/knife/user_delete_spec.rb
@@ -16,18 +16,18 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::UserDelete do
let(:knife) { Chef::Knife::UserDelete.new }
- let(:user) { double('user_object') }
+ let(:user) { double("user_object") }
let(:stdout) { StringIO.new }
before(:each) do
Chef::Knife::UserDelete.load_deps
- knife.name_args = [ 'my_user' ]
+ knife.name_args = [ "my_user" ]
allow(Chef::UserV1).to receive(:load).and_return(user)
- allow(user).to receive(:username).and_return('my_user')
+ allow(user).to receive(:username).and_return("my_user")
allow(knife.ui).to receive(:stderr).and_return(stdout)
allow(knife.ui).to receive(:stdout).and_return(stdout)
end
@@ -50,13 +50,13 @@ describe Chef::Knife::UserDelete do
end
end
- it 'deletes the user' do
+ it "deletes the user" do
#expect(knife).to receive(:delete_object).with(Chef::UserV1, 'my_user')
- expect(knife).to receive(:delete_object).with('my_user')
+ expect(knife).to receive(:delete_object).with("my_user")
knife.run
end
- it 'prints usage and exits when a user name is not provided' do
+ it "prints usage and exits when a user name is not provided" do
knife.name_args = []
expect(knife).to receive(:show_usage)
expect(knife.ui).to receive(:fatal)
diff --git a/spec/unit/knife/user_edit_spec.rb b/spec/unit/knife/user_edit_spec.rb
index a21d982d29..072a27be01 100644
--- a/spec/unit/knife/user_edit_spec.rb
+++ b/spec/unit/knife/user_edit_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::UserEdit do
let(:knife) { Chef::Knife::UserEdit.new }
@@ -28,7 +28,7 @@ describe Chef::Knife::UserEdit do
Chef::Knife::UserEdit.load_deps
allow(knife.ui).to receive(:stderr).and_return(@stderr)
allow(knife.ui).to receive(:stdout).and_return(@stdout)
- knife.name_args = [ 'my_user' ]
+ knife.name_args = [ "my_user" ]
knife.config[:disable_editing] = true
end
@@ -50,14 +50,14 @@ describe Chef::Knife::UserEdit do
end
end
- it 'loads and edits the user' do
+ it "loads and edits the user" do
data = { "username" => "my_user" }
allow(Chef::UserV1).to receive(:load).with("my_user").and_return(data)
expect(knife).to receive(:edit_data).with(data).and_return(data)
knife.run
end
- it 'prints usage and exits when a user name is not provided' do
+ it "prints usage and exits when a user name is not provided" do
knife.name_args = []
expect(knife).to receive(:show_usage)
expect(knife.ui).to receive(:fatal)
diff --git a/spec/unit/knife/user_list_spec.rb b/spec/unit/knife/user_list_spec.rb
index fa2bac426e..753929e250 100644
--- a/spec/unit/knife/user_list_spec.rb
+++ b/spec/unit/knife/user_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::UserList do
let(:knife) { Chef::Knife::UserList.new }
@@ -28,7 +28,7 @@ describe Chef::Knife::UserList do
allow(knife.ui).to receive(:stdout).and_return(stdout)
end
- it 'lists the users' do
+ it "lists the users" do
expect(Chef::UserV1).to receive(:list)
expect(knife).to receive(:format_list_for_display)
knife.run
diff --git a/spec/unit/knife/user_reregister_spec.rb b/spec/unit/knife/user_reregister_spec.rb
index 89aa6726cd..1907b5fa50 100644
--- a/spec/unit/knife/user_reregister_spec.rb
+++ b/spec/unit/knife/user_reregister_spec.rb
@@ -16,20 +16,20 @@
# limitations under the License.
#
-require 'spec_helper'
+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
Chef::Knife::UserReregister.load_deps
- knife.name_args = [ 'a_user' ]
+ knife.name_args = [ "a_user" ]
allow(Chef::UserV1).to receive(:load).and_return(user_mock)
allow(knife.ui).to receive(:stdout).and_return(stdout)
allow(knife.ui).to receive(:stderr).and_return(stdout)
- allow(user_mock).to receive(:username).and_return('a_user')
+ allow(user_mock).to receive(:username).and_return("a_user")
end
# delete this once OSC11 support is gone
@@ -50,24 +50,24 @@ describe Chef::Knife::UserReregister do
end
end
- it 'prints usage and exits when a user name is not provided' do
+ it "prints usage and exits when a user name is not provided" do
knife.name_args = []
expect(knife).to receive(:show_usage)
expect(knife.ui).to receive(:fatal)
expect { knife.run }.to raise_error(SystemExit)
end
- it 'reregisters the user and prints the key' do
+ it "reregisters the user and prints the key" do
expect(user_mock).to receive(:reregister).and_return(user_mock)
knife.run
expect(stdout.string).to match( /private_key/ )
end
- it 'writes the private key to a file when --file is specified' do
+ it "writes the private key to a file when --file is specified" do
expect(user_mock).to receive(:reregister).and_return(user_mock)
- knife.config[:file] = '/tmp/a_file'
+ knife.config[:file] = "/tmp/a_file"
filehandle = StringIO.new
- expect(File).to receive(:open).with('/tmp/a_file', 'w').and_yield(filehandle)
+ expect(File).to receive(:open).with("/tmp/a_file", "w").and_yield(filehandle)
knife.run
expect(filehandle.string).to eq("private_key")
end
diff --git a/spec/unit/knife/user_show_spec.rb b/spec/unit/knife/user_show_spec.rb
index 7c39e428c0..12e8424af2 100644
--- a/spec/unit/knife/user_show_spec.rb
+++ b/spec/unit/knife/user_show_spec.rb
@@ -16,17 +16,17 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Knife::UserShow do
let(:knife) { Chef::Knife::UserShow.new }
- let(:user_mock) { double('user_mock') }
+ let(:user_mock) { double("user_mock") }
let(:stdout) { StringIO.new }
before do
Chef::Knife::UserShow.load_deps
- knife.name_args = [ 'my_user' ]
- allow(user_mock).to receive(:username).and_return('my_user')
+ knife.name_args = [ "my_user" ]
+ allow(user_mock).to receive(:username).and_return("my_user")
allow(knife.ui).to receive(:stderr).and_return(stdout)
allow(knife.ui).to receive(:stdout).and_return(stdout)
end
@@ -35,7 +35,7 @@ describe Chef::Knife::UserShow do
context "when the username field is not supported by the server" do
before do
allow(knife).to receive(:run_osc_11_user_show).and_raise(SystemExit)
- allow(Chef::UserV1).to receive(:load).with('my_user').and_return(user_mock)
+ allow(Chef::UserV1).to receive(:load).with("my_user").and_return(user_mock)
allow(user_mock).to receive(:username).and_return(nil)
end
@@ -50,13 +50,13 @@ describe Chef::Knife::UserShow do
end
end
- it 'loads and displays the user' do
- expect(Chef::UserV1).to receive(:load).with('my_user').and_return(user_mock)
+ it "loads and displays the user" do
+ expect(Chef::UserV1).to receive(:load).with("my_user").and_return(user_mock)
expect(knife).to receive(:format_for_display).with(user_mock)
knife.run
end
- it 'prints usage and exits when a user name is not provided' do
+ it "prints usage and exits when a user name is not provided" do
knife.name_args = []
expect(knife).to receive(:show_usage)
expect(knife.ui).to receive(:fatal)
diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb
index 55b4f5c88a..06892af905 100644
--- a/spec/unit/knife_spec.rb
+++ b/spec/unit/knife_spec.rb
@@ -21,8 +21,8 @@
module KnifeSpecs
end
-require 'spec_helper'
-require 'uri'
+require "spec_helper"
+require "uri"
describe Chef::Knife do
@@ -81,28 +81,28 @@ describe Chef::Knife do
KnifeSpecs.send(:remove_const, :TestExplicitCategory)
end
- Kernel.load(File.join(CHEF_SPEC_DATA, 'knife_subcommand', 'test_name_mapping.rb'))
- Kernel.load(File.join(CHEF_SPEC_DATA, 'knife_subcommand', 'test_explicit_category.rb'))
+ Kernel.load(File.join(CHEF_SPEC_DATA, "knife_subcommand", "test_name_mapping.rb"))
+ Kernel.load(File.join(CHEF_SPEC_DATA, "knife_subcommand", "test_explicit_category.rb"))
end
it "has a category based on its name" do
- expect(KnifeSpecs::TestNameMapping.subcommand_category).to eq('test')
+ expect(KnifeSpecs::TestNameMapping.subcommand_category).to eq("test")
end
it "has an explicitly defined category if set" do
- expect(KnifeSpecs::TestExplicitCategory.subcommand_category).to eq('cookbook site')
+ expect(KnifeSpecs::TestExplicitCategory.subcommand_category).to eq("cookbook site")
end
it "can reference the subcommand by its snake cased name" do
- expect(Chef::Knife.subcommands['test_name_mapping']).to equal(KnifeSpecs::TestNameMapping)
+ expect(Chef::Knife.subcommands["test_name_mapping"]).to equal(KnifeSpecs::TestNameMapping)
end
it "lists subcommands by category" do
- expect(Chef::Knife.subcommands_by_category['test']).to include('test_name_mapping')
+ expect(Chef::Knife.subcommands_by_category["test"]).to include("test_name_mapping")
end
it "lists subcommands by category when the subcommands have explicit categories" do
- expect(Chef::Knife.subcommands_by_category['cookbook site']).to include('test_explicit_category')
+ expect(Chef::Knife.subcommands_by_category["cookbook site"]).to include("test_explicit_category")
end
it "has empty dependency_loader list by default" do
@@ -137,9 +137,9 @@ describe Chef::Knife do
it "guesses a category from a given ARGV" do
Chef::Knife.subcommands_by_category["cookbook"] << :cookbook
Chef::Knife.subcommands_by_category["cookbook site"] << :cookbook_site
- expect(Chef::Knife.guess_category(%w{cookbook foo bar baz})).to eq('cookbook')
- expect(Chef::Knife.guess_category(%w{cookbook site foo bar baz})).to eq('cookbook site')
- expect(Chef::Knife.guess_category(%w{cookbook site --help})).to eq('cookbook site')
+ expect(Chef::Knife.guess_category(%w{cookbook foo bar baz})).to eq("cookbook")
+ expect(Chef::Knife.guess_category(%w{cookbook site foo bar baz})).to eq("cookbook site")
+ expect(Chef::Knife.guess_category(%w{cookbook site --help})).to eq("cookbook site")
end
it "finds a subcommand class based on ARGV" do
@@ -154,7 +154,7 @@ describe Chef::Knife do
let(:headers) {{"Accept"=>"application/json",
"Accept-Encoding"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3",
- 'X-Chef-Version' => Chef::VERSION,
+ "X-Chef-Version" => Chef::VERSION,
"Host"=>"api.opscode.piab",
"X-REMOTE-REQUEST-ID"=>request_id,
}}
@@ -195,7 +195,7 @@ describe Chef::Knife do
if KnifeSpecs.const_defined?(:TestYourself)
KnifeSpecs.send :remove_const, :TestYourself
end
- Kernel.load(File.join(CHEF_SPEC_DATA, 'knife_subcommand', 'test_yourself.rb'))
+ Kernel.load(File.join(CHEF_SPEC_DATA, "knife_subcommand", "test_yourself.rb"))
Chef::Knife.subcommands.each { |name, klass| Chef::Knife.subcommands.delete(name) unless klass.kind_of?(Class) }
end
@@ -210,7 +210,7 @@ describe Chef::Knife do
if KnifeSpecs.const_defined?(:TestYourself)
KnifeSpecs.send :remove_const, :TestYourself
end
- Kernel.load(File.join(CHEF_SPEC_DATA, 'knife_subcommand', 'test_yourself.rb'))
+ Kernel.load(File.join(CHEF_SPEC_DATA, "knife_subcommand", "test_yourself.rb"))
Chef::Knife.subcommands.each { |name, klass| Chef::Knife.subcommands.delete(name) unless klass.kind_of?(Class) }
end
@@ -349,12 +349,12 @@ describe Chef::Knife do
before do
unless KnifeSpecs.const_defined?(:TestYourself)
- Kernel.load(File.join(CHEF_SPEC_DATA, 'knife_subcommand', 'test_yourself.rb'))
+ Kernel.load(File.join(CHEF_SPEC_DATA, "knife_subcommand", "test_yourself.rb"))
end
end
it "it parses the options passed to it" do
- expect(knife.config[:scro]).to eq('scrogramming')
+ expect(knife.config[:scro]).to eq("scrogramming")
end
it "extracts its command specific args from the full arg list" do
@@ -431,9 +431,9 @@ describe Chef::Knife do
allow(knife).to receive(:run).and_raise(Net::HTTPServerException.new("406 Not Acceptable", response))
knife.run_with_pretty_exceptions
- expect(stderr.string).to include('The request that Knife sent was using API version 10000000')
- expect(stderr.string).to include('The Chef server you sent the request to supports a min API verson of 0 and a max API version of 1')
- expect(stderr.string).to include('Please either update your Chef client or server to be a compatible set')
+ expect(stderr.string).to include("The request that Knife sent was using API version 10000000")
+ expect(stderr.string).to include("The Chef server you sent the request to supports a min API verson of 0 and a max API version of 1")
+ expect(stderr.string).to include("Please either update your Chef client or server to be a compatible set")
end
it "formats 500s nicely" do
@@ -485,7 +485,7 @@ describe Chef::Knife do
end
it "formats missing private key errors nicely" do
- allow(knife).to receive(:run).and_raise(Chef::Exceptions::PrivateKeyMissing.new('key not there'))
+ allow(knife).to receive(:run).and_raise(Chef::Exceptions::PrivateKeyMissing.new("key not there"))
allow(knife).to receive(:api_key).and_return("/home/root/.chef/no-key-here.pem")
knife.run_with_pretty_exceptions
expect(stderr.string).to match(%r[ERROR: Your private key could not be loaded from /home/root/.chef/no-key-here.pem])
@@ -493,7 +493,7 @@ describe Chef::Knife do
end
it "formats connection refused errors nicely" do
- allow(knife).to receive(:run).and_raise(Errno::ECONNREFUSED.new('y u no shut up'))
+ allow(knife).to receive(:run).and_raise(Errno::ECONNREFUSED.new("y u no shut up"))
knife.run_with_pretty_exceptions
# Errno::ECONNREFUSED message differs by platform
# *nix = Errno::ECONNREFUSED: Connection refused
diff --git a/spec/unit/log/syslog_spec.rb b/spec/unit/log/syslog_spec.rb
index 3db90e50c6..440b4f018e 100644
--- a/spec/unit/log/syslog_spec.rb
+++ b/spec/unit/log/syslog_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef'
+require "spec_helper"
+require "chef"
describe "Chef::Log::Syslog", :unix_only => true do
let(:syslog) { Chef::Log::Syslog.new }
diff --git a/spec/unit/log/winevt_spec.rb b/spec/unit/log/winevt_spec.rb
index 867ef55900..c20aeaf4bf 100644
--- a/spec/unit/log/winevt_spec.rb
+++ b/spec/unit/log/winevt_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Log::WinEvt do
let(:evtlog) { instance_double("Win32::EventLog")}
diff --git a/spec/unit/log_spec.rb b/spec/unit/log_spec.rb
index 7be40f77e6..288a827035 100644
--- a/spec/unit/log_spec.rb
+++ b/spec/unit/log_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'tempfile'
-require 'logger'
-require 'spec_helper'
+require "tempfile"
+require "logger"
+require "spec_helper"
describe Chef::Log do
end
diff --git a/spec/unit/lwrp_spec.rb b/spec/unit/lwrp_spec.rb
index 13d9f6acc7..8900743c75 100644
--- a/spec/unit/lwrp_spec.rb
+++ b/spec/unit/lwrp_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tmpdir'
-require 'fileutils'
-require 'chef/mixin/convert_to_class_name'
+require "spec_helper"
+require "tmpdir"
+require "fileutils"
+require "chef/mixin/convert_to_class_name"
module LwrpConstScopingConflict
end
@@ -57,21 +57,21 @@ describe "LWRP" do
end
it "should not skip loading a resource when there's a top level symbol of the same name" do
- Object.const_set('LwrpFoo', Class.new)
+ Object.const_set("LwrpFoo", Class.new)
file = File.expand_path( "lwrp/resources/foo.rb", CHEF_SPEC_DATA)
expect(Chef::Log).not_to receive(:info).with(/Skipping/)
expect(Chef::Log).not_to receive(:debug).with(/anymore/)
Chef::Resource::LWRPBase.build_from_file("lwrp", file, nil)
- Object.send(:remove_const, 'LwrpFoo')
+ Object.send(:remove_const, "LwrpFoo")
end
it "should not skip loading a provider when there's a top level symbol of the same name" do
- Object.const_set('LwrpBuckPasser', Class.new)
+ Object.const_set("LwrpBuckPasser", Class.new)
file = File.expand_path( "lwrp/providers/buck_passer.rb", CHEF_SPEC_DATA)
expect(Chef::Log).not_to receive(:info).with(/Skipping/)
expect(Chef::Log).not_to receive(:debug).with(/anymore/)
Chef::Provider::LWRPBase.build_from_file("lwrp", file, nil)
- Object.send(:remove_const, 'LwrpBuckPasser')
+ Object.send(:remove_const, "LwrpBuckPasser")
end
# @todo: we need a before block to manually remove_const all of the LWRPs that we
@@ -246,19 +246,19 @@ describe "LWRP" do
let(:klass) do
Class.new(Chef::Resource::LWRPBase) do
self.resource_name = :sample_resource
- attribute :food, :default => lazy { 'BACON!'*3 }
+ attribute :food, :default => lazy { "BACON!"*3 }
attribute :drink, :default => lazy { |r| "Drink after #{r.food}!"}
end
end
- let(:instance) { klass.new('kitchen') }
+ let(:instance) { klass.new("kitchen") }
it "evaluates the default value when requested" do
- expect(instance.food).to eq('BACON!BACON!BACON!')
+ expect(instance.food).to eq("BACON!BACON!BACON!")
end
it "evaluates yields self to the block" do
- expect(instance.drink).to eq('Drink after BACON!BACON!BACON!!')
+ expect(instance.drink).to eq("Drink after BACON!BACON!BACON!!")
end
end
end
@@ -325,7 +325,7 @@ describe "LWRP" do
end
def raise_if_deprecated!
- if Chef::VERSION.split('.').first.to_i > 12
+ if Chef::VERSION.split(".").first.to_i > 12
raise "This test should be removed and the associated code should be removed!"
end
end
@@ -344,7 +344,7 @@ describe "LWRP" do
end
end
let(:resource) do
- resource_class.new('blah')
+ resource_class.new("blah")
end
it "actions includes those actions" do
expect(resource_class.actions).to eq [ :nothing, :eat, :sleep ]
@@ -364,7 +364,7 @@ describe "LWRP" do
end
end
let(:resource) do
- resource_class.new('blah')
+ resource_class.new("blah")
end
it "actions includes those actions" do
expect(resource_class.actions).to eq [ :nothing, :eat, :sleep ]
@@ -383,7 +383,7 @@ describe "LWRP" do
let(:node) do
Chef::Node.new.tap do |n|
n.automatic[:platform] = :ubuntu
- n.automatic[:platform_version] = '8.10'
+ n.automatic[:platform_version] = "8.10"
end
end
@@ -483,8 +483,8 @@ describe "LWRP" do
Chef::Runner.new(run_context).converge
expect(run_context.resource_collection[0]).to eql(injector)
- expect(run_context.resource_collection[1].name).to eql('prepared_thumbs')
- expect(run_context.resource_collection[2].name).to eql('twiddled_thumbs')
+ expect(run_context.resource_collection[1].name).to eql("prepared_thumbs")
+ expect(run_context.resource_collection[2].name).to eql("twiddled_thumbs")
expect(run_context.resource_collection[3]).to eql(dummy)
end
@@ -507,12 +507,12 @@ describe "LWRP" do
Chef::Runner.new(run_context).converge
expect(run_context.resource_collection[0]).to eql(injector)
- expect(run_context.resource_collection[1].name).to eql('prepared_thumbs')
- expect(run_context.resource_collection[2].name).to eql('twiddled_thumbs')
+ expect(run_context.resource_collection[1].name).to eql("prepared_thumbs")
+ expect(run_context.resource_collection[2].name).to eql("twiddled_thumbs")
expect(run_context.resource_collection[3]).to eql(dummy)
expect(run_context.resource_collection[4]).to eql(injector2)
- expect(run_context.resource_collection[5].name).to eql('prepared_eyes')
- expect(run_context.resource_collection[6].name).to eql('dried_paint_watched')
+ expect(run_context.resource_collection[5].name).to eql("prepared_eyes")
+ expect(run_context.resource_collection[6].name).to eql("dried_paint_watched")
end
it "should properly handle a new_resource reference" do
@@ -535,7 +535,7 @@ describe "LWRP" do
#provider = @runner.build_provider(resource)
provider.action_twiddle_thumbs
- expect(provider.enclosed_resource.monkey).to eq('bob, the monkey')
+ expect(provider.enclosed_resource.monkey).to eq("bob, the monkey")
end
describe "when using inline compilation" do
@@ -603,7 +603,7 @@ describe "LWRP" do
end
it "get_lwrp(:lwrp_once).new is a Chef::Resource::LwrpOnce" do
- lwrp = get_lwrp(:lwrp_once).new('hi')
+ lwrp = get_lwrp(:lwrp_once).new("hi")
expect(lwrp.kind_of?(Chef::Resource::LwrpOnce)).to be_truthy
expect(lwrp.is_a?(Chef::Resource::LwrpOnce)).to be_truthy
expect(get_lwrp(:lwrp_once) === lwrp).to be_truthy
@@ -611,7 +611,7 @@ describe "LWRP" do
end
it "Chef::Resource::LwrpOnce.new is a get_lwrp(:lwrp_once)" do
- lwrp = Chef::Resource::LwrpOnce.new('hi')
+ lwrp = Chef::Resource::LwrpOnce.new("hi")
expect(lwrp.kind_of?(get_lwrp(:lwrp_once))).to be_truthy
expect(lwrp.is_a?(get_lwrp(:lwrp_once))).to be_truthy
expect(get_lwrp(:lwrp_once) === lwrp).to be_truthy
@@ -639,35 +639,35 @@ describe "LWRP" do
end
it "subclass.new is a subclass" do
- lwrp = subclass.new('hi')
+ lwrp = subclass.new("hi")
expect(lwrp.kind_of?(subclass)).to be_truthy
expect(lwrp.is_a?(subclass)).to be_truthy
expect(subclass === lwrp).to be_truthy
expect(lwrp.class === subclass)
end
it "subclass.new is a Chef::Resource::LwrpOnce" do
- lwrp = subclass.new('hi')
+ lwrp = subclass.new("hi")
expect(lwrp.kind_of?(Chef::Resource::LwrpOnce)).to be_truthy
expect(lwrp.is_a?(Chef::Resource::LwrpOnce)).to be_truthy
expect(Chef::Resource::LwrpOnce === lwrp).to be_truthy
expect(lwrp.class === Chef::Resource::LwrpOnce)
end
it "subclass.new is a get_lwrp(:lwrp_once)" do
- lwrp = subclass.new('hi')
+ lwrp = subclass.new("hi")
expect(lwrp.kind_of?(get_lwrp(:lwrp_once))).to be_truthy
expect(lwrp.is_a?(get_lwrp(:lwrp_once))).to be_truthy
expect(get_lwrp(:lwrp_once) === lwrp).to be_truthy
expect(lwrp.class === get_lwrp(:lwrp_once))
end
it "Chef::Resource::LwrpOnce.new is *not* a subclass" do
- lwrp = Chef::Resource::LwrpOnce.new('hi')
+ lwrp = Chef::Resource::LwrpOnce.new("hi")
expect(lwrp.kind_of?(subclass)).to be_falsey
expect(lwrp.is_a?(subclass)).to be_falsey
expect(subclass === lwrp.class).to be_falsey
expect(subclass === Chef::Resource::LwrpOnce).to be_falsey
end
it "get_lwrp(:lwrp_once).new is *not* a subclass" do
- lwrp = get_lwrp(:lwrp_once).new('hi')
+ lwrp = get_lwrp(:lwrp_once).new("hi")
expect(lwrp.kind_of?(subclass)).to be_falsey
expect(lwrp.is_a?(subclass)).to be_falsey
expect(subclass === lwrp.class).to be_falsey
@@ -681,35 +681,35 @@ describe "LWRP" do
end
it "subclass.new is a subclass" do
- lwrp = subclass.new('hi')
+ lwrp = subclass.new("hi")
expect(lwrp.kind_of?(subclass)).to be_truthy
expect(lwrp.is_a?(subclass)).to be_truthy
expect(subclass === lwrp).to be_truthy
expect(lwrp.class === subclass)
end
it "subclass.new is a Chef::Resource::LwrpOnce" do
- lwrp = subclass.new('hi')
+ lwrp = subclass.new("hi")
expect(lwrp.kind_of?(Chef::Resource::LwrpOnce)).to be_truthy
expect(lwrp.is_a?(Chef::Resource::LwrpOnce)).to be_truthy
expect(Chef::Resource::LwrpOnce === lwrp).to be_truthy
expect(lwrp.class === Chef::Resource::LwrpOnce)
end
it "subclass.new is a get_lwrp(:lwrp_once)" do
- lwrp = subclass.new('hi')
+ lwrp = subclass.new("hi")
expect(lwrp.kind_of?(get_lwrp(:lwrp_once))).to be_truthy
expect(lwrp.is_a?(get_lwrp(:lwrp_once))).to be_truthy
expect(get_lwrp(:lwrp_once) === lwrp).to be_truthy
expect(lwrp.class === get_lwrp(:lwrp_once))
end
it "Chef::Resource::LwrpOnce.new is *not* a subclass" do
- lwrp = Chef::Resource::LwrpOnce.new('hi')
+ lwrp = Chef::Resource::LwrpOnce.new("hi")
expect(lwrp.kind_of?(subclass)).to be_falsey
expect(lwrp.is_a?(subclass)).to be_falsey
expect(subclass === lwrp.class).to be_falsey
expect(subclass === Chef::Resource::LwrpOnce).to be_falsey
end
it "get_lwrp(:lwrp_once).new is *not* a subclass" do
- lwrp = get_lwrp(:lwrp_once).new('hi')
+ lwrp = get_lwrp(:lwrp_once).new("hi")
expect(lwrp.kind_of?(subclass)).to be_falsey
expect(lwrp.is_a?(subclass)).to be_falsey
expect(subclass === lwrp.class).to be_falsey
diff --git a/spec/unit/mash_spec.rb b/spec/unit/mash_spec.rb
index b8f4c2d5aa..59904816f6 100644
--- a/spec/unit/mash_spec.rb
+++ b/spec/unit/mash_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mash'
+require "spec_helper"
+require "chef/mash"
describe Mash do
it "should duplicate a simple key/value mash to a new mash" do
diff --git a/spec/unit/mixin/api_version_request_handling_spec.rb b/spec/unit/mixin/api_version_request_handling_spec.rb
index fc42d76d72..ac1122bbcf 100644
--- a/spec/unit/mixin/api_version_request_handling_spec.rb
+++ b/spec/unit/mixin/api_version_request_handling_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Mixin::ApiVersionRequestHandling do
let(:dummy_class) { Class.new { include Chef::Mixin::ApiVersionRequestHandling } }
@@ -27,7 +27,7 @@ describe Chef::Mixin::ApiVersionRequestHandling do
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
@@ -38,7 +38,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
@@ -59,7 +59,7 @@ describe Chef::Mixin::ApiVersionRequestHandling do
}
before(:each) do
- allow(response).to receive(:[]).with('x-ops-server-api-version').and_return(Chef::JSONCompat.to_json(return_hash))
+ allow(response).to receive(:[]).with("x-ops-server-api-version").and_return(Chef::JSONCompat.to_json(return_hash))
end
context "when there is no intersection between client and server versions" do
diff --git a/spec/unit/mixin/checksum_spec.rb b/spec/unit/mixin/checksum_spec.rb
index 864b15f2bc..080220ec81 100644
--- a/spec/unit/mixin/checksum_spec.rb
+++ b/spec/unit/mixin/checksum_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/checksum'
-require 'stringio'
+require "spec_helper"
+require "chef/mixin/checksum"
+require "stringio"
class Chef::CMCCheck
include Chef::Mixin::Checksum
diff --git a/spec/unit/mixin/command_spec.rb b/spec/unit/mixin/command_spec.rb
index cedabcbe49..8a4bb1acbf 100644
--- a/spec/unit/mixin/command_spec.rb
+++ b/spec/unit/mixin/command_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Mixin::Command, :volatile do
diff --git a/spec/unit/mixin/convert_to_class_name_spec.rb b/spec/unit/mixin/convert_to_class_name_spec.rb
index 4cf6728d64..cf90cf31a0 100644
--- a/spec/unit/mixin/convert_to_class_name_spec.rb
+++ b/spec/unit/mixin/convert_to_class_name_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class ConvertToClassTestHarness
include Chef::Mixin::ConvertToClassName
diff --git a/spec/unit/mixin/deep_merge_spec.rb b/spec/unit/mixin/deep_merge_spec.rb
index d107323f32..1212ff2b53 100644
--- a/spec/unit/mixin/deep_merge_spec.rb
+++ b/spec/unit/mixin/deep_merge_spec.rb
@@ -22,26 +22,26 @@
# available under the MIT license from
# http://trac.misuse.org/science/wiki/DeepMerge
-require 'spec_helper'
+require "spec_helper"
# Test coverage from the original author converted to rspec
describe Chef::Mixin::DeepMerge, "deep_merge!" do
before do
@dm = Chef::Mixin::DeepMerge
- @field_ko_prefix = '!merge'
+ @field_ko_prefix = "!merge"
end
# deep_merge core tests - moving from basic to more complex
it "tests merging an hash w/array into blank hash" do
- hash_src = {'id' => '2'}
+ hash_src = {"id" => "2"}
hash_dst = {}
@dm.deep_merge!(hash_src.dup, hash_dst)
expect(hash_dst).to eq(hash_src)
end
it "tests merging an hash w/array into blank hash" do
- hash_src = {'region' => {'id' => ['227', '2']}}
+ hash_src = {"region" => {"id" => ["227", "2"]}}
hash_dst = {}
@dm.deep_merge!(hash_src, hash_dst)
expect(hash_dst).to eq(hash_src)
@@ -181,10 +181,10 @@ describe Chef::Mixin::DeepMerge, "deep_merge!" do
end
it "tests merging of hash with blank hash, and make sure that source array split does not function when turned off" do
- hash_src = {'property' => {'bedroom_count' => ["1","2,3"]}}
+ hash_src = {"property" => {"bedroom_count" => ["1","2,3"]}}
hash_dst = {}
@dm.deep_merge!(hash_src, hash_dst)
- expect(hash_dst).to eq({'property' => {'bedroom_count' => ["1","2,3"]}})
+ expect(hash_dst).to eq({"property" => {"bedroom_count" => ["1","2,3"]}})
end
it "tests merging into a blank hash" do
@@ -247,13 +247,13 @@ describe Chef::Mixin::DeepMerge do
describe "merge" do
it "should merge a hash into an empty hash" do
hash_dst = {}
- hash_src = {'id' => '2'}
+ hash_src = {"id" => "2"}
expect(@dm.merge(hash_dst, hash_src)).to eq(hash_src)
end
it "should merge a nested hash into an empty hash" do
hash_dst = {}
- hash_src = {'region' => {'id' => ['227', '2']}}
+ hash_src = {"region" => {"id" => ["227", "2"]}}
expect(@dm.merge(hash_dst, hash_src)).to eq(hash_src)
end
diff --git a/spec/unit/mixin/deprecation_spec.rb b/spec/unit/mixin/deprecation_spec.rb
index 6d9f39af9f..3ac0936f60 100644
--- a/spec/unit/mixin/deprecation_spec.rb
+++ b/spec/unit/mixin/deprecation_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/deprecation'
+require "spec_helper"
+require "chef/mixin/deprecation"
describe Chef::Mixin do
describe "deprecating constants (Class/Module)" do
@@ -46,7 +46,7 @@ describe Chef::Mixin::Deprecation::DeprecatedInstanceVariable do
before do
Chef::Log.logger = Logger.new(StringIO.new)
- @deprecated_ivar = Chef::Mixin::Deprecation::DeprecatedInstanceVariable.new('value', 'an_ivar')
+ @deprecated_ivar = Chef::Mixin::Deprecation::DeprecatedInstanceVariable.new("value", "an_ivar")
end
it "forward method calls to the target object" do
diff --git a/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb b/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
index 408926293e..9da7270bc3 100644
--- a/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
+++ b/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'etc'
-require 'ostruct'
+require "spec_helper"
+require "etc"
+require "ostruct"
describe Chef::Mixin::EnforceOwnershipAndPermissions do
@@ -52,8 +52,8 @@ describe Chef::Mixin::EnforceOwnershipAndPermissions do
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')
+ :uid => 0, :gid => 0, :dir => "/root",
+ :shell => "/bin/bash")
group_struct = OpenStruct.new(:name => "root", :passwd => "x", :gid => 0)
allow(Etc).to receive(:getpwuid).and_return(passwd_struct)
@@ -76,8 +76,8 @@ describe Chef::Mixin::EnforceOwnershipAndPermissions do
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')
+ :uid => 0, :gid => 0, :dir => "/root",
+ :shell => "/bin/bash")
group_struct = OpenStruct.new(:name => "root", :passwd => "x", :gid => 0)
allow(Etc).to receive(:getpwuid).and_return(passwd_struct)
diff --git a/spec/unit/mixin/homebrew_user_spec.rb b/spec/unit/mixin/homebrew_user_spec.rb
index 57b89720dc..77e37a030c 100644
--- a/spec/unit/mixin/homebrew_user_spec.rb
+++ b/spec/unit/mixin/homebrew_user_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
-require 'chef/mixin/homebrew_user'
+require "spec_helper"
+require "chef/mixin/homebrew_user"
class ExampleHomebrewUser
include Chef::Mixin::HomebrewUser
@@ -24,22 +24,22 @@ end
describe Chef::Mixin::HomebrewUser do
before(:each) do
- node.default['homebrew']['owner'] = nil
+ node.default["homebrew"]["owner"] = nil
end
let(:homebrew_user) { ExampleHomebrewUser.new }
let(:node) { Chef::Node.new }
- describe 'when the homebrew user is provided' do
+ describe "when the homebrew user is provided" do
let(:uid) { 1001 }
let(:user) { "foo" }
- it 'returns the homebrew user without looking at the file when uid is provided' do
+ it "returns the homebrew user without looking at the file when uid is provided" do
expect(File).to receive(:exist?).exactly(0).times
expect(homebrew_user.find_homebrew_uid(uid)).to eq(uid)
end
- it 'returns the homebrew user without looking at the file when name is provided' do
+ it "returns the homebrew user without looking at the file when name is provided" do
expect(File).to receive(:exist?).exactly(0).times
allow(Etc).to receive_message_chain(:getpwnam, :uid).and_return(uid)
expect(homebrew_user.find_homebrew_uid(user)).to eq(uid)
@@ -50,7 +50,7 @@ describe Chef::Mixin::HomebrewUser do
shared_examples "successfully find executable" do
let(:user) { nil }
let(:brew_owner) { 2001 }
- let(:default_brew_path) { '/usr/local/bin/brew' }
+ let(:default_brew_path) { "/usr/local/bin/brew" }
let(:stat_double) {
d = double()
expect(d).to receive(:uid).and_return(brew_owner)
@@ -63,13 +63,13 @@ describe Chef::Mixin::HomebrewUser do
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
+ it "returns the owner of the brew executable when it is at a default location" do
expect(File).to receive(:exist?).with(default_brew_path).and_return(true)
expect(File).to receive(:stat).with(default_brew_path).and_return(stat_double)
expect(homebrew_user.find_homebrew_uid(user)).to eq(brew_owner)
end
- it 'returns the owner of the brew executable when it is not at a default location' do
+ it "returns the owner of the brew executable when it is not at a default location" do
expect(File).to receive(:exist?).with(default_brew_path).and_return(false)
allow(homebrew_user).to receive_message_chain(:shell_out, :stdout, :strip).and_return("/foo")
expect(File).to receive(:stat).with("/foo").and_return(stat_double)
@@ -79,9 +79,9 @@ describe Chef::Mixin::HomebrewUser do
end
end
- describe 'when the homebrew user is not provided' do
+ describe "when the homebrew user is not provided" do
- it 'raises an error if no executable is found' do
+ it "raises an error if no executable is found" do
expect(File).to receive(:exist?).with(default_brew_path).and_return(false)
allow(homebrew_user).to receive_message_chain(:shell_out, :stdout, :strip).and_return("")
expect { homebrew_user.find_homebrew_uid(user) }.to raise_error(Chef::Exceptions::CannotDetermineHomebrewOwner)
diff --git a/spec/unit/mixin/params_validate_spec.rb b/spec/unit/mixin/params_validate_spec.rb
index 99d5230a75..15f99d98f8 100644
--- a/spec/unit/mixin/params_validate_spec.rb
+++ b/spec/unit/mixin/params_validate_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class TinyClass
include Chef::Mixin::ParamsValidate
@@ -372,12 +372,12 @@ describe Chef::Mixin::ParamsValidate do
end
it "should allow DelayedEvaluator instance to be set for value regardless of restriction" do
- value = Chef::DelayedEvaluator.new{ 'test' }
+ value = Chef::DelayedEvaluator.new{ "test" }
@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' }
+ value = Chef::DelayedEvaluator.new{ "test" }
@vo.set_or_return(:test, value, {:kind_of => Numeric})
expect do
@vo.set_or_return(:test, nil, {:kind_of => Numeric})
@@ -385,22 +385,22 @@ describe Chef::Mixin::ParamsValidate do
end
it "should create DelayedEvaluator instance when #lazy is used" do
- @vo.set_or_return(:delayed, @vo.lazy{ 'test' }, {})
+ @vo.set_or_return(:delayed, @vo.lazy{ "test" }, {})
expect(@vo.instance_variable_get(:@delayed)).to be_a(Chef::DelayedEvaluator)
end
it "should execute block on each call when DelayedEvaluator" do
- value = 'fubar'
+ value = "fubar"
@vo.set_or_return(:test, @vo.lazy{ value }, {})
- expect(@vo.set_or_return(:test, nil, {})).to eq('fubar')
- value = 'foobar'
- expect(@vo.set_or_return(:test, nil, {})).to eq('foobar')
- value = 'fauxbar'
- expect(@vo.set_or_return(:test, nil, {})).to eq('fauxbar')
+ expect(@vo.set_or_return(:test, nil, {})).to eq("fubar")
+ value = "foobar"
+ expect(@vo.set_or_return(:test, nil, {})).to eq("foobar")
+ value = "fauxbar"
+ expect(@vo.set_or_return(:test, nil, {})).to eq("fauxbar")
end
it "should not evaluate non DelayedEvaluator instances" do
- value = lambda{ 'test' }
+ value = lambda{ "test" }
@vo.set_or_return(:test, value, {})
expect(@vo.set_or_return(:test, nil, {}).object_id).to eq(value.object_id)
expect(@vo.set_or_return(:test, nil, {})).to be_a(Proc)
diff --git a/spec/unit/mixin/path_sanity_spec.rb b/spec/unit/mixin/path_sanity_spec.rb
index 3a924b9538..547c78f706 100644
--- a/spec/unit/mixin/path_sanity_spec.rb
+++ b/spec/unit/mixin/path_sanity_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class PathSanityTestHarness
include Chef::Mixin::PathSanity
@@ -31,10 +31,10 @@ describe Chef::Mixin::PathSanity do
describe "when enforcing path sanity" do
before do
Chef::Config[:enforce_path_sanity] = true
- @ruby_bindir = '/some/ruby/bin'
- @gem_bindir = '/some/gem/bin'
+ @ruby_bindir = "/some/ruby/bin"
+ @gem_bindir = "/some/gem/bin"
allow(Gem).to receive(:bindir).and_return(@gem_bindir)
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return(@ruby_bindir)
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return(@ruby_bindir)
allow(ChefConfig).to receive(:windows?).and_return(false)
end
@@ -63,10 +63,10 @@ describe Chef::Mixin::PathSanity do
end
it "does not create entries for Ruby/Gem bindirs if they exist in SANE_PATH or PATH" do
- ruby_bindir = '/usr/bin'
- gem_bindir = '/yo/gabba/gabba'
+ ruby_bindir = "/usr/bin"
+ gem_bindir = "/yo/gabba/gabba"
allow(Gem).to receive(:bindir).and_return(gem_bindir)
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return(ruby_bindir)
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return(ruby_bindir)
env = {"PATH" => gem_bindir}
@sanity.enforce_path_sanity(env)
expect(env["PATH"]).to eq("/yo/gabba/gabba:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
@@ -76,7 +76,7 @@ describe Chef::Mixin::PathSanity do
ruby_bindir = 'C:\ruby\bin'
gem_bindir = 'C:\gems\bin'
allow(Gem).to receive(:bindir).and_return(gem_bindir)
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return(ruby_bindir)
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return(ruby_bindir)
allow(ChefConfig).to receive(:windows?).and_return(true)
env = {"PATH" => 'C:\Windows\system32;C:\mr\softie'}
@sanity.enforce_path_sanity(env)
diff --git a/spec/unit/mixin/powershell_out_spec.rb b/spec/unit/mixin/powershell_out_spec.rb
index 79faf8127d..e8ba6036c5 100644
--- a/spec/unit/mixin/powershell_out_spec.rb
+++ b/spec/unit/mixin/powershell_out_spec.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/powershell_out'
+require "spec_helper"
+require "chef/mixin/powershell_out"
describe Chef::Mixin::PowershellOut do
let(:shell_out_class) { Class.new { include Chef::Mixin::PowershellOut } }
diff --git a/spec/unit/mixin/powershell_type_coercions_spec.rb b/spec/unit/mixin/powershell_type_coercions_spec.rb
index 988c3926c1..7f49784e8b 100644
--- a/spec/unit/mixin/powershell_type_coercions_spec.rb
+++ b/spec/unit/mixin/powershell_type_coercions_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/powershell_type_coercions'
-require 'base64'
+require "spec_helper"
+require "chef/mixin/powershell_type_coercions"
+require "base64"
class Chef::PSTypeTester
include Chef::Mixin::PowershellTypeCoercions
@@ -28,45 +28,45 @@ describe Chef::Mixin::PowershellTypeCoercions do
let (:test_class) { Chef::PSTypeTester.new }
describe '#translate_type' do
- it 'should single quote a string' do
- expect(test_class.translate_type('foo')).to eq("'foo'")
+ it "should single quote a string" do
+ expect(test_class.translate_type("foo")).to eq("'foo'")
end
- ["'", '"', '#', '`'].each do |c|
+ ["'", '"', '#', "`"].each do |c|
it "should base64 encode a string that contains #{c}" do
expect(test_class.translate_type("#{c}")).to match(Base64.strict_encode64(c))
end
end
- it 'should not quote an integer' do
- expect(test_class.translate_type(123)).to eq('123')
+ it "should not quote an integer" do
+ expect(test_class.translate_type(123)).to eq("123")
end
- it 'should not quote a floating point number' do
- expect(test_class.translate_type(123.4)).to eq('123.4')
+ it "should not quote a floating point number" do
+ expect(test_class.translate_type(123.4)).to eq("123.4")
end
- it 'should return $false when an instance of FalseClass is provided' do
- expect(test_class.translate_type(false)).to eq('$false')
+ it "should return $false when an instance of FalseClass is provided" do
+ expect(test_class.translate_type(false)).to eq("$false")
end
- it 'should return $true when an instance of TrueClass is provided' do
- expect(test_class.translate_type(true)).to eq('$true')
+ it "should return $true when an instance of TrueClass is provided" do
+ expect(test_class.translate_type(true)).to eq("$true")
end
- it 'should translate all members of a hash and wrap them in @{} separated by ;' do
+ it "should translate all members of a hash and wrap them in @{} separated by ;" do
expect(test_class.translate_type({"a" => 1, "b" => 1.2, "c" => false, "d" => true
})).to eq("@{a=1;b=1.2;c=$false;d=$true}")
end
- it 'should translat all members of an array and them by a ,' do
- expect(test_class.translate_type([true, false])).to eq('@($true,$false)')
+ it "should translat all members of an array and them by a ," do
+ expect(test_class.translate_type([true, false])).to eq("@($true,$false)")
end
- it 'should fall back :to_psobject if we have not defined at explicit rule' do
+ it "should fall back :to_psobject if we have not defined at explicit rule" do
ps_obj = double("PSObject")
- expect(ps_obj).to receive(:to_psobject).and_return('$true')
- expect(test_class.translate_type(ps_obj)).to eq('($true)')
+ expect(ps_obj).to receive(:to_psobject).and_return("$true")
+ expect(test_class.translate_type(ps_obj)).to eq("($true)")
end
end
end
diff --git a/spec/unit/mixin/properties_spec.rb b/spec/unit/mixin/properties_spec.rb
index 18178619e4..00e339a221 100644
--- a/spec/unit/mixin/properties_spec.rb
+++ b/spec/unit/mixin/properties_spec.rb
@@ -1,5 +1,5 @@
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/properties'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/properties"
module ChefMixinPropertiesSpec
describe "Chef::Resource.property" do
@@ -8,46 +8,46 @@ module ChefMixinPropertiesSpec
context "with a base class A with properties a, ab, and ac" do
class A
include Chef::Mixin::Properties
- property :a, 'a', default: 'a'
- property :ab, ['a', 'b'], default: 'a'
- property :ac, ['a', 'c'], default: 'a'
+ property :a, "a", default: "a"
+ property :ab, ["a", "b"], default: "a"
+ property :ac, ["a", "c"], default: "a"
end
context "and a module B with properties b, ab and bc" do
module B
include Chef::Mixin::Properties
- property :b, 'b', default: 'b'
- property :ab, default: 'b'
- property :bc, ['b', 'c'], default: 'c'
+ property :b, "b", default: "b"
+ property :ab, default: "b"
+ property :bc, ["b", "c"], default: "c"
end
context "and a derived class C < A with properties c, ac and bc" do
class C < A
include B
- property :c, 'c', default: 'c'
- property :ac, default: 'c'
- property :bc, default: 'c'
+ property :c, "c", default: "c"
+ property :ac, default: "c"
+ property :bc, default: "c"
end
it "A.properties has a, ab, and ac with types 'a', ['a', 'b'], and ['b', 'c']" do
expect(A.properties.keys).to eq [ :a, :ab, :ac ]
- expect(A.properties[:a].validation_options[:is]).to eq 'a'
- expect(A.properties[:ab].validation_options[:is]).to eq [ 'a', 'b' ]
- expect(A.properties[:ac].validation_options[:is]).to eq [ 'a', 'c' ]
+ expect(A.properties[:a].validation_options[:is]).to eq "a"
+ expect(A.properties[:ab].validation_options[:is]).to eq [ "a", "b" ]
+ expect(A.properties[:ac].validation_options[:is]).to eq [ "a", "c" ]
end
it "B.properties has b, ab, and bc with types 'b', nil and ['b', 'c']" do
expect(B.properties.keys).to eq [ :b, :ab, :bc ]
- expect(B.properties[:b].validation_options[:is]).to eq 'b'
+ expect(B.properties[:b].validation_options[:is]).to eq "b"
expect(B.properties[:ab].validation_options[:is]).to be_nil
- expect(B.properties[:bc].validation_options[:is]).to eq [ 'b', 'c' ]
+ expect(B.properties[:bc].validation_options[:is]).to eq [ "b", "c" ]
end
it "C.properties has a, b, c, ac and bc with merged types" do
expect(C.properties.keys).to eq [ :a, :ab, :ac, :b, :bc, :c ]
- expect(C.properties[:a].validation_options[:is]).to eq 'a'
- expect(C.properties[:b].validation_options[:is]).to eq 'b'
- expect(C.properties[:c].validation_options[:is]).to eq 'c'
- expect(C.properties[:ac].validation_options[:is]).to eq [ 'a', 'c' ]
- expect(C.properties[:bc].validation_options[:is]).to eq [ 'b', 'c' ]
+ expect(C.properties[:a].validation_options[:is]).to eq "a"
+ expect(C.properties[:b].validation_options[:is]).to eq "b"
+ expect(C.properties[:c].validation_options[:is]).to eq "c"
+ expect(C.properties[:ac].validation_options[:is]).to eq [ "a", "c" ]
+ expect(C.properties[:bc].validation_options[:is]).to eq [ "b", "c" ]
end
it "C.properties has ab with a non-merged type (from B)" do
expect(C.properties[:ab].validation_options[:is]).to be_nil
@@ -57,12 +57,12 @@ module ChefMixinPropertiesSpec
let(:c) { C.new }
it "all properties can be retrieved and merged properties default to ab->b, ac->c, bc->c" do
- expect(c.a).to eq('a')
- expect(c.b).to eq('b')
- expect(c.c).to eq('c')
- expect(c.ab).to eq('b')
- expect(c.ac).to eq('c')
- expect(c.bc).to eq('c')
+ expect(c.a).to eq("a")
+ expect(c.b).to eq("b")
+ expect(c.c).to eq("c")
+ expect(c.ab).to eq("b")
+ expect(c.ac).to eq("c")
+ expect(c.bc).to eq("c")
end
end
end
diff --git a/spec/unit/mixin/proxified_socket_spec.rb b/spec/unit/mixin/proxified_socket_spec.rb
index 88f71ae48b..70c1ff95cd 100644
--- a/spec/unit/mixin/proxified_socket_spec.rb
+++ b/spec/unit/mixin/proxified_socket_spec.rb
@@ -63,8 +63,8 @@ describe Chef::Mixin::ProxifiedSocket do
before do
# I'm purposefully setting both of these because we prefer the https
# variable
- ENV['https_proxy'] = https_uri
- ENV['http_proxy'] = http_uri
+ ENV["https_proxy"] = https_uri
+ ENV["http_proxy"] = http_uri
end
let(:proxy_uri) { https_uri }
@@ -74,7 +74,7 @@ describe Chef::Mixin::ProxifiedSocket do
# This is testing that no_proxy is also provided to Proxified
# when it is set
before do
- ENV['no_proxy'] = no_proxy_spec
+ ENV["no_proxy"] = no_proxy_spec
end
let(:no_proxy_spec) { "somehost1,somehost2" }
@@ -84,7 +84,7 @@ describe Chef::Mixin::ProxifiedSocket do
context "when http_proxy is set" do
before do
- ENV['http_proxy'] = http_uri
+ ENV["http_proxy"] = http_uri
end
let(:proxy_uri) { http_uri }
diff --git a/spec/unit/mixin/securable_spec.rb b/spec/unit/mixin/securable_spec.rb
index 33d5eb2141..d52dcd7cbe 100644
--- a/spec/unit/mixin/securable_spec.rb
+++ b/spec/unit/mixin/securable_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Mixin::Securable do
@@ -59,32 +59,32 @@ describe Chef::Mixin::Securable do
end
it "should accept group/owner names that are a single character or digit" do
- expect { @securable.group 'v' }.not_to raise_error
- expect { @securable.group '1' }.not_to raise_error
- expect { @securable.owner 'v' }.not_to raise_error
- expect { @securable.owner '1' }.not_to raise_error
+ expect { @securable.group "v" }.not_to raise_error
+ expect { @securable.group "1" }.not_to raise_error
+ expect { @securable.owner "v" }.not_to raise_error
+ expect { @securable.owner "1" }.not_to raise_error
end
it "should not accept group/owner names starting with '-', '+', or '~'" do
- expect { @securable.group '-test' }.to raise_error(ArgumentError)
- expect { @securable.group '+test' }.to raise_error(ArgumentError)
- expect { @securable.group '~test' }.to raise_error(ArgumentError)
- expect { @securable.group 'te-st' }.not_to raise_error
- expect { @securable.group 'te+st' }.not_to raise_error
- expect { @securable.group 'te~st' }.not_to raise_error
- expect { @securable.owner '-test' }.to raise_error(ArgumentError)
- expect { @securable.owner '+test' }.to raise_error(ArgumentError)
- expect { @securable.owner '~test' }.to raise_error(ArgumentError)
- expect { @securable.owner 'te-st' }.not_to raise_error
- expect { @securable.owner 'te+st' }.not_to raise_error
- expect { @securable.owner 'te~st' }.not_to raise_error
+ expect { @securable.group "-test" }.to raise_error(ArgumentError)
+ expect { @securable.group "+test" }.to raise_error(ArgumentError)
+ expect { @securable.group "~test" }.to raise_error(ArgumentError)
+ expect { @securable.group "te-st" }.not_to raise_error
+ expect { @securable.group "te+st" }.not_to raise_error
+ expect { @securable.group "te~st" }.not_to raise_error
+ expect { @securable.owner "-test" }.to raise_error(ArgumentError)
+ expect { @securable.owner "+test" }.to raise_error(ArgumentError)
+ expect { @securable.owner "~test" }.to raise_error(ArgumentError)
+ expect { @securable.owner "te-st" }.not_to raise_error
+ expect { @securable.owner "te+st" }.not_to raise_error
+ expect { @securable.owner "te~st" }.not_to raise_error
end
it "should not accept group/owner names containing ':', ',' or non-space whitespace" do
- expect { @securable.group ':test' }.to raise_error(ArgumentError)
- expect { @securable.group 'te:st' }.to raise_error(ArgumentError)
- expect { @securable.group ',test' }.to raise_error(ArgumentError)
- expect { @securable.group 'te,st' }.to raise_error(ArgumentError)
+ expect { @securable.group ":test" }.to raise_error(ArgumentError)
+ expect { @securable.group "te:st" }.to raise_error(ArgumentError)
+ expect { @securable.group ",test" }.to raise_error(ArgumentError)
+ expect { @securable.group "te,st" }.to raise_error(ArgumentError)
expect { @securable.group "\ttest" }.to raise_error(ArgumentError)
expect { @securable.group "te\tst" }.to raise_error(ArgumentError)
expect { @securable.group "\rtest" }.to raise_error(ArgumentError)
@@ -93,10 +93,10 @@ describe Chef::Mixin::Securable do
expect { @securable.group "te\fst" }.to raise_error(ArgumentError)
expect { @securable.group "\0test" }.to raise_error(ArgumentError)
expect { @securable.group "te\0st" }.to raise_error(ArgumentError)
- expect { @securable.owner ':test' }.to raise_error(ArgumentError)
- expect { @securable.owner 'te:st' }.to raise_error(ArgumentError)
- expect { @securable.owner ',test' }.to raise_error(ArgumentError)
- expect { @securable.owner 'te,st' }.to raise_error(ArgumentError)
+ expect { @securable.owner ":test" }.to raise_error(ArgumentError)
+ expect { @securable.owner "te:st" }.to raise_error(ArgumentError)
+ expect { @securable.owner ",test" }.to raise_error(ArgumentError)
+ expect { @securable.owner "te,st" }.to raise_error(ArgumentError)
expect { @securable.owner "\ttest" }.to raise_error(ArgumentError)
expect { @securable.owner "te\tst" }.to raise_error(ArgumentError)
expect { @securable.owner "\rtest" }.to raise_error(ArgumentError)
@@ -124,10 +124,10 @@ describe Chef::Mixin::Securable do
end
it "should accept group/owner names in UTF-8" do
- expect { @securable.group 'tëst' }.not_to raise_error
- expect { @securable.group 'ë' }.not_to raise_error
- expect { @securable.owner 'tëst' }.not_to raise_error
- expect { @securable.owner 'ë' }.not_to raise_error
+ expect { @securable.group "tëst" }.not_to raise_error
+ expect { @securable.group "ë" }.not_to raise_error
+ expect { @securable.owner "tëst" }.not_to raise_error
+ expect { @securable.owner "ë" }.not_to raise_error
end
it "should accept a unix file mode in string form as an octal number" do
@@ -262,19 +262,19 @@ describe Chef::Mixin::Securable do
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 => "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_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 => "poop" }.to raise_error(ArgumentError)
end
it "should allow multiple rights and deny_rights declarations" do
diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb
index c22d45e5fd..8a2fea651a 100644
--- a/spec/unit/mixin/shell_out_spec.rb
+++ b/spec/unit/mixin/shell_out_spec.rb
@@ -20,7 +20,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Mixin::ShellOut do
let(:shell_out_class) { Class.new { include Chef::Mixin::ShellOut } }
@@ -34,25 +34,25 @@ describe Chef::Mixin::ShellOut do
let!(:capture_log_output) { Chef::Log.logger = Logger.new(output) }
let(:assume_deprecation_log_level) { allow(Chef::Log).to receive(:level).and_return(:warn) }
- context 'without options' do
+ context "without options" do
let(:command_args) { [ cmd ] }
- it 'should not edit command args' do
+ it "should not edit command args" do
is_expected.to eql(command_args)
end
end
- context 'without deprecated options' do
+ context "without deprecated options" do
let(:options) { { :environment => environment } }
- let(:environment) { { 'LC_ALL' => 'C', 'LANG' => 'C', 'LANGUAGE' => 'C' } }
+ let(:environment) { { "LC_ALL" => "C", "LANG" => "C", "LANGUAGE" => "C" } }
- it 'should not edit command args' do
+ it "should not edit command args" do
is_expected.to eql(command_args)
end
end
def self.should_emit_deprecation_warning_about(old_option, new_option)
- it 'should emit a deprecation warning' do
+ it "should emit a deprecation warning" do
assume_deprecation_log_level and capture_log_output
subject
expect(output.string).to match /DEPRECATION:/
@@ -61,22 +61,22 @@ describe Chef::Mixin::ShellOut do
end
end
- context 'with :command_log_level option' do
+ context "with :command_log_level option" do
let(:options) { { :command_log_level => command_log_level } }
let(:command_log_level) { :warn }
- it 'should convert :command_log_level to :log_level' do
+ it "should convert :command_log_level to :log_level" do
is_expected.to eql [ cmd, { :log_level => command_log_level } ]
end
should_emit_deprecation_warning_about :command_log_level, :log_level
end
- context 'with :command_log_prepend option' do
+ context "with :command_log_prepend option" do
let(:options) { { :command_log_prepend => command_log_prepend } }
- let(:command_log_prepend) { 'PROVIDER:' }
+ let(:command_log_prepend) { "PROVIDER:" }
- it 'should convert :command_log_prepend to :log_tag' do
+ it "should convert :command_log_prepend to :log_tag" do
is_expected.to eql [ cmd, { :log_tag => command_log_prepend } ]
end
@@ -84,7 +84,7 @@ describe Chef::Mixin::ShellOut do
end
context "with 'command_log_level' option" do
- let(:options) { { 'command_log_level' => command_log_level } }
+ let(:options) { { "command_log_level" => command_log_level } }
let(:command_log_level) { :warn }
it "should convert 'command_log_level' to :log_level" do
@@ -95,8 +95,8 @@ describe Chef::Mixin::ShellOut do
end
context "with 'command_log_prepend' option" do
- let(:options) { { 'command_log_prepend' => command_log_prepend } }
- let(:command_log_prepend) { 'PROVIDER:' }
+ let(:options) { { "command_log_prepend" => command_log_prepend } }
+ let(:command_log_prepend) { "PROVIDER:" }
it "should convert 'command_log_prepend' to :log_tag" do
is_expected.to eql [ cmd, { :log_tag => command_log_prepend } ]
@@ -124,95 +124,95 @@ 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 } }
+ options = { :environment => { "LC_ALL" => nil, "LANGUAGE" => nil, "LANG" => nil } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(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' } }
+ options = { :environment => { "LC_ALL" => "en_US.UTF-8", "LANGUAGE" => "en_US.UTF-8", "LANG" => "en_US.UTF-8" } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(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(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:environment => {
- 'HOME' => '/Users/morty',
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "HOME" => "/Users/morty",
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
}
},).and_return(true)
shell_out_obj.shell_out(cmd, options)
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(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:environment => {
- 'HOME' => '/Users/morty',
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "HOME" => "/Users/morty",
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
}
},).and_return(true)
shell_out_obj.shell_out(cmd, options)
- expect(options[:environment].has_key?('LC_ALL')).to be false
+ expect(options[:environment].has_key?("LC_ALL")).to be false
end
end
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 } }
+ options = { :env => { "LC_ALL" => nil, "LANG" => nil, "LANGUAGE" => nil } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(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' }}
+ options = { :env => { "LC_ALL" => "de_DE.UTF-8", "LANG" => "de_DE.UTF-8", "LANGUAGE" => "de_DE.UTF-8" }}
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(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(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:env => {
- 'HOME' => '/Users/morty',
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "HOME" => "/Users/morty",
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
}
},).and_return(true)
shell_out_obj.shell_out(cmd, options)
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(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:env => {
- 'HOME' => '/Users/morty',
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "HOME" => "/Users/morty",
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
}
},).and_return(true)
shell_out_obj.shell_out(cmd, options)
- expect(options[:env].has_key?('LC_ALL')).to be false
+ expect(options[:env].has_key?("LC_ALL")).to be false
end
end
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(shell_out_obj).to receive(:shell_out_command).with(cmd, {
- :user => 'morty',
+ :user => "morty",
:environment => {
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
},
},).and_return(true)
shell_out_obj.shell_out(cmd, options)
@@ -224,9 +224,9 @@ describe Chef::Mixin::ShellOut do
it "should set environment language settings to the configured internal locale" do
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:environment => {
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
}
},).and_return(true)
shell_out_obj.shell_out(cmd)
@@ -240,19 +240,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(shell_out_obj).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(shell_out_obj).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(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
@@ -260,19 +260,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(shell_out_obj).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(shell_out_obj).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(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
@@ -280,7 +280,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(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
diff --git a/spec/unit/mixin/subclass_directive_spec.rb b/spec/unit/mixin/subclass_directive_spec.rb
index 552f26c0c1..38357883d3 100644
--- a/spec/unit/mixin/subclass_directive_spec.rb
+++ b/spec/unit/mixin/subclass_directive_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class SubclassDirectiveParent
extend Chef::Mixin::SubclassDirective
diff --git a/spec/unit/mixin/template_spec.rb b/spec/unit/mixin/template_spec.rb
index 95d0eb6711..2fb384866d 100644
--- a/spec/unit/mixin/template_spec.rb
+++ b/spec/unit/mixin/template_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'cgi'
+require "cgi"
describe Chef::Mixin::Template, "render_template" do
let(:sep) { Chef::Platform.windows? ? "\r\n" : "\n" }
@@ -85,10 +85,10 @@ describe Chef::Mixin::Template, "render_template" do
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, @cookbook_collection, @events)
- @rendered_file_location = Dir.tmpdir + '/openldap_stuff.conf'
+ @rendered_file_location = Dir.tmpdir + "/openldap_stuff.conf"
@resource = Chef::Resource::Template.new(@rendered_file_location)
- @resource.cookbook_name = 'openldap'
+ @resource.cookbook_name = "openldap"
@current_resource = @resource.dup
@content_provider = Chef::Provider::Template::Content.new(@resource, @current_resource, @run_context)
@@ -117,7 +117,7 @@ describe Chef::Mixin::Template, "render_template" do
end
it "should render partials from a different cookbook" do
- @template_context[:template_finder] = Chef::Provider::TemplateFinder.new(@run_context, 'apache2', @node)
+ @template_context[:template_finder] = Chef::Provider::TemplateFinder.new(@run_context, "apache2", @node)
output = @template_context.render_template_from_string("before {<%= render('test.erb', :cookbook => 'openldap').strip %>} after")
expect(output).to eq("before {We could be diving for pearls!} after")
@@ -144,7 +144,7 @@ describe Chef::Mixin::Template, "render_template" do
end
it "should pass the original variables to partials" do
- @template_context[:secret] = 'candy'
+ @template_context[:secret] = "candy"
output = @template_context.render_template_from_string("before {<%= render 'openldap_variable_stuff.conf.erb' %>} after")
output == "before {super secret is candy} after"
@@ -161,7 +161,7 @@ describe Chef::Mixin::Template, "render_template" do
end
it "should pass variables to partials even if they are named the same" do
- @template_context[:secret] = 'one'
+ @template_context[:secret] = "one"
output = @template_context.render_template_from_string("before {<%= render 'openldap_variable_stuff.conf.erb', :variables => {:secret => 'two' } %>} after <%= @secret %>")
expect(output).to eq("before {super secret is two} after one")
@@ -206,7 +206,7 @@ describe Chef::Mixin::Template, "render_template" do
def render_template_from_string
end
end
- ['node', 'render', 'render_template', 'render_template_from_string'].each do |method_name|
+ ["node", "render", "render_template", "render_template_from_string"].each do |method_name|
expect(Chef::Log).to receive(:warn).with(/^Core template method `#{method_name}' overridden by extension module/)
end
@template_context._extend_modules([mod])
diff --git a/spec/unit/mixin/unformatter_spec.rb b/spec/unit/mixin/unformatter_spec.rb
index 2eae0ac9bb..c63ed62b8d 100644
--- a/spec/unit/mixin/unformatter_spec.rb
+++ b/spec/unit/mixin/unformatter_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/unformatter'
+require "spec_helper"
+require "chef/mixin/unformatter"
class Chef::UnformatterTest
include Chef::Mixin::Unformatter
diff --git a/spec/unit/mixin/uris_spec.rb b/spec/unit/mixin/uris_spec.rb
index d4985c4f67..7012ecd861 100644
--- a/spec/unit/mixin/uris_spec.rb
+++ b/spec/unit/mixin/uris_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/uris'
+require "spec_helper"
+require "chef/mixin/uris"
class Chef::UrisTest
include Chef::Mixin::Uris
@@ -28,19 +28,19 @@ describe Chef::Mixin::Uris do
describe "#uri_scheme?" do
it "matches 'scheme://foo.com'" do
- expect(uris.uri_scheme?('scheme://foo.com')).to eq(true)
+ expect(uris.uri_scheme?("scheme://foo.com")).to eq(true)
end
it "does not match 'c:/foo.com'" do
- expect(uris.uri_scheme?('c:/foo.com')).to eq(false)
+ expect(uris.uri_scheme?("c:/foo.com")).to eq(false)
end
it "does not match '/usr/bin/foo.com'" do
- expect(uris.uri_scheme?('/usr/bin/foo.com')).to eq(false)
+ expect(uris.uri_scheme?("/usr/bin/foo.com")).to eq(false)
end
it "does not match 'c:/foo.com://bar.com'" do
- expect(uris.uri_scheme?('c:/foo.com://bar.com')).to eq(false)
+ expect(uris.uri_scheme?("c:/foo.com://bar.com")).to eq(false)
end
end
diff --git a/spec/unit/mixin/windows_architecture_helper_spec.rb b/spec/unit/mixin/windows_architecture_helper_spec.rb
index 55eca28dc2..58e1927ea7 100644
--- a/spec/unit/mixin/windows_architecture_helper_spec.rb
+++ b/spec/unit/mixin/windows_architecture_helper_spec.rb
@@ -17,8 +17,8 @@
#
-require 'spec_helper'
-require 'chef/mixin/windows_architecture_helper'
+require "spec_helper"
+require "chef/mixin/windows_architecture_helper"
diff --git a/spec/unit/mixin/xml_escape_spec.rb b/spec/unit/mixin/xml_escape_spec.rb
index c5156cfb7b..a3f4bc839e 100644
--- a/spec/unit/mixin/xml_escape_spec.rb
+++ b/spec/unit/mixin/xml_escape_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class XMLEscapingTestHarness
include Chef::Mixin::XMLEscape
diff --git a/spec/unit/monkey_patches/uri_spec.rb b/spec/unit/monkey_patches/uri_spec.rb
index 9aca1fc9f1..e8ff1a3592 100644
--- a/spec/unit/monkey_patches/uri_spec.rb
+++ b/spec/unit/monkey_patches/uri_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe URI do
describe "when a URI contains an IPv6 literal" do
diff --git a/spec/unit/monologger_spec.rb b/spec/unit/monologger_spec.rb
index 8689ea0aaa..92381afffd 100644
--- a/spec/unit/monologger_spec.rb
+++ b/spec/unit/monologger_spec.rb
@@ -15,9 +15,9 @@
# limitations under the License.
#
-require 'chef/monologger'
-require 'tempfile'
-require 'spec_helper'
+require "chef/monologger"
+require "tempfile"
+require "spec_helper"
describe MonoLogger do
it "should disable buffering when passed an IO stream" do
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb
index 9956ef1ec9..dfa6f33122 100644
--- a/spec/unit/node/attribute_spec.rb
+++ b/spec/unit/node/attribute_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/node/attribute'
+require "spec_helper"
+require "chef/node/attribute"
describe Chef::Node::Attribute do
before(:each) do
@@ -488,31 +488,31 @@ describe Chef::Node::Attribute do
end
it "should create a deep copy of the node attribute" do
- @attributes.default['foo']['bar']['baz'] = 'fizz'
- hash = @attributes['foo'].to_hash
+ @attributes.default["foo"]["bar"]["baz"] = "fizz"
+ hash = @attributes["foo"].to_hash
expect(hash).to eql({"bar"=>{"baz"=>"fizz"}})
- hash['bar']['baz'] = 'buzz'
+ hash["bar"]["baz"] = "buzz"
expect(hash).to eql({"bar"=>{"baz"=>"buzz"}})
- expect(@attributes.default['foo']).to eql({"bar"=>{"baz"=>"fizz"}})
+ expect(@attributes.default["foo"]).to eql({"bar"=>{"baz"=>"fizz"}})
end
it "should create a deep copy of arrays in the node attribute" do
- @attributes.default['foo']['bar'] = ['fizz']
- hash = @attributes['foo'].to_hash
- expect(hash).to eql({"bar"=>[ 'fizz' ]})
- hash['bar'].push('buzz')
- expect(hash).to eql({"bar"=>[ 'fizz', 'buzz' ]})
- expect(@attributes.default['foo']).to eql({"bar"=>[ 'fizz' ]})
+ @attributes.default["foo"]["bar"] = ["fizz"]
+ hash = @attributes["foo"].to_hash
+ expect(hash).to eql({"bar"=>[ "fizz" ]})
+ hash["bar"].push("buzz")
+ expect(hash).to eql({"bar"=>[ "fizz", "buzz" ]})
+ expect(@attributes.default["foo"]).to eql({"bar"=>[ "fizz" ]})
end
it "mutating strings should not mutate the attributes" do
pending "this is a bug that should be fixed"
- @attributes.default['foo']['bar']['baz'] = 'fizz'
- hash = @attributes['foo'].to_hash
+ @attributes.default["foo"]["bar"]["baz"] = "fizz"
+ hash = @attributes["foo"].to_hash
expect(hash).to eql({"bar"=>{"baz"=>"fizz"}})
- hash['bar']['baz'] << 'buzz'
+ hash["bar"]["baz"] << "buzz"
expect(hash).to eql({"bar"=>{"baz"=>"fizzbuzz"}})
- expect(@attributes.default['foo']).to eql({"bar"=>{"baz"=>"fizz"}})
+ expect(@attributes.default["foo"]).to eql({"bar"=>{"baz"=>"fizz"}})
end
end
diff --git a/spec/unit/node/immutable_collections_spec.rb b/spec/unit/node/immutable_collections_spec.rb
index 73165c1fba..07176beb76 100644
--- a/spec/unit/node/immutable_collections_spec.rb
+++ b/spec/unit/node/immutable_collections_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
require "chef/node/immutable_collections"
describe Chef::Node::ImmutableMash do
@@ -64,19 +64,19 @@ describe Chef::Node::ImmutableMash do
end
it "converts an immutable nested mash to a new mutable hash" do
- expect(@copy['top_level_4']['level2']).to be_instance_of(Hash)
+ expect(@copy["top_level_4"]["level2"]).to be_instance_of(Hash)
end
it "converts an immutable nested array to a new mutable array" do
- expect(@copy['top_level_2']).to be_instance_of(Array)
+ expect(@copy["top_level_2"]).to be_instance_of(Array)
end
it "should create a mash with the same content" do
expect(@copy).to eq(@immutable_mash)
end
- it 'should allow mutation' do
- expect { @copy['m'] = 'm' }.not_to raise_error
+ it "should allow mutation" do
+ expect { @copy["m"] = "m" }.not_to raise_error
end
end
@@ -113,7 +113,7 @@ describe Chef::Node::ImmutableArray do
before do
@immutable_array = Chef::Node::ImmutableArray.new(%w[foo bar baz] + Array(1..3) + [nil, true, false, [ "el", 0, nil ] ])
- immutable_mash = Chef::Node::ImmutableMash.new({:m => 'm'})
+ immutable_mash = Chef::Node::ImmutableMash.new({:m => "m"})
@immutable_nested_array = Chef::Node::ImmutableArray.new(["level1",@immutable_array, immutable_mash])
end
@@ -189,8 +189,8 @@ describe Chef::Node::ImmutableArray do
expect(@copy).to eq(@immutable_nested_array)
end
- it 'should allow mutation' do
- expect { @copy << 'm' }.not_to raise_error
+ it "should allow mutation" do
+ expect { @copy << "m" }.not_to raise_error
end
end
diff --git a/spec/unit/node_map_spec.rb b/spec/unit/node_map_spec.rb
index 7b37ea59f4..ec7c042e4e 100644
--- a/spec/unit/node_map_spec.rb
+++ b/spec/unit/node_map_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/node_map'
+require "spec_helper"
+require "chef/node_map"
describe Chef::NodeMap do
@@ -27,7 +27,7 @@ describe Chef::NodeMap do
describe "with a bad filter name" do
it "should raise an error" do
- expect{ node_map.set(node, :thing, on_platform_family: 'rhel') }.to raise_error
+ expect{ node_map.set(node, :thing, on_platform_family: "rhel") }.to raise_error
end
end
@@ -156,7 +156,7 @@ describe Chef::NodeMap do
expect(node_map.get(node, :chef_gem)).to eql(:foo)
end
it "should handle :on_platforms => [ 'windows' ]" do
- node_map.set(:dsc_script, :foo, :on_platforms => [ 'windows' ])
+ node_map.set(:dsc_script, :foo, :on_platforms => [ "windows" ])
allow(node).to receive(:[]).with(:platform).and_return("windows")
expect(node_map.get(node, :dsc_script)).to eql(:foo)
end
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index 39ef684f31..dcee5f8eb5 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Node do
@@ -27,32 +27,32 @@ describe Chef::Node do
it_behaves_like "a platform introspector"
it "creates a node and assigns it a name" do
- node = Chef::Node.build('solo-node')
- expect(node.name).to eq('solo-node')
+ node = Chef::Node.build("solo-node")
+ expect(node.name).to eq("solo-node")
end
it "should validate the name of the node" do
- expect{Chef::Node.build('solo node')}.to raise_error(Chef::Exceptions::ValidationFailed)
+ expect{Chef::Node.build("solo node")}.to raise_error(Chef::Exceptions::ValidationFailed)
end
it "should be sortable" do
- n1 = Chef::Node.build('alpha')
- n2 = Chef::Node.build('beta')
- n3 = Chef::Node.build('omega')
+ n1 = Chef::Node.build("alpha")
+ n2 = Chef::Node.build("beta")
+ n3 = Chef::Node.build("omega")
expect([n3, n1, n2].sort).to eq([n1, n2, n3])
end
it "should share identity only with others of the same name" do
- n1 = Chef::Node.build('foo')
- n2 = Chef::Node.build('foo')
- n3 = Chef::Node.build('bar')
+ n1 = Chef::Node.build("foo")
+ n2 = Chef::Node.build("foo")
+ n3 = Chef::Node.build("bar")
expect(n1).to eq(n2)
expect(n1).not_to eq(n3)
end
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")
@@ -62,19 +62,19 @@ describe Chef::Node do
allow(Chef::Node).to receive(:new).and_return(node)
expect(node).to receive(:create).and_return(node)
node = Chef::Node.find_or_create("created-node")
- expect(node.name).to eq('created-node')
+ expect(node.name).to eq("created-node")
expect(node).to equal(node)
end
end
describe "when the node exists on the server" do
before do
- node.name('existing-node')
+ node.name("existing-node")
allow(Chef::Node).to receive(:load).and_return(node)
end
it "loads the node via the REST API for find_or_create" do
- expect(Chef::Node.find_or_create('existing-node')).to equal(node)
+ expect(Chef::Node.find_or_create("existing-node")).to equal(node)
end
end
@@ -88,7 +88,7 @@ describe Chef::Node do
describe "initialize" do
it "should default to the '_default' chef_environment" do
n = Chef::Node.new
- expect(n.chef_environment).to eq('_default')
+ expect(n.chef_environment).to eq("_default")
end
end
@@ -147,7 +147,7 @@ describe Chef::Node do
end
it "allows policy_name with every valid character" do
- expect { node.policy_name = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqurstuvwxyz0123456789-_:.' }.to_not raise_error
+ expect { node.policy_name = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqurstuvwxyz0123456789-_:." }.to_not raise_error
end
it "sets policy_name when given an argument" do
@@ -183,7 +183,7 @@ describe Chef::Node do
end
it "allows policy_group with every valid character" do
- expect { node.policy_group = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqurstuvwxyz0123456789-_:.' }.to_not raise_error
+ expect { node.policy_group = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqurstuvwxyz0123456789-_:." }.to_not raise_error
end
it "sets an environment with chef_environment(something)" do
@@ -291,9 +291,9 @@ describe Chef::Node do
end
it "should let you use tag as a convience method for the tags attribute" do
- node.normal['tags'] = ['one', 'two']
- node.tag('three', 'four')
- expect(node['tags']).to eq(['one', 'two', 'three', 'four'])
+ node.normal["tags"] = ["one", "two"]
+ node.tag("three", "four")
+ expect(node["tags"]).to eq(["one", "two", "three", "four"])
end
end
@@ -706,25 +706,25 @@ describe Chef::Node do
#
describe "deep merge attribute cache edge conditions" do
it "does not error with complicated attribute substitution" do
- node.default['chef_attribute_hell']['attr1'] = "attribute1"
- node.default['chef_attribute_hell']['attr2'] = "#{node.chef_attribute_hell.attr1}/attr2"
- expect { node.default['chef_attribute_hell']['attr3'] = "#{node.chef_attribute_hell.attr2}/attr3" }.not_to raise_error
+ node.default["chef_attribute_hell"]["attr1"] = "attribute1"
+ node.default["chef_attribute_hell"]["attr2"] = "#{node.chef_attribute_hell.attr1}/attr2"
+ expect { node.default["chef_attribute_hell"]["attr3"] = "#{node.chef_attribute_hell.attr2}/attr3" }.not_to raise_error
end
it "caches both strings and symbols correctly" do
- node.force_default[:solr][:version] = '4.10.2'
+ node.force_default[:solr][:version] = "4.10.2"
node.force_default[:solr][:data_dir] = "/opt/solr-#{node['solr'][:version]}/example/solr"
node.force_default[:solr][:xms] = "512M"
expect(node[:solr][:xms]).to eql("512M")
- expect(node['solr'][:xms]).to eql("512M")
+ expect(node["solr"][:xms]).to eql("512M")
end
it "method interpolation syntax also works" do
- node.default['passenger']['version'] = '4.0.57'
- node.default['passenger']['root_path'] = "passenger-#{node['passenger']['version']}"
- node.default['passenger']['root_path_2'] = "passenger-#{node.passenger['version']}"
- expect(node['passenger']['root_path_2']).to eql("passenger-4.0.57")
- expect(node[:passenger]['root_path_2']).to eql("passenger-4.0.57")
+ node.default["passenger"]["version"] = "4.0.57"
+ node.default["passenger"]["root_path"] = "passenger-#{node['passenger']['version']}"
+ node.default["passenger"]["root_path_2"] = "passenger-#{node.passenger['version']}"
+ expect(node["passenger"]["root_path_2"]).to eql("passenger-4.0.57")
+ expect(node[:passenger]["root_path_2"]).to eql("passenger-4.0.57")
end
end
@@ -749,7 +749,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
@@ -762,7 +762,7 @@ describe Chef::Node do
attrs = { "chef_environment" => "foo_environment", "bar" => "baz" }
expect(node.consume_chef_environment(attrs)).to eq({ "bar" => "baz" })
expect(node.chef_environment).to eq("foo_environment")
- expect(node['chef_environment']).to be nil
+ expect(node["chef_environment"]).to be nil
end
it "should overwrites the run list with the run list it consumes" do
@@ -805,7 +805,7 @@ describe Chef::Node do
end
it "should set the tags attribute to an empty array if it is nil" do
- node.attributes.normal = { 'tags' => nil }
+ node.attributes.normal = { "tags" => nil }
node.consume_external_attrs(@ohai_data, {})
expect(node.tags).to eql([])
end
@@ -841,22 +841,22 @@ 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
node.consume_external_attrs(@ohai_data, {})
- expect(node.automatic_attrs[:platform]).to eq('foobuntu')
- expect(node.automatic_attrs[:platform_version]).to eq('23.42')
+ expect(node.automatic_attrs[:platform]).to eq("foobuntu")
+ expect(node.automatic_attrs[:platform_version]).to eq("23.42")
end
it "consumes the run list from provided json attributes" do
- node.consume_external_attrs(@ohai_data, {"run_list" => ['recipe[unicorn]']})
- expect(node.run_list).to eq(['recipe[unicorn]'])
+ node.consume_external_attrs(@ohai_data, {"run_list" => ["recipe[unicorn]"]})
+ expect(node.run_list).to eq(["recipe[unicorn]"])
end
it "saves non-runlist json attrs for later" do
- expansion = Chef::RunList::RunListExpansion.new('_default', [])
+ expansion = Chef::RunList::RunListExpansion.new("_default", [])
allow(node.run_list).to receive(:expand).and_return(expansion)
node.consume_external_attrs(@ohai_data, {"foo" => "bar"})
node.expand!
@@ -868,7 +868,7 @@ describe Chef::Node do
describe "when expanding its run list and merging attributes" do
before do
@environment = Chef::Environment.new.tap do |e|
- e.name('rspec_env')
+ e.name("rspec_env")
e.default_attributes("env default key" => "env default value")
e.override_attributes("env override key" => "env override value")
end
@@ -879,15 +879,15 @@ describe Chef::Node do
end
it "sets the 'recipes' automatic attribute to the recipes in the expanded run_list" do
- @expansion.recipes << 'recipe[chef::client]' << 'recipe[nginx::default]'
+ @expansion.recipes << "recipe[chef::client]" << "recipe[nginx::default]"
node.expand!
- expect(node.automatic_attrs[:recipes]).to eq(['recipe[chef::client]', 'recipe[nginx::default]'])
+ expect(node.automatic_attrs[:recipes]).to eq(["recipe[chef::client]", "recipe[nginx::default]"])
end
it "sets the 'roles' automatic attribute to the expanded role list" do
- @expansion.instance_variable_set(:@applied_roles, {'arf' => nil, 'countersnark' => nil})
+ @expansion.instance_variable_set(:@applied_roles, {"arf" => nil, "countersnark" => nil})
node.expand!
- expect(node.automatic_attrs[:roles].sort).to eq(['arf', 'countersnark'])
+ expect(node.automatic_attrs[:roles].sort).to eq(["arf", "countersnark"])
end
it "applies default attributes from the environment as environment defaults" do
@@ -1152,7 +1152,7 @@ describe Chef::Node do
expect(h["chef_environment"]).to eq("dev")
end
- it 'should return an empty array for empty run_list' do
+ it "should return an empty array for empty run_list" do
expect(node.to_hash["run_list"]).to eq([])
end
end
@@ -1170,11 +1170,11 @@ 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'}
- node.run_list << {"type" => "role", "name" => 'Hastur'}
+ node.run_list << {"type" => "role", "name" => "Cthulu"}
+ node.run_list << {"type" => "role", "name" => "Hastur"}
json = Chef::JSONCompat.to_json(node)
expect(json).to match(/\"run_list\":\[\"role\[Cthulu\]\",\"role\[Hastur\]\"\]/)
end
diff --git a/spec/unit/org_spec.rb b/spec/unit/org_spec.rb
index 97e1b87704..cc5c9b45b7 100644
--- a/spec/unit/org_spec.rb
+++ b/spec/unit/org_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/org'
-require 'tempfile'
+require "chef/org"
+require "tempfile"
describe Chef::Org do
let(:org) { Chef::Org.new("an_org") }
@@ -135,7 +135,7 @@ describe Chef::Org do
describe "API Interactions" do
let(:rest) do
Chef::Config[:chef_server_root] = "http://www.example.com"
- r = double('rest')
+ r = double("rest")
allow(Chef::ServerAPI).to receive(:new).and_return(r)
r
end
diff --git a/spec/unit/platform/query_helpers_spec.rb b/spec/unit/platform/query_helpers_spec.rb
index d18b6f7902..3905b15071 100644
--- a/spec/unit/platform/query_helpers_spec.rb
+++ b/spec/unit/platform/query_helpers_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe "Chef::Platform#windows_server_2003?" do
it "returns false early when not on windows" do
@@ -51,8 +51,8 @@ describe "Chef::Platform#windows_nano_server?" do
end
after do
- Win32::Registry.send(:remove_const, 'HKEY_LOCAL_MACHINE') if defined?(Win32::Registry::HKEY_LOCAL_MACHINE)
- Win32::Registry.send(:remove_const, 'KEY_QUERY_VALUE') if defined?(Win32::Registry::KEY_QUERY_VALUE)
+ Win32::Registry.send(:remove_const, "HKEY_LOCAL_MACHINE") if defined?(Win32::Registry::HKEY_LOCAL_MACHINE)
+ Win32::Registry.send(:remove_const, "KEY_QUERY_VALUE") if defined?(Win32::Registry::KEY_QUERY_VALUE)
end
it "returns false early when not on windows" do
@@ -63,7 +63,7 @@ describe "Chef::Platform#windows_nano_server?" do
it "returns true when the registry value is 1" do
allow(ChefConfig).to receive(:windows?).and_return(true)
- allow(Chef::Platform).to receive(:require).with('win32/registry')
+ allow(Chef::Platform).to receive(:require).with("win32/registry")
expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).
with(key, access).
and_yield(registry)
@@ -73,7 +73,7 @@ describe "Chef::Platform#windows_nano_server?" do
it "returns false when the registry value is not 1" do
allow(ChefConfig).to receive(:windows?).and_return(true)
- allow(Chef::Platform).to receive(:require).with('win32/registry')
+ allow(Chef::Platform).to receive(:require).with("win32/registry")
expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).
with(key, access).
and_yield(registry)
@@ -83,7 +83,7 @@ describe "Chef::Platform#windows_nano_server?" do
it "returns false when the registry value does not exist" do
allow(ChefConfig).to receive(:windows?).and_return(true)
- allow(Chef::Platform).to receive(:require).with('win32/registry')
+ allow(Chef::Platform).to receive(:require).with("win32/registry")
expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).
with(key, access).
and_yield(registry)
@@ -94,7 +94,7 @@ describe "Chef::Platform#windows_nano_server?" do
it "returns false when the registry key does not exist" do
allow(ChefConfig).to receive(:windows?).and_return(true)
- allow(Chef::Platform).to receive(:require).with('win32/registry')
+ allow(Chef::Platform).to receive(:require).with("win32/registry")
expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).
with(key, access).
and_raise(Win32::Registry::Error, "The system cannot find the file specified.")
@@ -122,8 +122,8 @@ describe "Chef::Platform#supports_msi?" do
end
after do
- Win32::Registry.send(:remove_const, 'HKEY_LOCAL_MACHINE') if defined?(Win32::Registry::HKEY_LOCAL_MACHINE)
- Win32::Registry.send(:remove_const, 'KEY_QUERY_VALUE') if defined?(Win32::Registry::KEY_QUERY_VALUE)
+ Win32::Registry.send(:remove_const, "HKEY_LOCAL_MACHINE") if defined?(Win32::Registry::HKEY_LOCAL_MACHINE)
+ Win32::Registry.send(:remove_const, "KEY_QUERY_VALUE") if defined?(Win32::Registry::KEY_QUERY_VALUE)
end
it "returns false early when not on windows" do
@@ -134,7 +134,7 @@ describe "Chef::Platform#supports_msi?" do
it "returns true when the registry key exists" do
allow(ChefConfig).to receive(:windows?).and_return(true)
- allow(Chef::Platform).to receive(:require).with('win32/registry')
+ allow(Chef::Platform).to receive(:require).with("win32/registry")
expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).
with(key, access).
and_yield(registry)
@@ -143,7 +143,7 @@ describe "Chef::Platform#supports_msi?" do
it "returns false when the registry key does not exist" do
allow(ChefConfig).to receive(:windows?).and_return(true)
- allow(Chef::Platform).to receive(:require).with('win32/registry')
+ allow(Chef::Platform).to receive(:require).with("win32/registry")
expect(Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).
with(key, access).
and_raise(Win32::Registry::Error, "The system cannot find the file specified.")
@@ -152,12 +152,12 @@ describe "Chef::Platform#supports_msi?" do
end
describe 'Chef::Platform#supports_dsc?' do
- it 'returns false if powershell is not present' do
+ it "returns false if powershell is not present" do
node = Chef::Node.new
expect(Chef::Platform.supports_dsc?(node)).to be_falsey
end
- ['1.0', '2.0', '3.0'].each do |version|
+ ["1.0", "2.0", "3.0"].each do |version|
it "returns false for Powershell #{version}" do
node = Chef::Node.new
node.automatic[:languages][:powershell][:version] = version
@@ -165,7 +165,7 @@ describe 'Chef::Platform#supports_dsc?' do
end
end
- ['4.0', '5.0'].each do |version|
+ ["4.0", "5.0"].each do |version|
it "returns true for Powershell #{version}" do
node = Chef::Node.new
node.automatic[:languages][:powershell][:version] = version
@@ -175,12 +175,12 @@ describe 'Chef::Platform#supports_dsc?' do
end
describe 'Chef::Platform#supports_dsc_invoke_resource?' do
- it 'returns false if powershell is not present' do
+ it "returns false if powershell is not present" do
node = Chef::Node.new
expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey
end
- ['1.0', '2.0', '3.0', '4.0', '5.0.10017.9'].each do |version|
+ ["1.0", "2.0", "3.0", "4.0", "5.0.10017.9"].each do |version|
it "returns false for Powershell #{version}" do
node = Chef::Node.new
node.automatic[:languages][:powershell][:version] = version
@@ -196,16 +196,16 @@ describe 'Chef::Platform#supports_dsc_invoke_resource?' do
end
describe 'Chef::Platform#dsc_refresh_mode_disabled?' do
- let(:node) { instance_double('Chef::Node') }
- let(:cmdlet) { instance_double('Chef::Util::Powershell::Cmdlet') }
- let(:cmdlet_result) { instance_double('Chef::Util::Powershell::CmdletResult')}
+ let(:node) { instance_double("Chef::Node") }
+ let(:cmdlet) { instance_double("Chef::Util::Powershell::Cmdlet") }
+ let(:cmdlet_result) { instance_double("Chef::Util::Powershell::CmdletResult")}
it "returns true when RefreshMode is Disabled" do
expect(Chef::Util::Powershell::Cmdlet).to receive(:new).
with(node, "Get-DscLocalConfigurationManager", :object).
and_return(cmdlet)
expect(cmdlet).to receive(:run!).and_return(cmdlet_result)
- expect(cmdlet_result).to receive(:return_value).and_return({ 'RefreshMode' => 'Disabled' })
+ expect(cmdlet_result).to receive(:return_value).and_return({ "RefreshMode" => "Disabled" })
expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be true
end
@@ -214,7 +214,7 @@ describe 'Chef::Platform#dsc_refresh_mode_disabled?' do
with(node, "Get-DscLocalConfigurationManager", :object).
and_return(cmdlet)
expect(cmdlet).to receive(:run!).and_return(cmdlet_result)
- expect(cmdlet_result).to receive(:return_value).and_return({ 'RefreshMode' => 'LaLaLa' })
+ expect(cmdlet_result).to receive(:return_value).and_return({ "RefreshMode" => "LaLaLa" })
expect(Chef::Platform.dsc_refresh_mode_disabled?(node)).to be false
end
end
diff --git a/spec/unit/platform_spec.rb b/spec/unit/platform_spec.rb
index d16294a8aa..9785108124 100644
--- a/spec/unit/platform_spec.rb
+++ b/spec/unit/platform_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Platform do
@@ -175,7 +175,7 @@ describe Chef::Platform do
end
it "does not support finding a provider by resource and node -- a run context is required" do
- expect {Chef::Platform.provider_for_node('node', 'resource')}.to raise_error(NotImplementedError)
+ expect {Chef::Platform.provider_for_node("node", "resource")}.to raise_error(NotImplementedError)
end
it "should update the provider map with map" do
diff --git a/spec/unit/policy_builder/dynamic_spec.rb b/spec/unit/policy_builder/dynamic_spec.rb
index aff19f4d11..dd819e59b1 100644
--- a/spec/unit/policy_builder/dynamic_spec.rb
+++ b/spec/unit/policy_builder/dynamic_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/policy_builder'
+require "spec_helper"
+require "chef/policy_builder"
describe Chef::PolicyBuilder::Dynamic do
diff --git a/spec/unit/policy_builder/expand_node_object_spec.rb b/spec/unit/policy_builder/expand_node_object_spec.rb
index 944d4d3387..824e17091b 100644
--- a/spec/unit/policy_builder/expand_node_object_spec.rb
+++ b/spec/unit/policy_builder/expand_node_object_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/policy_builder'
+require "spec_helper"
+require "chef/policy_builder"
describe Chef::PolicyBuilder::ExpandNodeObject do
diff --git a/spec/unit/policy_builder/policyfile_spec.rb b/spec/unit/policy_builder/policyfile_spec.rb
index 98515a4102..8900bc27c4 100644
--- a/spec/unit/policy_builder/policyfile_spec.rb
+++ b/spec/unit/policy_builder/policyfile_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/policy_builder'
+require "spec_helper"
+require "chef/policy_builder"
describe Chef::PolicyBuilder::Policyfile do
diff --git a/spec/unit/policy_builder_spec.rb b/spec/unit/policy_builder_spec.rb
index 506911452c..01a507a8f4 100644
--- a/spec/unit/policy_builder_spec.rb
+++ b/spec/unit/policy_builder_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/policy_builder'
+require "spec_helper"
+require "chef/policy_builder"
describe Chef::PolicyBuilder do
diff --git a/spec/unit/property/state_spec.rb b/spec/unit/property/state_spec.rb
index 032b0aba52..3dce632570 100644
--- a/spec/unit/property/state_spec.rb
+++ b/spec/unit/property/state_spec.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe "Chef::Resource#identity and #state" do
include IntegrationSupport
@@ -26,7 +26,7 @@ describe "Chef::Resource#identity and #state" do
end
def self.english_join(values)
- return '<nothing>' if values.size == 0
+ return "<nothing>" if values.size == 0
return values[0].inspect if values.size == 1
"#{values[0..-2].map { |v| v.inspect }.join(", ")} and #{values[-1].inspect}"
end
@@ -55,8 +55,8 @@ describe "Chef::Resource#identity and #state" do
it "name is the default identity" do
expect(resource_class.identity_properties).to eq [ Chef::Resource.properties[:name] ]
expect(Chef::Resource.properties[:name].identity?).to be_falsey
- expect(resource.name).to eq 'blah'
- expect(resource.identity).to eq 'blah'
+ expect(resource.name).to eq "blah"
+ expect(resource.identity).to eq "blah"
end
it "identity_properties :x changes the identity" do
@@ -65,11 +65,11 @@ describe "Chef::Resource#identity and #state" do
expect(Chef::Resource.properties[:name].identity?).to be_falsey
expect(resource_class.properties[:x].identity?).to be_truthy
- expect(resource.x 'woo').to eq 'woo'
- expect(resource.x).to eq 'woo'
+ expect(resource.x "woo").to eq "woo"
+ expect(resource.x).to eq "woo"
- expect(resource.name).to eq 'blah'
- expect(resource.identity).to eq 'woo'
+ expect(resource.name).to eq "blah"
+ expect(resource.identity).to eq "woo"
end
with_property ":y, identity: true" do
@@ -81,19 +81,19 @@ describe "Chef::Resource#identity and #state" do
end
it "only returns :x as identity" do
- resource.x 'foo'
- resource.y 'bar'
+ resource.x "foo"
+ resource.y "bar"
expect(resource_class.identity_properties).to eq [ resource_class.properties[:x] ]
- expect(resource.identity).to eq 'foo'
+ expect(resource.identity).to eq "foo"
end
it "does not flip y.desired_state off" do
- resource.x 'foo'
- resource.y 'bar'
+ resource.x "foo"
+ resource.y "bar"
expect(resource_class.state_properties).to eq [
resource_class.properties[:x],
resource_class.properties[:y],
]
- expect(resource.state_for_resource_reporter).to eq(x: 'foo', y: 'bar')
+ expect(resource.state_for_resource_reporter).to eq(x: "foo", y: "bar")
end
end
end
@@ -106,14 +106,14 @@ describe "Chef::Resource#identity and #state" do
end
end
let(:subresource) do
- subresource_class.new('sub')
+ subresource_class.new("sub")
end
it "name is the default identity on the subclass" do
expect(subresource_class.identity_properties).to eq [ Chef::Resource.properties[:name] ]
expect(Chef::Resource.properties[:name].identity?).to be_falsey
- expect(subresource.name).to eq 'sub'
- expect(subresource.identity).to eq 'sub'
+ expect(subresource.name).to eq "sub"
+ expect(subresource.identity).to eq "sub"
end
context "With identity_properties :x on the superclass" do
@@ -128,8 +128,8 @@ describe "Chef::Resource#identity and #state" do
expect(Chef::Resource.properties[:name].identity?).to be_falsey
expect(subresource_class.properties[:x].identity?).to be_truthy
- subresource.x 'foo'
- expect(subresource.identity).to eq 'foo'
+ subresource.x "foo"
+ expect(subresource.identity).to eq "foo"
end
context "With property :y, identity: true on the subclass" do
@@ -143,9 +143,9 @@ describe "Chef::Resource#identity and #state" do
subresource_class.properties[:x],
subresource_class.properties[:y],
]
- subresource.x 'foo'
- subresource.y 'bar'
- expect(subresource.identity).to eq(x: 'foo', y: 'bar')
+ subresource.x "foo"
+ subresource.y "bar"
+ expect(subresource.identity).to eq(x: "foo", y: "bar")
end
end
@@ -157,9 +157,9 @@ describe "Chef::Resource#identity and #state" do
end
end
it "y is part of state" do
- subresource.x 'foo'
- subresource.y 'bar'
- expect(subresource.state_for_resource_reporter).to eq(x: 'foo', y: 'bar')
+ subresource.x "foo"
+ subresource.y "bar"
+ expect(subresource.state_for_resource_reporter).to eq(x: "foo", y: "bar")
expect(subresource_class.state_properties).to eq [
subresource_class.properties[:x],
subresource_class.properties[:y],
@@ -167,9 +167,9 @@ describe "Chef::Resource#identity and #state" do
end
it "y is the identity" do
expect(subresource_class.identity_properties).to eq [ subresource_class.properties[:y] ]
- subresource.x 'foo'
- subresource.y 'bar'
- expect(subresource.identity).to eq 'bar'
+ subresource.x "foo"
+ subresource.y "bar"
+ expect(subresource.identity).to eq "bar"
end
it "y still has validation" do
expect { subresource.y 12 }.to raise_error Chef::Exceptions::ValidationFailed
@@ -191,8 +191,8 @@ describe "Chef::Resource#identity and #state" do
with_property ":x, desired_state: false" do
it "identity_properties does not change desired_state" do
resource_class.identity_properties :x
- resource.x 'hi'
- expect(resource.identity).to eq 'hi'
+ resource.x "hi"
+ expect(resource.identity).to eq "hi"
expect(resource_class.properties[:x].desired_state?).to be_falsey
expect(resource_class.state_properties).to eq []
expect(resource.state_for_resource_reporter).to eq({})
@@ -247,8 +247,8 @@ describe "Chef::Resource#identity and #state" do
with_property ":x, identity: true" do
it "name is only part of the identity if an identity attribute is defined" do
expect(resource_class.identity_properties).to eq [ resource_class.properties[:x] ]
- resource.x 'woo'
- expect(resource.identity).to eq 'woo'
+ resource.x "woo"
+ expect(resource.identity).to eq "woo"
end
end
@@ -262,29 +262,29 @@ describe "Chef::Resource#identity and #state" do
expect { resource_class.identity_attr }.to raise_error Chef::Exceptions::MultipleIdentityError
end
it "identity returns all identity values in a hash if multiple are defined" do
- resource.x 'foo'
- resource.y 'bar'
- resource.z 'baz'
- expect(resource.identity).to eq(x: 'foo', y: 'bar', z: 'baz')
+ resource.x "foo"
+ resource.y "bar"
+ resource.z "baz"
+ expect(resource.identity).to eq(x: "foo", y: "bar", z: "baz")
end
it "identity returns all values whether any value is set or not" do
- expect(resource.identity).to eq(x: 'xxx', y: 'yyy', z: 'zzz')
+ expect(resource.identity).to eq(x: "xxx", y: "yyy", z: "zzz")
end
it "identity_properties wipes out any other identity attributes if multiple are defined" do
resource_class.identity_properties :y
- resource.x 'foo'
- resource.y 'bar'
- resource.z 'baz'
- expect(resource.identity).to eq 'bar'
+ resource.x "foo"
+ resource.y "bar"
+ resource.z "baz"
+ expect(resource.identity).to eq "bar"
end
end
with_property ":x, identity: true, name_property: true" do
it "identity when x is not defined returns the value of x" do
- expect(resource.identity).to eq 'blah'
+ expect(resource.identity).to eq "blah"
end
it "state when x is not defined returns the value of x" do
- expect(resource.state_for_resource_reporter).to eq(x: 'blah')
+ expect(resource.state_for_resource_reporter).to eq(x: "blah")
end
end
end
@@ -397,7 +397,7 @@ describe "Chef::Resource#identity and #state" do
end
it "state_properties(:x) does not turn off validation" do
resource_class.state_properties(:x)
- expect { resource.x 'ouch' }.to raise_error Chef::Exceptions::ValidationFailed
+ expect { resource.x "ouch" }.to raise_error Chef::Exceptions::ValidationFailed
end
it "state_properties(:x) does not turn off identity" do
resource_class.state_properties(:x)
@@ -459,7 +459,7 @@ describe "Chef::Resource#identity and #state" do
end
end
let(:subresource) do
- subresource_class.new('blah')
+ subresource_class.new("blah")
end
it "state_properties(:x) adds x to desired state" do
diff --git a/spec/unit/property/validation_spec.rb b/spec/unit/property/validation_spec.rb
index fef983ccf4..7e84a651e2 100644
--- a/spec/unit/property/validation_spec.rb
+++ b/spec/unit/property/validation_spec.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe "Chef::Resource.property validation" do
include IntegrationSupport
@@ -49,7 +49,7 @@ describe "Chef::Resource.property validation" do
end
def self.english_join(values)
- return '<nothing>' if values.size == 0
+ return "<nothing>" if values.size == 0
return values[0].inspect if values.size == 1
"#{values[0..-2].map { |v| v.inspect }.join(", ")} and #{values[-1].inspect}"
end
@@ -79,7 +79,7 @@ describe "Chef::Resource.property validation" do
end
success_values.each do |v|
it "value #{v.inspect} is valid" do
- resource.instance_eval { @x = 'default' }
+ resource.instance_eval { @x = "default" }
expect(resource.x v).to eq v
expect(resource.x).to eq v
end
@@ -87,16 +87,16 @@ describe "Chef::Resource.property validation" do
failure_values.each do |v|
it "value #{v.inspect} is invalid" do
expect { resource.x v }.to raise_error Chef::Exceptions::ValidationFailed
- resource.instance_eval { @x = 'default' }
+ resource.instance_eval { @x = "default" }
expect { resource.x v }.to raise_error Chef::Exceptions::ValidationFailed
end
end
getter_values.each do |v|
it "setting value to #{v.inspect} does not change the value" do
Chef::Config[:treat_deprecation_warnings_as_errors] = false
- resource.instance_eval { @x = 'default' }
- expect(resource.x v).to eq 'default'
- expect(resource.x).to eq 'default'
+ resource.instance_eval { @x = "default" }
+ expect(resource.x v).to eq "default"
+ expect(resource.x).to eq "default"
end
end
end
@@ -106,14 +106,14 @@ describe "Chef::Resource.property validation" do
with_property ":x, kind_of: String" do
context "when the variable already has a value" do
before do
- resource.instance_eval { @x = 'default' }
+ resource.instance_eval { @x = "default" }
end
it "get succeeds" do
- expect(resource.x).to eq 'default'
+ expect(resource.x).to eq "default"
end
it "set to valid value succeeds" do
- expect(resource.x 'str').to eq 'str'
- expect(resource.x).to eq 'str'
+ expect(resource.x "str").to eq "str"
+ expect(resource.x).to eq "str"
end
it "set to invalid value raises ValidationFailed" do
expect { resource.x 10 }.to raise_error Chef::Exceptions::ValidationFailed
@@ -121,9 +121,9 @@ describe "Chef::Resource.property validation" do
it "set to nil emits a deprecation warning and does a get" do
expect { resource.x nil }.to raise_error Chef::Exceptions::DeprecatedFeatureError
Chef::Config[:treat_deprecation_warnings_as_errors] = false
- resource.x 'str'
- expect(resource.x nil).to eq 'str'
- expect(resource.x).to eq 'str'
+ resource.x "str"
+ expect(resource.x nil).to eq "str"
+ expect(resource.x).to eq "str"
end
end
context "when the variable does not have an initial value" do
@@ -131,8 +131,8 @@ describe "Chef::Resource.property validation" do
expect(resource.x).to be_nil
end
it "set to valid value succeeds" do
- expect(resource.x 'str').to eq 'str'
- expect(resource.x).to eq 'str'
+ expect(resource.x "str").to eq "str"
+ expect(resource.x).to eq "str"
end
it "set to invalid value raises ValidationFailed" do
expect { resource.x 10 }.to raise_error Chef::Exceptions::ValidationFailed
@@ -145,18 +145,18 @@ describe "Chef::Resource.property validation" do
with_property ":x, [ String, nil ]" do
context "when the variable already has a value" do
before do
- resource.instance_eval { @x = 'default' }
+ resource.instance_eval { @x = "default" }
end
it "get succeeds" do
- expect(resource.x).to eq 'default'
+ expect(resource.x).to eq "default"
end
it "set(nil) sets the value" do
expect(resource.x nil).to be_nil
expect(resource.x).to be_nil
end
it "set to valid value succeeds" do
- expect(resource.x 'str').to eq 'str'
- expect(resource.x).to eq 'str'
+ expect(resource.x "str").to eq "str"
+ expect(resource.x).to eq "str"
end
it "set to invalid value raises ValidationFailed" do
expect { resource.x 10 }.to raise_error Chef::Exceptions::ValidationFailed
@@ -171,8 +171,8 @@ describe "Chef::Resource.property validation" do
expect(resource.x).to be_nil
end
it "set to valid value succeeds" do
- expect(resource.x 'str').to eq 'str'
- expect(resource.x).to eq 'str'
+ expect(resource.x "str").to eq "str"
+ expect(resource.x).to eq "str"
end
it "set to invalid value raises ValidationFailed" do
expect { resource.x 10 }.to raise_error Chef::Exceptions::ValidationFailed
@@ -183,45 +183,45 @@ describe "Chef::Resource.property validation" do
# Bare types
context "bare types" do
- validation_test 'String',
- [ 'hi' ],
+ validation_test "String",
+ [ "hi" ],
[ 10 ],
[ nil ]
- validation_test ':a',
+ validation_test ":a",
[ :a ],
[ :b ],
[ nil ]
- validation_test ':a, is: :b',
+ validation_test ":a, is: :b",
[ :a, :b ],
[ :c ],
[ nil ]
- validation_test ':a, is: [ :b, :c ]',
+ validation_test ":a, is: [ :b, :c ]",
[ :a, :b, :c ],
[ :d ],
[ nil ]
- validation_test '[ :a, :b ], is: :c',
+ validation_test "[ :a, :b ], is: :c",
[ :a, :b, :c ],
[ :d ],
[ nil ]
- validation_test '[ :a, :b ], is: [ :c, :d ]',
+ validation_test "[ :a, :b ], is: [ :c, :d ]",
[ :a, :b, :c, :d ],
[ :e ],
[ nil ]
- validation_test 'nil',
+ validation_test "nil",
[ nil ],
[ :a ]
- validation_test '[ nil ]',
+ validation_test "[ nil ]",
[ nil ],
[ :a ]
- validation_test '[]',
+ validation_test "[]",
[],
[ :a ],
[ nil ]
@@ -230,35 +230,35 @@ describe "Chef::Resource.property validation" do
# is
context "is" do
# Class
- validation_test 'is: String',
- [ 'a', '' ],
+ validation_test "is: String",
+ [ "a", "" ],
[ :a, 1 ],
[ nil ]
# Value
- validation_test 'is: :a',
+ validation_test "is: :a",
[ :a ],
[ :b ],
[ nil ]
- validation_test 'is: [ :a, :b ]',
+ validation_test "is: [ :a, :b ]",
[ :a, :b ],
[ [ :a, :b ] ],
[ nil ]
- validation_test 'is: [ [ :a, :b ] ]',
+ validation_test "is: [ [ :a, :b ] ]",
[ [ :a, :b ] ],
[ :a, :b ],
[ nil ]
# Regex
- validation_test 'is: /abc/',
- [ 'abc', 'wowabcwow' ],
- [ '', 'abac' ],
+ validation_test "is: /abc/",
+ [ "abc", "wowabcwow" ],
+ [ "", "abac" ],
[ nil ]
# Property
- validation_test 'is: Chef::Property.new(is: :a)',
+ validation_test "is: Chef::Property.new(is: :a)",
[ :a ],
[ :b, nil ]
@@ -273,24 +273,24 @@ describe "Chef::Resource.property validation" do
[ nil ]
# Proc
- validation_test 'is: proc { |x| x }',
+ validation_test "is: proc { |x| x }",
[ true, 1 ],
[ false ],
[ nil ]
- validation_test 'is: proc { |x| x > blah }',
+ validation_test "is: proc { |x| x > blah }",
[ 10 ],
[ -1 ]
- validation_test 'is: nil',
+ validation_test "is: nil",
[ nil ],
- [ 'a' ]
+ [ "a" ]
- validation_test 'is: [ String, nil ]',
- [ 'a', nil ],
+ validation_test "is: [ String, nil ]",
+ [ "a", nil ],
[ :b ]
- validation_test 'is: []',
+ validation_test "is: []",
[],
[ :a ],
[ nil ]
@@ -299,45 +299,45 @@ describe "Chef::Resource.property validation" do
# Combination
context "combination" do
validation_test 'kind_of: String, equal_to: "a"',
- [ 'a' ],
- [ 'b' ],
+ [ "a" ],
+ [ "b" ],
[ nil ]
end
# equal_to
context "equal_to" do
# Value
- validation_test 'equal_to: :a',
+ validation_test "equal_to: :a",
[ :a ],
[ :b ],
[ nil ]
- validation_test 'equal_to: [ :a, :b ]',
+ validation_test "equal_to: [ :a, :b ]",
[ :a, :b ],
[ [ :a, :b ] ],
[ nil ]
- validation_test 'equal_to: [ [ :a, :b ] ]',
+ validation_test "equal_to: [ [ :a, :b ] ]",
[ [ :a, :b ] ],
[ :a, :b ],
[ nil ]
- validation_test 'equal_to: nil',
+ validation_test "equal_to: nil",
[ ],
- [ 'a' ],
+ [ "a" ],
[ nil ]
validation_test 'equal_to: [ "a", nil ]',
- [ 'a' ],
- [ 'b' ],
+ [ "a" ],
+ [ "b" ],
[ nil ]
validation_test 'equal_to: [ nil, "a" ]',
- [ 'a' ],
- [ 'b' ],
+ [ "a" ],
+ [ "b" ],
[ nil ]
- validation_test 'equal_to: []',
+ validation_test "equal_to: []",
[],
[ :a ],
[ nil ]
@@ -345,37 +345,37 @@ describe "Chef::Resource.property validation" do
# kind_of
context "kind_of" do
- validation_test 'kind_of: String',
- [ 'a' ],
+ validation_test "kind_of: String",
+ [ "a" ],
[ :b ],
[ nil ]
- validation_test 'kind_of: [ String, Symbol ]',
- [ 'a', :b ],
+ validation_test "kind_of: [ String, Symbol ]",
+ [ "a", :b ],
[ 1 ],
[ nil ]
- validation_test 'kind_of: [ Symbol, String ]',
- [ 'a', :b ],
+ validation_test "kind_of: [ Symbol, String ]",
+ [ "a", :b ],
[ 1 ],
[ nil ]
- validation_test 'kind_of: NilClass',
+ validation_test "kind_of: NilClass",
[ ],
- [ 'a' ],
+ [ "a" ],
[ nil ]
- validation_test 'kind_of: [ NilClass, String ]',
- [ 'a' ],
+ validation_test "kind_of: [ NilClass, String ]",
+ [ "a" ],
[ :a ],
[ nil ]
- validation_test 'kind_of: []',
+ validation_test "kind_of: []",
[],
[ :a ],
[ nil ]
- validation_test 'kind_of: nil',
+ validation_test "kind_of: nil",
[],
[ :a ],
[ nil ]
@@ -383,32 +383,32 @@ describe "Chef::Resource.property validation" do
# regex
context "regex" do
- validation_test 'regex: /abc/',
- [ 'xabcy' ],
- [ 'gbh', 123 ],
+ validation_test "regex: /abc/",
+ [ "xabcy" ],
+ [ "gbh", 123 ],
[ nil ]
- validation_test 'regex: [ /abc/, /z/ ]',
- [ 'xabcy', 'aza' ],
- [ 'gbh', 123 ],
+ validation_test "regex: [ /abc/, /z/ ]",
+ [ "xabcy", "aza" ],
+ [ "gbh", 123 ],
[ nil ]
- validation_test 'regex: [ /z/, /abc/ ]',
- [ 'xabcy', 'aza' ],
- [ 'gbh', 123 ],
+ validation_test "regex: [ /z/, /abc/ ]",
+ [ "xabcy", "aza" ],
+ [ "gbh", 123 ],
[ nil ]
- validation_test 'regex: [ [ /z/, /abc/ ], [ /n/ ] ]',
- [ 'xabcy', 'aza', 'ana' ],
- [ 'gbh', 123 ],
+ validation_test "regex: [ [ /z/, /abc/ ], [ /n/ ] ]",
+ [ "xabcy", "aza", "ana" ],
+ [ "gbh", 123 ],
[ nil ]
- validation_test 'regex: []',
+ validation_test "regex: []",
[],
[ :a ],
[ nil ]
- validation_test 'regex: nil',
+ validation_test "regex: nil",
[],
[ :a ],
[ nil ]
@@ -426,10 +426,10 @@ describe "Chef::Resource.property validation" do
validation_test 'callbacks: { "a" => proc { |x| x.nil? } }',
[ ],
- [ 'a' ],
+ [ "a" ],
[ nil ]
- validation_test 'callbacks: {}',
+ validation_test "callbacks: {}",
[ :a ],
[],
[ nil ]
@@ -437,49 +437,49 @@ describe "Chef::Resource.property validation" do
# respond_to
context "respond_to" do
- validation_test 'respond_to: :split',
- [ 'hi' ],
+ validation_test "respond_to: :split",
+ [ "hi" ],
[ 1 ],
[ nil ]
validation_test 'respond_to: "split"',
- [ 'hi' ],
+ [ "hi" ],
[ 1 ],
[ nil ]
- validation_test 'respond_to: :to_s',
+ validation_test "respond_to: :to_s",
[ :a ],
[],
[ nil ]
- validation_test 'respond_to: [ :split, :to_s ]',
- [ 'hi' ],
+ validation_test "respond_to: [ :split, :to_s ]",
+ [ "hi" ],
[ 1 ],
[ nil ]
- validation_test 'respond_to: %w(split to_s)',
- [ 'hi' ],
+ validation_test "respond_to: %w(split to_s)",
+ [ "hi" ],
[ 1 ],
[ nil ]
- validation_test 'respond_to: [ :to_s, :split ]',
- [ 'hi' ],
+ validation_test "respond_to: [ :to_s, :split ]",
+ [ "hi" ],
[ 1 ],
[ nil ]
- validation_test 'respond_to: []',
+ validation_test "respond_to: []",
[ :a ],
[],
[ nil ]
- validation_test 'respond_to: nil',
+ validation_test "respond_to: nil",
[ :a ],
[],
[ nil ]
end
context "cannot_be" do
- validation_test 'cannot_be: :empty',
+ validation_test "cannot_be: :empty",
[ 1, [1,2], { a: 10 } ],
[ [] ],
[ nil ]
@@ -489,7 +489,7 @@ describe "Chef::Resource.property validation" do
[ [] ],
[ nil ]
- validation_test 'cannot_be: [ :empty, :nil ]',
+ validation_test "cannot_be: [ :empty, :nil ]",
[ 1, [1,2], { a: 10 } ],
[ [] ],
[ nil ]
@@ -499,22 +499,22 @@ describe "Chef::Resource.property validation" do
[ [] ],
[ nil ]
- validation_test 'cannot_be: [ :nil, :empty ]',
+ validation_test "cannot_be: [ :nil, :empty ]",
[ 1, [1,2], { a: 10 } ],
[ [] ],
[ nil ]
- validation_test 'cannot_be: [ :empty, :nil, :blahblah ]',
+ validation_test "cannot_be: [ :empty, :nil, :blahblah ]",
[ 1, [1,2], { a: 10 } ],
[ [] ],
[ nil ]
- validation_test 'cannot_be: []',
+ validation_test "cannot_be: []",
[ :a ],
[],
[ nil ]
- validation_test 'cannot_be: nil',
+ validation_test "cannot_be: nil",
[ :a ],
[],
[ nil ]
@@ -522,7 +522,7 @@ describe "Chef::Resource.property validation" do
end
context "required" do
- with_property ':x, required: true' do
+ with_property ":x, required: true" do
it "if x is not specified, retrieval fails" do
expect { resource.x }.to raise_error Chef::Exceptions::ValidationFailed
end
@@ -545,7 +545,7 @@ describe "Chef::Resource.property validation" do
end
end
- with_property ':x, [String, nil], required: true' do
+ with_property ":x, [String, nil], required: true" do
it "if x is not specified, retrieval fails" do
expect { resource.x }.to raise_error Chef::Exceptions::ValidationFailed
end
@@ -554,17 +554,17 @@ describe "Chef::Resource.property validation" do
expect(resource.x).to be_nil
end
it "value '1' is valid" do
- expect(resource.x '1').to eq '1'
- expect(resource.x).to eq '1'
+ expect(resource.x "1").to eq "1"
+ expect(resource.x).to eq "1"
end
it "value 1 is invalid" do
expect { resource.x 1 }.to raise_error Chef::Exceptions::ValidationFailed
end
end
- with_property ':x, name_property: true, required: true' do
+ with_property ":x, name_property: true, required: true" do
it "if x is not specified, the name property is returned" do
- expect(resource.x).to eq 'blah'
+ expect(resource.x).to eq "blah"
end
it "value 1 is valid" do
expect(resource.x 1).to eq 1
@@ -579,7 +579,7 @@ describe "Chef::Resource.property validation" do
end
end
- with_property ':x, default: 10, required: true' do
+ with_property ":x, default: 10, required: true" do
it "if x is not specified, the default is returned" do
expect(resource.x).to eq 10
end
@@ -602,7 +602,7 @@ describe "Chef::Resource.property validation" do
Chef::Config[:treat_deprecation_warnings_as_errors] = false
end
- with_property ':x, blarghle: 1' do
+ with_property ":x, blarghle: 1" do
context "and a class that implements _pv_blarghle" do
before do
resource_class.class_eval do
@@ -621,7 +621,7 @@ describe "Chef::Resource.property validation" do
it "value '1' is invalid" do
Chef::Config[:treat_deprecation_warnings_as_errors] = false
- expect { resource.x '1' }.to raise_error Chef::Exceptions::ValidationFailed
+ expect { resource.x "1" }.to raise_error Chef::Exceptions::ValidationFailed
end
it "value nil does a get" do
@@ -633,7 +633,7 @@ describe "Chef::Resource.property validation" do
end
end
- with_property ':x, blarghle: 1' do
+ with_property ":x, blarghle: 1" do
context "and a class that implements _pv_blarghle" do
before do
resource_class.class_eval do
@@ -651,7 +651,7 @@ describe "Chef::Resource.property validation" do
end
it "value '1' is invalid" do
- expect { resource.x '1' }.to raise_error Chef::Exceptions::ValidationFailed
+ expect { resource.x "1" }.to raise_error Chef::Exceptions::ValidationFailed
end
it "value nil does a get" do
diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb
index 095dcc8e98..1fe8abc706 100644
--- a/spec/unit/property_spec.rb
+++ b/spec/unit/property_spec.rb
@@ -1,4 +1,4 @@
-require 'support/shared/integration/integration_helper'
+require "support/shared/integration/integration_helper"
describe "Chef::Resource.property" do
include IntegrationSupport
@@ -46,7 +46,7 @@ describe "Chef::Resource.property" do
end
def self.english_join(values)
- return '<nothing>' if values.size == 0
+ return "<nothing>" if values.size == 0
return values[0].inspect if values.size == 1
"#{values[0..-2].map { |v| v.inspect }.join(", ")} and #{values[-1].inspect}"
end
@@ -74,7 +74,7 @@ describe "Chef::Resource.property" do
end
# Basic properties
- with_property ':bare_property' do
+ with_property ":bare_property" do
it "can be set" do
expect(resource.bare_property 10).to eq 10
expect(resource.bare_property).to eq 10
@@ -116,7 +116,7 @@ describe "Chef::Resource.property" do
end
end
let(:subresource) do
- subresource_class.new('blah')
+ subresource_class.new("blah")
end
context "with property :x on the subclass" do
@@ -127,7 +127,7 @@ describe "Chef::Resource.property" do
end
it "x is still name_property" do
- expect(subresource.x).to eq 'blah'
+ expect(subresource.x).to eq "blah"
end
end
@@ -166,7 +166,7 @@ describe "Chef::Resource.property" do
end
end
let(:subresource) do
- subresource_class.new('blah')
+ subresource_class.new("blah")
end
it "x is inherited" do
@@ -178,7 +178,7 @@ describe "Chef::Resource.property" do
end
it "x's validation is inherited" do
- expect { subresource.x 'ohno' }.to raise_error Chef::Exceptions::ValidationFailed
+ expect { subresource.x "ohno" }.to raise_error Chef::Exceptions::ValidationFailed
end
context "with property :y on the subclass" do
@@ -225,7 +225,7 @@ describe "Chef::Resource.property" do
end
it "x's validation is inherited" do
- expect { subresource.x 'ohno' }.to raise_error Chef::Exceptions::ValidationFailed
+ expect { subresource.x "ohno" }.to raise_error Chef::Exceptions::ValidationFailed
end
end
@@ -250,7 +250,7 @@ describe "Chef::Resource.property" do
end
it "x's validation is inherited" do
- expect { subresource.x 'ohno' }.to raise_error Chef::Exceptions::ValidationFailed
+ expect { subresource.x "ohno" }.to raise_error Chef::Exceptions::ValidationFailed
end
end
@@ -272,12 +272,12 @@ describe "Chef::Resource.property" do
it "x's validation is overwritten" do
expect { subresource.x 10 }.to raise_error Chef::Exceptions::ValidationFailed
- expect(subresource.x 'ohno').to eq 'ohno'
- expect(subresource.x).to eq 'ohno'
+ expect(subresource.x "ohno").to eq "ohno"
+ expect(subresource.x).to eq "ohno"
end
it "the superclass's validation for x is still there" do
- expect { resource.x 'ohno' }.to raise_error Chef::Exceptions::ValidationFailed
+ expect { resource.x "ohno" }.to raise_error Chef::Exceptions::ValidationFailed
expect(resource.x 10).to eq 10
expect(resource.x).to eq 10
end
@@ -297,7 +297,7 @@ describe "Chef::Resource.property" do
expect { resource.reset_property(:x) }.to raise_error(ArgumentError)
end
- with_property ':x' do
+ with_property ":x" do
it "when the resource is newly created, reset_property(:x) does nothing" do
expect(resource.property_is_set?(:x)).to be_falsey
resource.reset_property(:x)
@@ -313,7 +313,7 @@ describe "Chef::Resource.property" do
end
end
- with_property ':x, Integer' do
+ with_property ":x, Integer" do
it "when the resource is newly created, reset_property(:x) does nothing" do
expect(resource.property_is_set?(:x)).to be_falsey
resource.reset_property(:x)
@@ -329,7 +329,7 @@ describe "Chef::Resource.property" do
end
end
- with_property ':x, default: 10' do
+ with_property ":x, default: 10" do
it "when the resource is newly created, reset_property(:x) does nothing" do
expect(resource.property_is_set?(:x)).to be_falsey
resource.reset_property(:x)
@@ -344,7 +344,7 @@ describe "Chef::Resource.property" do
end
end
- with_property ':x, default: lazy { 10 }' do
+ with_property ":x, default: lazy { 10 }" do
it "when the resource is newly created, reset_property(:x) does nothing" do
expect(resource.property_is_set?(:x)).to be_falsey
resource.reset_property(:x)
@@ -369,7 +369,7 @@ describe "Chef::Resource.property" do
expect { resource.property_is_set?(:x) }.to raise_error(ArgumentError)
end
- with_property ':x' do
+ with_property ":x" do
it "when the resource is newly created, property_is_set?(:x) is false" do
expect(resource.property_is_set?(:x)).to be_falsey
end
@@ -391,7 +391,7 @@ describe "Chef::Resource.property" do
end
end
- with_property ':x, default: 10' do
+ with_property ":x, default: 10" do
it "when the resource is newly created, property_is_set?(:x) is false" do
expect(resource.property_is_set?(:x)).to be_falsey
end
@@ -413,7 +413,7 @@ describe "Chef::Resource.property" do
end
end
- with_property ':x, default: nil' do
+ with_property ":x, default: nil" do
it "when the resource is newly created, property_is_set?(:x) is false" do
expect(resource.property_is_set?(:x)).to be_falsey
end
@@ -435,7 +435,7 @@ describe "Chef::Resource.property" do
end
end
- with_property ':x, default: lazy { 10 }' do
+ with_property ":x, default: lazy { 10 }" do
it "when the resource is newly created, property_is_set?(:x) is false" do
expect(resource.property_is_set?(:x)).to be_falsey
end
@@ -455,7 +455,7 @@ describe "Chef::Resource.property" do
end
context "Chef::Resource::Property#default" do
- with_property ':x, default: 10' do
+ with_property ":x, default: 10" do
it "when x is set, it returns its value" do
expect(resource.x 20).to eq 20
expect(resource.property_is_set?(:x)).to be_truthy
@@ -479,33 +479,33 @@ describe "Chef::Resource.property" do
resource_name new_resource_name
end
end
- let(:subresource) { subresource_class.new('blah') }
+ let(:subresource) { subresource_class.new("blah") }
it "The default is inherited" do
expect(subresource.x).to eq 10
end
end
end
- with_property ':x, default: 10, identity: true' do
+ with_property ":x, default: 10, identity: true" do
it "when x is not set, it is included in identity" do
expect(resource.identity).to eq(10)
end
end
- with_property ':x, default: 1, identity: true', ':y, default: 2, identity: true' do
+ with_property ":x, default: 1, identity: true", ":y, default: 2, identity: true" do
it "when x is not set, it is still included in identity" do
resource.y 20
expect(resource.identity).to eq(x: 1, y: 20)
end
end
- with_property ':x, default: nil' do
+ with_property ":x, default: nil" do
it "when x is not set, it returns nil" do
expect(resource.x).to be_nil
end
end
- with_property ':x' do
+ with_property ":x" do
it "when x is not set, it returns nil" do
expect(resource.x).to be_nil
end
@@ -515,7 +515,7 @@ describe "Chef::Resource.property" do
context "(deprecations allowed)" do
before { Chef::Config[:treat_deprecation_warnings_as_errors] = false }
- with_property ':x, default: {}' do
+ with_property ":x, default: {}" do
it "when x is not set, it returns {}" do
expect(resource.x).to eq({})
end
@@ -525,12 +525,12 @@ describe "Chef::Resource.property" do
expect(resource.x.object_id).to eq(value.object_id)
end
it "Multiple instances of x receive the exact same value" do
- expect(resource.x.object_id).to eq(resource_class.new('blah2').x.object_id)
+ expect(resource.x.object_id).to eq(resource_class.new("blah2").x.object_id)
end
end
end
- with_property ':x, default: lazy { {} }' do
+ with_property ":x, default: lazy { {} }" do
it "when x is not set, it returns {}" do
expect(resource.x).to eq({})
end
@@ -540,7 +540,7 @@ describe "Chef::Resource.property" do
# expect(resource.x.object_id).not_to eq(value.object_id)
# end
it "Multiple instances of x receive different values" do
- expect(resource.x.object_id).not_to eq(resource_class.new('blah2').x.object_id)
+ expect(resource.x.object_id).not_to eq(resource_class.new("blah2").x.object_id)
end
end
end
@@ -549,7 +549,7 @@ describe "Chef::Resource.property" do
before do
resource_class.class_eval do
def self.blah
- 'class'
+ "class"
end
def blah
"#{name}#{next_index}"
@@ -557,13 +557,13 @@ describe "Chef::Resource.property" do
end
end
- with_property ':x, default: lazy { blah }' do
+ with_property ":x, default: lazy { blah }" do
it "x is run in context of the instance" do
expect(resource.x).to eq "blah1"
end
it "x is run in the context of each instance it is run in" do
expect(resource.x).to eq "blah1"
- expect(resource_class.new('another').x).to eq "another2"
+ expect(resource_class.new("another").x).to eq "another2"
# expect(resource.x).to eq "blah3"
end
end
@@ -574,20 +574,20 @@ describe "Chef::Resource.property" do
end
it "x is passed the value of each instance it is run in" do
expect(resource.x).to eq "classblah1"
- expect(resource_class.new('another').x).to eq "classanother2"
+ expect(resource_class.new("another").x).to eq "classanother2"
# expect(resource.x).to eq "classblah3"
end
end
end
context "validation of defaults" do
- with_property ':x, String, default: 10' do
+ with_property ":x, String, default: 10" do
it "when the resource is created, no error is raised" do
resource
end
it "when x is set, no error is raised" do
- expect(resource.x 'hi').to eq 'hi'
- expect(resource.x).to eq 'hi'
+ expect(resource.x "hi").to eq "hi"
+ expect(resource.x).to eq "hi"
end
it "when x is retrieved, no validation error is raised" do
expect(resource.x).to eq 10
@@ -602,8 +602,8 @@ describe "Chef::Resource.property" do
resource
end
it "when x is set, no error is raised" do
- expect(resource.x 'hi').to eq 'hi'
- expect(resource.x).to eq 'hi'
+ expect(resource.x "hi").to eq "hi"
+ expect(resource.x).to eq "hi"
end
it "when x is retrieved, no validation error is raised" do
expect(resource.x).to eq 1
@@ -617,7 +617,7 @@ describe "Chef::Resource.property" do
with_property ":x, default: lazy { Namer.next_index.to_s }, is: proc { |v| Namer.next_index; true }" do
it "validation is not run at all on the default value" do
- expect(resource.x).to eq '1'
+ expect(resource.x).to eq "1"
expect(Namer.current_index).to eq 1
end
# it "validation is run each time" do
@@ -630,7 +630,7 @@ describe "Chef::Resource.property" do
with_property ":x, default: lazy { Namer.next_index.to_s.freeze }, is: proc { |v| Namer.next_index; true }" do
it "validation is not run at all on the default value" do
- expect(resource.x).to eq '1'
+ expect(resource.x).to eq "1"
expect(Namer.current_index).to eq 1
end
# it "validation is only run the first time" do
@@ -650,13 +650,13 @@ describe "Chef::Resource.property" do
expect(Namer.current_index).to eq 0
end
it "when x is set, coercion is run" do
- expect(resource.x 'hi').to eq 'hi1'
- expect(resource.x).to eq 'hi1'
+ expect(resource.x "hi").to eq "hi1"
+ expect(resource.x).to eq "hi1"
expect(Namer.current_index).to eq 1
end
it "when x is retrieved, coercion is run exactly once" do
- expect(resource.x).to eq '101'
- expect(resource.x).to eq '101'
+ expect(resource.x).to eq "101"
+ expect(resource.x).to eq "101"
expect(Namer.current_index).to eq 1
end
end
@@ -668,13 +668,13 @@ describe "Chef::Resource.property" do
expect(Namer.current_index).to eq 0
end
it "when x is set, coercion is run" do
- expect(resource.x 'hi').to eq 'hi1'
- expect(resource.x).to eq 'hi1'
+ expect(resource.x "hi").to eq "hi1"
+ expect(resource.x).to eq "hi1"
expect(Namer.current_index).to eq 1
end
it "when x is retrieved, coercion is run each time" do
- expect(resource.x).to eq '101'
- expect(resource.x).to eq '102'
+ expect(resource.x).to eq "101"
+ expect(resource.x).to eq "102"
expect(Namer.current_index).to eq 2
end
end
@@ -686,13 +686,13 @@ describe "Chef::Resource.property" do
expect(Namer.current_index).to eq 0
end
it "when x is set, coercion is run" do
- expect(resource.x 'hi').to eq 'hi1'
- expect(resource.x).to eq 'hi1'
+ expect(resource.x "hi").to eq "hi1"
+ expect(resource.x).to eq "hi1"
expect(Namer.current_index).to eq 1
end
it "when x is retrieved, coercion is run exactly once" do
- expect(resource.x).to eq '101'
- expect(resource.x).to eq '101'
+ expect(resource.x).to eq "101"
+ expect(resource.x).to eq "101"
expect(Namer.current_index).to eq 1
end
end
@@ -704,13 +704,13 @@ describe "Chef::Resource.property" do
expect(Namer.current_index).to eq 0
end
it "when x is set, coercion is run" do
- expect(resource.x 'hi').to eq 'hi1'
- expect(resource.x).to eq 'hi1'
+ expect(resource.x "hi").to eq "hi1"
+ expect(resource.x).to eq "hi1"
expect(Namer.current_index).to eq 1
end
it "when x is retrieved, coercion is run each time" do
- expect(resource.x).to eq '101'
- expect(resource.x).to eq '102'
+ expect(resource.x).to eq "101"
+ expect(resource.x).to eq "102"
expect(Namer.current_index).to eq 2
end
end
@@ -718,9 +718,9 @@ describe "Chef::Resource.property" do
with_property ':x, proc { |v| Namer.next_index; true }, coerce: proc { |v| "#{v}#{next_index}" }, default: lazy { 10 }' do
it "coercion is only run the first time x is retrieved, and validation is not run" do
expect(Namer.current_index).to eq 0
- expect(resource.x).to eq '101'
+ expect(resource.x).to eq "101"
expect(Namer.current_index).to eq 1
- expect(resource.x).to eq '101'
+ expect(resource.x).to eq "101"
expect(Namer.current_index).to eq 1
end
end
@@ -728,12 +728,12 @@ describe "Chef::Resource.property" do
context "validation and coercion of defaults" do
with_property ':x, String, coerce: proc { |v| "#{v}#{next_index}" }, default: 10' do
it "when x is retrieved, it is coerced before validating and passes" do
- expect(resource.x).to eq '101'
+ expect(resource.x).to eq "101"
end
end
with_property ':x, Integer, coerce: proc { |v| "#{v}#{next_index}" }, default: 10' do
it "when x is retrieved, it is coerced and not validated" do
- expect(resource.x).to eq '101'
+ expect(resource.x).to eq "101"
end
# it "when x is retrieved, it is coerced before validating and fails" do
# expect { resource.x }.to raise_error Chef::Exceptions::ValidationFailed
@@ -741,12 +741,12 @@ describe "Chef::Resource.property" do
end
with_property ':x, String, coerce: proc { |v| "#{v}#{next_index}" }, default: lazy { 10 }' do
it "when x is retrieved, it is coerced before validating and passes" do
- expect(resource.x).to eq '101'
+ expect(resource.x).to eq "101"
end
end
with_property ':x, Integer, coerce: proc { |v| "#{v}#{next_index}" }, default: lazy { 10 }' do
it "when x is retrieved, it is coerced and not validated" do
- expect(resource.x).to eq '101'
+ expect(resource.x).to eq "101"
end
# it "when x is retrieved, it is coerced before validating and fails" do
# expect { resource.x }.to raise_error Chef::Exceptions::ValidationFailed
@@ -755,9 +755,9 @@ describe "Chef::Resource.property" do
with_property ':x, proc { |v| Namer.next_index; true }, coerce: proc { |v| "#{v}#{next_index}" }, default: lazy { 10 }' do
it "coercion is only run the first time x is retrieved, and validation is not run" do
expect(Namer.current_index).to eq 0
- expect(resource.x).to eq '101'
+ expect(resource.x).to eq "101"
expect(Namer.current_index).to eq 1
- expect(resource.x).to eq '101'
+ expect(resource.x).to eq "101"
expect(Namer.current_index).to eq 1
end
end
@@ -766,7 +766,7 @@ describe "Chef::Resource.property" do
end
context "Chef::Resource#lazy" do
- with_property ':x' do
+ with_property ":x" do
it "setting x to a lazy value does not run it immediately" do
resource.x lazy { Namer.next_index }
expect(Namer.current_index).to eq 0
@@ -861,7 +861,7 @@ describe "Chef::Resource.property" do
end
end
- with_property ':x, String' do
+ with_property ":x, String" do
it "lazy values are not validated on set" do
resource.x lazy { Namer.next_index }
expect(Namer.current_index).to eq 0
@@ -873,7 +873,7 @@ describe "Chef::Resource.property" do
end
end
- with_property ':x, is: proc { |v| Namer.next_index; true }' do
+ with_property ":x, is: proc { |v| Namer.next_index; true }" do
it "lazy values are validated on each access" do
resource.x lazy { Namer.next_index }
expect(resource.x).to eq 1
@@ -936,7 +936,7 @@ describe "Chef::Resource.property" do
expect(Namer.current_index).to eq 2
end
end
- with_property ':x, coerce: proc { |x| x }' do
+ with_property ":x, coerce: proc { |x| x }" do
it "does not emit a deprecation warning if set to nil" do
expect(resource.x nil).to be_nil
end
@@ -946,19 +946,19 @@ describe "Chef::Resource.property" do
resource.x 20
expect(resource.x).to eq 20
expect(Namer.current_index).to eq 2
- expect { resource.x 10 }.to raise_error 'hi'
+ expect { resource.x 10 }.to raise_error "hi"
expect(resource.x).to eq 20
expect(Namer.current_index).to eq 3
end
it "validation does not run if coercion fails" do
- expect { resource.x 10 }.to raise_error 'hi'
+ expect { resource.x 10 }.to raise_error "hi"
expect(Namer.current_index).to eq 1
end
end
end
context "Chef::Resource::Property validation" do
- with_property ':x, is: proc { |v| Namer.next_index; v.is_a?(Integer) }' do
+ with_property ":x, is: proc { |v| Namer.next_index; v.is_a?(Integer) }" do
it "validation runs on set" do
expect(resource.x 10).to eq 10
expect(Namer.current_index).to eq 1
@@ -977,31 +977,31 @@ describe "Chef::Resource.property" do
it "failed validation fails to set the value" do
expect(resource.x 10).to eq 10
expect(Namer.current_index).to eq 1
- expect { resource.x 'blah' }.to raise_error Chef::Exceptions::ValidationFailed
+ expect { resource.x "blah" }.to raise_error Chef::Exceptions::ValidationFailed
expect(resource.x).to eq 10
expect(Namer.current_index).to eq 2
end
end
end
- [ 'name_attribute', 'name_property' ].each do |name|
+ [ "name_attribute", "name_property" ].each do |name|
context "Chef::Resource::Property##{name}" do
with_property ":x, #{name}: true" do
it "defaults x to resource.name" do
- expect(resource.x).to eq 'blah'
+ expect(resource.x).to eq "blah"
end
it "does not pick up resource.name if set" do
expect(resource.x 10).to eq 10
expect(resource.x).to eq 10
end
it "binds to the latest resource.name when run" do
- resource.name 'foo'
- expect(resource.x).to eq 'foo'
+ resource.name "foo"
+ expect(resource.x).to eq "foo"
end
it "caches resource.name" do
- expect(resource.x).to eq 'blah'
- resource.name 'foo'
- expect(resource.x).to eq 'blah'
+ expect(resource.x).to eq "blah"
+ resource.name "foo"
+ expect(resource.x).to eq "blah"
end
end
@@ -1045,17 +1045,17 @@ describe "Chef::Resource.property" do
end
with_property ":x, default: nil, #{name}: true" do
it "chooses #{name} over default" do
- expect(resource.x).to eq 'blah'
+ expect(resource.x).to eq "blah"
end
end
with_property ":x, #{name}: true, default: 10" do
it "chooses #{name} over default" do
- expect(resource.x).to eq 'blah'
+ expect(resource.x).to eq "blah"
end
end
with_property ":x, #{name}: true, default: nil" do
it "chooses #{name} over default" do
- expect(resource.x).to eq 'blah'
+ expect(resource.x).to eq "blah"
end
end
end
@@ -1117,7 +1117,7 @@ describe "Chef::Resource.property" do
end
end
let(:subresource) do
- subresource_class.new('blah')
+ subresource_class.new("blah")
end
context "with property :x, default: 10 on the subclass" do
diff --git a/spec/unit/provider/breakpoint_spec.rb b/spec/unit/provider/breakpoint_spec.rb
index 386e5a1d17..58dc4649c4 100644
--- a/spec/unit/provider/breakpoint_spec.rb
+++ b/spec/unit/provider/breakpoint_spec.rb
@@ -17,7 +17,7 @@
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Breakpoint do
before do
diff --git a/spec/unit/provider/cookbook_file/content_spec.rb b/spec/unit/provider/cookbook_file/content_spec.rb
index 6946966153..8c66f3fcc4 100644
--- a/spec/unit/provider/cookbook_file/content_spec.rb
+++ b/spec/unit/provider/cookbook_file/content_spec.rb
@@ -16,24 +16,24 @@
# limitations under the License.
#
-require 'spec_helper'
+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)')
+ @run_context = double("Chef::RunContext")
+ @current_resource = double("Chef::Resource::CookbookFile (current)")
Chef::Provider::CookbookFile::Content.new(new_resource, @current_resource, @run_context)
end
it "prefers the explicit cookbook name on the resource to the implicit one" do
- allow(new_resource).to receive(:cookbook).and_return('nginx')
- expect(content.send(:resource_cookbook)).to eq('nginx')
+ allow(new_resource).to receive(:cookbook).and_return("nginx")
+ expect(content.send(:resource_cookbook)).to eq("nginx")
end
it "falls back to the implicit cookbook name on the resource" do
- expect(content.send(:resource_cookbook)).to eq('apache2')
+ expect(content.send(:resource_cookbook)).to eq("apache2")
end
end
diff --git a/spec/unit/provider/cookbook_file_spec.rb b/spec/unit/provider/cookbook_file_spec.rb
index a7cbba97cb..bc52cf2f00 100644
--- a/spec/unit/provider/cookbook_file_spec.rb
+++ b/spec/unit/provider/cookbook_file_spec.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
-require 'support/shared/unit/provider/file'
+require "support/shared/unit/provider/file"
describe Chef::Provider::CookbookFile 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(: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(:enclosing_directory) {
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
}
@@ -44,12 +44,12 @@ describe Chef::Provider::CookbookFile do
let(:resource) do
resource = Chef::Resource::CookbookFile.new("seattle", @run_context)
resource.path(resource_path)
- resource.cookbook_name = 'apache2'
+ resource.cookbook_name = "apache2"
resource
end
let(:content) do
- content = double('Chef::Provider::CookbookFile::Content')
+ content = double("Chef::Provider::CookbookFile::Content")
end
it_behaves_like Chef::Provider::File
diff --git a/spec/unit/provider/cron/unix_spec.rb b/spec/unit/provider/cron/unix_spec.rb
index 3d7a5675fc..615ae608f2 100644
--- a/spec/unit/provider/cron/unix_spec.rb
+++ b/spec/unit/provider/cron/unix_spec.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Cron::Unix do
@@ -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) }
it "is a Chef::Provider:Cron" do
expect(provider).to be_a(Chef::Provider::Cron)
@@ -61,12 +61,12 @@ describe Chef::Provider::Cron::Unix do
before do
allow(Chef::Log).to receive(:debug)
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
diff --git a/spec/unit/provider/cron_spec.rb b/spec/unit/provider/cron_spec.rb
index 7a917a4f27..cf9680775c 100644
--- a/spec/unit/provider/cron_spec.rb
+++ b/spec/unit/provider/cron_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Cron do
describe "when with special time string" do
@@ -56,7 +56,7 @@ CRONTAB
it "should pull the details out of the cron line" do
cron = @provider.load_current_resource
expect(cron.time).to eq(:reboot)
- expect(cron.command).to eq('/bin/true param1 param2')
+ expect(cron.command).to eq("/bin/true param1 param2")
end
it "should pull env vars out" do
@@ -75,12 +75,12 @@ HOME=/home/foo
# Another comment
CRONTAB
cron = @provider.load_current_resource
- expect(cron.mailto).to eq('foo@example.com')
- expect(cron.shell).to eq('/bin/foosh')
- expect(cron.path).to eq('/bin:/foo')
- expect(cron.home).to eq('/home/foo')
+ expect(cron.mailto).to eq("foo@example.com")
+ expect(cron.shell).to eq("/bin/foosh")
+ expect(cron.path).to eq("/bin:/foo")
+ expect(cron.home).to eq("/home/foo")
expect(cron.time).to eq(:reboot)
- expect(cron.command).to eq('/bin/true param1 param2')
+ expect(cron.command).to eq("/bin/true param1 param2")
end
it "should parse and load generic and standard environment variables from cron entry" do
@@ -227,13 +227,13 @@ CRONTAB
it "should pull the details out of the cron line" do
cron = @provider.load_current_resource
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('5')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('1')
- expect(cron.weekday).to eq('*')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("5")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("1")
+ expect(cron.weekday).to eq("*")
expect(cron.time).to eq(nil)
- expect(cron.command).to eq('/bin/true param1 param2')
+ expect(cron.command).to eq("/bin/true param1 param2")
end
it "should pull env vars out" do
@@ -252,17 +252,17 @@ HOME=/home/foo
# Another comment
CRONTAB
cron = @provider.load_current_resource
- expect(cron.mailto).to eq('foo@example.com')
- expect(cron.shell).to eq('/bin/foosh')
- expect(cron.path).to eq('/bin:/foo')
- expect(cron.home).to eq('/home/foo')
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('5')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('1')
- expect(cron.weekday).to eq('*')
+ expect(cron.mailto).to eq("foo@example.com")
+ expect(cron.shell).to eq("/bin/foosh")
+ expect(cron.path).to eq("/bin:/foo")
+ expect(cron.home).to eq("/home/foo")
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("5")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("1")
+ expect(cron.weekday).to eq("*")
expect(cron.time).to eq(nil)
- expect(cron.command).to eq('/bin/true param1 param2')
+ expect(cron.command).to eq("/bin/true param1 param2")
end
it "should parse and load generic and standard environment variables from cron entry" do
@@ -290,8 +290,8 @@ ENVIRONMENT=production
CRONTAB
cron = @provider.load_current_resource
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('5')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("5")
expect(cron.environment).to eq({"MINUTE" => "40", "HOUR" => "midnight", "TEST" => "lol", "ENVIRONMENT" => "production"})
end
@@ -323,12 +323,12 @@ CRONTAB
it "should pull the details out of the cron line" do
cron = @provider.load_current_resource
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('5')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('Jan')
- expect(cron.weekday).to eq('Mon')
- expect(cron.command).to eq('/bin/true param1 param2')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("5")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("Jan")
+ expect(cron.weekday).to eq("Mon")
+ expect(cron.command).to eq("/bin/true param1 param2")
end
it "should report the match" do
@@ -346,11 +346,11 @@ CRONTAB
CRONTAB
cron = @provider.load_current_resource
expect(@provider.cron_exists).to eq(true)
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('*')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('*')
- expect(cron.weekday).to eq('*')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("*")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("*")
+ expect(cron.weekday).to eq("*")
expect(cron.time).to eq(nil)
expect(cron.command).to eq(nil)
end
@@ -364,11 +364,11 @@ CRONTAB
CRONTAB
cron = @provider.load_current_resource
expect(@provider.cron_exists).to eq(true)
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('*')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('*')
- expect(cron.weekday).to eq('*')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("*")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("*")
+ expect(cron.weekday).to eq("*")
expect(cron.time).to eq(nil)
expect(cron.command).to eq(nil)
end
@@ -386,11 +386,11 @@ CRONTAB
CRONTAB
cron = @provider.load_current_resource
expect(@provider.cron_exists).to eq(true)
- expect(cron.minute).to eq('*')
- expect(cron.hour).to eq('*')
- expect(cron.day).to eq('*')
- expect(cron.month).to eq('*')
- expect(cron.weekday).to eq('*')
+ expect(cron.minute).to eq("*")
+ expect(cron.hour).to eq("*")
+ expect(cron.day).to eq("*")
+ expect(cron.month).to eq("*")
+ expect(cron.weekday).to eq("*")
expect(cron.time).to eq(nil)
expect(cron.command).to eq(nil)
end
@@ -455,10 +455,10 @@ CRONTAB
end
it "should include env variables that are set" do
- @new_resource.mailto 'foo@example.com'
- @new_resource.path '/usr/bin:/my/custom/path'
- @new_resource.shell '/bin/foosh'
- @new_resource.home '/home/foo'
+ @new_resource.mailto "foo@example.com"
+ @new_resource.path "/usr/bin:/my/custom/path"
+ @new_resource.shell "/bin/foosh"
+ @new_resource.home "/home/foo"
@new_resource.environment "TEST" => "LOL"
expect(@provider).to receive(:write_crontab).with(<<-ENDCRON)
# Chef Name: cronhole some stuff
@@ -511,10 +511,10 @@ TEST=LOL
end
it "should include env variables that are set" do
- @new_resource.mailto 'foo@example.com'
- @new_resource.path '/usr/bin:/my/custom/path'
- @new_resource.shell '/bin/foosh'
- @new_resource.home '/home/foo'
+ @new_resource.mailto "foo@example.com"
+ @new_resource.path "/usr/bin:/my/custom/path"
+ @new_resource.shell "/bin/foosh"
+ @new_resource.home "/home/foo"
@new_resource.environment "TEST" => "LOL"
expect(@provider).to receive(:write_crontab).with(<<-ENDCRON)
0 2 * * * /some/other/command
@@ -576,10 +576,10 @@ TEST=LOL
end
it "should include env variables that are set" do
- @new_resource.mailto 'foo@example.com'
- @new_resource.path '/usr/bin:/my/custom/path'
- @new_resource.shell '/bin/foosh'
- @new_resource.home '/home/foo'
+ @new_resource.mailto "foo@example.com"
+ @new_resource.path "/usr/bin:/my/custom/path"
+ @new_resource.shell "/bin/foosh"
+ @new_resource.home "/home/foo"
@new_resource.environment "TEST" => "LOL"
expect(@provider).to receive(:write_crontab).with(<<-ENDCRON)
0 2 * * * /some/other/command
@@ -671,10 +671,10 @@ HOME=/home/foo
# Another comment
CRONTAB
- @new_resource.mailto 'foo@example.com'
- @new_resource.path '/usr/bin:/my/custom/path'
- @new_resource.shell '/bin/foosh'
- @new_resource.home '/home/foo'
+ @new_resource.mailto "foo@example.com"
+ @new_resource.path "/usr/bin:/my/custom/path"
+ @new_resource.shell "/bin/foosh"
+ @new_resource.home "/home/foo"
expect(@provider).to receive(:write_crontab).with(<<-ENDCRON)
0 2 * * * /some/other/command
diff --git a/spec/unit/provider/deploy/revision_spec.rb b/spec/unit/provider/deploy/revision_spec.rb
index caa60878e1..1b77c472e0 100644
--- a/spec/unit/provider/deploy/revision_spec.rb
+++ b/spec/unit/provider/deploy/revision_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Deploy::Revision do
diff --git a/spec/unit/provider/deploy/timestamped_spec.rb b/spec/unit/provider/deploy/timestamped_spec.rb
index b189d33502..b665ac3101 100644
--- a/spec/unit/provider/deploy/timestamped_spec.rb
+++ b/spec/unit/provider/deploy/timestamped_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Deploy::Timestamped do
diff --git a/spec/unit/provider/deploy_spec.rb b/spec/unit/provider/deploy_spec.rb
index adcb9431eb..a7f7375752 100644
--- a/spec/unit/provider/deploy_spec.rb
+++ b/spec/unit/provider/deploy_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Deploy do
@@ -163,9 +163,9 @@ describe Chef::Provider::Deploy do
end
it "dont care by default if error happens on deploy" do
- allow(@provider).to receive(:all_releases).and_return(['previous_release'])
+ allow(@provider).to receive(:all_releases).and_return(["previous_release"])
allow(@provider).to receive(:deploy){ raise "Unexpected error" }
- allow(@provider).to receive(:previous_release_path).and_return('previous_release')
+ allow(@provider).to receive(:previous_release_path).and_return("previous_release")
expect(@provider).not_to receive(:rollback)
expect {
@provider.run_action(:deploy)
@@ -174,9 +174,9 @@ describe Chef::Provider::Deploy do
it "rollbacks to previous release if error happens on deploy" do
@resource.rollback_on_error true
- allow(@provider).to receive(:all_releases).and_return(['previous_release'])
+ allow(@provider).to receive(:all_releases).and_return(["previous_release"])
allow(@provider).to receive(:deploy){ raise "Unexpected error" }
- allow(@provider).to receive(:previous_release_path).and_return('previous_release')
+ allow(@provider).to receive(:previous_release_path).and_return("previous_release")
expect(@provider).to receive(:rollback)
expect {
@provider.run_action(:deploy)
@@ -552,7 +552,7 @@ describe Chef::Provider::Deploy do
expect(@provider).to receive(:execute).with("iGoToHell4this").and_return(mock_execution)
@resource.user("notCoolMan")
@resource.group("Ggroup")
- @resource.environment("APP_ENV" => 'staging')
+ @resource.environment("APP_ENV" => "staging")
@resource.deploy_to("/my/app")
expect(mock_execution).to receive(:user).with("notCoolMan")
expect(mock_execution).to receive(:group).with("Ggroup")
diff --git a/spec/unit/provider/directory_spec.rb b/spec/unit/provider/directory_spec.rb
index 4fad8c8906..6157c6c200 100644
--- a/spec/unit/provider/directory_spec.rb
+++ b/spec/unit/provider/directory_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tmpdir'
+require "spec_helper"
+require "tmpdir"
describe Chef::Provider::Directory do
let(:tmp_dir) { Dir.mktmpdir }
@@ -200,14 +200,14 @@ describe Chef::Provider::Directory do
describe "on OS X" do
before do
- allow(node).to receive(:[]).with("platform").and_return('mac_os_x')
+ allow(node).to receive(:[]).with("platform").and_return("mac_os_x")
new_resource.path "/usr/bin/chef_test"
new_resource.recursive false
allow_any_instance_of(Chef::Provider::File).to receive(:do_selinux)
end
it "os x 10.10 can write to sip locations" do
- allow(node).to receive(:[]).with("platform_version").and_return('10.10')
+ allow(node).to receive(:[]).with("platform_version").and_return("10.10")
allow(Dir).to receive(:mkdir).and_return([true], [])
allow(::File).to receive(:directory?).and_return(true)
allow(Chef::FileAccessControl).to receive(:writable?).and_return(true)
@@ -216,7 +216,7 @@ describe Chef::Provider::Directory do
end
it "os x 10.11 cannot write to sip locations" do
- allow(node).to receive(:[]).with("platform_version").and_return('10.11')
+ allow(node).to receive(:[]).with("platform_version").and_return("10.11")
allow(::File).to receive(:directory?).and_return(true)
allow(Chef::FileAccessControl).to receive(:writable?).and_return(false)
expect {directory.run_action(:create) }.to raise_error(Chef::Exceptions::InsufficientPermissions)
@@ -224,7 +224,7 @@ describe Chef::Provider::Directory do
it "os x 10.11 can write to sip exlcusions" do
new_resource.path "/usr/local/chef_test"
- allow(node).to receive(:[]).with("platform_version").and_return('10.11')
+ allow(node).to receive(:[]).with("platform_version").and_return("10.11")
allow(::File).to receive(:directory?).and_return(true)
allow(Dir).to receive(:mkdir).and_return([true], [])
allow(Chef::FileAccessControl).to receive(:writable?).and_return(false)
diff --git a/spec/unit/provider/dsc_resource_spec.rb b/spec/unit/provider/dsc_resource_spec.rb
index 46cdbd93a6..afa8ce3975 100644
--- a/spec/unit/provider/dsc_resource_spec.rb
+++ b/spec/unit/provider/dsc_resource_spec.rb
@@ -16,8 +16,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef'
-require 'spec_helper'
+require "chef"
+require "spec_helper"
describe Chef::Provider::DscResource do
let (:events) { Chef::EventDispatch::Dispatcher.new }
@@ -27,41 +27,41 @@ describe Chef::Provider::DscResource do
Chef::Provider::DscResource.new(resource, run_context)
end
- context 'when Powershell does not support Invoke-DscResource' do
+ context "when Powershell does not support Invoke-DscResource" do
let (:node) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '4.0'
+ node.automatic[:languages][:powershell][:version] = "4.0"
node
}
- it 'raises a ProviderNotFound exception' do
+ it "raises a ProviderNotFound exception" do
expect(provider).not_to receive(:meta_configuration)
expect{provider.run_action(:run)}.to raise_error(
Chef::Exceptions::ProviderNotFound, /5\.0\.10018\.0/)
end
end
- context 'when Powershell supports Invoke-DscResource' do
+ context "when Powershell supports Invoke-DscResource" do
- context 'when RefreshMode is not set to Disabled' do
- context 'and the WMF 5 is a preview release' do
+ context "when RefreshMode is not set to Disabled" do
+ context "and the WMF 5 is a preview release" do
let (:node) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '5.0.10018.0'
+ node.automatic[:languages][:powershell][:version] = "5.0.10018.0"
node
}
- it 'raises an exception' do
+ it "raises an exception" do
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(false)
expect { provider.run_action(:run) }.to raise_error(
Chef::Exceptions::ProviderNotFound, /Disabled/)
end
end
- context 'and the WMF is 5 RTM or newer' do
+ context "and the WMF is 5 RTM or newer" do
let (:node) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '5.0.10586.0'
+ node.automatic[:languages][:powershell][:version] = "5.0.10586.0"
node
}
- it 'does not raises an exception' do
+ it "does not raises an exception" do
expect(provider).to receive(:test_resource)
expect(provider).to receive(:set_resource)
expect(provider).to receive(:reboot_if_required)
@@ -71,21 +71,21 @@ describe Chef::Provider::DscResource do
end
end
- context 'when the LCM supports Invoke-DscResource' do
+ context "when the LCM supports Invoke-DscResource" do
let (:node) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '5.0.10018.0'
+ node.automatic[:languages][:powershell][:version] = "5.0.10018.0"
node
}
- it 'does not update the resource if it is up to date' do
+ it "does not update the resource if it is up to date" do
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(true)
expect(provider).to receive(:test_resource).and_return(true)
provider.run_action(:run)
expect(resource).not_to be_updated
end
- it 'converges the resource if it is not up to date' do
+ it "converges the resource if it is not up to date" do
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(true)
expect(provider).to receive(:test_resource).and_return(false)
expect(provider).to receive(:set_resource)
@@ -93,21 +93,21 @@ describe Chef::Provider::DscResource do
expect(resource).to be_updated
end
- it 'flags the resource as reboot required when required' do
+ it "flags the resource as reboot required when required" do
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(true)
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(:return_dsc_resource_result).and_return(true)
expect(provider).to receive(:create_reboot_resource)
provider.run_action(:run)
end
- it 'does not flag the resource as reboot required when not required' do
+ it "does not flag the resource as reboot required when not required" do
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(true)
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(:return_dsc_resource_result).and_return(false)
expect(provider).to_not receive(:create_reboot_resource)
provider.run_action(:run)
diff --git a/spec/unit/provider/dsc_script_spec.rb b/spec/unit/provider/dsc_script_spec.rb
index 76589e71c1..ebde817010 100644
--- a/spec/unit/provider/dsc_script_spec.rb
+++ b/spec/unit/provider/dsc_script_spec.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'chef'
-require 'chef/util/dsc/resource_info'
-require 'spec_helper'
+require "chef"
+require "chef/util/dsc/resource_info"
+require "spec_helper"
describe Chef::Provider::DscScript do
- context 'when DSC is available' do
+ context "when DSC is available" do
let (:node) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '4.0'
+ node.automatic[:languages][:powershell][:version] = "4.0"
node
}
let (:events) { Chef::EventDispatch::Dispatcher.new }
@@ -39,75 +39,75 @@ describe Chef::Provider::DscScript do
it "describes the resource as converged if there were 0 DSC resources" do
allow(provider).to receive(:run_configuration).with(:test).and_return([])
provider.load_current_resource
- expect(provider.instance_variable_get('@resource_converged')).to be_truthy
+ expect(provider.instance_variable_get("@resource_converged")).to be_truthy
end
it "describes the resource as not converged if there is 1 DSC resources that is converged" do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resource', false, ['nothing will change something'])
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resource", false, ["nothing will change something"])
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info])
provider.load_current_resource
- expect(provider.instance_variable_get('@resource_converged')).to be_truthy
+ expect(provider.instance_variable_get("@resource_converged")).to be_truthy
end
it "describes the resource as not converged if there is 1 DSC resources that is not converged" do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resource', true, ['will change something'])
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resource", true, ["will change something"])
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info])
provider.load_current_resource
- expect(provider.instance_variable_get('@resource_converged')).to be_falsey
+ expect(provider.instance_variable_get("@resource_converged")).to be_falsey
end
it "describes the resource as not converged if there are any DSC resources that are not converged" do
- dsc_resource_info1 = Chef::Util::DSC::ResourceInfo.new('resource', true, ['will change something'])
- dsc_resource_info2 = Chef::Util::DSC::ResourceInfo.new('resource', false, ['nothing will change something'])
+ dsc_resource_info1 = Chef::Util::DSC::ResourceInfo.new("resource", true, ["will change something"])
+ dsc_resource_info2 = Chef::Util::DSC::ResourceInfo.new("resource", false, ["nothing will change something"])
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info1, dsc_resource_info2])
provider.load_current_resource
- expect(provider.instance_variable_get('@resource_converged')).to be_falsey
+ expect(provider.instance_variable_get("@resource_converged")).to be_falsey
end
it "describes the resource as converged if all DSC resources that are converged" do
- dsc_resource_info1 = Chef::Util::DSC::ResourceInfo.new('resource', false, ['nothing will change something'])
- dsc_resource_info2 = Chef::Util::DSC::ResourceInfo.new('resource', false, ['nothing will change something'])
+ dsc_resource_info1 = Chef::Util::DSC::ResourceInfo.new("resource", false, ["nothing will change something"])
+ dsc_resource_info2 = Chef::Util::DSC::ResourceInfo.new("resource", false, ["nothing will change something"])
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info1, dsc_resource_info2])
provider.load_current_resource
- expect(provider.instance_variable_get('@resource_converged')).to be_truthy
+ expect(provider.instance_variable_get("@resource_converged")).to be_truthy
end
end
describe '#generate_configuration_document' do
# I think integration tests should cover these cases
- it 'uses configuration_document_from_script_path when a dsc script file is given' do
+ it "uses configuration_document_from_script_path when a dsc script file is given" do
allow(provider).to receive(:load_current_resource)
resource.command("path_to_script")
- generator = double('Chef::Util::DSC::ConfigurationGenerator')
+ generator = double("Chef::Util::DSC::ConfigurationGenerator")
expect(generator).to receive(:configuration_document_from_script_path)
allow(Chef::Util::DSC::ConfigurationGenerator).to receive(:new).and_return(generator)
- provider.send(:generate_configuration_document, 'tmp', nil)
+ provider.send(:generate_configuration_document, "tmp", nil)
end
- it 'uses configuration_document_from_script_code when a the dsc resource is given' do
+ it "uses configuration_document_from_script_code when a the dsc resource is given" do
allow(provider).to receive(:load_current_resource)
resource.code("ImADSCResource{}")
- generator = double('Chef::Util::DSC::ConfigurationGenerator')
+ generator = double("Chef::Util::DSC::ConfigurationGenerator")
expect(generator).to receive(:configuration_document_from_script_code)
allow(Chef::Util::DSC::ConfigurationGenerator).to receive(:new).and_return(generator)
- provider.send(:generate_configuration_document, 'tmp', nil)
+ provider.send(:generate_configuration_document, "tmp", nil)
end
- it 'should noop if neither code or command are provided' do
+ it "should noop if neither code or command are provided" do
allow(provider).to receive(:load_current_resource)
- generator = double('Chef::Util::DSC::ConfigurationGenerator')
- expect(generator).to receive(:configuration_document_from_script_code).with('', anything(), anything(), anything())
+ generator = double("Chef::Util::DSC::ConfigurationGenerator")
+ expect(generator).to receive(:configuration_document_from_script_code).with("", anything(), anything(), anything())
allow(Chef::Util::DSC::ConfigurationGenerator).to receive(:new).and_return(generator)
- provider.send(:generate_configuration_document, 'tmp', nil)
+ provider.send(:generate_configuration_document, "tmp", nil)
end
end
- describe 'action_run' do
- it 'should converge the script if it is not converged' do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resource', true, ['will change something'])
+ describe "action_run" do
+ it "should converge the script if it is not converged" do
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resource", true, ["will change something"])
allow(provider).to receive(:run_configuration).with(:test).and_return([dsc_resource_info])
allow(provider).to receive(:run_configuration).with(:set)
@@ -115,7 +115,7 @@ describe Chef::Provider::DscScript do
expect(resource).to be_updated
end
- it 'should not converge if the script is already converged' do
+ it "should not converge if the script is already converged" do
allow(provider).to receive(:run_configuration).with(:test).and_return([])
provider.run_action(:run)
@@ -124,35 +124,35 @@ describe Chef::Provider::DscScript do
end
describe '#generate_description' do
- it 'removes the resource name from the beginning of any log line from the LCM' do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resourcename', true, ['resourcename doing something', 'lastline'])
- provider.instance_variable_set('@dsc_resources_info', [dsc_resource_info])
+ it "removes the resource name from the beginning of any log line from the LCM" do
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resourcename", true, ["resourcename doing something", "lastline"])
+ provider.instance_variable_set("@dsc_resources_info", [dsc_resource_info])
expect(provider.send(:generate_description)[1]).to match(/converge DSC resource resourcename by doing something/)
end
- it 'ignores the last line' do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resourcename', true, ['resourcename doing something', 'lastline'])
- provider.instance_variable_set('@dsc_resources_info', [dsc_resource_info])
+ it "ignores the last line" do
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resourcename", true, ["resourcename doing something", "lastline"])
+ provider.instance_variable_set("@dsc_resources_info", [dsc_resource_info])
expect(provider.send(:generate_description)[1]).not_to match(/lastline/)
end
- it 'reports a dsc resource has not been changed if the LCM reported no change was required' do
- dsc_resource_info = Chef::Util::DSC::ResourceInfo.new('resourcename', false, ['resourcename does nothing', 'lastline'])
- provider.instance_variable_set('@dsc_resources_info', [dsc_resource_info])
+ it "reports a dsc resource has not been changed if the LCM reported no change was required" do
+ dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resourcename", false, ["resourcename does nothing", "lastline"])
+ provider.instance_variable_set("@dsc_resources_info", [dsc_resource_info])
expect(provider.send(:generate_description)[1]).to match(/converge DSC resource resourcename by doing nothing/)
end
end
end
- context 'when Dsc is not available' do
+ context "when Dsc is not available" do
let (:node) { Chef::Node.new }
let (:events) { Chef::EventDispatch::Dispatcher.new }
let (:run_context) { Chef::RunContext.new(node, {}, events) }
- let (:resource) { Chef::Resource::DscScript.new('script', run_context) }
+ let (:resource) { Chef::Resource::DscScript.new("script", run_context) }
let (:provider) { Chef::Provider::DscScript.new(resource, run_context) }
- describe 'action_run' do
- ['1.0', '2.0', '3.0'].each do |version|
+ describe "action_run" do
+ ["1.0", "2.0", "3.0"].each do |version|
it "raises an exception for powershell version '#{version}'" do
node.automatic[:languages][:powershell][:version] = version
@@ -162,7 +162,7 @@ describe Chef::Provider::DscScript do
end
end
- it 'raises an exception if Powershell is not present' do
+ it "raises an exception if Powershell is not present" do
expect {
provider.run_action(:run)
}.to raise_error(Chef::Exceptions::ProviderNotFound)
diff --git a/spec/unit/provider/env/windows_spec.rb b/spec/unit/provider/env/windows_spec.rb
index 99f33d392a..b72e41884f 100644
--- a/spec/unit/provider/env/windows_spec.rb
+++ b/spec/unit/provider/env/windows_spec.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Env::Windows, :windows_only do
let(:node) { Chef::Node.new }
let(:events) {Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
- context 'when environment variable is not PATH' do
+ context "when environment variable is not PATH" do
let(:new_resource) {
new_resource = Chef::Resource::Env.new("CHEF_WINDOWS_ENV_TEST")
new_resource.value("foo")
@@ -31,71 +31,71 @@ describe Chef::Provider::Env::Windows, :windows_only do
}
let(:provider) {
provider = Chef::Provider::Env::Windows.new(new_resource, run_context)
- allow(provider).to receive(:env_obj).and_return(double('null object').as_null_object)
+ allow(provider).to receive(:env_obj).and_return(double("null object").as_null_object)
provider
}
describe "action_create" do
before do
- ENV.delete('CHEF_WINDOWS_ENV_TEST')
+ ENV.delete("CHEF_WINDOWS_ENV_TEST")
provider.key_exists = false
end
it "should update the ruby ENV object when it creates the key" do
provider.action_create
- expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql('foo')
+ expect(ENV["CHEF_WINDOWS_ENV_TEST"]).to eql("foo")
end
end
describe "action_modify" do
before do
- ENV['CHEF_WINDOWS_ENV_TEST'] = 'foo'
+ ENV["CHEF_WINDOWS_ENV_TEST"] = "foo"
end
it "should update the ruby ENV object when it updates the value" do
expect(provider).to receive(:requires_modify_or_create?).and_return(true)
new_resource.value("foobar")
provider.action_modify
- expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql('foobar')
+ expect(ENV["CHEF_WINDOWS_ENV_TEST"]).to eql("foobar")
end
describe "action_delete" do
before do
- ENV['CHEF_WINDOWS_ENV_TEST'] = 'foo'
+ ENV["CHEF_WINDOWS_ENV_TEST"] = "foo"
end
it "should update the ruby ENV object when it deletes the key" do
provider.action_delete
- expect(ENV['CHEF_WINDOWS_ENV_TEST']).to eql(nil)
+ expect(ENV["CHEF_WINDOWS_ENV_TEST"]).to eql(nil)
end
end
end
end
- context 'when environment is PATH' do
+ context "when environment is PATH" do
describe "for PATH" do
- let(:system_root) {'%SystemRoot%'}
+ let(:system_root) {"%SystemRoot%"}
let(:system_root_value) { 'D:\Windows' }
let(:new_resource) {
- new_resource = Chef::Resource::Env.new('PATH')
+ new_resource = Chef::Resource::Env.new("PATH")
new_resource.value(system_root)
new_resource
}
let(:provider) {
provider = Chef::Provider::Env::Windows.new(new_resource, run_context)
- allow(provider).to receive(:env_obj).and_return(double('null object').as_null_object)
+ allow(provider).to receive(:env_obj).and_return(double("null object").as_null_object)
provider
}
before do
- stub_const('ENV', {'PATH' => ''})
+ stub_const("ENV", {"PATH" => ""})
end
it "replaces Windows system variables" do
expect(provider).to receive(:requires_modify_or_create?).and_return(true)
expect(provider).to receive(:expand_path).with(system_root).and_return(system_root_value)
provider.action_modify
- expect(ENV['PATH']).to eql(system_root_value)
+ expect(ENV["PATH"]).to eql(system_root_value)
end
end
diff --git a/spec/unit/provider/env_spec.rb b/spec/unit/provider/env_spec.rb
index 230603dcb3..f0e74f347f 100644
--- a/spec/unit/provider/env_spec.rb
+++ b/spec/unit/provider/env_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Env do
diff --git a/spec/unit/provider/erl_call_spec.rb b/spec/unit/provider/erl_call_spec.rb
index 2fb7e5b737..6526de0087 100644
--- a/spec/unit/provider/erl_call_spec.rb
+++ b/spec/unit/provider/erl_call_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::ErlCall do
before(:each) do
@@ -33,7 +33,7 @@ describe Chef::Provider::ErlCall do
allow(@provider).to receive(:popen4).and_return(@status)
@stdin = StringIO.new
- @stdout = StringIO.new('{ok, woohoo}')
+ @stdout = StringIO.new("{ok, woohoo}")
@stderr = StringIO.new
@pid = 2342999
end
diff --git a/spec/unit/provider/execute_spec.rb b/spec/unit/provider/execute_spec.rb
index 8a55025d9e..c656607ca7 100644
--- a/spec/unit/provider/execute_spec.rb
+++ b/spec/unit/provider/execute_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Execute do
diff --git a/spec/unit/provider/file/content_spec.rb b/spec/unit/provider/file/content_spec.rb
index 0a45d15bc9..7271772e2c 100644
--- a/spec/unit/provider/file/content_spec.rb
+++ b/spec/unit/provider/file/content_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::File::Content do
diff --git a/spec/unit/provider/file_spec.rb b/spec/unit/provider/file_spec.rb
index 504ae045d9..4e8b4507ba 100644
--- a/spec/unit/provider/file_spec.rb
+++ b/spec/unit/provider/file_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'support/shared/unit/provider/file'
+require "support/shared/unit/provider/file"
describe Chef::Provider::File do
@@ -29,12 +29,12 @@ describe Chef::Provider::File do
end
let(:content) do
- content = double('Chef::Provider::File::Content')
+ content = double("Chef::Provider::File::Content")
end
- 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(: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(:enclosing_directory) {
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
}
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb
index 41536a450f..4ec0439092 100644
--- a/spec/unit/provider/git_spec.rb
+++ b/spec/unit/provider/git_spec.rb
@@ -17,7 +17,7 @@
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Git do
before(:each) do
@@ -59,7 +59,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]}).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]}).and_return(double("ShellOut result", :stdout => @stdout))
expect(@provider.find_current_revision).to eql("9b4d8dc38dd471246e7cfb1c3c1ad14b0f2bee13")
end
@@ -67,7 +67,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]).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]).and_return(double("ShellOut result", :stdout => "", :stderr => @stderr))
expect(@provider.find_current_revision).to be_nil
end
end
@@ -206,7 +206,7 @@ d7b9957f67236fa54e660cc3ab45ffecd6e0ba38\trefs/tags/0.7.8
b7d19519a1c15f1c1a324e2683bd728b6198ce5a\trefs/tags/0.7.8^{}
ebc1b392fe7e8f0fbabc305c299b4d365d2b4d9b\trefs/tags/chef-server-package
SHAS
- @resource.revision ''
+ @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.target_revision).to eql("28af684d8460ba4793eda3e7ac238c864a5d029a")
end
@@ -284,8 +284,8 @@ SHAS
it "compiles a clone command using --depth for shallow cloning" do
@resource.depth 5
expected_cmd = "git clone --depth 5 \"git://github.com/opscode/chef.git\" \"/my/deploy/dir\""
- version_response = double('shell_out')
- allow(version_response).to receive(:stdout) { 'git version 1.7.9' }
+ 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]")
@@ -295,8 +295,8 @@ SHAS
it "compiles a clone command using --no-single-branch for shallow cloning when git >= 1.7.10" do
@resource.depth 5
expected_cmd = "git clone --depth 5 --no-single-branch \"git://github.com/opscode/chef.git\" \"/my/deploy/dir\""
- version_response = double('shell_out')
- allow(version_response).to receive(:stdout) { 'git version 1.7.10' }
+ 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]")
@@ -311,9 +311,9 @@ SHAS
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",
+ 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",
+ expect(@provider).to receive(:shell_out!).with("git checkout deploy", :cwd => "/my/deploy/dir",
:log_tag => "git[web2.0 app]").ordered
@provider.checkout
end
@@ -372,7 +372,7 @@ SHAS
context "configuring remote tracking branches" do
it "checks if a remote with this name already exists" do
- command_response = double('shell_out')
+ 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,
@@ -390,7 +390,7 @@ SHAS
@resource.user("whois")
@resource.group("thisis")
allow(Etc).to receive(:getpwnam).and_return(double("Struct::Passwd", :name => @resource.user, :dir => "/home/whois"))
- command_response = double('shell_out')
+ 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,
@@ -412,7 +412,7 @@ SHAS
describe "when a remote with a given name hasn't been configured yet" do
it "adds a new remote " do
- command_response = double('shell_out')
+ command_response = double("shell_out")
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,
@@ -429,7 +429,7 @@ SHAS
describe "when a remote with a given name has already been configured" do
it "updates remote url when the url is different" do
- command_response = double('shell_out')
+ command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 0 }
allow(command_response).to receive(:stdout) { "some_other_url" }
check_remote_command = "git config --get remote.#{@resource.remote}.url"
@@ -445,7 +445,7 @@ SHAS
end
it "doesn't update remote url when the url is the same" do
- command_response = double('shell_out')
+ command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 0 }
allow(command_response).to receive(:stdout) { @resource.repository }
check_remote_command = "git config --get remote.#{@resource.remote}.url"
@@ -461,7 +461,7 @@ SHAS
end
it "resets remote url when it has multiple values" do
- command_response = double('shell_out')
+ command_response = double("shell_out")
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,
@@ -488,7 +488,7 @@ SHAS
allow(::File).to receive(:exist?).with("/my/deploy/dir").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(['.','..'])
+ allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return([".",".."])
expect(@provider).to receive(:clone)
expect(@provider).to receive(:checkout)
expect(@provider).to receive(:enable_submodules)
@@ -504,7 +504,7 @@ SHAS
allow(::File).to receive(:exist?).with("/my/deploy/dir").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(['.','..'])
+ allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return([".",".."])
@resource.enable_checkout false
expect(@provider).to receive(:clone)
@@ -519,7 +519,7 @@ SHAS
allow(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(false)
allow(::File).to receive(:exist?).with("/my/deploy/dir").and_return(false)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(['..','.'])
+ allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(["..","."])
expect(@provider).to receive(:clone)
expect(@provider).to receive(:checkout)
expect(@provider).to receive(:enable_submodules)
@@ -534,7 +534,7 @@ SHAS
allow(::File).to receive(:exist?).with("/my/deploy/dir").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(['.','..','foo','bar'])
+ allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return([".","..","foo","bar"])
expect(@provider).not_to receive(:clone)
expect(@provider).not_to receive(:checkout)
expect(@provider).not_to receive(:enable_submodules)
@@ -546,7 +546,7 @@ SHAS
it "syncs the code by updating the source when the repo has already been checked out" do
expect(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- expect(@provider).to receive(:find_current_revision).exactly(1).and_return('d35af14d41ae22b19da05d7d03a0bafc321b244c')
+ expect(@provider).to receive(:find_current_revision).exactly(1).and_return("d35af14d41ae22b19da05d7d03a0bafc321b244c")
expect(@provider).not_to receive(:fetch_updates)
expect(@provider).to receive(:add_remotes)
@provider.run_action(:sync)
@@ -557,8 +557,8 @@ SHAS
expect(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
# invoked twice - first time from load_current_resource
- expect(@provider).to receive(:find_current_revision).exactly(1).and_return('d35af14d41ae22b19da05d7d03a0bafc321b244c')
- allow(@provider).to receive(:target_revision).and_return('28af684d8460ba4793eda3e7ac238c864a5d029a')
+ expect(@provider).to receive(:find_current_revision).exactly(1).and_return("d35af14d41ae22b19da05d7d03a0bafc321b244c")
+ allow(@provider).to receive(:target_revision).and_return("28af684d8460ba4793eda3e7ac238c864a5d029a")
expect(@provider).to receive(:fetch_updates)
expect(@provider).to receive(:enable_submodules)
expect(@provider).to receive(:add_remotes)
@@ -569,8 +569,8 @@ SHAS
it "does not fetch any updates if the remote revision matches the current revision" do
expect(::File).to receive(:exist?).with("/my/deploy/dir/.git").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(@provider).to receive(:find_current_revision).and_return('d35af14d41ae22b19da05d7d03a0bafc321b244c')
- allow(@provider).to receive(:target_revision).and_return('d35af14d41ae22b19da05d7d03a0bafc321b244c')
+ allow(@provider).to receive(:find_current_revision).and_return("d35af14d41ae22b19da05d7d03a0bafc321b244c")
+ allow(@provider).to receive(:target_revision).and_return("d35af14d41ae22b19da05d7d03a0bafc321b244c")
expect(@provider).not_to receive(:fetch_updates)
expect(@provider).to receive(:add_remotes)
@provider.run_action(:sync)
@@ -609,7 +609,7 @@ SHAS
@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')
+ command_response = double("shell_out")
allow(command_response).to receive(:exitstatus) { 0 }
@resource.additional_remotes.each_pair do |remote_name, remote_url|
expect(@provider).to receive(:setup_remote_tracking_branches).with(remote_name, remote_url)
@@ -620,7 +620,7 @@ SHAS
describe "calling multiple_remotes?" do
before(:each) do
- @command_response = double('shell_out')
+ @command_response = double("shell_out")
end
describe "when check remote command returns with status 2" do
@@ -647,7 +647,7 @@ SHAS
describe "calling remote_matches?" do
before(:each) do
- @command_response = double('shell_out')
+ @command_response = double("shell_out")
end
describe "when output of the check remote command matches the repository url" do
diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb
index d84e4e1d57..1a61fc2383 100644
--- a/spec/unit/provider/group/dscl_spec.rb
+++ b/spec/unit/provider/group/dscl_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Dscl do
before do
@@ -293,7 +293,7 @@ describe Chef::Provider::Group::Dscl do
end
end
-describe 'Test DSCL loading' do
+describe "Test DSCL loading" do
before do
@node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@@ -320,12 +320,12 @@ EOF
end
- it 'should parse gid properly' do
+ it "should parse gid properly" do
allow(File).to receive(:exists?).and_return(true)
expect(@current_resource.gid).to eq("999")
end
- it 'should parse members properly' do
+ it "should parse members properly" do
allow(File).to receive(:exists?).and_return(true)
- expect(@current_resource.members).to eq(['waka', 'bar'])
+ expect(@current_resource.members).to eq(["waka", "bar"])
end
end
diff --git a/spec/unit/provider/group/gpasswd_spec.rb b/spec/unit/provider/group/gpasswd_spec.rb
index 55d978fa7e..a24424182d 100644
--- a/spec/unit/provider/group/gpasswd_spec.rb
+++ b/spec/unit/provider/group/gpasswd_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Gpasswd, "modify_group_members" do
before do
diff --git a/spec/unit/provider/group/groupadd_spec.rb b/spec/unit/provider/group/groupadd_spec.rb
index 47021a9af3..8cdc096c68 100644
--- a/spec/unit/provider/group/groupadd_spec.rb
+++ b/spec/unit/provider/group/groupadd_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Groupadd, "set_options" do
before do
diff --git a/spec/unit/provider/group/groupmod_spec.rb b/spec/unit/provider/group/groupmod_spec.rb
index 496d1e28fa..a69774a309 100644
--- a/spec/unit/provider/group/groupmod_spec.rb
+++ b/spec/unit/provider/group/groupmod_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Groupmod do
before do
diff --git a/spec/unit/provider/group/pw_spec.rb b/spec/unit/provider/group/pw_spec.rb
index 531d0a52a2..ed1f06efe0 100644
--- a/spec/unit/provider/group/pw_spec.rb
+++ b/spec/unit/provider/group/pw_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Pw do
before do
diff --git a/spec/unit/provider/group/usermod_spec.rb b/spec/unit/provider/group/usermod_spec.rb
index 6c4c4d2e07..cd532f8b8d 100644
--- a/spec/unit/provider/group/usermod_spec.rb
+++ b/spec/unit/provider/group/usermod_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Group::Usermod do
before do
diff --git a/spec/unit/provider/group/windows_spec.rb b/spec/unit/provider/group/windows_spec.rb
index 23dfa8315f..4f071f3b94 100644
--- a/spec/unit/provider/group/windows_spec.rb
+++ b/spec/unit/provider/group/windows_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef
class Util
@@ -94,7 +94,7 @@ describe Chef::Provider::Group::Windows, "NetGroup" do
@new_resource = Chef::Resource::Group.new("Creating a new group")
@new_resource.group_name "Remote Desktop Users"
end
- it 'sets group_name correctly' do
+ it "sets group_name correctly" do
expect(Chef::Util::Windows::NetGroup).to receive(:new).with("Remote Desktop Users")
Chef::Provider::Group::Windows.new(@new_resource, @run_context)
end
diff --git a/spec/unit/provider/group_spec.rb b/spec/unit/provider/group_spec.rb
index 55a2f97aa5..957e7b14df 100644
--- a/spec/unit/provider/group_spec.rb
+++ b/spec/unit/provider/group_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::User do
@@ -41,7 +41,7 @@ describe Chef::Provider::User do
:gid => 20,
:mem => [ "root", "aj" ],
)
- allow(Etc).to receive(:getgrnam).with('wheel').and_return(@pw_group)
+ allow(Etc).to receive(:getgrnam).with("wheel").and_return(@pw_group)
end
it "assumes the group exists by default" do
@@ -52,7 +52,7 @@ describe Chef::Provider::User do
it "sets the group name of the current resource to the group name of the new resource" do
@provider.load_current_resource
- expect(@provider.current_resource.group_name).to eq('wheel')
+ expect(@provider.current_resource.group_name).to eq("wheel")
end
it "does not modify the desired gid if set" do
diff --git a/spec/unit/provider/http_request_spec.rb b/spec/unit/provider/http_request_spec.rb
index 980458abd3..33c9167c33 100644
--- a/spec/unit/provider/http_request_spec.rb
+++ b/spec/unit/provider/http_request_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::HttpRequest do
before(:each) do
@@ -24,7 +24,7 @@ describe Chef::Provider::HttpRequest do
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::HttpRequest.new('adam')
+ @new_resource = Chef::Resource::HttpRequest.new("adam")
@new_resource.name "adam"
@new_resource.url "http://www.opscode.com/"
@new_resource.message "is cool"
diff --git a/spec/unit/provider/ifconfig/aix_spec.rb b/spec/unit/provider/ifconfig/aix_spec.rb
index 0b6fa33614..6213de4803 100644
--- a/spec/unit/provider/ifconfig/aix_spec.rb
+++ b/spec/unit/provider/ifconfig/aix_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/exceptions'
+require "spec_helper"
+require "chef/exceptions"
describe Chef::Provider::Ifconfig::Aix do
diff --git a/spec/unit/provider/ifconfig/debian_spec.rb b/spec/unit/provider/ifconfig/debian_spec.rb
index 0c02ae9cd4..b116ecf127 100644
--- a/spec/unit/provider/ifconfig/debian_spec.rb
+++ b/spec/unit/provider/ifconfig/debian_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/exceptions'
+require "spec_helper"
+require "chef/exceptions"
describe Chef::Provider::Ifconfig::Debian do
diff --git a/spec/unit/provider/ifconfig/redhat_spec.rb b/spec/unit/provider/ifconfig/redhat_spec.rb
index 620fd341d7..bdcaa57330 100644
--- a/spec/unit/provider/ifconfig/redhat_spec.rb
+++ b/spec/unit/provider/ifconfig/redhat_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/exceptions'
+require "spec_helper"
+require "chef/exceptions"
describe Chef::Provider::Ifconfig::Redhat do
before do
diff --git a/spec/unit/provider/ifconfig_spec.rb b/spec/unit/provider/ifconfig_spec.rb
index 90109ca1c0..e4335ed3e7 100644
--- a/spec/unit/provider/ifconfig_spec.rb
+++ b/spec/unit/provider/ifconfig_spec.rb
@@ -17,8 +17,8 @@
#
#require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
-require 'spec_helper'
-require 'chef/exceptions'
+require "spec_helper"
+require "chef/exceptions"
describe Chef::Provider::Ifconfig do
before do
diff --git a/spec/unit/provider/link_spec.rb b/spec/unit/provider/link_spec.rb
index 0f95ce997e..80ebc62f2a 100644
--- a/spec/unit/provider/link_spec.rb
+++ b/spec/unit/provider/link_spec.rb
@@ -17,12 +17,12 @@
# limitations under the License.
#
-require 'ostruct'
+require "ostruct"
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/win32/file' #probably need this in spec_helper
+ require "chef/win32/file" #probably need this in spec_helper
end
describe Chef::Resource::Link, :not_supported_on_win2k3 do
@@ -39,7 +39,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
end
def canonicalize(path)
- Chef::Platform.windows? ? path.gsub('/', '\\') : path
+ Chef::Platform.windows? ? path.gsub("/", '\\') : path
end
describe "when the target is a symlink" do
@@ -80,13 +80,13 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
# We test create in unit tests because there is no other way to ensure
# it does no work. Other create and delete scenarios are covered in
# the functional tests for links.
- context 'when the desired state is identical' do
+ context "when the desired state is identical" do
let(:new_resource) do
result = Chef::Resource::Link.new("#{CHEF_SPEC_DATA}/fofile-link")
result.to "#{CHEF_SPEC_DATA}/fofile"
result
end
- it 'create does no work' do
+ it "create does no work" do
expect(provider.access_controls).not_to receive(:set_all)
provider.run_action(:create)
end
@@ -164,7 +164,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
expect(provider.current_resource.target_file).to eq("#{CHEF_SPEC_DATA}/fofile-link")
end
it "should update the current source of the existing link with an empty string" do
- expect(provider.current_resource.to).to eq('')
+ expect(provider.current_resource.to).to eq("")
end
it "should not set the owner" do
expect(provider.current_resource.owner).to eq(nil)
@@ -191,7 +191,7 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
expect(provider.current_resource.target_file).to eq("#{CHEF_SPEC_DATA}/fofile-link")
end
it "should update the current source of the existing link with an empty string" do
- expect(provider.current_resource.to).to eq('')
+ expect(provider.current_resource.to).to eq("")
end
it "should not set the owner" do
expect(provider.current_resource.owner).to eq(nil)
@@ -233,14 +233,14 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
# We test create in unit tests because there is no other way to ensure
# it does no work. Other create and delete scenarios are covered in
# the functional tests for links.
- context 'when the desired state is identical' do
+ context "when the desired state is identical" do
let(:new_resource) do
result = Chef::Resource::Link.new("#{CHEF_SPEC_DATA}/fofile-link")
result.to "#{CHEF_SPEC_DATA}/fofile"
result.link_type :hard
result
end
- it 'create does no work' do
+ it "create does no work" do
expect(provider.file_class).not_to receive(:symlink)
expect(provider.file_class).not_to receive(:link)
expect(provider.access_controls).not_to receive(:set_all)
diff --git a/spec/unit/provider/log_spec.rb b/spec/unit/provider/log_spec.rb
index 1ecc633ce1..5aadcbf7cd 100644
--- a/spec/unit/provider/log_spec.rb
+++ b/spec/unit/provider/log_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Log::ChefLog do
diff --git a/spec/unit/provider/mdadm_spec.rb b/spec/unit/provider/mdadm_spec.rb
index 38401b7225..ec5f6237d1 100644
--- a/spec/unit/provider/mdadm_spec.rb
+++ b/spec/unit/provider/mdadm_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Mdadm do
@@ -25,7 +25,7 @@ describe Chef::Provider::Mdadm do
@node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::Mdadm.new('/dev/md1')
+ @new_resource = Chef::Resource::Mdadm.new("/dev/md1")
@new_resource.devices ["/dev/sdz1","/dev/sdz2","/dev/sdz3"]
@provider = Chef::Provider::Mdadm.new(@new_resource, @run_context)
end
@@ -34,8 +34,8 @@ describe Chef::Provider::Mdadm 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))
@provider.load_current_resource
- expect(@provider.current_resource.name).to eq('/dev/md1')
- expect(@provider.current_resource.raid_device).to eq('/dev/md1')
+ 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
@@ -53,7 +53,7 @@ describe Chef::Provider::Mdadm do
describe "after the metadevice status is known" do
before(:each) do
- @current_resource = Chef::Resource::Mdadm.new('/dev/md1')
+ @current_resource = Chef::Resource::Mdadm.new("/dev/md1")
@new_resource.level 5
allow(@provider).to receive(:load_current_resource).and_return(true)
@provider.current_resource = @current_resource
@@ -69,7 +69,7 @@ describe Chef::Provider::Mdadm do
it "should specify a bitmap only if set" do
@current_resource.exists(false)
- @new_resource.bitmap('grow')
+ @new_resource.bitmap("grow")
expected_command = "yes | mdadm --create /dev/md1 --level 5 --chunk=16 --metadata=0.90 --bitmap=grow --raid-devices 3 /dev/sdz1 /dev/sdz2 /dev/sdz3"
expect(@provider).to receive(:shell_out!).with(expected_command)
@provider.run_action(:create)
diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb
index e232592275..1aa64967af 100644
--- a/spec/unit/provider/mount/aix_spec.rb
+++ b/spec/unit/provider/mount/aix_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Mount::Aix do
@@ -114,7 +114,7 @@ ENABLED
expect(@provider.current_resource.mounted).to be_truthy
expect(@provider.current_resource.mount_point).to eql(@new_resource.mount_point)
expect(@provider.current_resource.fstype).to eql("jfs2")
- expect(@provider.current_resource.options).to eql(['rw'])
+ expect(@provider.current_resource.options).to eql(["rw"])
end
describe "mount_fs" do
diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb
index 124d51b367..c267dc706c 100644
--- a/spec/unit/provider/mount/mount_spec.rb
+++ b/spec/unit/provider/mount/mount_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Mount::Mount do
before(:each) do
@@ -42,15 +42,15 @@ 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
it "should create a current resource with the same mount point and device" do
@provider.load_current_resource
- expect(@provider.current_resource.name).to eq('/tmp/foo')
- expect(@provider.current_resource.mount_point).to eq('/tmp/foo')
- expect(@provider.current_resource.device).to eq('/dev/sdz1')
+ expect(@provider.current_resource.name).to eq("/tmp/foo")
+ expect(@provider.current_resource.mount_point).to eq("/tmp/foo")
+ expect(@provider.current_resource.device).to eq("/dev/sdz1")
end
it "should accecpt device_type :uuid", :not_supported_on_solaris do
@@ -134,7 +134,7 @@ describe Chef::Provider::Mount::Mount do
it "should set mounted true if the symlink target of the device is found in the mounts list" do
# expand the target path to correct specs on Windows
- target = ::File.expand_path('/dev/mapper/target')
+ target = ::File.expand_path("/dev/mapper/target")
allow(::File).to receive(:symlink?).with("#{@new_resource.device}").and_return(true)
allow(::File).to receive(:readlink).with("#{@new_resource.device}").and_return(target)
@@ -266,7 +266,7 @@ describe Chef::Provider::Mount::Mount do
fstab = "#{@new_resource.device} #{@new_resource.mount_point} #{@new_resource.fstype} #{options} 1 2\n"
allow(::File).to receive(:foreach).with("/etc/fstab").and_yield fstab
@provider.load_current_resource
- expect(@provider.current_resource.options).to eq(options.split(','))
+ expect(@provider.current_resource.options).to eq(options.split(","))
end
it "should not mangle the mount options if the symlink target is in fstab" do
@@ -279,7 +279,7 @@ describe Chef::Provider::Mount::Mount do
fstab = "#{target} #{@new_resource.mount_point} #{@new_resource.fstype} #{options} 1 2\n"
allow(::File).to receive(:foreach).with("/etc/fstab").and_yield fstab
@provider.load_current_resource
- expect(@provider.current_resource.options).to eq(options.split(','))
+ expect(@provider.current_resource.options).to eq(options.split(","))
end
end
@@ -311,7 +311,7 @@ describe Chef::Provider::Mount::Mount do
@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)
- @stdout_mock = double('stdout mock')
+ @stdout_mock = double("stdout mock")
allow(@stdout_mock).to receive(:each).and_yield("#{@new_resource.device} on #{@new_resource.mount_point}")
expect(@provider).to receive(:shell_out!).with("mount -t #{@new_resource.fstype} -o defaults -U #{@new_resource.device} #{@new_resource.mount_point}").and_return(@stdout_mock)
@provider.mount_fs()
diff --git a/spec/unit/provider/mount/solaris_spec.rb b/spec/unit/provider/mount/solaris_spec.rb
index 9a9b09b531..707a06ceee 100644
--- a/spec/unit/provider/mount/solaris_spec.rb
+++ b/spec/unit/provider/mount/solaris_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
# Do not run these tests on windows because some path handling
# code is not implemented to handle windows paths.
@@ -57,7 +57,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
}
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
@@ -84,7 +84,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
}
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t0d0s0 on / type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Tue Jul 31 22:34:46 2012
/dev/dsk/c0t2d0s7 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
@@ -215,7 +215,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when loading a normal UFS filesystem with noauto, don't mount at boot" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
@@ -245,12 +245,12 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the device is an smbfs mount" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
//solarsystem/tmp on /mnt type smbfs read/write/setuid/devices/dev=5080000 on Tue Mar 29 11:40:18 2011
EOF
}
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
//WORKGROUP;username:password@host/share - /mountpoint smbfs - no fileperms=0777,dirperms=0777
EOF
}
@@ -264,13 +264,13 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the device is an NFS mount" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
cartman:/share2 on /cartman type nfs rsize=32768,wsize=32768,NFSv4,dev=4000004 on Tue Mar 29 11:40:18 2011
EOF
}
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
cartman:/share2 - /cartman nfs - yes rw,soft
EOF
}
@@ -335,13 +335,13 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
let(:target) { "/dev/mapper/target" }
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#{target} on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
}
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#{target} /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
EOF
}
@@ -372,13 +372,13 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
let(:absolute_target) { File.expand_path(target, File.dirname(device)) }
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#{absolute_target} on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
}
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#{absolute_target} /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
EOF
}
@@ -405,7 +405,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the matching mount point is last in the mounts list" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t0d0s0 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Tue Jul 31 22:34:46 2012
/dev/dsk/c0t2d0s7 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
@@ -418,7 +418,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the matching mount point is not last in the mounts list" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s7 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
/dev/dsk/c0t0d0s0 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Tue Jul 31 22:34:46 2012
EOF
@@ -431,7 +431,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the matching mount point is not in the mounts list (mountpoint wrong)" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s7 on /mnt/foob type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
}
@@ -443,7 +443,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the matching mount point is not in the mounts list (raw device wrong)" do
let(:mount_output) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s72 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
EOF
}
@@ -455,7 +455,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mount point is last in fstab" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
EOF
@@ -469,7 +469,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mount point is not last in fstab and is a substring of another mount" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s7 /mnt/foo/bar ufs 2 yes -
EOF
@@ -483,7 +483,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mount point is not last in fstab" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s72 /mnt/foo ufs 2 yes -
EOF
@@ -497,7 +497,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mount point is not in fstab, but the mountpoint is a substring of one that is" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foob ufs 2 yes -
EOF
}
@@ -510,7 +510,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mount point is not in fstab, but the device is a substring of one that is" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
EOF
}
@@ -523,7 +523,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
context "when the mountpoint line is commented out" do
let(:vfstab_file_contents) {
- <<-EOF.gsub /^\s*/, ''
+ <<-EOF.gsub /^\s*/, ""
#/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
EOF
}
diff --git a/spec/unit/provider/mount/windows_spec.rb b/spec/unit/provider/mount/windows_spec.rb
index 2de6f11d43..c3c1934fa0 100644
--- a/spec/unit/provider/mount/windows_spec.rb
+++ b/spec/unit/provider/mount/windows_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef
class Util
diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb
index cc2a456440..3d36a921b3 100644
--- a/spec/unit/provider/mount_spec.rb
+++ b/spec/unit/provider/mount_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Mount do
@@ -28,7 +28,7 @@ describe Chef::Provider::Mount do
let(:run_context) { Chef::RunContext.new(node, {}, events) }
let(:new_resource) do
- new_resource = Chef::Resource::Mount.new('/tmp/foo')
+ new_resource = Chef::Resource::Mount.new("/tmp/foo")
new_resource.device "/dev/sdz1"
new_resource.name "/tmp/foo"
new_resource.mount_point "/tmp/foo"
@@ -38,7 +38,7 @@ describe Chef::Provider::Mount do
let(:current_resource) do
# this abstract superclass has no load_current_resource to call
- current_resource = Chef::Resource::Mount.new('/tmp/foo')
+ current_resource = Chef::Resource::Mount.new("/tmp/foo")
current_resource.device "/dev/sdz1"
current_resource.name "/tmp/foo"
current_resource.mount_point "/tmp/foo"
diff --git a/spec/unit/provider/ohai_spec.rb b/spec/unit/provider/ohai_spec.rb
index 4072487f35..b5ce1e8fc5 100644
--- a/spec/unit/provider/ohai_spec.rb
+++ b/spec/unit/provider/ohai_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/run_context'
+require "chef/run_context"
describe Chef::Provider::Ohai do
before(:each) do
@@ -63,22 +63,22 @@ describe Chef::Provider::Ohai do
describe "when reloading ohai" do
before do
- @node.automatic_attrs[:origdata] = 'somevalue'
+ @node.automatic_attrs[:origdata] = "somevalue"
end
it "applies updated ohai data to the node" do
- expect(@node[:origdata]).to eq('somevalue')
+ expect(@node[:origdata]).to eq("somevalue")
expect(@node[:newdata]).to be_nil
@provider.run_action(:reload)
- expect(@node[:origdata]).to eq('somevalue')
- expect(@node[:newdata]).to eq('somevalue')
+ expect(@node[:origdata]).to eq("somevalue")
+ expect(@node[:newdata]).to eq("somevalue")
end
it "should reload a specific plugin and cause node to pick up new values" do
@new_resource.plugin "someplugin"
@provider.run_action(:reload)
- expect(@node[:origdata]).to eq('somevalue')
- expect(@node[:newdata]).to eq('somevalue')
+ expect(@node[:origdata]).to eq("somevalue")
+ expect(@node[:newdata]).to eq("somevalue")
end
end
end
diff --git a/spec/unit/provider/osx_profile_spec.rb b/spec/unit/provider/osx_profile_spec.rb
index 2e87faeb48..76bfc3b4eb 100644
--- a/spec/unit/provider/osx_profile_spec.rb
+++ b/spec/unit/provider/osx_profile_spec.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'spec_helper'
+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
+ describe "action_create" do
let(:node) { Chef::Node.new }
let(:events) { Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
@@ -74,28 +74,28 @@ describe Chef::Provider::OsxProfile do
# ProfileUUID in all_profiles to match the new config specific UUID
let(:test_profile) do
{
- 'PayloadIdentifier' => 'com.testprofile.screensaver',
- 'PayloadRemovalDisallowed' => false,
- 'PayloadScope' => 'System',
- 'PayloadType' => 'Configuration',
- 'PayloadUUID' => '1781fbec-3325-565f-9022-8aa28135c3cc',
- 'PayloadOrganization' => 'Chef',
- 'PayloadVersion' => 1,
- 'PayloadDisplayName' => 'Screensaver Settings',
- 'PayloadContent'=> [
+ "PayloadIdentifier" => "com.testprofile.screensaver",
+ "PayloadRemovalDisallowed" => false,
+ "PayloadScope" => "System",
+ "PayloadType" => "Configuration",
+ "PayloadUUID" => "1781fbec-3325-565f-9022-8aa28135c3cc",
+ "PayloadOrganization" => "Chef",
+ "PayloadVersion" => 1,
+ "PayloadDisplayName" => "Screensaver Settings",
+ "PayloadContent"=> [
{
- 'PayloadType' => 'com.apple.ManagedClient.preferences',
- 'PayloadVersion' => 1,
- 'PayloadIdentifier' => 'com.testprofile.screensaver',
- 'PayloadUUID' => '73fc30e0-1e57-0131-c32d-000c2944c108',
- 'PayloadEnabled' => true,
- 'PayloadDisplayName' => 'com.apple.screensaver',
- 'PayloadContent' => {
- 'com.apple.screensaver' => {
- 'Forced' => [
+ "PayloadType" => "com.apple.ManagedClient.preferences",
+ "PayloadVersion" => 1,
+ "PayloadIdentifier" => "com.testprofile.screensaver",
+ "PayloadUUID" => "73fc30e0-1e57-0131-c32d-000c2944c108",
+ "PayloadEnabled" => true,
+ "PayloadDisplayName" => "com.apple.screensaver",
+ "PayloadContent" => {
+ "com.apple.screensaver" => {
+ "Forced" => [
{
- 'mcx_preference_settings' => {
- 'idleTime' => 0
+ "mcx_preference_settings" => {
+ "idleTime" => 0
}
},
]
@@ -111,16 +111,16 @@ describe Chef::Provider::OsxProfile do
before(:each) do
allow(provider).to receive(:cookbook_file_available?).and_return(true)
- allow(provider).to receive(:cache_cookbook_profile).and_return('/tmp/test.mobileconfig.remote')
+ allow(provider).to receive(:cache_cookbook_profile).and_return("/tmp/test.mobileconfig.remote")
allow(provider).to receive(:get_new_profile_hash).and_return(test_profile)
allow(provider).to receive(:get_installed_profiles).and_return(all_profiles)
allow(provider).to receive(:read_plist).and_return(all_profiles)
allow(::File).to receive(:unlink).and_return(true)
end
- it 'should build the get all profiles shellout command correctly' do
- profile_name = 'com.testprofile.screensaver.mobileconfig'
- tempfile = '/tmp/allprofiles.plist'
+ it "should build the get all profiles shellout command correctly" do
+ profile_name = "com.testprofile.screensaver.mobileconfig"
+ tempfile = "/tmp/allprofiles.plist"
new_resource.profile_name profile_name
allow(provider).to receive(:generate_tempfile).and_return(tempfile)
allow(provider).to receive(:get_installed_profiles).and_call_original
@@ -129,29 +129,29 @@ describe Chef::Provider::OsxProfile do
provider.load_current_resource
end
- it 'should use profile name as profile when no profile is set' do
- profile_name = 'com.testprofile.screensaver.mobileconfig'
+ it "should use profile name as profile when no profile is set" do
+ profile_name = "com.testprofile.screensaver.mobileconfig"
new_resource.profile_name profile_name
provider.load_current_resource
expect(new_resource.profile_name).to eql(profile_name)
end
- it 'should use identifier from specified profile' do
+ it "should use identifier from specified profile" do
new_resource.profile test_profile
provider.load_current_resource
expect(
provider.instance_variable_get(:@new_profile_identifier)
- ).to eql(test_profile['PayloadIdentifier'])
+ ).to eql(test_profile["PayloadIdentifier"])
end
- it 'should install when not installed' do
+ it "should install when not installed" do
new_resource.profile test_profile
allow(provider).to receive(:get_installed_profiles).and_return(no_profiles)
provider.load_current_resource
expect { provider.run_action(:install) }.to_not raise_error
end
- it 'does not install if the profile is already installed' do
+ it "does not install if the profile is already installed" do
new_resource.profile test_profile
allow(provider).to receive(:get_installed_profiles).and_return(all_profiles)
provider.load_current_resource
@@ -159,40 +159,40 @@ describe Chef::Provider::OsxProfile do
expect { provider.action_install }.to_not raise_error
end
- it 'should install when installed but uuid differs' do
+ it "should install when installed but uuid differs" do
new_resource.profile test_profile
- all_profiles['_computerlevel'][1]['ProfileUUID'] = '1781fbec-3325-565f-9022-9bb39245d4dd'
+ all_profiles["_computerlevel"][1]["ProfileUUID"] = "1781fbec-3325-565f-9022-9bb39245d4dd"
provider.load_current_resource
expect { provider.run_action(:install) }.to_not raise_error
end
- it 'should build the shellout install command correctly' do
- profile_path = '/tmp/test.mobileconfig'
+ it "should build the shellout install command correctly" do
+ profile_path = "/tmp/test.mobileconfig"
new_resource.profile test_profile
# Change the profile so it triggers an install
- all_profiles['_computerlevel'][1]['ProfileUUID'] = '1781fbec-3325-565f-9022-9bb39245d4dd'
+ all_profiles["_computerlevel"][1]["ProfileUUID"] = "1781fbec-3325-565f-9022-9bb39245d4dd"
provider.load_current_resource
allow(provider).to receive(:write_profile_to_disk).and_return(profile_path)
expect(provider).to receive(:shell_out).with("profiles -I -F '#{profile_path}'").and_return(shell_out_success)
provider.action_install()
end
- it 'should fail if there is no identifier inside the profile' do
- test_profile.delete('PayloadIdentifier')
+ it "should fail if there is no identifier inside the profile" do
+ test_profile.delete("PayloadIdentifier")
new_resource.profile test_profile
- error_message = 'The specified profile does not seem to be valid'
+ error_message = "The specified profile does not seem to be valid"
expect{provider.run_action(:install)}.to raise_error(RuntimeError, error_message)
end
end
- describe 'action_remove' do
+ describe "action_remove" do
let(:node) { Chef::Node.new }
let(:events) { Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
let(:new_resource) { Chef::Resource::OsxProfile.new("Profile Test", run_context) }
let(:provider) { Chef::Provider::OsxProfile.new(new_resource, run_context) }
- let(:current_resource) { Chef::Resource::OsxProfile.new('Profile Test') }
+ let(:current_resource) { Chef::Resource::OsxProfile.new("Profile Test") }
let(:all_profiles) do
{"_computerlevel"=>
[{"ProfileDisplayName"=>"ScreenSaver Settings",
@@ -240,24 +240,24 @@ describe Chef::Provider::OsxProfile do
allow(provider).to receive(:get_installed_profiles).and_return(all_profiles)
end
- it 'should use resource name for identifier when not specified' do
- new_resource.profile_name 'com.testprofile.screensaver'
+ it "should use resource name for identifier when not specified" do
+ new_resource.profile_name "com.testprofile.screensaver"
new_resource.action(:remove)
provider.load_current_resource
expect(provider.instance_variable_get(:@new_profile_identifier)
).to eql(new_resource.profile_name)
end
- it 'should use specified identifier' do
- new_resource.identifier 'com.testprofile.screensaver'
+ it "should use specified identifier" do
+ new_resource.identifier "com.testprofile.screensaver"
new_resource.action(:remove)
provider.load_current_resource
expect(provider.instance_variable_get(:@new_profile_identifier)
).to eql(new_resource.identifier)
end
- it 'should build the shellout remove command correctly' do
- new_resource.identifier 'com.testprofile.screensaver'
+ it "should build the shellout remove command correctly" do
+ new_resource.identifier "com.testprofile.screensaver"
new_resource.action(:remove)
provider.load_current_resource
expect(provider).to receive(:shell_out).with("profiles -R -p '#{new_resource.identifier}'").and_return(shell_out_success)
diff --git a/spec/unit/provider/package/aix_spec.rb b/spec/unit/provider/package/aix_spec.rb
index 13992cb8d1..9eb980f5cb 100644
--- a/spec/unit/provider/package/aix_spec.rb
+++ b/spec/unit/provider/package/aix_spec.rb
@@ -16,7 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package::Aix do
before(:each) do
diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb
index f1845abfb1..1f4322041d 100644
--- a/spec/unit/provider/package/apt_spec.rb
+++ b/spec/unit/provider/package/apt_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Package::Apt do
# XXX: sorry this is ugly and was done quickly to get 12.0.2 out, this file needs a rewrite to use
@@ -356,7 +356,7 @@ mpg123 1.12.1-0ubuntu1
describe "when installing a virtual package" do
it "should install the package without specifying a version" do
- @provider.is_virtual_package['libmysqlclient-dev'] = true
+ @provider.is_virtual_package["libmysqlclient-dev"] = true
expect(@provider).to receive(:shell_out!).with(
"apt-get -q -y install libmysqlclient-dev",
:env => {"DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
@@ -369,8 +369,8 @@ mpg123 1.12.1-0ubuntu1
describe "when installing multiple packages" do
it "can install a virtual package followed by a non-virtual package" do
# https://github.com/chef/chef/issues/2914
- @provider.is_virtual_package['libmysqlclient-dev'] = true
- @provider.is_virtual_package['irssi'] = false
+ @provider.is_virtual_package["libmysqlclient-dev"] = true
+ @provider.is_virtual_package["irssi"] = false
expect(@provider).to receive(:shell_out!).with(
"apt-get -q -y install libmysqlclient-dev irssi=0.8.12-7",
:env => {"DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil },
diff --git a/spec/unit/provider/package/chocolatey_spec.rb b/spec/unit/provider/package/chocolatey_spec.rb
index b2e1d2daaf..406ebcd184 100644
--- a/spec/unit/provider/package/chocolatey_spec.rb
+++ b/spec/unit/provider/package/chocolatey_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package::Chocolatey do
let(:timeout) { 900 }
diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb
index 5b77e7788b..e0bf2accde 100644
--- a/spec/unit/provider/package/dpkg_spec.rb
+++ b/spec/unit/provider/package/dpkg_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package::Dpkg do
let(:node) { Chef::Node.new }
@@ -114,7 +114,7 @@ Conflicts: wget-ssl
expect(provider.current_resource.package_name).to eq(["wget"])
end
- describe 'gets the source package version from dpkg-deb' do
+ describe "gets the source package version from dpkg-deb" do
def check_version(version)
status = double(:stdout => "wget\t#{version}", :exitstatus => 0)
expect(provider).to receive(:shell_out!).with("dpkg-deb -W #{source}", timeout: 900).and_return(status)
@@ -123,20 +123,20 @@ Conflicts: wget-ssl
expect(provider.candidate_version).to eq([version])
end
- it 'if short version provided' do
- check_version('1.11.4')
+ it "if short version provided" do
+ check_version("1.11.4")
end
- it 'if extended version provided' do
- check_version('1.11.4-1ubuntu1')
+ it "if extended version provided" do
+ check_version("1.11.4-1ubuntu1")
end
- it 'if distro-specific version provided' do
- check_version('1.11.4-1ubuntu1~lucid')
+ it "if distro-specific version provided" do
+ check_version("1.11.4-1ubuntu1~lucid")
end
- it 'returns the version if an epoch is used' do
- check_version('1:1.8.3-2')
+ it "returns the version if an epoch is used" do
+ check_version("1:1.8.3-2")
end
end
@@ -156,7 +156,7 @@ Conflicts: wget-ssl
it "gets the source package version from dpkg-deb correctly when the package version has `~', `-', `+' or `.' characters" do
provider.load_current_resource
- expect(provider.candidate_version).to eq(['1.2.3+3141592-1ubuntu1~lucid'])
+ expect(provider.candidate_version).to eq(["1.2.3+3141592-1ubuntu1~lucid"])
end
end
diff --git a/spec/unit/provider/package/easy_install_spec.rb b/spec/unit/provider/package/easy_install_spec.rb
index 4ac325e7d4..09d295fec3 100644
--- a/spec/unit/provider/package/easy_install_spec.rb
+++ b/spec/unit/provider/package/easy_install_spec.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package::EasyInstall do
before(:each) do
@node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::EasyInstallPackage.new('boto')
- @new_resource.version('1.8d')
+ @new_resource = Chef::Resource::EasyInstallPackage.new("boto")
+ @new_resource.version("1.8d")
@provider = Chef::Provider::Package::EasyInstall.new(@new_resource, @run_context)
diff --git a/spec/unit/provider/package/freebsd/pkg_spec.rb b/spec/unit/provider/package/freebsd/pkg_spec.rb
index d1f5a649bc..05660d196a 100644
--- a/spec/unit/provider/package/freebsd/pkg_spec.rb
+++ b/spec/unit/provider/package/freebsd/pkg_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
before(:each) do
@@ -30,7 +30,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
@provider = Chef::Provider::Package::Freebsd::Pkg.new(@new_resource, @run_context)
@provider.current_resource = @current_resource
- allow(::File).to receive(:exist?).with('/usr/ports/Makefile').and_return(false)
+ allow(::File).to receive(:exist?).with("/usr/ports/Makefile").and_return(false)
end
describe "when determining the current package state" do
@@ -107,7 +107,7 @@ describe Chef::Provider::Package::Freebsd::Pkg, "load_current_resource" do
end
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(::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)
expect(@provider).to receive(:shell_out!).with("make -V PKGNAME", {cwd: "/usr/ports/shells/zsh", env: nil, returns: [0, 1], timeout: 900}).and_return(make_v)
diff --git a/spec/unit/provider/package/freebsd/pkgng_spec.rb b/spec/unit/provider/package/freebsd/pkgng_spec.rb
index 59215f855b..0052300e45 100644
--- a/spec/unit/provider/package/freebsd/pkgng_spec.rb
+++ b/spec/unit/provider/package/freebsd/pkgng_spec.rb
@@ -17,8 +17,8 @@
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Package::Freebsd::Port do
before(:each) do
@@ -34,7 +34,7 @@ describe Chef::Provider::Package::Freebsd::Port do
describe "initialization" do
it "should create a current resource with the name of the new resource" do
expect(@provider.current_resource.is_a?(Chef::Resource::Package)).to be_truthy
- expect(@provider.current_resource.name).to eq('zsh')
+ expect(@provider.current_resource.name).to eq("zsh")
end
end
@@ -85,7 +85,7 @@ describe Chef::Provider::Package::Freebsd::Port do
end
it "should query specified repository when given option" do
- @provider.new_resource.options('-r LocalMirror') # This requires LocalMirror repo configuration.
+ @provider.new_resource.options("-r LocalMirror") # This requires LocalMirror repo configuration.
pkg_query = OpenStruct.new(:stdout => "5.0.3\n", :exitstatus => 0)
expect(@provider).to receive(:shell_out!).with("pkg rquery -r LocalMirror '%v' zsh", env: nil, timeout: 900).and_return(pkg_query)
expect(@provider.candidate_version).to eq("5.0.3")
@@ -106,7 +106,7 @@ describe Chef::Provider::Package::Freebsd::Port do
it "should handle package source from file" do
@provider.new_resource.source("/nas/pkg/repo/zsh-5.0.1.txz")
expect(@provider).to receive(:shell_out!).
- with("pkg add /nas/pkg/repo/zsh-5.0.1.txz", env: { 'LC_ALL' => nil }, timeout: 900).
+ with("pkg add /nas/pkg/repo/zsh-5.0.1.txz", env: { "LC_ALL" => nil }, timeout: 900).
and_return(@install_result)
@provider.install_package("zsh", "5.0.1")
end
@@ -114,21 +114,21 @@ describe Chef::Provider::Package::Freebsd::Port do
it "should handle package source over ftp or http" do
@provider.new_resource.source("http://repo.example.com/zsh-5.0.1.txz")
expect(@provider).to receive(:shell_out!).
- with("pkg add http://repo.example.com/zsh-5.0.1.txz", env: { 'LC_ALL' => nil }, timeout: 900).
+ with("pkg add http://repo.example.com/zsh-5.0.1.txz", env: { "LC_ALL" => nil }, timeout: 900).
and_return(@install_result)
@provider.install_package("zsh", "5.0.1")
end
it "should handle a package name" do
expect(@provider).to receive(:shell_out!).
- with("pkg install -y zsh", env: { 'LC_ALL' => nil }, timeout: 900).and_return(@install_result)
+ with("pkg install -y zsh", env: { "LC_ALL" => nil }, timeout: 900).and_return(@install_result)
@provider.install_package("zsh", "5.0.1")
end
it "should handle a package name with a specified repo" do
- @provider.new_resource.options('-r LocalMirror') # This requires LocalMirror repo configuration.
+ @provider.new_resource.options("-r LocalMirror") # This requires LocalMirror repo configuration.
expect(@provider).to receive(:shell_out!).
- with("pkg install -y -r LocalMirror zsh", env: { 'LC_ALL' => nil }, timeout: 900).and_return(@install_result)
+ with("pkg install -y -r LocalMirror zsh", env: { "LC_ALL" => nil }, timeout: 900).and_return(@install_result)
@provider.install_package("zsh", "5.0.1")
end
end
@@ -146,7 +146,7 @@ describe Chef::Provider::Package::Freebsd::Port do
end
it "should not include repo option in pkg delete" do
- @provider.new_resource.options('-r LocalMirror') # This requires LocalMirror repo configuration.
+ @provider.new_resource.options("-r LocalMirror") # This requires LocalMirror repo configuration.
expect(@provider).to receive(:shell_out!).
with("pkg delete -y zsh-5.0.1", env: nil, timeout: 900).and_return(@install_result)
@provider.remove_package("zsh", "5.0.1")
diff --git a/spec/unit/provider/package/freebsd/port_spec.rb b/spec/unit/provider/package/freebsd/port_spec.rb
index 4b23575740..958d505187 100644
--- a/spec/unit/provider/package/freebsd/port_spec.rb
+++ b/spec/unit/provider/package/freebsd/port_spec.rb
@@ -17,8 +17,8 @@
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Package::Freebsd::Port do
before(:each) do
@@ -34,7 +34,7 @@ describe Chef::Provider::Package::Freebsd::Port do
describe "initialization" do
it "should create a current resource with the name of the new resource" do
expect(@provider.current_resource.is_a?(Chef::Resource::Package)).to be_truthy
- expect(@provider.current_resource.name).to eq('zsh')
+ expect(@provider.current_resource.name).to eq("zsh")
end
end
@@ -80,7 +80,7 @@ describe Chef::Provider::Package::Freebsd::Port do
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!).with('make -V WITH_PKGNG', env: nil).and_return(pkg_enabled)
+ expect(@new_resource).to receive(:shell_out!).with("make -V WITH_PKGNG", env: nil).and_return(pkg_enabled)
expect(@provider).to receive(:shell_out!).with('pkg info "zsh"', env: nil, returns: [0,70], timeout: 900).and_return(@pkg_info)
expect(@provider.current_installed_version).to eq("3.1.7")
end
@@ -100,15 +100,15 @@ describe Chef::Provider::Package::Freebsd::Port do
end
it "should return candidate version if port exists" do
- allow(::File).to receive(:exist?).with('/usr/ports/Makefile').and_return(true)
- allow(@provider).to receive(:port_dir).and_return('/usr/ports/shells/zsh')
+ allow(::File).to receive(:exist?).with("/usr/ports/Makefile").and_return(true)
+ allow(@provider).to receive(:port_dir).and_return("/usr/ports/shells/zsh")
expect(@provider).to receive(:shell_out!).with("make -V PORTVERSION", cwd: "/usr/ports/shells/zsh", env: nil, returns: [0,1], timeout: 900).
and_return(@port_version)
expect(@provider.candidate_version).to eq("5.0.5")
end
it "should raise exception if ports tree not found" do
- allow(::File).to receive(:exist?).with('/usr/ports/Makefile').and_return(false)
+ allow(::File).to receive(:exist?).with("/usr/ports/Makefile").and_return(false)
expect { @provider.candidate_version }.to raise_error(Chef::Exceptions::Package, "Ports collection could not be found")
end
end
diff --git a/spec/unit/provider/package/homebrew_spec.rb b/spec/unit/provider/package/homebrew_spec.rb
index 926c1a0ff0..b4a2e16f87 100644
--- a/spec/unit/provider/package/homebrew_spec.rb
+++ b/spec/unit/provider/package/homebrew_spec.rb
@@ -15,14 +15,14 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package::Homebrew do
let(:node) { Chef::Node.new }
- let(:events) { double('Chef::Events').as_null_object }
- let(:run_context) { double('Chef::RunContext', node: node, events: events) }
- let(:new_resource) { Chef::Resource::HomebrewPackage.new('emacs') }
- let(:current_resource) { Chef::Resource::HomebrewPackage.new('emacs')}
+ let(:events) { double("Chef::Events").as_null_object }
+ let(:run_context) { double("Chef::RunContext", node: node, events: events) }
+ let(:new_resource) { Chef::Resource::HomebrewPackage.new("emacs") }
+ let(:current_resource) { Chef::Resource::HomebrewPackage.new("emacs")}
let(:provider) do
Chef::Provider::Package::Homebrew.new(new_resource, run_context)
@@ -32,85 +32,85 @@ describe Chef::Provider::Package::Homebrew do
let(:uninstalled_brew_info) do
{
- 'name' => 'emacs',
- 'homepage' => 'http://www.gnu.org/software/emacs',
- 'versions' => {
- 'stable' => '24.3',
- 'bottle' => false,
- 'devel' => nil,
- 'head' => nil,
+ "name" => "emacs",
+ "homepage" => "http://www.gnu.org/software/emacs",
+ "versions" => {
+ "stable" => "24.3",
+ "bottle" => false,
+ "devel" => nil,
+ "head" => nil,
},
- 'revision' => 0,
- 'installed' => [],
- 'linked_keg' => nil,
- 'keg_only' => nil,
- 'dependencies' => [],
- 'conflicts_with' => [],
- 'caveats' => nil,
- 'options' => [],
+ "revision" => 0,
+ "installed" => [],
+ "linked_keg" => nil,
+ "keg_only" => nil,
+ "dependencies" => [],
+ "conflicts_with" => [],
+ "caveats" => nil,
+ "options" => [],
}
end
let(:installed_brew_info) do
{
- 'name' => 'emacs',
- 'homepage' => 'http://www.gnu.org/software/emacs/',
- 'versions' => {
- 'stable' => '24.3',
- 'bottle' => false,
- 'devel' => nil,
- 'head' => 'HEAD',
+ "name" => "emacs",
+ "homepage" => "http://www.gnu.org/software/emacs/",
+ "versions" => {
+ "stable" => "24.3",
+ "bottle" => false,
+ "devel" => nil,
+ "head" => "HEAD",
},
- 'revision' => 0,
- 'installed' => [{ 'version' => '24.3' }],
- 'linked_keg' => '24.3',
- 'keg_only' => nil,
- 'dependencies' => [],
- 'conflicts_with' => [],
- 'caveats' => '',
- 'options' => [],
+ "revision" => 0,
+ "installed" => [{ "version" => "24.3" }],
+ "linked_keg" => "24.3",
+ "keg_only" => nil,
+ "dependencies" => [],
+ "conflicts_with" => [],
+ "caveats" => "",
+ "options" => [],
}
end
let(:keg_only_brew_info) do
{
- 'name' => 'emacs-kegger',
- 'homepage' => 'http://www.gnu.org/software/emacs/',
- 'versions' => {
- 'stable' => '24.3-keggy',
- 'bottle' => false,
- 'devel' => nil,
- 'head' => 'HEAD',
+ "name" => "emacs-kegger",
+ "homepage" => "http://www.gnu.org/software/emacs/",
+ "versions" => {
+ "stable" => "24.3-keggy",
+ "bottle" => false,
+ "devel" => nil,
+ "head" => "HEAD",
},
- 'revision' => 0,
- 'installed' => [{ 'version' => '24.3-keggy' }],
- 'linked_keg' => nil,
- 'keg_only' => true,
- 'dependencies' => [],
- 'conflicts_with' => [],
- 'caveats' => '',
- 'options' => [],
+ "revision" => 0,
+ "installed" => [{ "version" => "24.3-keggy" }],
+ "linked_keg" => nil,
+ "keg_only" => true,
+ "dependencies" => [],
+ "conflicts_with" => [],
+ "caveats" => "",
+ "options" => [],
}
end
let(:keg_only_uninstalled_brew_info) do
{
- 'name' => 'emacs-kegger',
- 'homepage' => 'http://www.gnu.org/software/emacs/',
- 'versions' => {
- 'stable' => '24.3-keggy',
- 'bottle' => false,
- 'devel' => nil,
- 'head' => 'HEAD',
+ "name" => "emacs-kegger",
+ "homepage" => "http://www.gnu.org/software/emacs/",
+ "versions" => {
+ "stable" => "24.3-keggy",
+ "bottle" => false,
+ "devel" => nil,
+ "head" => "HEAD",
},
- 'revision' => 0,
- 'installed' => [],
- 'linked_keg' => nil,
- 'keg_only' => true,
- 'dependencies' => [],
- 'conflicts_with' => [],
- 'caveats' => '',
- 'options' => [],
+ "revision" => 0,
+ "installed" => [],
+ "linked_keg" => nil,
+ "keg_only" => true,
+ "dependencies" => [],
+ "conflicts_with" => [],
+ "caveats" => "",
+ "options" => [],
}
end
@@ -118,174 +118,174 @@ describe Chef::Provider::Package::Homebrew do
end
- describe 'load_current_resource' do
+ describe "load_current_resource" do
before(:each) do
allow(provider).to receive(:current_installed_version).and_return(nil)
- allow(provider).to receive(:candidate_version).and_return('24.3')
+ allow(provider).to receive(:candidate_version).and_return("24.3")
end
- it 'creates a current resource with the name of the new resource' do
+ it "creates a current resource with the name of the new resource" do
provider.load_current_resource
expect(provider.current_resource).to be_a(Chef::Resource::Package)
- expect(provider.current_resource.name).to eql('emacs')
+ expect(provider.current_resource.name).to eql("emacs")
end
- it 'creates a current resource with the version if the package is installed' do
- expect(provider).to receive(:current_installed_version).and_return('24.3')
+ it "creates a current resource with the version if the package is installed" do
+ expect(provider).to receive(:current_installed_version).and_return("24.3")
provider.load_current_resource
- expect(provider.current_resource.version).to eql('24.3')
+ expect(provider.current_resource.version).to eql("24.3")
end
- it 'creates a current resource with a nil version if the package is not installed' do
+ it "creates a current resource with a nil version if the package is not installed" do
provider.load_current_resource
expect(provider.current_resource.version).to be_nil
end
- it 'sets a candidate version if one exists' do
+ it "sets a candidate version if one exists" do
provider.load_current_resource
- expect(provider.candidate_version).to eql('24.3')
+ expect(provider.candidate_version).to eql("24.3")
end
end
- describe 'current_installed_version' do
- it 'returns the latest version from brew info if the package is keg only' do
+ describe "current_installed_version" do
+ it "returns the latest version from brew info if the package is keg only" do
allow(provider).to receive(:brew_info).and_return(keg_only_brew_info)
- expect(provider.current_installed_version).to eql('24.3-keggy')
+ expect(provider.current_installed_version).to eql("24.3-keggy")
end
- it 'returns the linked keg version if the package is not keg only' do
+ it "returns the linked keg version if the package is not keg only" do
allow(provider).to receive(:brew_info).and_return(installed_brew_info)
- expect(provider.current_installed_version).to eql('24.3')
+ expect(provider.current_installed_version).to eql("24.3")
end
- it 'returns nil if the package is not installed' do
+ it "returns nil if the package is not installed" do
allow(provider).to receive(:brew_info).and_return(uninstalled_brew_info)
expect(provider.current_installed_version).to be_nil
end
- it 'returns nil if the package is keg only and not installed' do
+ it "returns nil if the package is keg only and not installed" do
allow(provider).to receive(:brew_info).and_return(keg_only_uninstalled_brew_info)
expect(provider.current_installed_version).to be_nil
end
end
- describe 'brew' 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 => "/"))
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'))
- expect(provider.brew).to eql('zombo')
+ it "passes a single to the brew command and return stdout" do
+ 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'))
- expect(provider.brew('info', 'opts', 'bananas')).to eql('homestarrunner')
+ it "takes multiple arguments as an array" do
+ allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "homestarrunner"))
+ expect(provider.brew("info", "opts", "bananas")).to eql("homestarrunner")
end
context "when new_resource is Package" do
- let(:new_resource) { Chef::Resource::Package.new('emacs') }
+ 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'))
- expect(provider.brew).to eql('zombo')
+ allow(provider).to receive(:shell_out!).and_return(OpenStruct.new(:stdout => "zombo"))
+ expect(provider.brew).to eql("zombo")
end
end
end
- context 'when testing actions' do
+ context "when testing actions" do
before(:each) do
provider.current_resource = current_resource
end
- describe 'install_package' do
+ describe "install_package" do
before(:each) do
- allow(provider).to receive(:candidate_version).and_return('24.3')
+ allow(provider).to receive(:candidate_version).and_return("24.3")
end
- it 'installs the named package with brew install' do
- allow(provider.new_resource).to receive(:version).and_return('24.3')
+ it "installs the named package with brew install" do
+ allow(provider.new_resource).to receive(:version).and_return("24.3")
allow(provider.current_resource).to receive(:version).and_return(nil)
allow(provider).to receive(:brew_info).and_return(uninstalled_brew_info)
- expect(provider).to receive(:get_response_from_command).with('brew install emacs')
- provider.install_package('emacs', '24.3')
+ expect(provider).to receive(:get_response_from_command).with("brew install emacs")
+ provider.install_package("emacs", "24.3")
end
- it 'does not do anything if the package is installed' do
- allow(provider.current_resource).to receive(:version).and_return('24.3')
+ it "does not do anything if the package is installed" do
+ allow(provider.current_resource).to receive(:version).and_return("24.3")
allow(provider).to receive(:brew_info).and_return(installed_brew_info)
expect(provider).not_to receive(:get_response_from_command)
- provider.install_package('emacs', '24.3')
+ provider.install_package("emacs", "24.3")
end
- it 'uses options to the brew command if specified' do
- allow(provider.new_resource).to receive(:options).and_return('--cocoa')
- allow(provider.current_resource).to receive(:version).and_return('24.3')
- allow(provider).to receive(:get_response_from_command).with('brew install --cocoa emacs')
- provider.install_package('emacs', '24.3')
+ it "uses options to the brew command if specified" do
+ allow(provider.new_resource).to receive(:options).and_return("--cocoa")
+ allow(provider.current_resource).to receive(:version).and_return("24.3")
+ allow(provider).to receive(:get_response_from_command).with("brew install --cocoa emacs")
+ provider.install_package("emacs", "24.3")
end
end
- describe 'upgrade_package' do
- it 'uses brew upgrade to upgrade the package if it is installed' do
- allow(provider.current_resource).to receive(:version).and_return('24')
+ describe "upgrade_package" do
+ it "uses brew upgrade to upgrade the package if it is installed" do
+ allow(provider.current_resource).to receive(:version).and_return("24")
allow(provider).to receive(:brew_info).and_return(installed_brew_info)
- expect(provider).to receive(:get_response_from_command).with('brew upgrade emacs')
- provider.upgrade_package('emacs', '24.3')
+ expect(provider).to receive(:get_response_from_command).with("brew upgrade emacs")
+ provider.upgrade_package("emacs", "24.3")
end
- it 'does not do anything if the package version is already installed' do
- allow(provider.current_resource).to receive(:version).and_return('24.3')
+ it "does not do anything if the package version is already installed" do
+ allow(provider.current_resource).to receive(:version).and_return("24.3")
allow(provider).to receive(:brew_info).and_return(installed_brew_info)
expect(provider).not_to receive(:get_response_from_command)
- provider.install_package('emacs', '24.3')
+ provider.install_package("emacs", "24.3")
end
- it 'uses brew install to install the package if it is not installed' do
+ it "uses brew install to install the package if it is not installed" do
allow(provider.current_resource).to receive(:version).and_return(nil)
allow(provider).to receive(:brew_info).and_return(uninstalled_brew_info)
- expect(provider).to receive(:get_response_from_command).with('brew install emacs')
- provider.upgrade_package('emacs', '24.3')
+ expect(provider).to receive(:get_response_from_command).with("brew install emacs")
+ provider.upgrade_package("emacs", "24.3")
end
- it 'uses options to the brew command if specified' do
- allow(provider.current_resource).to receive(:version).and_return('24')
+ it "uses options to the brew command if specified" do
+ allow(provider.current_resource).to receive(:version).and_return("24")
allow(provider).to receive(:brew_info).and_return(installed_brew_info)
- allow(provider.new_resource).to receive(:options).and_return('--cocoa')
- expect(provider).to receive(:get_response_from_command).with('brew upgrade --cocoa emacs')
- provider.upgrade_package('emacs', '24.3')
+ allow(provider.new_resource).to receive(:options).and_return("--cocoa")
+ expect(provider).to receive(:get_response_from_command).with("brew upgrade --cocoa emacs")
+ provider.upgrade_package("emacs", "24.3")
end
end
- describe 'remove_package' do
- it 'uninstalls the package with brew uninstall' do
- allow(provider.current_resource).to receive(:version).and_return('24.3')
+ describe "remove_package" do
+ it "uninstalls the package with brew uninstall" do
+ allow(provider.current_resource).to receive(:version).and_return("24.3")
allow(provider).to receive(:brew_info).and_return(installed_brew_info)
- expect(provider).to receive(:get_response_from_command).with('brew uninstall emacs')
- provider.remove_package('emacs', '24.3')
+ expect(provider).to receive(:get_response_from_command).with("brew uninstall emacs")
+ provider.remove_package("emacs", "24.3")
end
- it 'does not do anything if the package is not installed' do
+ it "does not do anything if the package is not installed" do
allow(provider).to receive(:brew_info).and_return(uninstalled_brew_info)
expect(provider).not_to receive(:get_response_from_command)
- provider.remove_package('emacs', '24.3')
+ provider.remove_package("emacs", "24.3")
end
end
- describe 'purge_package' do
- it 'uninstalls the package with brew uninstall --force' do
- allow(provider.current_resource).to receive(:version).and_return('24.3')
+ describe "purge_package" do
+ it "uninstalls the package with brew uninstall --force" do
+ allow(provider.current_resource).to receive(:version).and_return("24.3")
allow(provider).to receive(:brew_info).and_return(installed_brew_info)
- expect(provider).to receive(:get_response_from_command).with('brew uninstall --force emacs')
- provider.purge_package('emacs', '24.3')
+ expect(provider).to receive(:get_response_from_command).with("brew uninstall --force emacs")
+ provider.purge_package("emacs", "24.3")
end
- it 'does not do anything if the package is not installed' do
+ it "does not do anything if the package is not installed" do
allow(provider).to receive(:brew_info).and_return(uninstalled_brew_info)
expect(provider).not_to receive(:get_response_from_command)
- provider.purge_package('emacs', '24.3')
+ provider.purge_package("emacs", "24.3")
end
end
end
diff --git a/spec/unit/provider/package/ips_spec.rb b/spec/unit/provider/package/ips_spec.rb
index ad69dffb10..bc29e30fd8 100644
--- a/spec/unit/provider/package/ips_spec.rb
+++ b/spec/unit/provider/package/ips_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
# based on the apt specs
@@ -34,7 +34,7 @@ describe Chef::Provider::Package::Ips do
def local_output
stdin = StringIO.new
- stdout = ''
+ stdout = ""
stderr =<<-PKG_STATUS
pkg: info: no packages matching the following patterns you specified are
installed on the system. Try specifying -r to query remotely:
@@ -59,7 +59,7 @@ Packaging Date: April 1, 2012 05:55:52 PM
FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z
PKG_STATUS
stdin = StringIO.new
- stderr = ''
+ stderr = ""
return OpenStruct.new(:stdout => stdout,:stdin => stdin,:stderr => stderr,:status => @status,:exitstatus => 0)
end
diff --git a/spec/unit/provider/package/macports_spec.rb b/spec/unit/provider/package/macports_spec.rb
index eef84113b4..83b6e04be9 100644
--- a/spec/unit/provider/package/macports_spec.rb
+++ b/spec/unit/provider/package/macports_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package::Macports do
before(:each) do
diff --git a/spec/unit/provider/package/openbsd_spec.rb b/spec/unit/provider/package/openbsd_spec.rb
index 8407f83785..0801b4b233 100644
--- a/spec/unit/provider/package/openbsd_spec.rb
+++ b/spec/unit/provider/package/openbsd_spec.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Package::Openbsd do
let(:node) do
node = Chef::Node.new
- node.default['kernel'] = {'name' => 'OpenBSD', 'release' => '5.5', 'machine' => 'amd64'}
+ node.default["kernel"] = {"name" => "OpenBSD", "release" => "5.5", "machine" => "amd64"}
node
end
@@ -36,24 +36,24 @@ describe Chef::Provider::Package::Openbsd do
let(:new_resource) { Chef::Resource::Package.new(name)}
before(:each) do
- ENV['PKG_PATH'] = nil
+ ENV["PKG_PATH"] = nil
end
describe "install a package" do
- let(:name) { 'ihavetoes' }
- let(:version) {'0.0'}
+ let(:name) { "ihavetoes" }
+ let(:version) {"0.0"}
- context 'when not already installed' do
+ context "when not already installed" do
before do
- allow(provider).to receive(:shell_out!).with("pkg_info -e \"#{name}->0\"", anything()).and_return(instance_double('shellout', :stdout => ''))
+ allow(provider).to receive(:shell_out!).with("pkg_info -e \"#{name}->0\"", anything()).and_return(instance_double("shellout", :stdout => ""))
end
- context 'when there is a single candidate' do
+ context "when there is a single candidate" do
- context 'when source is not provided' do
- it 'should run the installation command' do
+ context "when source is not provided" do
+ it "should run the installation command" do
expect(provider).to receive(:shell_out!).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!).with(
"pkg_add -r #{name}-#{version}",
{:env => {"PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/"}, timeout: 900}
@@ -63,29 +63,29 @@ describe Chef::Provider::Package::Openbsd do
end
end
- context 'when there are multiple candidates' do
- let(:flavor_a) { 'flavora' }
- let(:flavor_b) { 'flavorb' }
+ context "when there are multiple candidates" do
+ let(:flavor_a) { "flavora" }
+ let(:flavor_b) { "flavorb" }
- context 'if no version is specified' do
- it 'should raise an exception' do
+ context "if no version is specified" do
+ it "should raise an exception" do
expect(provider).to receive(:shell_out!).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
- context 'if a flavor is specified' do
+ context "if a flavor is specified" do
- let(:flavor) { 'flavora' }
- let(:package_name) {'ihavetoes' }
+ let(:flavor) { "flavora" }
+ let(:package_name) {"ihavetoes" }
let(:name) { "#{package_name}--#{flavor}" }
- context 'if no version is specified' do
- it 'should run the installation command' do
- expect(provider).to receive(:shell_out!).with("pkg_info -e \"#{package_name}->0\"", anything()).and_return(instance_double('shellout', :stdout => ''))
+ context "if no version is specified" do
+ it "should run the installation command" do
+ expect(provider).to receive(:shell_out!).with("pkg_info -e \"#{package_name}->0\"", anything()).and_return(instance_double("shellout", :stdout => ""))
expect(provider).to receive(:shell_out!).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!).with(
"pkg_add -r #{name}-#{version}-#{flavor}",
{env: {"PKG_PATH" => "http://ftp.OpenBSD.org/pub/OpenBSD/5.5/packages/amd64/"}, timeout: 900}
@@ -96,10 +96,10 @@ describe Chef::Provider::Package::Openbsd do
end
- context 'if a version is specified' do
- it 'should use the flavor from the version' do
+ context "if a version is specified" do
+ it "should use the flavor from the version" do
expect(provider).to receive(:shell_out!).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!).with(
@@ -115,7 +115,7 @@ describe Chef::Provider::Package::Openbsd do
describe "delete a package" do
before do
- @name = 'ihavetoes'
+ @name = "ihavetoes"
@new_resource = Chef::Resource::Package.new(@name)
@current_resource = Chef::Resource::Package.new(@name)
@provider = Chef::Provider::Package::Openbsd.new(@new_resource, @run_context)
diff --git a/spec/unit/provider/package/pacman_spec.rb b/spec/unit/provider/package/pacman_spec.rb
index da27edafeb..4b715da8b6 100644
--- a/spec/unit/provider/package/pacman_spec.rb
+++ b/spec/unit/provider/package/pacman_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package::Pacman do
before(:each) do
diff --git a/spec/unit/provider/package/paludis_spec.rb b/spec/unit/provider/package/paludis_spec.rb
index 4ed5dfc003..05c1e529b7 100644
--- a/spec/unit/provider/package/paludis_spec.rb
+++ b/spec/unit/provider/package/paludis_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
# based on the ips specs
diff --git a/spec/unit/provider/package/portage_spec.rb b/spec/unit/provider/package/portage_spec.rb
index 55743dbeaf..a73db877b6 100644
--- a/spec/unit/provider/package/portage_spec.rb
+++ b/spec/unit/provider/package/portage_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package::Portage, "load_current_resource" do
before(:each) do
diff --git a/spec/unit/provider/package/rpm_spec.rb b/spec/unit/provider/package/rpm_spec.rb
index ad9d694e34..409b5268ee 100644
--- a/spec/unit/provider/package/rpm_spec.rb
+++ b/spec/unit/provider/package/rpm_spec.rb
@@ -16,7 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package::Rpm do
let(:provider) { Chef::Provider::Package::Rpm.new(new_resource, run_context) }
@@ -35,10 +35,10 @@ describe Chef::Provider::Package::Rpm do
end
# `rpm -qp [stuff] $source`
- let(:rpm_qp_status) { instance_double('Mixlib::ShellOut', exitstatus: rpm_qp_exitstatus, stdout: rpm_qp_stdout) }
+ let(:rpm_qp_status) { instance_double("Mixlib::ShellOut", exitstatus: rpm_qp_exitstatus, stdout: rpm_qp_stdout) }
# `rpm -q [stuff] $package_name`
- let(:rpm_q_status) { instance_double('Mixlib::ShellOut', exitstatus: rpm_q_exitstatus, stdout: rpm_q_stdout) }
+ let(:rpm_q_status) { instance_double("Mixlib::ShellOut", exitstatus: rpm_q_exitstatus, stdout: rpm_q_stdout) }
before(:each) do
allow(::File).to receive(:exists?).with("PLEASE STUB File.exists? EXACTLY").and_return(true)
diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb
index 5e4d8a6224..85de24fdb4 100644
--- a/spec/unit/provider/package/rubygems_spec.rb
+++ b/spec/unit/provider/package/rubygems_spec.rb
@@ -16,7 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'pp'
+require "pp"
module GemspecBackcompatCreator
def gemspec(name, version)
@@ -28,8 +28,8 @@ module GemspecBackcompatCreator
end
end
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
include GemspecBackcompatCreator
@@ -43,18 +43,18 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
end
it "determines the installed versions of gems from Gem.source_index" do
- gems = [gemspec('rspec-core', Gem::Version.new('1.2.9')), gemspec('rspec-core', Gem::Version.new('1.3.0'))]
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
- expect(Gem::Specification).to receive(:find_all_by_name).with('rspec-core', Gem::Dependency.new('rspec-core').requirement).and_return(gems)
+ gems = [gemspec("rspec-core", Gem::Version.new("1.2.9")), gemspec("rspec-core", Gem::Version.new("1.3.0"))]
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.8.0")
+ expect(Gem::Specification).to receive(:find_all_by_name).with("rspec-core", Gem::Dependency.new("rspec-core").requirement).and_return(gems)
else
- expect(Gem.source_index).to receive(:search).with(Gem::Dependency.new('rspec-core', nil)).and_return(gems)
+ expect(Gem.source_index).to receive(:search).with(Gem::Dependency.new("rspec-core", nil)).and_return(gems)
end
- expect(@gem_env.installed_versions(Gem::Dependency.new('rspec-core', nil))).to eq(gems)
+ expect(@gem_env.installed_versions(Gem::Dependency.new("rspec-core", nil))).to eq(gems)
end
it "determines the installed versions of gems from the source index (part2: the unmockening)" do
- expected = ['rspec-core', Gem::Version.new(RSpec::Core::Version::STRING)]
- actual = @gem_env.installed_versions(Gem::Dependency.new('rspec-core', nil)).map { |spec| [spec.name, spec.version] }
+ expected = ["rspec-core", Gem::Version.new(RSpec::Core::Version::STRING)]
+ actual = @gem_env.installed_versions(Gem::Dependency.new("rspec-core", nil)).map { |spec| [spec.name, spec.version] }
expect(actual).to include(expected)
end
@@ -87,16 +87,16 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
end
it "finds a matching gem candidate version" do
- dep = Gem::Dependency.new('rspec', '>= 0')
+ dep = Gem::Dependency.new("rspec", ">= 0")
dep_installer = Gem::DependencyInstaller.new
allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "https://rubygems.org/"]]
expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(latest)
- expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0'))).to eq(Gem::Version.new('1.3.0'))
+ expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">= 0"))).to eq(Gem::Version.new("1.3.0"))
end
it "finds a matching gem candidate version on rubygems 2.0.0+" do
- dep = Gem::Dependency.new('rspec', '>= 0')
+ dep = Gem::Dependency.new("rspec", ">= 0")
dep_installer = Gem::DependencyInstaller.new
allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
best_gem = double("best gem match", :spec => gemspec("rspec", Gem::Version.new("1.3.0")), :source => "https://rubygems.org")
@@ -104,62 +104,62 @@ describe Chef::Provider::Package::Rubygems::CurrentGemEnvironment do
expect(available_set).to receive(:pick_best!)
expect(available_set).to receive(:set).and_return([best_gem])
expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(available_set)
- expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0'))).to eq(Gem::Version.new('1.3.0'))
+ expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">= 0"))).to eq(Gem::Version.new("1.3.0"))
end
it "gives the candidate version as nil if none is found" do
- dep = Gem::Dependency.new('rspec', '>= 0')
+ dep = Gem::Dependency.new("rspec", ">= 0")
latest = []
dep_installer = Gem::DependencyInstaller.new
allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(latest)
- expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>= 0'))).to be_nil
+ expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">= 0"))).to be_nil
end
it "finds a matching candidate version from a .gem file when the path to the gem is supplied" do
- location = CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem'
- expect(@gem_env.candidate_version_from_file(Gem::Dependency.new('chef-integration-test', '>= 0'), location)).to eq(Gem::Version.new('0.1.0'))
- expect(@gem_env.candidate_version_from_file(Gem::Dependency.new('chef-integration-test', '>= 0.2.0'), location)).to be_nil
+ location = CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem"
+ expect(@gem_env.candidate_version_from_file(Gem::Dependency.new("chef-integration-test", ">= 0"), location)).to eq(Gem::Version.new("0.1.0"))
+ expect(@gem_env.candidate_version_from_file(Gem::Dependency.new("chef-integration-test", ">= 0.2.0"), location)).to be_nil
end
it "finds a matching gem from a specific gemserver when explicit sources are given" do
- dep = Gem::Dependency.new('rspec', '>= 0')
+ dep = Gem::Dependency.new("rspec", ">= 0")
latest = [[gemspec("rspec", Gem::Version.new("1.3.0")), "https://rubygems.org/"]]
- expect(@gem_env).to receive(:with_gem_sources).with('http://gems.example.com').and_yield
+ expect(@gem_env).to receive(:with_gem_sources).with("http://gems.example.com").and_yield
dep_installer = Gem::DependencyInstaller.new
allow(@gem_env).to receive(:dependency_installer).and_return(dep_installer)
expect(dep_installer).to receive(:find_gems_with_sources).with(dep).and_return(latest)
- expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new('rspec', '>=0'), 'http://gems.example.com')).to eq(Gem::Version.new('1.3.0'))
+ expect(@gem_env.candidate_version_from_remote(Gem::Dependency.new("rspec", ">=0"), "http://gems.example.com")).to eq(Gem::Version.new("1.3.0"))
end
it "installs a gem with a hash of options for the dependency installer" do
dep_installer = Gem::DependencyInstaller.new
- expect(@gem_env).to receive(:dependency_installer).with(:install_dir => '/foo/bar').and_return(dep_installer)
- expect(@gem_env).to receive(:with_gem_sources).with('http://gems.example.com').and_yield
- expect(dep_installer).to receive(:install).with(Gem::Dependency.new('rspec', '>= 0'))
- @gem_env.install(Gem::Dependency.new('rspec', '>= 0'), :install_dir => '/foo/bar', :sources => ['http://gems.example.com'])
+ expect(@gem_env).to receive(:dependency_installer).with(:install_dir => "/foo/bar").and_return(dep_installer)
+ expect(@gem_env).to receive(:with_gem_sources).with("http://gems.example.com").and_yield
+ expect(dep_installer).to receive(:install).with(Gem::Dependency.new("rspec", ">= 0"))
+ @gem_env.install(Gem::Dependency.new("rspec", ">= 0"), :install_dir => "/foo/bar", :sources => ["http://gems.example.com"])
end
it "builds an uninstaller for a gem with options set to avoid requiring user input" do
# default options for uninstaller should be:
# :ignore => true, :executables => true
- expect(Gem::Uninstaller).to receive(:new).with('rspec', :ignore => true, :executables => true)
- @gem_env.uninstaller('rspec')
+ expect(Gem::Uninstaller).to receive(:new).with("rspec", :ignore => true, :executables => true)
+ @gem_env.uninstaller("rspec")
end
it "uninstalls all versions of a gem" do
- uninstaller = double('gem uninstaller')
+ uninstaller = double("gem uninstaller")
expect(uninstaller).to receive(:uninstall)
- expect(@gem_env).to receive(:uninstaller).with('rspec', :all => true).and_return(uninstaller)
- @gem_env.uninstall('rspec')
+ expect(@gem_env).to receive(:uninstaller).with("rspec", :all => true).and_return(uninstaller)
+ @gem_env.uninstall("rspec")
end
it "uninstalls a specific version of a gem" do
- uninstaller = double('gem uninstaller')
+ uninstaller = double("gem uninstaller")
expect(uninstaller).to receive(:uninstall)
- expect(@gem_env).to receive(:uninstaller).with('rspec', :version => '1.2.3').and_return(uninstaller)
- @gem_env.uninstall('rspec', '1.2.3')
+ expect(@gem_env).to receive(:uninstaller).with("rspec", :version => "1.2.3").and_return(uninstaller)
+ @gem_env.uninstall("rspec", "1.2.3")
end
end
@@ -170,54 +170,54 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do
before do
Chef::Provider::Package::Rubygems::AlternateGemEnvironment.gempath_cache.clear
Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache.clear
- @gem_env = Chef::Provider::Package::Rubygems::AlternateGemEnvironment.new('/usr/weird/bin/gem')
+ @gem_env = Chef::Provider::Package::Rubygems::AlternateGemEnvironment.new("/usr/weird/bin/gem")
end
it "determines the gem paths from shelling out to gem env" do
- gem_env_output = ['/path/to/gems', '/another/path/to/gems'].join(File::PATH_SEPARATOR)
+ gem_env_output = ["/path/to/gems", "/another/path/to/gems"].join(File::PATH_SEPARATOR)
shell_out_result = OpenStruct.new(:stdout => gem_env_output)
- expect(@gem_env).to receive(:shell_out!).with('/usr/weird/bin/gem env gempath').and_return(shell_out_result)
- expect(@gem_env.gem_paths).to eq(['/path/to/gems', '/another/path/to/gems'])
+ expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env gempath").and_return(shell_out_result)
+ expect(@gem_env.gem_paths).to eq(["/path/to/gems", "/another/path/to/gems"])
end
it "caches the gempaths by gem_binary" do
- gem_env_output = ['/path/to/gems', '/another/path/to/gems'].join(File::PATH_SEPARATOR)
+ gem_env_output = ["/path/to/gems", "/another/path/to/gems"].join(File::PATH_SEPARATOR)
shell_out_result = OpenStruct.new(:stdout => gem_env_output)
- expect(@gem_env).to receive(:shell_out!).with('/usr/weird/bin/gem env gempath').and_return(shell_out_result)
- expected = ['/path/to/gems', '/another/path/to/gems']
- expect(@gem_env.gem_paths).to eq(['/path/to/gems', '/another/path/to/gems'])
- expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.gempath_cache['/usr/weird/bin/gem']).to eq(expected)
+ expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env gempath").and_return(shell_out_result)
+ expected = ["/path/to/gems", "/another/path/to/gems"]
+ expect(@gem_env.gem_paths).to eq(["/path/to/gems", "/another/path/to/gems"])
+ expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.gempath_cache["/usr/weird/bin/gem"]).to eq(expected)
end
it "uses the cached result for gem paths when available" do
expect(@gem_env).not_to receive(:shell_out!)
- expected = ['/path/to/gems', '/another/path/to/gems']
- Chef::Provider::Package::Rubygems::AlternateGemEnvironment.gempath_cache['/usr/weird/bin/gem']= expected
- expect(@gem_env.gem_paths).to eq(['/path/to/gems', '/another/path/to/gems'])
+ expected = ["/path/to/gems", "/another/path/to/gems"]
+ Chef::Provider::Package::Rubygems::AlternateGemEnvironment.gempath_cache["/usr/weird/bin/gem"]= expected
+ expect(@gem_env.gem_paths).to eq(["/path/to/gems", "/another/path/to/gems"])
end
it "builds the gems source index from the gem paths" do
- allow(@gem_env).to receive(:gem_paths).and_return(['/path/to/gems', '/another/path/to/gems'])
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
+ allow(@gem_env).to receive(:gem_paths).and_return(["/path/to/gems", "/another/path/to/gems"])
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.8.0")
@gem_env.gem_specification
- expect(Gem::Specification.dirs).to eq([ '/path/to/gems/specifications', '/another/path/to/gems/specifications' ])
+ expect(Gem::Specification.dirs).to eq([ "/path/to/gems/specifications", "/another/path/to/gems/specifications" ])
else
- expect(Gem::SourceIndex).to receive(:from_gems_in).with('/path/to/gems/specifications', '/another/path/to/gems/specifications')
+ expect(Gem::SourceIndex).to receive(:from_gems_in).with("/path/to/gems/specifications", "/another/path/to/gems/specifications")
@gem_env.gem_source_index
end
end
it "determines the installed versions of gems from the source index" do
- gems = [gemspec('rspec', Gem::Version.new('1.2.9')), gemspec('rspec', Gem::Version.new('1.3.0'))]
- rspec_dep = Gem::Dependency.new('rspec', nil)
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
+ gems = [gemspec("rspec", Gem::Version.new("1.2.9")), gemspec("rspec", Gem::Version.new("1.3.0"))]
+ rspec_dep = Gem::Dependency.new("rspec", nil)
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.8.0")
allow(@gem_env).to receive(:gem_specification).and_return(Gem::Specification)
expect(@gem_env.gem_specification).to receive(:find_all_by_name).with(rspec_dep.name, rspec_dep.requirement).and_return(gems)
else
allow(@gem_env).to receive(:gem_source_index).and_return(Gem.source_index)
expect(@gem_env.gem_source_index).to receive(:search).with(rspec_dep).and_return(gems)
end
- expect(@gem_env.installed_versions(Gem::Dependency.new('rspec', nil))).to eq(gems)
+ expect(@gem_env.installed_versions(Gem::Dependency.new("rspec", nil))).to eq(gems)
end
it "determines the installed versions of gems from the source index (part2: the unmockening)" do
@@ -229,8 +229,8 @@ describe Chef::Provider::Package::Rubygems::AlternateGemEnvironment do
end
skip("cant find your gem executable") if path_to_gem.empty?
gem_env = Chef::Provider::Package::Rubygems::AlternateGemEnvironment.new(path_to_gem)
- expected = ['rspec-core', Gem::Version.new(RSpec::Core::Version::STRING)]
- actual = gem_env.installed_versions(Gem::Dependency.new('rspec-core', nil)).map { |s| [s.name, s.version] }
+ expected = ["rspec-core", Gem::Version.new(RSpec::Core::Version::STRING)]
+ actual = gem_env.installed_versions(Gem::Dependency.new("rspec-core", nil)).map { |s| [s.name, s.version] }
expect(actual).to include(expected)
end
@@ -262,17 +262,17 @@ RubyGems Environment:
- https://rubygems.org/
- http://gems.github.com/
JRUBY_GEM_ENV
- expect(@gem_env).to receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(double('jruby_gem_env', :stdout => gem_env_out))
- expected = ['ruby', Gem::Platform.new('universal-java-1.6')]
+ expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env").and_return(double("jruby_gem_env", :stdout => gem_env_out))
+ expected = ["ruby", Gem::Platform.new("universal-java-1.6")]
expect(@gem_env.gem_platforms).to eq(expected)
# it should also cache the result
- expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache['/usr/weird/bin/gem']).to eq(expected)
+ expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache["/usr/weird/bin/gem"]).to eq(expected)
end
it "uses the cached result for gem platforms if available" do
expect(@gem_env).not_to receive(:shell_out!)
- expected = ['ruby', Gem::Platform.new('universal-java-1.6')]
- Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache['/usr/weird/bin/gem']= expected
+ expected = ["ruby", Gem::Platform.new("universal-java-1.6")]
+ Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache["/usr/weird/bin/gem"]= expected
expect(@gem_env.gem_platforms).to eq(expected)
end
@@ -304,22 +304,22 @@ RubyGems Environment:
- https://rubygems.org/
- http://gems.github.com/
RBX_GEM_ENV
- expect(@gem_env).to receive(:shell_out!).with('/usr/weird/bin/gem env').and_return(double('rbx_gem_env', :stdout => gem_env_out))
+ expect(@gem_env).to receive(:shell_out!).with("/usr/weird/bin/gem env").and_return(double("rbx_gem_env", :stdout => gem_env_out))
expect(@gem_env.gem_platforms).to eq(Gem.platforms)
- expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache['/usr/weird/bin/gem']).to eq(Gem.platforms)
+ expect(Chef::Provider::Package::Rubygems::AlternateGemEnvironment.platform_cache["/usr/weird/bin/gem"]).to eq(Gem.platforms)
end
it "yields to a block while masquerading as a different gems platform" do
original_platforms = Gem.platforms
platforms_in_block = nil
begin
- @gem_env.with_gem_platforms(['ruby', Gem::Platform.new('sparc64-java-1.7')]) do
+ @gem_env.with_gem_platforms(["ruby", Gem::Platform.new("sparc64-java-1.7")]) do
platforms_in_block = Gem.platforms
raise "gem platforms should get set to the correct value even when an error occurs"
end
rescue RuntimeError
end
- expect(platforms_in_block).to eq(['ruby', Gem::Platform.new('sparc64-java-1.7')])
+ expect(platforms_in_block).to eq(["ruby", Gem::Platform.new("sparc64-java-1.7")])
expect(Gem.platforms).to eq(original_platforms)
end
@@ -336,9 +336,9 @@ describe Chef::Provider::Package::Rubygems do
@run_context = Chef::RunContext.new(@node, {}, @events)
# We choose detect omnibus via RbConfig::CONFIG['bindir'] in Chef::Provider::Package::Rubygems.new
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/usr/bin/ruby")
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("/usr/bin/ruby")
# Rubygems uses this interally
- allow(RbConfig::CONFIG).to receive(:[]).with('arch').and_call_original
+ allow(RbConfig::CONFIG).to receive(:[]).with("arch").and_call_original
@provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
end
@@ -364,45 +364,45 @@ describe Chef::Provider::Package::Rubygems do
end
it "uses the AlternateGemEnvironment implementation when a gem_binary_path is provided" do
- @new_resource.gem_binary('/usr/weird/bin/gem')
+ @new_resource.gem_binary("/usr/weird/bin/gem")
provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
- expect(provider.gem_env.gem_binary_location).to eq('/usr/weird/bin/gem')
+ expect(provider.gem_env.gem_binary_location).to eq("/usr/weird/bin/gem")
end
it "recognizes chef as omnibus" do
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/chef/embedded/bin")
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("/opt/chef/embedded/bin")
provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
expect(provider.is_omnibus?).to be true
end
it "recognizes opscode as omnibus" do
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/opscode/embedded/bin")
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("/opt/opscode/embedded/bin")
provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
expect(provider.is_omnibus?).to be true
end
it "recognizes chefdk as omnibus" do
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/chefdk/embedded/bin")
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("/opt/chefdk/embedded/bin")
provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
expect(provider.is_omnibus?).to be true
end
it "searches for a gem binary when running on Omnibus on Unix" do
platform_mock :unix do
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("/opt/chef/embedded/bin")
- allow(ENV).to receive(:[]).with('PATH').and_return("/usr/bin:/usr/sbin:/opt/chef/embedded/bin")
- allow(File).to receive(:exists?).with('/usr/bin/gem').and_return(false)
- allow(File).to receive(:exists?).with('/usr/sbin/gem').and_return(true)
- allow(File).to receive(:exists?).with('/opt/chef/embedded/bin/gem').and_return(true) # should not get here
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("/opt/chef/embedded/bin")
+ allow(ENV).to receive(:[]).with("PATH").and_return("/usr/bin:/usr/sbin:/opt/chef/embedded/bin")
+ allow(File).to receive(:exists?).with("/usr/bin/gem").and_return(false)
+ allow(File).to receive(:exists?).with("/usr/sbin/gem").and_return(true)
+ allow(File).to receive(:exists?).with("/opt/chef/embedded/bin/gem").and_return(true) # should not get here
provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
- expect(provider.gem_env.gem_binary_location).to eq('/usr/sbin/gem')
+ expect(provider.gem_env.gem_binary_location).to eq("/usr/sbin/gem")
end
end
it "searches for a gem binary when running on Omnibus on Windows" do
platform_mock :windows do
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return("d:/opscode/chef/embedded/bin")
- allow(ENV).to receive(:[]).with('PATH').and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin;d:\opscode\chef\embedded\bin')
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return("d:/opscode/chef/embedded/bin")
+ allow(ENV).to receive(:[]).with("PATH").and_return('C:\windows\system32;C:\windows;C:\Ruby186\bin;d:\opscode\chef\embedded\bin')
allow(File).to receive(:exists?).with('C:\\windows\\system32\\gem').and_return(false)
allow(File).to receive(:exists?).with('C:\\windows\\gem').and_return(false)
allow(File).to receive(:exists?).with('C:\\Ruby186\\bin\\gem').and_return(true)
@@ -414,15 +414,15 @@ describe Chef::Provider::Package::Rubygems do
end
it "smites you when you try to use a hash of install options with an explicit gem binary" do
- @new_resource.gem_binary('/foo/bar')
+ @new_resource.gem_binary("/foo/bar")
@new_resource.options(:fail => :burger)
expect {Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)}.to raise_error(ArgumentError)
end
it "converts the new resource into a gem dependency" do
- expect(@provider.gem_dependency).to eq(Gem::Dependency.new('rspec-core', @spec_version))
- @new_resource.version('~> 1.2.0')
- expect(@provider.gem_dependency).to eq(Gem::Dependency.new('rspec-core', '~> 1.2.0'))
+ expect(@provider.gem_dependency).to eq(Gem::Dependency.new("rspec-core", @spec_version))
+ @new_resource.version("~> 1.2.0")
+ expect(@provider.gem_dependency).to eq(Gem::Dependency.new("rspec-core", "~> 1.2.0"))
end
describe "when determining the currently installed version" do
@@ -433,7 +433,7 @@ describe Chef::Provider::Package::Rubygems do
end
it "sets the current version to the highest installed version if the requested version is not installed" do
- @new_resource.version('9000.0.2')
+ @new_resource.version("9000.0.2")
@provider.load_current_resource
expect(@provider.current_resource.version).to eq(@spec_version)
end
@@ -454,31 +454,31 @@ describe Chef::Provider::Package::Rubygems do
end
it "determines the candidate version by querying the remote gem servers" do
- @new_resource.source('http://mygems.example.com')
+ @new_resource.source("http://mygems.example.com")
@provider.load_current_resource
- @provider.current_resource.version('0.0.1')
+ @provider.current_resource.version("0.0.1")
version = Gem::Version.new(@spec_version)
expect(@provider.gem_env).to receive(:candidate_version_from_remote).
- with(Gem::Dependency.new('rspec-core', @spec_version), "http://mygems.example.com").
+ with(Gem::Dependency.new("rspec-core", @spec_version), "http://mygems.example.com").
and_return(version)
expect(@provider.candidate_version).to eq(@spec_version)
end
it "parses the gem's specification if the requested source is a file" do
- @new_resource.package_name('chef-integration-test')
- @new_resource.source(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
- @new_resource.version('>= 0')
+ @new_resource.package_name("chef-integration-test")
+ @new_resource.source(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem")
+ @new_resource.version(">= 0")
@provider.load_current_resource
- expect(@provider.candidate_version).to eq('0.1.0')
+ expect(@provider.candidate_version).to eq("0.1.0")
end
end
describe "when installing a gem" do
before do
- @current_resource = Chef::Resource::GemPackage.new('rspec-core')
+ @current_resource = Chef::Resource::GemPackage.new("rspec-core")
@provider.current_resource = @current_resource
- @gem_dep = Gem::Dependency.new('rspec-core', @spec_version)
+ @gem_dep = Gem::Dependency.new("rspec-core", @spec_version)
allow(@provider).to receive(:load_current_resource)
end
@@ -490,26 +490,26 @@ describe Chef::Provider::Package::Rubygems do
end
it "installs the gem via the gems api when a remote source is provided" do
- @new_resource.source('http://gems.example.org')
- sources = ['http://gems.example.org']
+ @new_resource.source("http://gems.example.org")
+ sources = ["http://gems.example.org"]
expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => sources)
@provider.run_action(:install)
expect(@new_resource).to be_updated_by_last_action
end
it "installs the gem from file via the gems api when no explicit options are used" do
- @new_resource.source(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
- expect(@provider.gem_env).to receive(:install).with(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
+ @new_resource.source(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem")
+ expect(@provider.gem_env).to receive(:install).with(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem")
@provider.run_action(:install)
expect(@new_resource).to be_updated_by_last_action
end
it "installs the gem from file via the gems api when the package is a path and the source is nil" do
- @new_resource = Chef::Resource::GemPackage.new(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
+ @new_resource = Chef::Resource::GemPackage.new(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem")
@provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
@provider.current_resource = @current_resource
- expect(@new_resource.source).to eq(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
- expect(@provider.gem_env).to receive(:install).with(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
+ expect(@new_resource.source).to eq(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem")
+ expect(@provider.gem_env).to receive(:install).with(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem")
@provider.run_action(:install)
expect(@new_resource).to be_updated_by_last_action
end
@@ -517,14 +517,14 @@ describe Chef::Provider::Package::Rubygems do
# this catches 'gem_package "foo"' when "./foo" is a file in the cwd, and instead of installing './foo' it fetches the remote gem
it "installs the gem via the gems api, when the package has no file separator characters in it, but a matching file exists in cwd" do
allow(::File).to receive(:exists?).and_return(true)
- @new_resource.package_name('rspec-core')
+ @new_resource.package_name("rspec-core")
expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => nil)
@provider.run_action(:install)
expect(@new_resource).to be_updated_by_last_action
end
it "installs the gem by shelling out when options are provided as a String" do
- @new_resource.options('-i /alt/install/location')
+ @new_resource.options("-i /alt/install/location")
expected ="gem install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" -i /alt/install/location"
expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
@provider.run_action(:install)
@@ -532,8 +532,8 @@ describe Chef::Provider::Package::Rubygems do
end
it "installs the gem with rubygems.org as an added source" do
- @new_resource.gem_binary('/foo/bar')
- @new_resource.source('http://mirror.ops.rhcloud.com/mirror/ruby')
+ @new_resource.gem_binary("/foo/bar")
+ @new_resource.source("http://mirror.ops.rhcloud.com/mirror/ruby")
expected ="/foo/bar install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" --source=#{@new_resource.source} --source=https://rubygems.org"
expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
@provider.run_action(:install)
@@ -541,8 +541,8 @@ describe Chef::Provider::Package::Rubygems do
end
it "installs the gem with cleared sources and explict source when specified" do
- @new_resource.gem_binary('/foo/bar')
- @new_resource.source('http://mirror.ops.rhcloud.com/mirror/ruby')
+ @new_resource.gem_binary("/foo/bar")
+ @new_resource.source("http://mirror.ops.rhcloud.com/mirror/ruby")
@new_resource.clear_sources(true)
expected ="/foo/bar install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\" --clear-sources --source=#{@new_resource.source}"
expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
@@ -554,7 +554,7 @@ describe Chef::Provider::Package::Rubygems do
let(:target_version) { nil }
it "installs the gem by shelling out when options are provided but no version is given" do
- @new_resource.options('-i /alt/install/location')
+ @new_resource.options("-i /alt/install/location")
expected ="gem install rspec-core -q --no-rdoc --no-ri -v \"#{@provider.candidate_version}\" -i /alt/install/location"
expect(@provider).to receive(:shell_out!).with(expected, env: nil, timeout: 900)
@provider.run_action(:install)
@@ -563,15 +563,15 @@ describe Chef::Provider::Package::Rubygems do
end
it "installs the gem via the gems api when options are given as a Hash" do
- @new_resource.options(:install_dir => '/alt/install/location')
- expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => nil, :install_dir => '/alt/install/location')
+ @new_resource.options(:install_dir => "/alt/install/location")
+ expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => nil, :install_dir => "/alt/install/location")
@provider.run_action(:install)
expect(@new_resource).to be_updated_by_last_action
end
describe "at a specific version" do
before do
- @gem_dep = Gem::Dependency.new('rspec-core', @spec_version)
+ @gem_dep = Gem::Dependency.new("rspec-core", @spec_version)
end
it "installs the gem via the gems api" do
@@ -601,28 +601,28 @@ describe Chef::Provider::Package::Rubygems do
describe "in an alternate gem environment" do
it "installs the gem by shelling out to gem install" do
- @new_resource.gem_binary('/usr/weird/bin/gem')
+ @new_resource.gem_binary("/usr/weird/bin/gem")
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install rspec-core -q --no-rdoc --no-ri -v \"#{@spec_version}\"", env: nil, timeout: 900)
@provider.run_action(:install)
expect(@new_resource).to be_updated_by_last_action
end
it "installs the gem from file by shelling out to gem install" do
- @new_resource.gem_binary('/usr/weird/bin/gem')
- @new_resource.source(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
- @new_resource.version('>= 0')
+ @new_resource.gem_binary("/usr/weird/bin/gem")
+ @new_resource.source(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem")
+ @new_resource.version(">= 0")
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", env: nil, timeout: 900)
@provider.run_action(:install)
expect(@new_resource).to be_updated_by_last_action
end
it "installs the gem from file by shelling out to gem install when the package is a path and the source is nil" do
- @new_resource = Chef::Resource::GemPackage.new(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
+ @new_resource = Chef::Resource::GemPackage.new(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem")
@provider = Chef::Provider::Package::Rubygems.new(@new_resource, @run_context)
@provider.current_resource = @current_resource
- @new_resource.gem_binary('/usr/weird/bin/gem')
- @new_resource.version('>= 0')
- expect(@new_resource.source).to eq(CHEF_SPEC_DATA + '/gems/chef-integration-test-0.1.0.gem')
+ @new_resource.gem_binary("/usr/weird/bin/gem")
+ @new_resource.version(">= 0")
+ expect(@new_resource.source).to eq(CHEF_SPEC_DATA + "/gems/chef-integration-test-0.1.0.gem")
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem install #{CHEF_SPEC_DATA}/gems/chef-integration-test-0.1.0.gem -q --no-rdoc --no-ri -v \">= 0\"", env: nil, timeout: 900)
@provider.run_action(:install)
expect(@new_resource).to be_updated_by_last_action
@@ -635,7 +635,7 @@ describe Chef::Provider::Package::Rubygems do
before do
@new_resource = Chef::Resource::GemPackage.new("rspec")
@current_resource = @new_resource.dup
- @current_resource.version('1.2.3')
+ @current_resource.version("1.2.3")
@provider.new_resource = @new_resource
@provider.current_resource = @current_resource
end
@@ -646,7 +646,7 @@ describe Chef::Provider::Package::Rubygems do
expect(@provider.new_resource.version).to be_nil
expect(@provider.current_resource.version).not_to be_nil
# the behavior we're testing:
- expect(@provider.gem_env).to receive(:uninstall).with('rspec', nil)
+ expect(@provider.gem_env).to receive(:uninstall).with("rspec", nil)
@provider.action_remove
end
@@ -655,27 +655,27 @@ describe Chef::Provider::Package::Rubygems do
expect(@provider.new_resource.version).to be_nil
expect(@provider.current_resource.version).not_to be_nil
# the behavior we're testing:
- @new_resource.options(:install_dir => '/alt/install/location')
- expect(@provider.gem_env).to receive(:uninstall).with('rspec', nil, :install_dir => '/alt/install/location')
+ @new_resource.options(:install_dir => "/alt/install/location")
+ expect(@provider.gem_env).to receive(:uninstall).with("rspec", nil, :install_dir => "/alt/install/location")
@provider.action_remove
end
it "uninstalls via the gem command when options are given as a String" do
- @new_resource.options('-i /alt/install/location')
+ @new_resource.options("-i /alt/install/location")
expect(@provider).to receive(:shell_out!).with("gem uninstall rspec -q -x -I -a -i /alt/install/location", env: nil, timeout: 900)
@provider.action_remove
end
it "uninstalls a specific version of a gem when a version is provided" do
- @new_resource.version('1.2.3')
- expect(@provider.gem_env).to receive(:uninstall).with('rspec', '1.2.3')
+ @new_resource.version("1.2.3")
+ expect(@provider.gem_env).to receive(:uninstall).with("rspec", "1.2.3")
@provider.action_remove
end
end
describe "in an alternate gem environment" do
it "uninstalls via the gem command" do
- @new_resource.gem_binary('/usr/weird/bin/gem')
+ @new_resource.gem_binary("/usr/weird/bin/gem")
expect(@provider).to receive(:shell_out!).with("/usr/weird/bin/gem uninstall rspec -q -x -I -a", env: nil, timeout: 900)
@provider.action_remove
end
diff --git a/spec/unit/provider/package/smartos_spec.rb b/spec/unit/provider/package/smartos_spec.rb
index 8f2d2bb8ea..93bfcb7a39 100644
--- a/spec/unit/provider/package/smartos_spec.rb
+++ b/spec/unit/provider/package/smartos_spec.rb
@@ -18,7 +18,7 @@
#
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper"))
-require 'ostruct'
+require "ostruct"
describe Chef::Provider::Package::SmartOS, "load_current_resource" do
before(:each) do
@@ -81,8 +81,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!).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!).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
@@ -91,8 +91,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!).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!).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
diff --git a/spec/unit/provider/package/solaris_spec.rb b/spec/unit/provider/package/solaris_spec.rb
index ae6c96da00..722007a6b0 100644
--- a/spec/unit/provider/package/solaris_spec.rb
+++ b/spec/unit/provider/package/solaris_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package::Solaris do
before(:each) do
diff --git a/spec/unit/provider/package/windows/exe_spec.rb b/spec/unit/provider/package/windows/exe_spec.rb
index 6756ffa9e0..18c1c2cd5d 100644
--- a/spec/unit/provider/package/windows/exe_spec.rb
+++ b/spec/unit/provider/package/windows/exe_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/provider/package/windows/exe'
+require "spec_helper"
+require "chef/provider/package/windows/exe"
unless Chef::Platform.windows?
class Chef
@@ -41,14 +41,14 @@ describe Chef::Provider::Package::Windows::Exe do
end
let(:uninstall_hash) do
[{
- 'DisplayVersion' => 'outdated',
- 'UninstallString' => File.join("uninst_dir", "uninst_file"),
+ "DisplayVersion" => "outdated",
+ "UninstallString" => File.join("uninst_dir", "uninst_file"),
}]
end
let(:uninstall_entry) do
entries = []
uninstall_hash.each do |entry|
- entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new('hive', 'key', entry))
+ entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new("hive", "key", entry))
end
entries
end
@@ -100,8 +100,8 @@ describe Chef::Provider::Package::Windows::Exe do
end
it "returns the version attribute if given" do
- new_resource.version('v55555')
- expect(provider.package_version).to eql('v55555')
+ new_resource.version("v55555")
+ expect(provider.package_version).to eql("v55555")
end
it "returns nil if no version given" do
@@ -121,19 +121,19 @@ describe Chef::Provider::Package::Windows::Exe do
let(:uninstall_hash) do
[
{
- 'DisplayVersion' => 'v1',
- 'UninstallString' => File.join("uninst_dir1", "uninst_file1"),
+ "DisplayVersion" => "v1",
+ "UninstallString" => File.join("uninst_dir1", "uninst_file1"),
},
{
- 'DisplayVersion' => 'v2',
- 'UninstallString' => File.join("uninst_dir2", "uninst_file2"),
+ "DisplayVersion" => "v2",
+ "UninstallString" => File.join("uninst_dir2", "uninst_file2"),
},
]
end
context "version given and installed" do
it "removes given version" do
- new_resource.version('v2')
+ new_resource.version("v2")
expect(provider).to receive(:shell_out!).with(/start \"\" \/wait \/d\"uninst_dir2\" uninst_file2 \/S \/NCRC & exit %%%%ERRORLEVEL%%%%/, kind_of(Hash))
provider.remove_package
end
diff --git a/spec/unit/provider/package/windows/msi_spec.rb b/spec/unit/provider/package/windows/msi_spec.rb
index 835bd4ad19..86067ce8c8 100644
--- a/spec/unit/provider/package/windows/msi_spec.rb
+++ b/spec/unit/provider/package/windows/msi_spec.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/provider/package/windows/msi'
+require "spec_helper"
+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(: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(:package_name) { "calculator" }
let(:resource_source) { "calculator.msi" }
let(:resource_version) { nil }
@@ -34,14 +34,14 @@ describe Chef::Provider::Package::Windows::MSI do
end
let(:uninstall_hash) do
[{
- 'DisplayVersion' => 'outdated',
- 'UninstallString' => "MsiExec.exe /X{guid}",
+ "DisplayVersion" => "outdated",
+ "UninstallString" => "MsiExec.exe /X{guid}",
}]
end
let(:uninstall_entry) do
entries = []
uninstall_hash.each do |entry|
- entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new('hive', 'key', entry))
+ entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new("hive", "key", entry))
end
entries
end
@@ -129,12 +129,12 @@ describe Chef::Provider::Package::Windows::MSI do
let(:uninstall_hash) do
[
{
- 'DisplayVersion' => 'outdated',
- 'UninstallString' => "MsiExec.exe /X{guid}",
+ "DisplayVersion" => "outdated",
+ "UninstallString" => "MsiExec.exe /X{guid}",
},
{
- 'DisplayVersion' => 'really_outdated',
- 'UninstallString' => "MsiExec.exe /X{guid2}",
+ "DisplayVersion" => "really_outdated",
+ "UninstallString" => "MsiExec.exe /X{guid2}",
},
]
end
diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb
index 200cc9888a..4771057133 100644
--- a/spec/unit/provider/package/windows_spec.rb
+++ b/spec/unit/provider/package/windows_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/provider/package/windows/exe'
-require 'chef/provider/package/windows/msi'
+require "spec_helper"
+require "chef/provider/package/windows/exe"
+require "chef/provider/package/windows/msi"
describe Chef::Provider::Package::Windows, :windows_only do
before(:each) do
@@ -26,11 +26,11 @@ describe Chef::Provider::Package::Windows, :windows_only do
allow(Chef::FileCache).to receive(:create_cache_path).with("package/").and_return(cache_path)
end
- 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(:resource_source) { 'calculator.msi' }
- let(:resource_name) { 'calculator' }
+ 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(:resource_source) { "calculator.msi" }
+ let(:resource_name) { "calculator" }
let(:new_resource) do
new_resource = Chef::Resource::WindowsPackage.new(resource_name)
new_resource.source(resource_source) if resource_source
@@ -47,7 +47,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
shared_examples "a local file" do
before(:each) do
allow(Chef::Util::PathHelper).to receive(:validate_path)
- allow(provider).to receive(:package_provider).and_return(double('package_provider',
+ allow(provider).to receive(:package_provider).and_return(double("package_provider",
:installed_version => "1.0", :package_version => "2.0"))
end
@@ -69,7 +69,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
end
context "when the source is a uri" do
- let(:resource_source) { 'https://foo.bar/calculator.msi' }
+ let(:resource_source) { "https://foo.bar/calculator.msi" }
context "when the source has not been downloaded" do
before(:each) do
@@ -134,7 +134,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
end
context "when the source is a uri" do
- let(:resource_source) { 'https://foo.bar/calculator.msi' }
+ let(:resource_source) { "https://foo.bar/calculator.msi" }
context "when the source has not been downloaded" do
before(:each) do
@@ -170,15 +170,15 @@ describe Chef::Provider::Package::Windows, :windows_only do
context "there is no source" do
let(:uninstall_hash) do
[{
- 'DisplayVersion' => 'outdated',
- 'UninstallString' => "blah blah",
+ "DisplayVersion" => "outdated",
+ "UninstallString" => "blah blah",
}]
end
let(:uninstall_key) { "blah" }
let(:uninstall_entry) do
entries = []
uninstall_hash.each do |entry|
- entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new('hive', uninstall_key, entry))
+ entries.push(Chef::Provider::Package::Windows::RegistryUninstallEntry.new("hive", uninstall_key, entry))
end
entries
end
@@ -191,8 +191,8 @@ describe Chef::Provider::Package::Windows, :windows_only do
context "uninstall string contains MsiExec.exe" do
let(:uninstall_hash) do
[{
- 'DisplayVersion' => 'outdated',
- 'UninstallString' => "MsiExec.exe /X{guid}",
+ "DisplayVersion" => "outdated",
+ "UninstallString" => "MsiExec.exe /X{guid}",
}]
end
@@ -204,8 +204,8 @@ describe Chef::Provider::Package::Windows, :windows_only do
context "uninstall string ends with uninst.exe" do
let(:uninstall_hash) do
[{
- 'DisplayVersion' => 'outdated',
- 'UninstallString' => %q{"c:/hfhfheru/uninst.exe"},
+ "DisplayVersion" => "outdated",
+ "UninstallString" => %q{"c:/hfhfheru/uninst.exe"},
}]
end
@@ -237,17 +237,17 @@ describe Chef::Provider::Package::Windows, :windows_only do
end
it "sets installer_type to inno if the source contains inno" do
- allow(::Kernel).to receive(:open).and_yield(StringIO.new('blah blah inno blah'))
+ allow(::Kernel).to receive(:open).and_yield(StringIO.new("blah blah inno blah"))
expect(provider.installer_type).to eql(:inno)
end
it "sets installer_type to wise if the source contains wise" do
- allow(::Kernel).to receive(:open).and_yield(StringIO.new('blah blah wise blah'))
+ allow(::Kernel).to receive(:open).and_yield(StringIO.new("blah blah wise blah"))
expect(provider.installer_type).to eql(:wise)
end
it "sets installer_type to nsis if the source contains nsis" do
- allow(::Kernel).to receive(:open).and_yield(StringIO.new('blah blah nullsoft blah'))
+ allow(::Kernel).to receive(:open).and_yield(StringIO.new("blah blah nullsoft blah"))
expect(provider.installer_type).to eql(:nsis)
end
@@ -263,7 +263,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
let(:resource_source) { "setup.exe" }
it "sets installer_type to installshield" do
- allow(::Kernel).to receive(:open).and_yield(StringIO.new(''))
+ allow(::Kernel).to receive(:open).and_yield(StringIO.new(""))
expect(provider.installer_type).to eql(:installshield)
end
end
@@ -272,7 +272,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
let(:resource_source) { "tomfoolery.now" }
it "raises an error" do
- allow(::Kernel).to receive(:open).and_yield(StringIO.new(''))
+ allow(::Kernel).to receive(:open).and_yield(StringIO.new(""))
provider.new_resource.installer_type(nil)
expect { provider.installer_type }.to raise_error(Chef::Exceptions::CannotDetermineWindowsInstallerType)
end
@@ -313,7 +313,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
end
context "a version is given and none is installed" do
- before { new_resource.version('5.5.5') }
+ before { new_resource.version("5.5.5") }
it "installs given version" do
expect(provider).to receive(:install_package).with("blah", "5.5.5")
@@ -324,7 +324,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
context "a version is given and several are installed" do
context "given version matches an installed version" do
before do
- new_resource.version('5.5.5')
+ new_resource.version("5.5.5")
allow(provider).to receive(:current_version_array).and_return([ ["5.5.5", "4.3.0", "1.1.1"] ])
end
@@ -336,7 +336,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
context "given version does not match an installed version" do
before do
- new_resource.version('5.5.5')
+ new_resource.version("5.5.5")
allow(provider).to receive(:current_version_array).and_return([ ["5.5.0", "4.3.0", "1.1.1"] ])
end
@@ -350,7 +350,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
context "a version is given and one is installed" do
context "given version matches installed version" do
before do
- new_resource.version('5.5.5')
+ new_resource.version("5.5.5")
allow(provider).to receive(:current_version_array).and_return(["5.5.5"])
end
@@ -362,7 +362,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
context "given version does not match installed version" do
before do
- new_resource.version('5.5.5')
+ new_resource.version("5.5.5")
allow(provider).to receive(:current_version_array).and_return(["5.5.0"])
end
diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb
index 70ab257a54..efbbdf6450 100644
--- a/spec/unit/provider/package/yum_spec.rb
+++ b/spec/unit/provider/package/yum_spec.rb
@@ -16,18 +16,18 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'securerandom'
+require "spec_helper"
+require "securerandom"
describe Chef::Provider::Package::Yum do
before(:each) do
@node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::YumPackage.new('cups')
+ @new_resource = Chef::Resource::YumPackage.new("cups")
@status = double("Status", :exitstatus => 0)
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
:installed_version => "1.2.4-11.18.el5",
@@ -77,15 +77,15 @@ describe Chef::Provider::Package::Yum do
describe "when source is provided" do
it "should set the candidate version" do
- @new_resource = Chef::Resource::YumPackage.new('testing.source')
+ @new_resource = Chef::Resource::YumPackage.new("testing.source")
@new_resource.source "chef-server-core-12.0.5-1.rpm"
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
allow(File).to receive(:exists?).with(@new_resource.source).and_return(true)
allow(@yum_cache).to receive(:installed_version).and_return(nil)
- shellout_double = double(:stdout => 'chef-server-core 12.0.5-1')
+ shellout_double = double(:stdout => "chef-server-core 12.0.5-1")
allow(@provider).to receive(:shell_out!).and_return(shellout_double)
@provider.load_current_resource
- expect(@provider.candidate_version).to eql('12.0.5-1')
+ expect(@provider.candidate_version).to eql("12.0.5-1")
end
end
@@ -113,7 +113,7 @@ describe Chef::Provider::Package::Yum do
end
it "when the new_resource is a vanilla package class and yum-deprecated exists" do
- @new_resource = Chef::Resource::Package.new('cups')
+ @new_resource = Chef::Resource::Package.new("cups")
expect(File).to receive(:exist?).with("/usr/bin/yum-deprecated").and_return(true)
expect(@yum_cache).to receive(:yum_binary=).with("yum-deprecated")
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@@ -121,7 +121,7 @@ describe Chef::Provider::Package::Yum do
end
it "when the new_resource is a vanilla package class and yum-deprecated does not exist" do
- @new_resource = Chef::Resource::Package.new('cups')
+ @new_resource = Chef::Resource::Package.new("cups")
expect(File).to receive(:exist?).with("/usr/bin/yum-deprecated").and_return(false)
expect(@yum_cache).to receive(:yum_binary=).with("yum")
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@@ -131,9 +131,9 @@ describe Chef::Provider::Package::Yum do
describe "when arch in package_name" do
it "should set the arch if no existing package_name is found and new_package_name+new_arch is available" do
- @new_resource = Chef::Resource::YumPackage.new('testing.noarch')
+ @new_resource = Chef::Resource::YumPackage.new("testing.noarch")
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache'
+ "Chef::Provider::Yum::YumCache"
)
allow(@yum_cache).to receive(:installed_version) do |package_name, arch|
# nothing installed for package_name/new_package_name
@@ -157,7 +157,7 @@ describe Chef::Provider::Package::Yum do
expect(@provider.new_resource.arch).to eq("noarch")
expect(@provider.arch).to eq("noarch")
- @new_resource = Chef::Resource::YumPackage.new('testing.more.noarch')
+ @new_resource = Chef::Resource::YumPackage.new("testing.more.noarch")
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
expect(@provider.new_resource.package_name).to eq("testing.more")
@@ -167,9 +167,9 @@ describe Chef::Provider::Package::Yum do
describe "when version constraint in package_name" do
it "should set package_version if no existing package_name is found and new_package_name is available" do
- @new_resource = Chef::Resource::Package.new('cups = 1.2.4-11.18.el5_2.3')
+ @new_resource = Chef::Resource::Package.new("cups = 1.2.4-11.18.el5_2.3")
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
- allow(@yum_cache).to receive(:package_available?) { |pkg| pkg == 'cups' ? true : false }
+ allow(@yum_cache).to receive(:package_available?) { |pkg| pkg == "cups" ? true : false }
allow(@yum_cache).to receive(:packages_from_require) do |pkg|
[Chef::Provider::Package::Yum::RPMDbPackage.new("cups", "1.2.4-11.18.el5_2.3", "noarch", [], false, true, "base"),
Chef::Provider::Package::Yum::RPMDbPackage.new("cups", "1.2.4-11.18.el5_2.2", "noarch", [], false, true, "base")]
@@ -186,9 +186,9 @@ describe Chef::Provider::Package::Yum do
end
it "should not set the arch when an existing package_name is found" do
- @new_resource = Chef::Resource::YumPackage.new('testing.beta3')
+ @new_resource = Chef::Resource::YumPackage.new("testing.beta3")
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache'
+ "Chef::Provider::Yum::YumCache"
)
allow(@yum_cache).to receive(:installed_version) do |package_name, arch|
# installed for package_name
@@ -213,7 +213,7 @@ describe Chef::Provider::Package::Yum do
expect(@provider.new_resource.arch).to eq(nil)
expect(@provider.arch).to eq(nil)
- @new_resource = Chef::Resource::YumPackage.new('testing.beta3.more')
+ @new_resource = Chef::Resource::YumPackage.new("testing.beta3.more")
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
expect(@provider.new_resource.package_name).to eq("testing.beta3.more")
@@ -222,9 +222,9 @@ describe Chef::Provider::Package::Yum do
end
it "should not set the arch when no existing package_name or new_package_name+new_arch is found" do
- @new_resource = Chef::Resource::YumPackage.new('testing.beta3')
+ @new_resource = Chef::Resource::YumPackage.new("testing.beta3")
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache'
+ "Chef::Provider::Yum::YumCache"
)
allow(@yum_cache).to receive(:installed_version) do |package_name, arch|
# nothing installed for package_name/new_package_name
@@ -244,7 +244,7 @@ describe Chef::Provider::Package::Yum do
expect(@provider.new_resource.arch).to eq(nil)
expect(@provider.arch).to eq(nil)
- @new_resource = Chef::Resource::YumPackage.new('testing.beta3.more')
+ @new_resource = Chef::Resource::YumPackage.new("testing.beta3.more")
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
expect(@provider.new_resource.package_name).to eq("testing.beta3.more")
@@ -253,10 +253,10 @@ describe Chef::Provider::Package::Yum do
end
it "should ensure it doesn't clobber an existing arch if passed" do
- @new_resource = Chef::Resource::YumPackage.new('testing.i386')
+ @new_resource = Chef::Resource::YumPackage.new("testing.i386")
@new_resource.arch("x86_64")
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache'
+ "Chef::Provider::Yum::YumCache"
)
allow(@yum_cache).to receive(:installed_version) do |package_name, arch|
# nothing installed for package_name/new_package_name
@@ -313,7 +313,7 @@ describe Chef::Provider::Package::Yum do
context "when the package name isn't found" do
let(:yum_cache) { double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
:installed_version => "1.0.1.el5",
@@ -334,61 +334,61 @@ describe Chef::Provider::Package::Yum do
it "should search provides then set package_name to match" do
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
- expect(@new_resource.package_name).to eq('test-package')
+ expect(@new_resource.package_name).to eq("test-package")
expect(@new_resource.version).to eq(nil)
end
it "should search provides then set version to match if a requirement was passed in the package name" do
- @new_resource = Chef::Resource::YumPackage.new('test-package = 2.0.1.el5')
+ @new_resource = Chef::Resource::YumPackage.new("test-package = 2.0.1.el5")
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
- expect(@new_resource.package_name).to eq('test-package')
- expect(@new_resource.version).to eq('2.0.1.el5')
+ expect(@new_resource.package_name).to eq("test-package")
+ expect(@new_resource.version).to eq("2.0.1.el5")
end
it "should search provides then set version to match if a requirement was passed in the version" do
- @new_resource = Chef::Resource::YumPackage.new('test-package')
- @new_resource.version('= 2.0.1.el5')
+ @new_resource = Chef::Resource::YumPackage.new("test-package")
+ @new_resource.version("= 2.0.1.el5")
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
- expect(@new_resource.package_name).to eq('test-package')
- expect(@new_resource.version).to eq('2.0.1.el5')
+ expect(@new_resource.package_name).to eq("test-package")
+ expect(@new_resource.version).to eq("2.0.1.el5")
end
it "should search provides and not set the version to match if a specific version was requested" do
- @new_resource = Chef::Resource::YumPackage.new('test-package')
- @new_resource.version('3.0.1.el5')
+ @new_resource = Chef::Resource::YumPackage.new("test-package")
+ @new_resource.version("3.0.1.el5")
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
- expect(@new_resource.package_name).to eq('test-package')
- expect(@new_resource.version).to eq('3.0.1.el5')
+ expect(@new_resource.package_name).to eq("test-package")
+ expect(@new_resource.version).to eq("3.0.1.el5")
end
it "should search provides then set versions to match if requirements were passed in the package name as an array" do
- @new_resource = Chef::Resource::YumPackage.new(['test-package = 2.0.1.el5'])
+ @new_resource = Chef::Resource::YumPackage.new(["test-package = 2.0.1.el5"])
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
- expect(@new_resource.package_name).to eq(['test-package'])
- expect(@new_resource.version).to eq(['2.0.1.el5'])
+ expect(@new_resource.package_name).to eq(["test-package"])
+ expect(@new_resource.version).to eq(["2.0.1.el5"])
end
it "should search provides and not set the versions to match if specific versions were requested in an array" do
- @new_resource = Chef::Resource::YumPackage.new(['test-package'])
- @new_resource.version(['3.0.1.el5'])
+ @new_resource = Chef::Resource::YumPackage.new(["test-package"])
+ @new_resource.version(["3.0.1.el5"])
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
- expect(@new_resource.package_name).to eq(['test-package'])
- expect(@new_resource.version).to eq(['3.0.1.el5'])
+ expect(@new_resource.package_name).to eq(["test-package"])
+ expect(@new_resource.version).to eq(["3.0.1.el5"])
end
end
it "should not return an error if no version number is specified in the resource" do
- @new_resource = Chef::Resource::YumPackage.new('test-package')
+ @new_resource = Chef::Resource::YumPackage.new("test-package")
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
:installed_version => "1.0.1.el5",
@@ -408,9 +408,9 @@ describe Chef::Provider::Package::Yum do
end
it "should give precedence to the version attribute when both a requirement in the resource name and a version attribute are specified" do
- @new_resource = Chef::Resource::YumPackage.new('test-package')
+ @new_resource = Chef::Resource::YumPackage.new("test-package")
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
:installed_version => "1.2.4-11.18.el5",
@@ -423,17 +423,17 @@ describe Chef::Provider::Package::Yum do
allow(@yum_cache).to receive(:yum_binary=).with("yum")
pkg = Chef::Provider::Package::Yum::RPMPackage.new("test-package", "2.0.1.el5", "x86_64", [])
expect(@yum_cache).to receive(:packages_from_require).and_return([pkg])
- @new_resource = Chef::Resource::YumPackage.new('test-package = 2.0.1.el5')
- @new_resource.version('3.0.1.el5')
+ @new_resource = Chef::Resource::YumPackage.new("test-package = 2.0.1.el5")
+ @new_resource.version("3.0.1.el5")
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
- expect(@new_resource.package_name).to eq('test-package')
- expect(@new_resource.version).to eq('3.0.1.el5')
+ expect(@new_resource.package_name).to eq("test-package")
+ expect(@new_resource.version).to eq("3.0.1.el5")
end
it "should correctly detect the installed states of an array of package names and version numbers" do
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
:installed_version => "1.0.1.el5",
@@ -448,17 +448,17 @@ describe Chef::Provider::Package::Yum do
expect(@yum_cache).to receive(:packages_from_require).exactly(4).times.and_return([])
expect(@yum_cache).to receive(:reload_provides).twice
- @new_resource = Chef::Resource::YumPackage.new(['test-package','test-package2'])
- @new_resource.version(['2.0.1.el5','3.0.1.el5'])
+ @new_resource = Chef::Resource::YumPackage.new(["test-package","test-package2"])
+ @new_resource.version(["2.0.1.el5","3.0.1.el5"])
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
@provider.load_current_resource
- expect(@new_resource.package_name).to eq(['test-package','test-package2'])
- expect(@new_resource.version).to eq(['2.0.1.el5','3.0.1.el5'])
+ expect(@new_resource.package_name).to eq(["test-package","test-package2"])
+ expect(@new_resource.version).to eq(["2.0.1.el5","3.0.1.el5"])
end
it "should search provides if no package is available - if no match in installed provides then load the complete set" do
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
:installed_version => "1.2.4-11.18.el5",
@@ -478,7 +478,7 @@ describe Chef::Provider::Package::Yum do
it "should search provides if no package is available and not load the complete set if action is :remove or :purge" do
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
:installed_version => "1.2.4-11.18.el5",
@@ -502,7 +502,7 @@ describe Chef::Provider::Package::Yum do
it "should search provides if no package is available - if no match in provides leave the name intact" do
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_provides => true,
:reload_installed => true,
:reset => true,
@@ -562,7 +562,7 @@ describe Chef::Provider::Package::Yum do
it "installs the package with the options given in the resource" do
@provider.load_current_resource
- allow(@provider).to receive(:candidate_version).and_return('11')
+ allow(@provider).to receive(:candidate_version).and_return("11")
allow(@new_resource).to receive(:options).and_return("--disablerepo epmd")
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
expect(@provider).to receive(:yum_command).with(
@@ -573,7 +573,7 @@ describe Chef::Provider::Package::Yum do
it "should raise an exception if the package is not available" do
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_from_cache => true,
:reset => true,
:installed_version => "1.2.4-11.18.el5",
@@ -591,7 +591,7 @@ describe Chef::Provider::Package::Yum do
it "should raise an exception if candidate version is older than the installed version and allow_downgrade is false" do
allow(@new_resource).to receive(:allow_downgrade).and_return(false)
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
:installed_version => "1.2.4-11.18.el5",
@@ -610,7 +610,7 @@ describe Chef::Provider::Package::Yum do
it "should not raise an exception if candidate version is older than the installed version and the package is list in yum's installonlypkg option" do
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
:installed_version => "1.2.4-11.18.el5",
@@ -634,7 +634,7 @@ describe Chef::Provider::Package::Yum do
it "should run yum downgrade if candidate version is older than the installed version and allow_downgrade is true" do
allow(@new_resource).to receive(:allow_downgrade).and_return(true)
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
:installed_version => "1.2.4-11.18.el5",
@@ -681,7 +681,7 @@ describe Chef::Provider::Package::Yum do
describe "when upgrading a package" do
it "should run yum install if the package is installed and a version is given" do
@provider.load_current_resource
- allow(@provider).to receive(:candidate_version).and_return('11')
+ allow(@provider).to receive(:candidate_version).and_return("11")
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
expect(@provider).to receive(:yum_command).with(
"-d0 -e0 -y install cups-11"
@@ -691,8 +691,8 @@ describe Chef::Provider::Package::Yum do
it "should run yum install if the package is not installed" do
@provider.load_current_resource
- @current_resource = Chef::Resource::Package.new('cups')
- allow(@provider).to receive(:candidate_version).and_return('11')
+ @current_resource = Chef::Resource::Package.new("cups")
+ allow(@provider).to receive(:candidate_version).and_return("11")
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
expect(@provider).to receive(:yum_command).with(
"-d0 -e0 -y install cups-11"
@@ -702,7 +702,7 @@ describe Chef::Provider::Package::Yum do
it "should raise an exception if candidate version is older than the installed version" do
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
:installed_version => "1.2.4-11.18.el5",
@@ -722,8 +722,8 @@ describe Chef::Provider::Package::Yum do
# Test our little workaround, some crossover into Chef::Provider::Package territory
it "should call action_upgrade in the parent if the current resource version is nil" do
allow(@yum_cache).to receive(:installed_version).and_return(nil)
- @current_resource = Chef::Resource::Package.new('cups')
- allow(@provider).to receive(:candidate_version).and_return('11')
+ @current_resource = Chef::Resource::Package.new("cups")
+ allow(@provider).to receive(:candidate_version).and_return("11")
expect(@provider).to receive(:upgrade_package).with(
"cups",
"11",
@@ -733,7 +733,7 @@ describe Chef::Provider::Package::Yum do
it "should call action_upgrade in the parent if the candidate version is nil" do
@provider.load_current_resource
- @current_resource = Chef::Resource::Package.new('cups')
+ @current_resource = Chef::Resource::Package.new("cups")
allow(@provider).to receive(:candidate_version).and_return(nil)
expect(@provider).not_to receive(:upgrade_package)
@provider.run_action(:upgrade)
@@ -741,8 +741,8 @@ describe Chef::Provider::Package::Yum do
it "should call action_upgrade in the parent if the candidate is newer" do
@provider.load_current_resource
- @current_resource = Chef::Resource::Package.new('cups')
- allow(@provider).to receive(:candidate_version).and_return('11')
+ @current_resource = Chef::Resource::Package.new("cups")
+ allow(@provider).to receive(:candidate_version).and_return("11")
expect(@provider).to receive(:upgrade_package).with(
"cups",
"11",
@@ -753,8 +753,8 @@ describe Chef::Provider::Package::Yum do
it "should not call action_upgrade in the parent if the candidate is older" do
allow(@yum_cache).to receive(:installed_version).and_return("12")
@provider.load_current_resource
- @current_resource = Chef::Resource::Package.new('cups')
- allow(@provider).to receive(:candidate_version).and_return('11')
+ @current_resource = Chef::Resource::Package.new("cups")
+ allow(@provider).to receive(:candidate_version).and_return("11")
expect(@provider).not_to receive(:upgrade_package)
@provider.run_action(:upgrade)
end
@@ -989,37 +989,37 @@ describe Chef::Provider::Package::Yum::RPMUtils do
end
it "tests isalnum good input" do
- [ 'a', 'z', 'A', 'Z', '0', '9' ].each do |t|
+ [ "a", "z", "A", "Z", "0", "9" ].each do |t|
expect(@rpmutils.isalnum(t)).to eq(true)
end
end
it "tests isalnum bad input" do
- [ '-', '.', '!', '^', ':', '_' ].each do |t|
+ [ "-", ".", "!", "^", ":", "_" ].each do |t|
expect(@rpmutils.isalnum(t)).to eq(false)
end
end
it "tests isalpha good input" do
- [ 'a', 'z', 'A', 'Z' ].each do |t|
+ [ "a", "z", "A", "Z" ].each do |t|
expect(@rpmutils.isalpha(t)).to eq(true)
end
end
it "tests isalpha bad input" do
- [ '0', '9', '-', '.', '!', '^', ':', '_' ].each do |t|
+ [ "0", "9", "-", ".", "!", "^", ":", "_" ].each do |t|
expect(@rpmutils.isalpha(t)).to eq(false)
end
end
it "tests isdigit good input" do
- [ '0', '9' ].each do |t|
+ [ "0", "9" ].each do |t|
expect(@rpmutils.isdigit(t)).to eq(true)
end
end
it "tests isdigit bad input" do
- [ 'A', 'z', '-', '.', '!', '^', ':', '_' ].each do |t|
+ [ "A", "z", "-", ".", "!", "^", ":", "_" ].each do |t|
expect(@rpmutils.isdigit(t)).to eq(false)
end
end
@@ -2115,18 +2115,18 @@ describe "Chef::Provider::Package::Yum - Multi" do
@node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::Package.new(['cups', 'vim'])
+ @new_resource = Chef::Resource::Package.new(["cups", "vim"])
@status = double("Status", :exitstatus => 0)
@yum_cache = double(
- 'Chef::Provider::Yum::YumCache',
+ "Chef::Provider::Yum::YumCache",
:reload_installed => true,
:reset => true,
- :installed_version => 'XXXX',
- :candidate_version => 'YYYY',
+ :installed_version => "XXXX",
+ :candidate_version => "YYYY",
:package_available? => true,
:version_available? => true,
- :allow_multi_install => [ 'kernel' ],
- :package_repository => 'base',
+ :allow_multi_install => [ "kernel" ],
+ :package_repository => "base",
:disable_extra_repo_control => true,
)
allow(Chef::Provider::Package::Yum::YumCache).to receive(:instance).and_return(@yum_cache)
@@ -2139,12 +2139,12 @@ describe "Chef::Provider::Package::Yum - Multi" do
describe "when loading the current system state" do
it "should create a current resource with the name of the new_resource" do
@provider.load_current_resource
- expect(@provider.current_resource.name).to eq('cups, vim')
+ expect(@provider.current_resource.name).to eq("cups, vim")
end
it "should set the current resources package name to the new resources package name" do
@provider.load_current_resource
- expect(@provider.current_resource.package_name).to eq(['cups', 'vim'])
+ expect(@provider.current_resource.package_name).to eq(["cups", "vim"])
end
it "should set the installed version to nil on the current resource if no installed package" do
@@ -2154,21 +2154,21 @@ describe "Chef::Provider::Package::Yum - Multi" do
end
it "should set the installed version if yum has one" do
- allow(@yum_cache).to receive(:installed_version).with('cups', nil).and_return('1.2.4-11.18.el5')
- allow(@yum_cache).to receive(:installed_version).with('vim', nil).and_return('1.0')
- allow(@yum_cache).to receive(:candidate_version).with('cups', nil).and_return('1.2.4-11.18.el5_2.3')
- allow(@yum_cache).to receive(:candidate_version).with('vim', nil).and_return('1.5')
+ allow(@yum_cache).to receive(:installed_version).with("cups", nil).and_return("1.2.4-11.18.el5")
+ allow(@yum_cache).to receive(:installed_version).with("vim", nil).and_return("1.0")
+ allow(@yum_cache).to receive(:candidate_version).with("cups", nil).and_return("1.2.4-11.18.el5_2.3")
+ allow(@yum_cache).to receive(:candidate_version).with("vim", nil).and_return("1.5")
@provider.load_current_resource
- expect(@provider.current_resource.version).to eq(['1.2.4-11.18.el5', '1.0'])
+ expect(@provider.current_resource.version).to eq(["1.2.4-11.18.el5", "1.0"])
end
it "should set the candidate version if yum info has one" do
- allow(@yum_cache).to receive(:installed_version).with('cups', nil).and_return('1.2.4-11.18.el5')
- allow(@yum_cache).to receive(:installed_version).with('vim', nil).and_return('1.0')
- allow(@yum_cache).to receive(:candidate_version).with('cups', nil).and_return('1.2.4-11.18.el5_2.3')
- allow(@yum_cache).to receive(:candidate_version).with('vim', nil).and_return('1.5')
+ allow(@yum_cache).to receive(:installed_version).with("cups", nil).and_return("1.2.4-11.18.el5")
+ allow(@yum_cache).to receive(:installed_version).with("vim", nil).and_return("1.0")
+ allow(@yum_cache).to receive(:candidate_version).with("cups", nil).and_return("1.2.4-11.18.el5_2.3")
+ allow(@yum_cache).to receive(:candidate_version).with("vim", nil).and_return("1.5")
@provider.load_current_resource
- expect(@provider.candidate_version).to eql(['1.2.4-11.18.el5_2.3', '1.5'])
+ expect(@provider.candidate_version).to eql(["1.2.4-11.18.el5_2.3", "1.5"])
end
it "should return the current resouce" do
@@ -2177,20 +2177,20 @@ describe "Chef::Provider::Package::Yum - Multi" do
describe "when version constraint in package_name" do
it "should set package_version if no existing package_name is found and new_package_name is available" do
- @new_resource = Chef::Resource::Package.new(['cups = 1.2.4-11.18.el5_2.3', 'emacs = 24.4'])
+ @new_resource = Chef::Resource::Package.new(["cups = 1.2.4-11.18.el5_2.3", "emacs = 24.4"])
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
allow(@yum_cache).to receive(:package_available?) { |pkg| %w(cups emacs).include?(pkg) ? true : false }
allow(@yum_cache).to receive(:candidate_version) do |pkg|
- if pkg == 'cups'
+ if pkg == "cups"
"1.2.4-11.18.el5_2.3"
- elsif pkg == 'emacs'
+ elsif pkg == "emacs"
"24.4"
end
end
allow(@yum_cache).to receive(:packages_from_require) do |pkg|
- if pkg.name == 'cups'
+ if pkg.name == "cups"
[Chef::Provider::Package::Yum::RPMDbPackage.new("cups", "1.2.4-11.18.el5_2.3", "noarch", [], false, true, "base")]
- elsif pkg.name == 'emacs'
+ elsif pkg.name == "emacs"
[Chef::Provider::Package::Yum::RPMDbPackage.new("emacs", "24.4", "noarch", [], false, true, "base")]
end
end
@@ -2210,12 +2210,12 @@ describe "Chef::Provider::Package::Yum - Multi" do
it "should run yum install with the package name and version" do
@provider.load_current_resource
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
- allow(@yum_cache).to receive(:installed_version).with('cups', nil).and_return('1.2.4-11.18.el5')
- allow(@yum_cache).to receive(:installed_version).with('vim', nil).and_return('0.9')
+ allow(@yum_cache).to receive(:installed_version).with("cups", nil).and_return("1.2.4-11.18.el5")
+ allow(@yum_cache).to receive(:installed_version).with("vim", nil).and_return("0.9")
expect(@provider).to receive(:yum_command).with(
"-d0 -e0 -y install cups-1.2.4-11.19.el5 vim-1.0"
)
- @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", '1.0'])
+ @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", "1.0"])
end
it "should run yum install with the package name, version and arch" do
@@ -2231,17 +2231,17 @@ describe "Chef::Provider::Package::Yum - Multi" do
it "installs the package with the options given in the resource" do
@provider.load_current_resource
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
- allow(@yum_cache).to receive(:installed_version).with('cups', nil).and_return('1.2.4-11.18.el5')
- allow(@yum_cache).to receive(:installed_version).with('vim', nil).and_return('0.9')
+ allow(@yum_cache).to receive(:installed_version).with("cups", nil).and_return("1.2.4-11.18.el5")
+ allow(@yum_cache).to receive(:installed_version).with("vim", nil).and_return("0.9")
expect(@provider).to receive(:yum_command).with(
"-d0 -e0 -y --disablerepo epmd install cups-1.2.4-11.19.el5 vim-1.0"
)
allow(@new_resource).to receive(:options).and_return("--disablerepo epmd")
- @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", '1.0'])
+ @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", "1.0"])
end
it "should run yum install with the package name and version when name has arch" do
- @new_resource = Chef::Resource::Package.new(['cups.x86_64', 'vim'])
+ @new_resource = Chef::Resource::Package.new(["cups.x86_64", "vim"])
@provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context)
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
@@ -2249,20 +2249,20 @@ describe "Chef::Provider::Package::Yum - Multi" do
# and we need to craft the right response. The default mock setup above
# will just return valid versions all the time which won't work for this
# test.
- allow(@yum_cache).to receive(:installed_version).with('cups', 'x86_64').and_return('XXXX')
- allow(@yum_cache).to receive(:candidate_version).with('cups', 'x86_64').and_return('1.2.4-11.18.el5')
- allow(@yum_cache).to receive(:installed_version).with('cups.x86_64').and_return(nil)
- allow(@yum_cache).to receive(:candidate_version).with('cups.x86_64').and_return(nil)
+ allow(@yum_cache).to receive(:installed_version).with("cups", "x86_64").and_return("XXXX")
+ allow(@yum_cache).to receive(:candidate_version).with("cups", "x86_64").and_return("1.2.4-11.18.el5")
+ allow(@yum_cache).to receive(:installed_version).with("cups.x86_64").and_return(nil)
+ allow(@yum_cache).to receive(:candidate_version).with("cups.x86_64").and_return(nil)
# Normal mock's for the idempotency check
- allow(@yum_cache).to receive(:installed_version).with('cups', nil).and_return('1.2.4-11.18.el5')
- allow(@yum_cache).to receive(:installed_version).with('vim', nil).and_return('0.9')
+ allow(@yum_cache).to receive(:installed_version).with("cups", nil).and_return("1.2.4-11.18.el5")
+ allow(@yum_cache).to receive(:installed_version).with("vim", nil).and_return("0.9")
@provider.load_current_resource
expect(@provider).to receive(:yum_command).with(
"-d0 -e0 -y install cups-1.2.4-11.19.el5.x86_64 vim-1.0"
)
- @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", '1.0'])
+ @provider.install_package(["cups", "vim"], ["1.2.4-11.19.el5", "1.0"])
end
end
diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb
index 5fb3abe875..0f39fde5cf 100644
--- a/spec/unit/provider/package/zypper_spec.rb
+++ b/spec/unit/provider/package/zypper_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package::Zypper do
let!(:new_resource) { Chef::Resource::ZypperPackage.new("cups") }
diff --git a/spec/unit/provider/package_spec.rb b/spec/unit/provider/package_spec.rb
index cf905aeab7..ca2e545358 100644
--- a/spec/unit/provider/package_spec.rb
+++ b/spec/unit/provider/package_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Package do
let(:node) do
@@ -27,8 +27,8 @@ describe Chef::Provider::Package do
end
let(:events) { Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
- let(:new_resource) { Chef::Resource::Package.new('emacs') }
- let(:current_resource) { Chef::Resource::Package.new('emacs') }
+ let(:new_resource) { Chef::Resource::Package.new("emacs") }
+ let(:current_resource) { Chef::Resource::Package.new("emacs") }
let(:candidate_version) { "1.0" }
let(:provider) do
provider = Chef::Provider::Package.new(new_resource, run_context)
@@ -44,8 +44,8 @@ describe Chef::Provider::Package do
end
it "raises a Chef::Exceptions::InvalidResourceSpecification if both multipackage and source are provided" do
- new_resource.package_name(['a', 'b'])
- new_resource.source('foo')
+ new_resource.package_name(["a", "b"])
+ new_resource.source("foo")
expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::InvalidResourceSpecification)
end
@@ -187,12 +187,12 @@ describe Chef::Provider::Package do
describe "When removing the package" do
before(:each) do
allow(provider).to receive(:remove_package).and_return(true)
- current_resource.version '1.4.2'
+ current_resource.version "1.4.2"
end
it "should remove the package if it is installed" do
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with('emacs', nil)
+ expect(provider).to receive(:remove_package).with("emacs", nil)
provider.run_action(:remove)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
@@ -201,7 +201,7 @@ describe Chef::Provider::Package do
it "should remove the package at a specific version if it is installed at that version" do
new_resource.version "1.4.2"
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with('emacs', '1.4.2')
+ expect(provider).to receive(:remove_package).with("emacs", "1.4.2")
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
@@ -231,12 +231,12 @@ describe Chef::Provider::Package do
describe "When purging the package" do
before(:each) do
allow(provider).to receive(:purge_package).and_return(true)
- current_resource.version '1.4.2'
+ current_resource.version "1.4.2"
end
it "should purge the package if it is installed" do
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with('emacs', nil)
+ expect(provider).to receive(:purge_package).with("emacs", nil)
provider.run_action(:purge)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
@@ -245,7 +245,7 @@ describe Chef::Provider::Package do
it "should purge the package at a specific version if it is installed at that version" do
new_resource.version "1.4.2"
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with('emacs', '1.4.2')
+ expect(provider).to receive(:purge_package).with("emacs", "1.4.2")
provider.run_action(:purge)
expect(new_resource).to be_updated_by_last_action
end
@@ -280,9 +280,9 @@ describe Chef::Provider::Package do
end
it "should info log, reconfigure the package and update the resource" do
- allow(current_resource).to receive(:version).and_return('1.0')
+ allow(current_resource).to receive(:version).and_return("1.0")
allow(new_resource).to receive(:response_file).and_return(true)
- expect(provider).to receive(:get_preseed_file).and_return('/var/cache/preseed-test')
+ expect(provider).to receive(:get_preseed_file).and_return("/var/cache/preseed-test")
allow(provider).to receive(:preseed_package).and_return(true)
allow(provider).to receive(:reconfig_package).and_return(true)
expect(Chef::Log).to receive(:info).with("package[emacs] reconfigured")
@@ -301,7 +301,7 @@ describe Chef::Provider::Package do
end
it "should debug log and not reconfigure the package if no response_file is given" do
- allow(current_resource).to receive(:version).and_return('1.0')
+ allow(current_resource).to receive(:version).and_return("1.0")
allow(new_resource).to receive(:response_file).and_return(nil)
expect(Chef::Log).to receive(:debug).with("package[emacs] no response_file provided - nothing to do")
expect(provider).not_to receive(:reconfig_package)
@@ -310,7 +310,7 @@ describe Chef::Provider::Package do
end
it "should debug log and not reconfigure the package if the response_file has not changed" do
- allow(current_resource).to receive(:version).and_return('1.0')
+ allow(current_resource).to receive(:version).and_return("1.0")
allow(new_resource).to receive(:response_file).and_return(true)
expect(provider).to receive(:get_preseed_file).and_return(false)
allow(provider).to receive(:preseed_package).and_return(false)
@@ -323,19 +323,19 @@ describe Chef::Provider::Package do
describe "when running commands to be implemented by subclasses" do
it "should raises UnsupportedAction for install" do
- expect { provider.install_package('emacs', '1.4.2') }.to raise_error(Chef::Exceptions::UnsupportedAction)
+ expect { provider.install_package("emacs", "1.4.2") }.to raise_error(Chef::Exceptions::UnsupportedAction)
end
it "should raises UnsupportedAction for upgrade" do
- expect { provider.upgrade_package('emacs', '1.4.2') }.to raise_error(Chef::Exceptions::UnsupportedAction)
+ expect { provider.upgrade_package("emacs", "1.4.2") }.to raise_error(Chef::Exceptions::UnsupportedAction)
end
it "should raises UnsupportedAction for remove" do
- expect { provider.remove_package('emacs', '1.4.2') }.to raise_error(Chef::Exceptions::UnsupportedAction)
+ expect { provider.remove_package("emacs", "1.4.2") }.to raise_error(Chef::Exceptions::UnsupportedAction)
end
it "should raises UnsupportedAction for purge" do
- expect { provider.purge_package('emacs', '1.4.2') }.to raise_error(Chef::Exceptions::UnsupportedAction)
+ expect { provider.purge_package("emacs", "1.4.2") }.to raise_error(Chef::Exceptions::UnsupportedAction)
end
it "should raise UnsupportedAction for preseed_package" do
@@ -344,7 +344,7 @@ describe Chef::Provider::Package do
end
it "should raise UnsupportedAction for reconfig" do
- expect { provider.reconfig_package('emacs', '1.4.2') }.to raise_error(Chef::Exceptions::UnsupportedAction)
+ expect { provider.reconfig_package("emacs", "1.4.2") }.to raise_error(Chef::Exceptions::UnsupportedAction)
end
end
@@ -360,52 +360,52 @@ describe Chef::Provider::Package do
end
let(:run_context) { Chef::RunContext.new(node, cookbook_collection, events) }
let(:new_resource) do
- new_resource = Chef::Resource::Package.new('emacs')
- new_resource.response_file('java.response')
- new_resource.cookbook_name = 'java'
+ new_resource = Chef::Resource::Package.new("emacs")
+ new_resource.response_file("java.response")
+ new_resource.cookbook_name = "java"
new_resource
end
describe "creating the cookbook file resource to fetch the response file" do
before do
- expect(Chef::FileCache).to receive(:create_cache_path).with('preseed/java').and_return("/tmp/preseed/java")
+ expect(Chef::FileCache).to receive(:create_cache_path).with("preseed/java").and_return("/tmp/preseed/java")
end
it "sets the preseed resource's runcontext to its own run context" do
allow(Chef::FileCache).to receive(:create_cache_path).and_return("/tmp/preseed/java")
- expect(provider.preseed_resource('java', '6').run_context).not_to be_nil
- expect(provider.preseed_resource('java', '6').run_context).to equal(provider.run_context)
+ expect(provider.preseed_resource("java", "6").run_context).not_to be_nil
+ expect(provider.preseed_resource("java", "6").run_context).to equal(provider.run_context)
end
it "should set the cookbook name of the remote file to the new resources cookbook name" do
- expect(provider.preseed_resource('java', '6').cookbook_name).to eq('java')
+ expect(provider.preseed_resource("java", "6").cookbook_name).to eq("java")
end
it "should set remote files source to the new resources response file" do
- expect(provider.preseed_resource('java', '6').source).to eq('java.response')
+ expect(provider.preseed_resource("java", "6").source).to eq("java.response")
end
it "should never back up the cached response file" do
- expect(provider.preseed_resource('java', '6').backup).to be_falsey
+ expect(provider.preseed_resource("java", "6").backup).to be_falsey
end
it "sets the install path of the resource to $file_cache/$cookbook/$pkg_name-$pkg_version.seed" do
- expect(provider.preseed_resource('java', '6').path).to eq('/tmp/preseed/java/java-6.seed')
+ expect(provider.preseed_resource("java", "6").path).to eq("/tmp/preseed/java/java-6.seed")
end
end
describe "when installing the preseed file to the cache location" do
- let(:response_file_destination) { Dir.tmpdir + '/preseed--java--java-6.seed' }
+ let(:response_file_destination) { Dir.tmpdir + "/preseed--java--java-6.seed" }
let(:response_file_resource) {
response_file_resource = Chef::Resource::CookbookFile.new(response_file_destination, run_context)
- response_file_resource.cookbook_name = 'java'
+ response_file_resource.cookbook_name = "java"
response_file_resource.backup(false)
- response_file_resource.source('java.response')
+ response_file_resource.source("java.response")
response_file_resource
}
before do
- expect(provider).to receive(:preseed_resource).with('java', '6').and_return(response_file_resource)
+ expect(provider).to receive(:preseed_resource).with("java", "6").and_return(response_file_resource)
end
after do
@@ -547,7 +547,7 @@ describe "Subclass with use_multipackage_api" do
current_resource.package_name "vim"
current_resource.version [ "1.0" ]
allow(new_resource).to receive(:response_file).and_return(true)
- expect(provider).to receive(:get_preseed_file).and_return('/var/cache/preseed-test')
+ expect(provider).to receive(:get_preseed_file).and_return("/var/cache/preseed-test")
allow(provider).to receive(:preseed_package).and_return(true)
allow(provider).to receive(:reconfig_package).and_return(true)
expect(provider).to receive(:reconfig_package).with(
@@ -563,8 +563,8 @@ describe "Chef::Provider::Package - Multi" do
let(:node) { Chef::Node.new }
let(:events) { Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
- let(:new_resource) { Chef::Resource::Package.new(['emacs', 'vi']) }
- let(:current_resource) { Chef::Resource::Package.new(['emacs', 'vi']) }
+ let(:new_resource) { Chef::Resource::Package.new(["emacs", "vi"]) }
+ let(:current_resource) { Chef::Resource::Package.new(["emacs", "vi"]) }
let(:candidate_version) { [ "1.0", "6.2" ] }
let(:provider) do
provider = Chef::Provider::Package.new(new_resource, run_context)
@@ -590,30 +590,30 @@ describe "Chef::Provider::Package - Multi" do
it "installs the candidate versions when some are installed" do
expect(provider).to receive(:install_package).with(
- [ 'vi' ],
- [ '6.2' ],
+ [ "vi" ],
+ [ "6.2" ],
).and_return(true)
- current_resource.version(['1.0', nil])
+ current_resource.version(["1.0", nil])
provider.run_action(:install)
expect(new_resource).to be_updated
end
it "installs the specified version when some are out of date" do
- current_resource.version(['1.0', '6.2'])
- new_resource.version(['1.0', '6.1'])
+ current_resource.version(["1.0", "6.2"])
+ new_resource.version(["1.0", "6.1"])
provider.run_action(:install)
expect(new_resource).to be_updated
end
it "does not install any version if all are installed at the right version" do
- current_resource.version(['1.0', '6.2'])
- new_resource.version(['1.0', '6.2'])
+ current_resource.version(["1.0", "6.2"])
+ new_resource.version(["1.0", "6.2"])
provider.run_action(:install)
expect(new_resource).not_to be_updated_by_last_action
end
it "does not install any version if all are installed, and no version was specified" do
- current_resource.version(['1.0', '6.2'])
+ current_resource.version(["1.0", "6.2"])
provider.run_action(:install)
expect(new_resource).not_to be_updated_by_last_action
end
@@ -625,42 +625,42 @@ describe "Chef::Provider::Package - Multi" do
end
it "raises an exception if one is not installed and no candidates are available" do
- current_resource.version(['1.0', nil])
- provider.candidate_version = ['1.0', nil]
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = ["1.0", nil]
expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
end
it "does not raise an exception if the packages are installed or have a candidate" do
- current_resource.version(['1.0', nil])
- provider.candidate_version = [nil, '6.2']
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = [nil, "6.2"]
expect { provider.run_action(:install) }.not_to raise_error
end
it "raises an exception if an explicit version is asked for, an old version is installed, but no candidate" do
- new_resource.version ['1.0', '6.2']
- current_resource.version(['1.0', '6.1'])
- provider.candidate_version = ['1.0', nil]
+ new_resource.version ["1.0", "6.2"]
+ current_resource.version(["1.0", "6.1"])
+ provider.candidate_version = ["1.0", nil]
expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
end
it "does not raise an exception if an explicit version is asked for, and is installed, but no candidate" do
- new_resource.version ['1.0', '6.2']
- current_resource.version(['1.0', '6.2'])
- provider.candidate_version = ['1.0', nil]
+ new_resource.version ["1.0", "6.2"]
+ current_resource.version(["1.0", "6.2"])
+ provider.candidate_version = ["1.0", nil]
expect { provider.run_action(:install) }.not_to raise_error
end
it "raise an exception if an explicit version is asked for, and is not installed, and no candidate" do
- new_resource.version ['1.0', '6.2']
- current_resource.version(['1.0', nil])
- provider.candidate_version = ['1.0', nil]
+ new_resource.version ["1.0", "6.2"]
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = ["1.0", nil]
expect { provider.run_action(:install) }.to raise_error(Chef::Exceptions::Package)
end
it "does not raise an exception if an explicit version is asked for, and is not installed, and there is a candidate" do
- new_resource.version ['1.0', '6.2']
- current_resource.version(['1.0', nil])
- provider.candidate_version = ['1.0', '6.2']
+ new_resource.version ["1.0", "6.2"]
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = ["1.0", "6.2"]
expect { provider.run_action(:install) }.not_to raise_error
end
end
@@ -672,7 +672,7 @@ describe "Chef::Provider::Package - Multi" do
end
it "should upgrade the package if the current versions are not the candidate version" do
- current_resource.version ['0.9', '6.1']
+ current_resource.version ["0.9", "6.1"]
expect(provider).to receive(:upgrade_package).with(
new_resource.package_name,
provider.candidate_version,
@@ -682,7 +682,7 @@ describe "Chef::Provider::Package - Multi" do
end
it "should upgrade the package if some of current versions are not the candidate versions" do
- current_resource.version ['1.0', '6.1']
+ current_resource.version ["1.0", "6.1"]
expect(provider).to receive(:upgrade_package).with(
["vi"],
["6.2"],
@@ -692,7 +692,7 @@ describe "Chef::Provider::Package - Multi" do
end
it "should not install the package if the current versions are the candidate version" do
- current_resource.version ['1.0', '6.2']
+ current_resource.version ["1.0", "6.2"]
expect(provider).not_to receive(:upgrade_package)
provider.run_action(:upgrade)
expect(new_resource).not_to be_updated_by_last_action
@@ -705,20 +705,20 @@ describe "Chef::Provider::Package - Multi" do
end
it "should raise an exception if one is not installed and no candidates are available" do
- current_resource.version(['1.0', nil])
- provider.candidate_version = ['1.0', nil]
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = ["1.0", nil]
expect { provider.run_action(:upgrade) }.to raise_error(Chef::Exceptions::Package)
end
it "should not raise an exception if the packages are installed or have a candidate" do
- current_resource.version(['1.0', nil])
- provider.candidate_version = [nil, '6.2']
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = [nil, "6.2"]
expect { provider.run_action(:upgrade) }.not_to raise_error
end
it "should not raise an exception if the packages are installed or have a candidate" do
- current_resource.version(['1.0', nil])
- provider.candidate_version = [nil, '6.2']
+ current_resource.version(["1.0", nil])
+ provider.candidate_version = [nil, "6.2"]
expect { provider.run_action(:upgrade) }.not_to raise_error
end
end
@@ -726,44 +726,44 @@ describe "Chef::Provider::Package - Multi" do
describe "When removing multiple packages " do
before(:each) do
allow(provider).to receive(:remove_package).and_return(true)
- current_resource.version ['1.0', '6.2']
+ current_resource.version ["1.0", "6.2"]
end
it "should remove the packages if all are installed" do
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with(['emacs', 'vi'], nil)
+ expect(provider).to receive(:remove_package).with(["emacs", "vi"], nil)
provider.run_action(:remove)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
end
it "should remove the packages if some are installed" do
- current_resource.version ['1.0', nil]
+ current_resource.version ["1.0", nil]
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with(['emacs', 'vi'], nil)
+ expect(provider).to receive(:remove_package).with(["emacs", "vi"], nil)
provider.run_action(:remove)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
end
it "should remove the packages at a specific version if they are installed at that version" do
- new_resource.version ['1.0', '6.2']
+ new_resource.version ["1.0", "6.2"]
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with(['emacs', 'vi'], ['1.0', '6.2'])
+ expect(provider).to receive(:remove_package).with(["emacs", "vi"], ["1.0", "6.2"])
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
it "should remove the packages at a specific version any are is installed at that version" do
- new_resource.version ['0.5', '6.2']
+ new_resource.version ["0.5", "6.2"]
expect(provider).to be_removing_package
- expect(provider).to receive(:remove_package).with(['emacs', 'vi'], ['0.5', '6.2'])
+ expect(provider).to receive(:remove_package).with(["emacs", "vi"], ["0.5", "6.2"])
provider.run_action(:remove)
expect(new_resource).to be_updated_by_last_action
end
it "should not remove the packages at a specific version if they are not installed at that version" do
- new_resource.version ['0.5', '6.0']
+ new_resource.version ["0.5", "6.0"]
expect(provider).not_to be_removing_package
expect(provider).not_to receive(:remove_package)
provider.run_action(:remove)
@@ -782,44 +782,44 @@ describe "Chef::Provider::Package - Multi" do
describe "When purging multiple packages " do
before(:each) do
allow(provider).to receive(:purge_package).and_return(true)
- current_resource.version ['1.0', '6.2']
+ current_resource.version ["1.0", "6.2"]
end
it "should purge the packages if all are installed" do
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with(['emacs', 'vi'], nil)
+ expect(provider).to receive(:purge_package).with(["emacs", "vi"], nil)
provider.run_action(:purge)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
end
it "should purge the packages if some are installed" do
- current_resource.version ['1.0', nil]
+ current_resource.version ["1.0", nil]
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with(['emacs', 'vi'], nil)
+ expect(provider).to receive(:purge_package).with(["emacs", "vi"], nil)
provider.run_action(:purge)
expect(new_resource).to be_updated
expect(new_resource).to be_updated_by_last_action
end
it "should purge the packages at a specific version if they are installed at that version" do
- new_resource.version ['1.0', '6.2']
+ new_resource.version ["1.0", "6.2"]
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with(['emacs', 'vi'], ['1.0', '6.2'])
+ expect(provider).to receive(:purge_package).with(["emacs", "vi"], ["1.0", "6.2"])
provider.run_action(:purge)
expect(new_resource).to be_updated_by_last_action
end
it "should purge the packages at a specific version any are is installed at that version" do
- new_resource.version ['0.5', '6.2']
+ new_resource.version ["0.5", "6.2"]
expect(provider).to be_removing_package
- expect(provider).to receive(:purge_package).with(['emacs', 'vi'], ['0.5', '6.2'])
+ expect(provider).to receive(:purge_package).with(["emacs", "vi"], ["0.5", "6.2"])
provider.run_action(:purge)
expect(new_resource).to be_updated_by_last_action
end
it "should not purge the packages at a specific version if they are not installed at that version" do
- new_resource.version ['0.5', '6.0']
+ new_resource.version ["0.5", "6.0"]
expect(provider).not_to be_removing_package
expect(provider).not_to receive(:purge_package)
provider.run_action(:purge)
diff --git a/spec/unit/provider/powershell_script_spec.rb b/spec/unit/provider/powershell_script_spec.rb
index 121973763d..c4a712d69a 100644
--- a/spec/unit/provider/powershell_script_spec.rb
+++ b/spec/unit/provider/powershell_script_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::PowershellScript, "action_run" do
let(:powershell_version) { nil }
@@ -33,12 +33,12 @@ describe Chef::Provider::PowershellScript, "action_run" do
let(:provider) {
empty_events = Chef::EventDispatch::Dispatcher.new
run_context = Chef::RunContext.new(node, {}, empty_events)
- new_resource = Chef::Resource::PowershellScript.new('run some powershell code', run_context)
+ new_resource = Chef::Resource::PowershellScript.new("run some powershell code", run_context)
Chef::Provider::PowershellScript.new(new_resource, run_context)
}
- context 'when setting interpreter flags' do
- context 'on nano' do
+ context "when setting interpreter flags" do
+ context "on nano" do
before(:each) do
allow(Chef::Platform).to receive(:windows_nano_server?).and_return(true)
allow(provider).to receive(:is_forced_32bit).and_return(false)
@@ -48,12 +48,12 @@ describe Chef::Provider::PowershellScript, "action_run" do
end
it "sets the -Command flag as the last flag" do
- flags = provider.command.split(' ').keep_if { |flag| flag =~ /^-/ }
+ flags = provider.command.split(" ").keep_if { |flag| flag =~ /^-/ }
expect(flags.pop).to eq("-Command")
end
end
- context 'not on nano' do
+ context "not on nano" do
before(:each) do
allow(Chef::Platform).to receive(:windows_nano_server?).and_return(false)
allow(provider).to receive(:is_forced_32bit).and_return(false)
@@ -63,36 +63,36 @@ describe Chef::Provider::PowershellScript, "action_run" do
end
it "sets the -File flag as the last flag" do
- flags = provider.command.split(' ').keep_if { |flag| flag =~ /^-/ }
+ flags = provider.command.split(" ").keep_if { |flag| flag =~ /^-/ }
expect(flags.pop).to eq("-File")
end
let(:execution_policy_flag) do
execution_policy_index = 0
- provider_flags = provider.flags.split(' ')
+ provider_flags = provider.flags.split(" ")
execution_policy_specified = false
provider_flags.find do | value |
execution_policy_index += 1
- execution_policy_specified = value.downcase == '-ExecutionPolicy'.downcase
+ execution_policy_specified = value.downcase == "-ExecutionPolicy".downcase
end
execution_policy = execution_policy_specified ? provider_flags[execution_policy_index] : nil
end
- context 'when running with an unspecified PowerShell version' do
+ context "when running with an unspecified PowerShell version" do
let(:powershell_version) { nil }
it "sets the -ExecutionPolicy flag to 'Unrestricted' by default" do
- expect(execution_policy_flag.downcase).to eq('unrestricted'.downcase)
+ expect(execution_policy_flag.downcase).to eq("unrestricted".downcase)
end
end
- { '2.0' => 'Unrestricted',
- '2.5' => 'Unrestricted',
- '3.0' => 'Bypass',
- '3.6' => 'Bypass',
- '4.0' => 'Bypass',
- '5.0' => 'Bypass' }.each do | version_policy |
+ { "2.0" => "Unrestricted",
+ "2.5" => "Unrestricted",
+ "3.0" => "Bypass",
+ "3.6" => "Bypass",
+ "4.0" => "Bypass",
+ "5.0" => "Bypass" }.each do | version_policy |
let(:powershell_version) { version_policy[0].to_f }
context "when running PowerShell version #{version_policy[0]}" do
let(:powershell_version) { version_policy[0].to_f }
diff --git a/spec/unit/provider/registry_key_spec.rb b/spec/unit/provider/registry_key_spec.rb
index 47543ffe39..ef03ec4012 100644
--- a/spec/unit/provider/registry_key_spec.rb
+++ b/spec/unit/provider/registry_key_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
shared_examples_for "a registry key" do
before(:each) do
diff --git a/spec/unit/provider/remote_directory_spec.rb b/spec/unit/provider/remote_directory_spec.rb
index 6426dafd79..0103169e84 100644
--- a/spec/unit/provider/remote_directory_spec.rb
+++ b/spec/unit/provider/remote_directory_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'digest/md5'
-require 'tmpdir'
-require 'chef/mixin/file_class'
+require "spec_helper"
+require "digest/md5"
+require "tmpdir"
+require "chef/mixin/file_class"
class Chef::CFCCheck
include Chef::Mixin::FileClass
@@ -32,7 +32,7 @@ describe Chef::Provider::RemoteDirectory do
@resource = Chef::Resource::RemoteDirectory.new(File.join(Dir.tmpdir, "tafty"))
# in CHEF_SPEC_DATA/cookbooks/openldap/files/default/remotedir
@resource.source "remotedir"
- @resource.cookbook('openldap')
+ @resource.cookbook("openldap")
@cookbook_repo = ::File.expand_path(::File.join(CHEF_SPEC_DATA, "cookbooks"))
Chef::Cookbook::FileVendor.fetch_from_disk(@cookbook_repo)
@@ -121,12 +121,12 @@ describe Chef::Provider::RemoteDirectory do
it "transfers the directory with all contents" do
@provider.run_action(:create)
- expect(::File.exist?(@destination_dir + '/remote_dir_file1.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remote_dir_file2.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file2.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remotesubdir/.a_dotfile')).to be_truthy
- expect(::File.exist?(@destination_dir + '/.a_dotdir/.a_dotfile_in_a_dotdir')).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remote_dir_file1.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remote_dir_file2.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remotesubdir/remote_subdir_file1.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remotesubdir/remote_subdir_file2.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remotesubdir/.a_dotfile")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/.a_dotdir/.a_dotfile_in_a_dotdir")).to be_truthy
end
describe "only if it is missing" do
@@ -134,15 +134,15 @@ describe Chef::Provider::RemoteDirectory do
@resource.overwrite(true)
@provider.run_action(:create)
- File.open(@destination_dir + '/remote_dir_file1.txt', 'a') {|f| f.puts "blah blah blah" }
- File.open(@destination_dir + '/remotesubdir/remote_subdir_file1.txt', 'a') {|f| f.puts "blah blah blah" }
- file1md5 = Digest::MD5.hexdigest(File.read(@destination_dir + '/remote_dir_file1.txt'))
- subdirfile1md5 = Digest::MD5.hexdigest(File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt'))
+ File.open(@destination_dir + "/remote_dir_file1.txt", "a") {|f| f.puts "blah blah blah" }
+ File.open(@destination_dir + "/remotesubdir/remote_subdir_file1.txt", "a") {|f| f.puts "blah blah blah" }
+ file1md5 = Digest::MD5.hexdigest(File.read(@destination_dir + "/remote_dir_file1.txt"))
+ subdirfile1md5 = Digest::MD5.hexdigest(File.read(@destination_dir + "/remotesubdir/remote_subdir_file1.txt"))
@provider.run_action(:create_if_missing)
- expect(file1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + '/remote_dir_file1.txt')))).to be_truthy
- expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')))).to be_truthy
+ expect(file1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + "/remote_dir_file1.txt")))).to be_truthy
+ expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(File.read(@destination_dir + "/remotesubdir/remote_subdir_file1.txt")))).to be_truthy
end
end
@@ -151,35 +151,35 @@ describe Chef::Provider::RemoteDirectory do
it "removes existing files if purge is true" do
@provider.run_action(:create)
- FileUtils.touch(@destination_dir + '/marked_for_death.txt')
- FileUtils.touch(@destination_dir + '/remotesubdir/marked_for_death_again.txt')
+ FileUtils.touch(@destination_dir + "/marked_for_death.txt")
+ FileUtils.touch(@destination_dir + "/remotesubdir/marked_for_death_again.txt")
@provider.run_action(:create)
- expect(::File.exist?(@destination_dir + '/remote_dir_file1.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remote_dir_file2.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')).to be_truthy
- expect(::File.exist?(@destination_dir + '/remotesubdir/remote_subdir_file2.txt')).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remote_dir_file1.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remote_dir_file2.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remotesubdir/remote_subdir_file1.txt")).to be_truthy
+ expect(::File.exist?(@destination_dir + "/remotesubdir/remote_subdir_file2.txt")).to be_truthy
- expect(::File.exist?(@destination_dir + '/marked_for_death.txt')).to be_falsey
- expect(::File.exist?(@destination_dir + '/remotesubdir/marked_for_death_again.txt')).to be_falsey
+ expect(::File.exist?(@destination_dir + "/marked_for_death.txt")).to be_falsey
+ expect(::File.exist?(@destination_dir + "/remotesubdir/marked_for_death_again.txt")).to be_falsey
end
it "removes files in subdirectories before files above" do
@provider.run_action(:create)
- FileUtils.mkdir_p(@destination_dir + '/a/multiply/nested/directory/')
- FileUtils.touch(@destination_dir + '/a/foo.txt')
- FileUtils.touch(@destination_dir + '/a/multiply/bar.txt')
- FileUtils.touch(@destination_dir + '/a/multiply/nested/baz.txt')
- FileUtils.touch(@destination_dir + '/a/multiply/nested/directory/qux.txt')
+ FileUtils.mkdir_p(@destination_dir + "/a/multiply/nested/directory/")
+ FileUtils.touch(@destination_dir + "/a/foo.txt")
+ FileUtils.touch(@destination_dir + "/a/multiply/bar.txt")
+ FileUtils.touch(@destination_dir + "/a/multiply/nested/baz.txt")
+ FileUtils.touch(@destination_dir + "/a/multiply/nested/directory/qux.txt")
@provider.run_action(:create)
- expect(::File.exist?(@destination_dir + '/a/foo.txt')).to be_falsey
- expect(::File.exist?(@destination_dir + '/a/multiply/bar.txt')).to be_falsey
- expect(::File.exist?(@destination_dir + '/a/multiply/nested/baz.txt')).to be_falsey
- expect(::File.exist?(@destination_dir + '/a/multiply/nested/directory/qux.txt')).to be_falsey
+ expect(::File.exist?(@destination_dir + "/a/foo.txt")).to be_falsey
+ expect(::File.exist?(@destination_dir + "/a/multiply/bar.txt")).to be_falsey
+ expect(::File.exist?(@destination_dir + "/a/multiply/nested/baz.txt")).to be_falsey
+ expect(::File.exist?(@destination_dir + "/a/multiply/nested/directory/qux.txt")).to be_falsey
end
it "removes directory symlinks properly", :not_supported_on_win2k3 do
- symlinked_dir_path = @destination_dir + '/symlinked_dir'
+ symlinked_dir_path = @destination_dir + "/symlinked_dir"
@provider.action = :create
@provider.run_action
@@ -207,13 +207,13 @@ describe Chef::Provider::RemoteDirectory do
it "leaves modifications alone" do
@provider.run_action(:create)
- ::File.open(@destination_dir + '/remote_dir_file1.txt', 'a') {|f| f.puts "blah blah blah" }
- ::File.open(@destination_dir + '/remotesubdir/remote_subdir_file1.txt', 'a') {|f| f.puts "blah blah blah" }
- file1md5 = Digest::MD5.hexdigest(::File.read(@destination_dir + '/remote_dir_file1.txt'))
- subdirfile1md5 = Digest::MD5.hexdigest(::File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt'))
+ ::File.open(@destination_dir + "/remote_dir_file1.txt", "a") {|f| f.puts "blah blah blah" }
+ ::File.open(@destination_dir + "/remotesubdir/remote_subdir_file1.txt", "a") {|f| f.puts "blah blah blah" }
+ file1md5 = Digest::MD5.hexdigest(::File.read(@destination_dir + "/remote_dir_file1.txt"))
+ subdirfile1md5 = Digest::MD5.hexdigest(::File.read(@destination_dir + "/remotesubdir/remote_subdir_file1.txt"))
@provider.run_action(:create)
- expect(file1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + '/remote_dir_file1.txt')))).to be_truthy
- expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + '/remotesubdir/remote_subdir_file1.txt')))).to be_truthy
+ expect(file1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + "/remote_dir_file1.txt")))).to be_truthy
+ expect(subdirfile1md5.eql?(Digest::MD5.hexdigest(::File.read(@destination_dir + "/remotesubdir/remote_subdir_file1.txt")))).to be_truthy
end
end
diff --git a/spec/unit/provider/remote_file/cache_control_data_spec.rb b/spec/unit/provider/remote_file/cache_control_data_spec.rb
index c154c4228e..a0c200bc79 100644
--- a/spec/unit/provider/remote_file/cache_control_data_spec.rb
+++ b/spec/unit/provider/remote_file/cache_control_data_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'uri'
+require "spec_helper"
+require "uri"
CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH = 64
CACHE_FILE_CHECKSUM_HEX_LENGTH = 32
@@ -136,7 +136,7 @@ describe Chef::Provider::RemoteFile::CacheControlData do
end
context "and it still is valid JSON" do
- let(:cache_json_data) { '' }
+ let(:cache_json_data) { "" }
it "returns empty cache control data" do
expect(cache_control_data.etag).to be_nil
@@ -214,16 +214,16 @@ describe Chef::Provider::RemoteFile::CacheControlData do
# local file system path limits resulting in exceptions from
# file system API's on both Windows and Unix systems.
context "and the URI results in a file cache path that exceeds #{CACHE_FILE_PATH_LIMIT} characters in length" do
- let(:long_remote_path) { "http://www.bing.com/" + ('0' * (CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH * 2 )) }
+ let(:long_remote_path) { "http://www.bing.com/" + ("0" * (CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH * 2 )) }
let(:uri) { URI.parse(long_remote_path) }
let(:truncated_remote_uri) { URI.parse(long_remote_path[0...CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH]) }
let(:truncated_file_cache_path) do
cache_control_data_truncated = Chef::Provider::RemoteFile::CacheControlData.load_and_validate(truncated_remote_uri, current_file_checksum)
- cache_control_data_truncated.send('sanitized_cache_file_basename')[0...CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH]
+ cache_control_data_truncated.send("sanitized_cache_file_basename")[0...CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH]
end
it "truncates the file cache path to 102 characters" do
- normalized_cache_path = cache_control_data.send('sanitized_cache_file_basename')
+ normalized_cache_path = cache_control_data.send("sanitized_cache_file_basename")
expect(Chef::FileCache).to receive(:store).with("remote_file/" + normalized_cache_path, cache_control_data.json_data)
@@ -233,7 +233,7 @@ describe Chef::Provider::RemoteFile::CacheControlData do
end
it "uses a file cache path that starts with the first #{CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH} characters of the URI" do
- normalized_cache_path = cache_control_data.send('sanitized_cache_file_basename')
+ normalized_cache_path = cache_control_data.send("sanitized_cache_file_basename")
expect(truncated_file_cache_path.length).to eq(CACHE_FILE_TRUNCATED_FRIENDLY_FILE_NAME_LENGTH)
expect(normalized_cache_path.start_with?(truncated_file_cache_path)).to eq(true)
diff --git a/spec/unit/provider/remote_file/content_spec.rb b/spec/unit/provider/remote_file/content_spec.rb
index 2639c39faa..c1e827887a 100644
--- a/spec/unit/provider/remote_file/content_spec.rb
+++ b/spec/unit/provider/remote_file/content_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::Content do
diff --git a/spec/unit/provider/remote_file/fetcher_spec.rb b/spec/unit/provider/remote_file/fetcher_spec.rb
index 8bd3b7c625..10742bc671 100644
--- a/spec/unit/provider/remote_file/fetcher_spec.rb
+++ b/spec/unit/provider/remote_file/fetcher_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::Fetcher do
diff --git a/spec/unit/provider/remote_file/ftp_spec.rb b/spec/unit/provider/remote_file/ftp_spec.rb
index dbbddd8e84..4292a744a5 100644
--- a/spec/unit/provider/remote_file/ftp_spec.rb
+++ b/spec/unit/provider/remote_file/ftp_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::FTP do
let(:enclosing_directory) {
diff --git a/spec/unit/provider/remote_file/http_spec.rb b/spec/unit/provider/remote_file/http_spec.rb
index d9cfaa15eb..a08e65add3 100644
--- a/spec/unit/provider/remote_file/http_spec.rb
+++ b/spec/unit/provider/remote_file/http_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::HTTP do
diff --git a/spec/unit/provider/remote_file/local_file_spec.rb b/spec/unit/provider/remote_file/local_file_spec.rb
index 575996a540..791d411e03 100644
--- a/spec/unit/provider/remote_file/local_file_spec.rb
+++ b/spec/unit/provider/remote_file/local_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::LocalFile do
diff --git a/spec/unit/provider/remote_file/network_file_spec.rb b/spec/unit/provider/remote_file/network_file_spec.rb
index 3666a47468..38e0acd13f 100644
--- a/spec/unit/provider/remote_file/network_file_spec.rb
+++ b/spec/unit/provider/remote_file/network_file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RemoteFile::NetworkFile do
diff --git a/spec/unit/provider/remote_file_spec.rb b/spec/unit/provider/remote_file_spec.rb
index de4a897847..d6381905e9 100644
--- a/spec/unit/provider/remote_file_spec.rb
+++ b/spec/unit/provider/remote_file_spec.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'support/shared/unit/provider/file'
+require "support/shared/unit/provider/file"
describe Chef::Provider::RemoteFile do
@@ -32,12 +32,12 @@ describe Chef::Provider::RemoteFile do
end
let(:content) do
- content = double('Chef::Provider::File::Content::RemoteFile')
+ content = double("Chef::Provider::File::Content::RemoteFile")
end
- 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(: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(:enclosing_directory) {
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
}
diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb
index ff68eea895..0205df430c 100644
--- a/spec/unit/provider/route_spec.rb
+++ b/spec/unit/provider/route_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Route do
before do
@@ -25,9 +25,9 @@ describe Chef::Provider::Route do
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, @cookbook_collection, @events)
- @new_resource = Chef::Resource::Route.new('10.0.0.10')
+ @new_resource = Chef::Resource::Route.new("10.0.0.10")
@new_resource.gateway "10.0.0.9"
- @current_resource = Chef::Resource::Route.new('10.0.0.10')
+ @current_resource = Chef::Resource::Route.new("10.0.0.10")
@current_resource.gateway "10.0.0.9"
@provider = Chef::Provider::Route.new(@new_resource, @run_context)
@@ -36,14 +36,14 @@ describe Chef::Provider::Route do
describe Chef::Provider::Route, "hex2ip" do
it "should return nil if ip address is invalid" do
- expect(@provider.hex2ip('foo')).to be_nil # does not even look like an ip
- expect(@provider.hex2ip('ABCDEFGH')).to be_nil # 8 chars, but invalid
+ expect(@provider.hex2ip("foo")).to be_nil # does not even look like an ip
+ expect(@provider.hex2ip("ABCDEFGH")).to be_nil # 8 chars, but invalid
end
it "should return quad-dotted notation for a valid IP" do
- expect(@provider.hex2ip('01234567')).to eq('103.69.35.1')
- expect(@provider.hex2ip('0064a8c0')).to eq('192.168.100.0')
- expect(@provider.hex2ip('00FFFFFF')).to eq('255.255.255.0')
+ expect(@provider.hex2ip("01234567")).to eq("103.69.35.1")
+ expect(@provider.hex2ip("0064a8c0")).to eq("192.168.100.0")
+ expect(@provider.hex2ip("00FFFFFF")).to eq("255.255.255.0")
end
end
@@ -51,7 +51,7 @@ describe Chef::Provider::Route do
describe Chef::Provider::Route, "load_current_resource" do
context "on linux" do
before do
- @node.automatic_attrs[:os] = 'linux'
+ @node.automatic_attrs[:os] = "linux"
routing_table = "Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT\n" +
"eth0 0064A8C0 0984A8C0 0003 0 0 0 00FFFFFF 0 0 0\n"
route_file = StringIO.new(routing_table)
@@ -59,7 +59,7 @@ describe Chef::Provider::Route do
end
it "should set is_running to false when a route is not detected" do
- resource = Chef::Resource::Route.new('10.10.10.0/24')
+ resource = Chef::Resource::Route.new("10.10.10.0/24")
allow(resource).to receive(:gateway).and_return("10.0.0.1")
allow(resource).to receive(:device).and_return("eth0")
provider = Chef::Provider::Route.new(resource, @run_context)
@@ -69,7 +69,7 @@ describe Chef::Provider::Route do
end
it "should detect existing routes and set is_running attribute correctly" do
- resource = Chef::Resource::Route.new('192.168.100.0/24')
+ resource = Chef::Resource::Route.new("192.168.100.0/24")
allow(resource).to receive(:gateway).and_return("192.168.132.9")
allow(resource).to receive(:device).and_return("eth0")
provider = Chef::Provider::Route.new(resource, @run_context)
@@ -79,7 +79,7 @@ describe Chef::Provider::Route do
end
it "should use gateway value when matching routes" do
- resource = Chef::Resource::Route.new('192.168.100.0/24')
+ resource = Chef::Resource::Route.new("192.168.100.0/24")
allow(resource).to receive(:gateway).and_return("10.10.10.10")
allow(resource).to receive(:device).and_return("eth0")
provider = Chef::Provider::Route.new(resource, @run_context)
@@ -110,11 +110,11 @@ describe Chef::Provider::Route do
end
it "should not delete config file for :add action (CHEF-3332)" do
- @node.automatic_attrs[:platform] = 'centos'
+ @node.automatic_attrs[:platform] = "centos"
route_file = StringIO.new
expect(File).to receive(:new).and_return(route_file)
- @resource_add = Chef::Resource::Route.new('192.168.1.0/24 via 192.168.0.1')
+ @resource_add = Chef::Resource::Route.new("192.168.1.0/24 via 192.168.0.1")
@run_context.resource_collection << @resource_add
allow(@provider).to receive(:run_command).and_return(true)
@@ -145,7 +145,7 @@ describe Chef::Provider::Route do
describe Chef::Provider::Route, "generate_command for action_add" do
it "should include a netmask when a one is specified" do
- allow(@new_resource).to receive(:netmask).and_return('255.255.0.0')
+ allow(@new_resource).to receive(:netmask).and_return("255.255.0.0")
expect(@provider.generate_command(:add)).to match(/\/\d{1,2}\s/)
end
@@ -166,7 +166,7 @@ describe Chef::Provider::Route do
describe Chef::Provider::Route, "generate_command for action_delete" do
it "should include a netmask when a one is specified" do
- allow(@new_resource).to receive(:netmask).and_return('255.255.0.0')
+ allow(@new_resource).to receive(:netmask).and_return("255.255.0.0")
expect(@provider.generate_command(:delete)).to match(/\/\d{1,2}\s/)
end
@@ -187,7 +187,7 @@ describe Chef::Provider::Route do
describe Chef::Provider::Route, "config_file_contents for action_add" do
it "should include a netmask when a one is specified" do
- allow(@new_resource).to receive(:netmask).and_return('255.255.0.0')
+ allow(@new_resource).to receive(:netmask).and_return("255.255.0.0")
expect(@provider.config_file_contents(:add, { :target => @new_resource.target, :netmask => @new_resource.netmask})).to match(/\/\d{1,2}.*\n$/)
end
@@ -224,13 +224,13 @@ describe Chef::Provider::Route do
end
it "should put all routes for a device in a route config file" do
- @node.automatic_attrs[:platform] = 'centos'
+ @node.automatic_attrs[:platform] = "centos"
route_file = StringIO.new
expect(File).to receive(:new).and_return(route_file)
- @run_context.resource_collection << Chef::Resource::Route.new('192.168.1.0/24 via 192.168.0.1')
- @run_context.resource_collection << Chef::Resource::Route.new('192.168.2.0/24 via 192.168.0.1')
- @run_context.resource_collection << Chef::Resource::Route.new('192.168.3.0/24 via 192.168.0.1')
+ @run_context.resource_collection << Chef::Resource::Route.new("192.168.1.0/24 via 192.168.0.1")
+ @run_context.resource_collection << Chef::Resource::Route.new("192.168.2.0/24 via 192.168.0.1")
+ @run_context.resource_collection << Chef::Resource::Route.new("192.168.3.0/24 via 192.168.0.1")
@provider.action = :add
@provider.generate_config
diff --git a/spec/unit/provider/ruby_block_spec.rb b/spec/unit/provider/ruby_block_spec.rb
index 266c943367..c306d0ae9c 100644
--- a/spec/unit/provider/ruby_block_spec.rb
+++ b/spec/unit/provider/ruby_block_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::RubyBlock, "initialize" do
before(:each) do
diff --git a/spec/unit/provider/script_spec.rb b/spec/unit/provider/script_spec.rb
index 7cc5abbd15..e488b0ef79 100644
--- a/spec/unit/provider/script_spec.rb
+++ b/spec/unit/provider/script_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Script, "action_run" do
let(:node) { Chef::Node.new }
@@ -26,9 +26,9 @@ describe Chef::Provider::Script, "action_run" do
let(:run_context) { Chef::RunContext.new(node, {}, events) }
let(:new_resource) {
- new_resource = Chef::Resource::Script.new('run some perl code')
+ new_resource = Chef::Resource::Script.new("run some perl code")
new_resource.code "$| = 1; print 'i like beans'"
- new_resource.interpreter 'perl'
+ new_resource.interpreter "perl"
new_resource
}
@@ -58,9 +58,9 @@ describe Chef::Provider::Script, "action_run" do
context "#set_owner_and_group" do
it "sets the owner and group for the script file" do
- new_resource.user 'toor'
- new_resource.group 'wheel'
- expect(FileUtils).to receive(:chown).with('toor', 'wheel', tempfile.path)
+ new_resource.user "toor"
+ new_resource.group "wheel"
+ expect(FileUtils).to receive(:chown).with("toor", "wheel", tempfile.path)
provider.set_owner_and_group
end
end
@@ -99,13 +99,13 @@ describe Chef::Provider::Script, "action_run" do
expect(provider.command).to eq(%Q{"perl" "#{tempfile.path}"})
end
- it 'should call shell_out! with the command' do
+ it "should call shell_out! with the command" do
expect(provider).to receive(:shell_out!).with(provider.command, default_opts).and_return(true)
provider.action_run
end
it "should set the command to 'interpreter flags tempfile'" do
- new_resource.flags '-f'
+ new_resource.flags "-f"
expect(provider.command).to eq(%Q{"perl" -f "#{tempfile.path}"})
end
end
diff --git a/spec/unit/provider/service/aix_service_spec.rb b/spec/unit/provider/service/aix_service_spec.rb
index 5cca7d6f0a..abfc19d94f 100644
--- a/spec/unit/provider/service/aix_service_spec.rb
+++ b/spec/unit/provider/service/aix_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Aix do
before(:each) do
@@ -133,7 +133,7 @@ describe Chef::Provider::Service::Aix do
end
it "should call the start command for groups" do
- @provider.instance_eval('@is_resource_group = true')
+ @provider.instance_eval("@is_resource_group = true")
expect(@provider).to receive(:shell_out!).with("startsrc -g #{@new_resource.service_name}")
@provider.start_service
@@ -152,7 +152,7 @@ describe Chef::Provider::Service::Aix do
end
it "should call the stop command for groups" do
- @provider.instance_eval('@is_resource_group = true')
+ @provider.instance_eval("@is_resource_group = true")
expect(@provider).to receive(:shell_out!).with("stopsrc -g #{@new_resource.service_name}")
@provider.stop_service
@@ -171,7 +171,7 @@ describe Chef::Provider::Service::Aix do
end
it "should call the reload command for groups" do
- @provider.instance_eval('@is_resource_group = true')
+ @provider.instance_eval("@is_resource_group = true")
expect(@provider).to receive(:shell_out!).with("refresh -g #{@new_resource.service_name}")
@provider.reload_service
diff --git a/spec/unit/provider/service/aixinit_service_spec.rb b/spec/unit/provider/service/aixinit_service_spec.rb
index 9977343daa..9274c3001b 100644
--- a/spec/unit/provider/service/aixinit_service_spec.rb
+++ b/spec/unit/provider/service/aixinit_service_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+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)
@@ -102,7 +102,7 @@ describe Chef::Provider::Service::AixInit do
context "when the service doesn't set a priority" do
it "creates symlink with status S" do
- expect(@provider).to receive(:create_symlink).with(2,'S','')
+ expect(@provider).to receive(:create_symlink).with(2,"S","")
@provider.enable_service
end
@@ -114,7 +114,7 @@ describe Chef::Provider::Service::AixInit do
end
it "creates a symlink with status S and a priority" do
- expect(@provider).to receive(:create_symlink).with(2,'S',75)
+ expect(@provider).to receive(:create_symlink).with(2,"S",75)
@provider.enable_service
end
@@ -127,8 +127,8 @@ describe Chef::Provider::Service::AixInit do
end
it "create symlink with status start (S) or stop (K) and a priority " do
- expect(@provider).to receive(:create_symlink).with(2,'S',20)
- expect(@provider).to receive(:create_symlink).with(3,'K',10)
+ expect(@provider).to receive(:create_symlink).with(2,"S",20)
+ expect(@provider).to receive(:create_symlink).with(3,"K",10)
@provider.enable_service
end
@@ -142,7 +142,7 @@ describe Chef::Provider::Service::AixInit do
context "when the service doesn't set a priority" do
it "creates symlinks with status stop (K)" do
- expect(@provider).to receive(:create_symlink).with(2,'K','')
+ expect(@provider).to receive(:create_symlink).with(2,"K","")
@provider.disable_service
end
@@ -154,7 +154,7 @@ describe Chef::Provider::Service::AixInit do
end
it "create symlink with status stop (k) and a priority " do
- expect(@provider).to receive(:create_symlink).with(2,'K',25)
+ expect(@provider).to receive(:create_symlink).with(2,"K",25)
@provider.disable_service
end
@@ -167,7 +167,7 @@ describe Chef::Provider::Service::AixInit do
end
it "create symlink with status stop (k) and a priority " do
- expect(@provider).to receive(:create_symlink).with(3,'K',90)
+ expect(@provider).to receive(:create_symlink).with(3,"K",90)
@provider.disable_service
end
@@ -231,7 +231,7 @@ describe Chef::Provider::Service::AixInit do
it "the service is enabled" do
expect(@provider.current_resource).to receive(:enabled).with(true)
- expect(@provider.current_resource).to receive(:priority).with('')
+ expect(@provider.current_resource).to receive(:priority).with("")
@provider.set_current_resource_attributes
end
@@ -240,7 +240,7 @@ describe Chef::Provider::Service::AixInit do
context "when rc2.d contains only stop script (without priority)" do
before do
files = ["/etc/rc.d/rc2.d/Kapache"]
- @priority = {2 => [:stop, '']}
+ @priority = {2 => [:stop, ""]}
allow(Dir).to receive(:glob).with(["/etc/rc.d/rc2.d/[SK][0-9][0-9]#{@new_resource.service_name}", "/etc/rc.d/rc2.d/[SK]#{@new_resource.service_name}"]).and_return(files)
end
@@ -257,7 +257,7 @@ describe Chef::Provider::Service::AixInit do
files = ["/etc/rc.d/rc2.d/Sapache", "/etc/rc.d/rc2.d/Kapache"]
# FIXME: this is clearly buggy the duplicated keys do not work
#@priority = {2 => [:start, ''], 2 => [:stop, '']}
- @priority = {2 => [:stop, '']}
+ @priority = {2 => [:stop, ""]}
allow(Dir).to receive(:glob).with(["/etc/rc.d/rc2.d/[SK][0-9][0-9]#{@new_resource.service_name}", "/etc/rc.d/rc2.d/[SK]#{@new_resource.service_name}"]).and_return(files)
end
diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb
index 49be0e274c..40f87b24bf 100644
--- a/spec/unit/provider/service/arch_service_spec.rb
+++ b/spec/unit/provider/service/arch_service_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
# most of this code has been ripped from init_service_spec.rb
# and is only slightly modified to match "arch" needs.
@@ -45,7 +45,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" 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 => ""))
@provider.load_current_resource
- expect(@provider.current_resource.service_name).to eq('chef')
+ expect(@provider.current_resource.service_name).to eq("chef")
end
end
@@ -155,7 +155,7 @@ RUNNING_PS
it "should return existing entries in DAEMONS array" do
allow(::File).to receive(:read).with("/etc/rc.conf").and_return("DAEMONS=(network !apache ssh)")
- expect(@provider.daemons).to eq(['network', '!apache', 'ssh'])
+ expect(@provider.daemons).to eq(["network", "!apache", "ssh"])
end
context "when the current service status is known" do
@@ -180,7 +180,7 @@ RUNNING_PS
it "should add chef to DAEMONS array" do
allow(::File).to receive(:read).with("/etc/rc.conf").and_return("DAEMONS=(network)")
- expect(@provider).to receive(:update_daemons).with(['network', 'chef'])
+ expect(@provider).to receive(:update_daemons).with(["network", "chef"])
@provider.enable_service()
end
end
@@ -201,7 +201,7 @@ RUNNING_PS
it "should remove chef from DAEMONS array" do
allow(::File).to receive(:read).with("/etc/rc.conf").and_return("DAEMONS=(network chef)")
- expect(@provider).to receive(:update_daemons).with(['network', '!chef'])
+ expect(@provider).to receive(:update_daemons).with(["network", "!chef"])
@provider.disable_service()
end
end
diff --git a/spec/unit/provider/service/debian_service_spec.rb b/spec/unit/provider/service/debian_service_spec.rb
index 346e349db7..79c51d0ea7 100644
--- a/spec/unit/provider/service/debian_service_spec.rb
+++ b/spec/unit/provider/service/debian_service_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+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 cfc28c94d5..5bfa8ff6c0 100644
--- a/spec/unit/provider/service/freebsd_service_spec.rb
+++ b/spec/unit/provider/service/freebsd_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef::Provider::Service::Freebsd
public :service_enable_variable_name
diff --git a/spec/unit/provider/service/gentoo_service_spec.rb b/spec/unit/provider/service/gentoo_service_spec.rb
index b4155f9628..8bfac80002 100644
--- a/spec/unit/provider/service/gentoo_service_spec.rb
+++ b/spec/unit/provider/service/gentoo_service_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Gentoo do
before(:each) do
diff --git a/spec/unit/provider/service/init_service_spec.rb b/spec/unit/provider/service/init_service_spec.rb
index 827a4261e1..2594a732d9 100644
--- a/spec/unit/provider/service/init_service_spec.rb
+++ b/spec/unit/provider/service/init_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Init, "load_current_resource" do
before(:each) do
@@ -48,7 +48,7 @@ PS
it "should set the current resources service name to the new resources service name" do
@provider.load_current_resource
- expect(@current_resource.service_name).to eq('chef')
+ expect(@current_resource.service_name).to eq("chef")
end
describe "when the service supports status" do
diff --git a/spec/unit/provider/service/insserv_service_spec.rb b/spec/unit/provider/service/insserv_service_spec.rb
index 3799daebb4..fccbfac2b3 100644
--- a/spec/unit/provider/service/insserv_service_spec.rb
+++ b/spec/unit/provider/service/insserv_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Insserv do
before(:each) do
diff --git a/spec/unit/provider/service/invokercd_service_spec.rb b/spec/unit/provider/service/invokercd_service_spec.rb
index 81588c80e5..d8d860a291 100644
--- a/spec/unit/provider/service/invokercd_service_spec.rb
+++ b/spec/unit/provider/service/invokercd_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Invokercd, "load_current_resource" do
before(:each) do
@@ -48,7 +48,7 @@ PS
it "should set the current resources service name to the new resources service name" do
@provider.load_current_resource
- expect(@current_resource.service_name).to eq('chef')
+ expect(@current_resource.service_name).to eq("chef")
end
describe "when the service supports status" do
diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb
index 54183bdc3d..c3204700d7 100644
--- a/spec/unit/provider/service/macosx_spec.rb
+++ b/spec/unit/provider/service/macosx_spec.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Macosx do
describe ".gather_plist_dirs" do
context "when HOME directory is set" do
before do
- allow(Chef::Util::PathHelper).to receive(:home).with('Library', 'LaunchAgents').and_yield('/Users/someuser/Library/LaunchAgents')
+ allow(Chef::Util::PathHelper).to receive(:home).with("Library", "LaunchAgents").and_yield("/Users/someuser/Library/LaunchAgents")
end
it "includes users's LaunchAgents folder" do
@@ -32,7 +32,7 @@ describe Chef::Provider::Service::Macosx do
context "when HOME directory is not set" do
before do
- allow(Chef::Util::PathHelper).to receive(:home).with('Library', 'LaunchAgents').and_return(nil)
+ allow(Chef::Util::PathHelper).to receive(:home).with("Library", "LaunchAgents").and_return(nil)
end
it "doesn't include user's LaunchAgents folder" do
@@ -61,20 +61,20 @@ XML
["Daemon", "Agent"].each do |service_type|
["redis-server", "io.redis.redis-server"].each do |service_name|
["10.9", "10.10", "10.11"].each do |platform_version|
- let(:plist) {'/Library/LaunchDaemons/io.redis.redis-server.plist'}
+ let(:plist) {"/Library/LaunchDaemons/io.redis.redis-server.plist"}
let(:session) { StringIO.new }
- if service_type == 'Agent'
- let(:plist) {'/Library/LaunchAgents/io.redis.redis-server.plist'}
- let(:session) {'-S Aqua '}
- let(:su_cmd) {'su -l igor -c'}
+ if service_type == "Agent"
+ let(:plist) {"/Library/LaunchAgents/io.redis.redis-server.plist"}
+ let(:session) {"-S Aqua "}
+ let(:su_cmd) {"su -l igor -c"}
if platform_version == "10.9"
- let(:su_cmd) {'su igor -c'}
+ let(:su_cmd) {"su igor -c"}
end
end
- let(:service_label) {'io.redis.redis-server'}
+ let(:service_label) {"io.redis.redis-server"}
before do
allow(Dir).to receive(:glob).and_return([plist], [])
- allow(Etc).to receive(:getlogin).and_return('igor')
+ allow(Etc).to receive(:getlogin).and_return("igor")
allow(node).to receive(:[]).with("platform_version").and_return(platform_version)
cmd = "launchctl list #{service_label}"
allow(provider).to receive(:shell_out_with_systems_locale).
@@ -263,7 +263,7 @@ SVC_LIST
end
it "starts service via launchctl if service found" do
- cmd = 'launchctl load -w ' + session + plist
+ cmd = "launchctl load -w " + session + plist
expect(provider).to receive(:shell_out_with_systems_locale).
with(/(#{su_cmd} .#{cmd}.|#{cmd})/).
and_return(0)
@@ -295,7 +295,7 @@ SVC_LIST
end
it "stops the service via launchctl if service found" do
- cmd = 'launchctl unload -w '+ plist
+ cmd = "launchctl unload -w "+ plist
expect(provider).to receive(:shell_out_with_systems_locale).
with(/(#{su_cmd} .#{cmd}.|#{cmd})/).
and_return(0)
diff --git a/spec/unit/provider/service/openbsd_service_spec.rb b/spec/unit/provider/service/openbsd_service_spec.rb
index 8118e9b3ee..c08a97e7b1 100644
--- a/spec/unit/provider/service/openbsd_service_spec.rb
+++ b/spec/unit/provider/service/openbsd_service_spec.rb
@@ -18,7 +18,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef::Provider::Service::Openbsd
public :builtin_service_enable_variable_name
@@ -52,8 +52,8 @@ describe Chef::Provider::Service::Openbsd do
let(:provider) do
events = Chef::EventDispatch::Dispatcher.new
run_context = Chef::RunContext.new(node, {}, events)
- allow(::File).to receive(:read).with('/etc/rc.conf').and_return('')
- allow(::File).to receive(:read).with('/etc/rc.conf.local').and_return('')
+ allow(::File).to receive(:read).with("/etc/rc.conf").and_return("")
+ allow(::File).to receive(:read).with("/etc/rc.conf.local").and_return("")
provider = Chef::Provider::Service::Openbsd.new(new_resource,run_context)
provider.action = :start
provider
@@ -80,7 +80,7 @@ describe Chef::Provider::Service::Openbsd do
end
it "should set init_command to nil if it can't find anything" do
- expect(::File).to receive(:exist?).with('/etc/rc.d/sndiod').and_return(false)
+ expect(::File).to receive(:exist?).with("/etc/rc.d/sndiod").and_return(false)
expect(provider.init_command).to be nil
end
end
@@ -381,7 +381,7 @@ describe Chef::Provider::Service::Openbsd do
describe Chef::Provider::Service::Openbsd, "enable_service" do
before do
provider.current_resource = current_resource
- allow(FileUtils).to receive(:touch).with('/etc/rc.conf.local')
+ allow(FileUtils).to receive(:touch).with("/etc/rc.conf.local")
end
context "is builtin and disabled by default" do
before do
@@ -398,10 +398,10 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should enable the service by adding a line to rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', include("#{provider.builtin_service_enable_variable_name}=\"\""))
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", include("#{provider.builtin_service_enable_variable_name}=\"\""))
expect(provider.is_enabled?).to be false
provider.enable_service
expect(provider.is_enabled?).to be true
@@ -414,7 +414,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is enabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should not change rc.conf.local since it is already enabled" do
expect(::File).not_to receive(:write)
@@ -426,7 +426,7 @@ describe Chef::Provider::Service::Openbsd do
provider.rc_conf_local = "#{provider.builtin_service_enable_variable_name}=NO"
end
it "should enable the service by removing a line from rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', /^(?!#{provider.builtin_service_enable_variable_name})$/)
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", /^(?!#{provider.builtin_service_enable_variable_name})$/)
expect(provider.is_enabled?).to be false
provider.enable_service
expect(provider.is_enabled?).to be true
@@ -435,7 +435,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is not builtin" do
before do
- provider.rc_conf = ''
+ provider.rc_conf = ""
end
context "is enabled" do
before do
@@ -448,10 +448,10 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should enable the service by adding it to the pkg_scripts list" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', "\npkg_scripts=\"#{new_resource.service_name}\"\n")
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", "\npkg_scripts=\"#{new_resource.service_name}\"\n")
expect(provider.is_enabled?).to be false
provider.enable_service
expect(provider.is_enabled?).to be true
@@ -463,7 +463,7 @@ describe Chef::Provider::Service::Openbsd do
describe Chef::Provider::Service::Openbsd, "disable_service" do
before do
provider.current_resource = current_resource
- allow(FileUtils).to receive(:touch).with('/etc/rc.conf.local')
+ allow(FileUtils).to receive(:touch).with("/etc/rc.conf.local")
end
context "is builtin and disabled by default" do
before do
@@ -474,7 +474,7 @@ describe Chef::Provider::Service::Openbsd do
provider.rc_conf_local = "#{provider.builtin_service_enable_variable_name}=\"\""
end
it "should disable the service by removing its line from rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', /^(?!#{provider.builtin_service_enable_variable_name})$/)
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", /^(?!#{provider.builtin_service_enable_variable_name})$/)
expect(provider.is_enabled?).to be true
provider.disable_service
expect(provider.is_enabled?).to be false
@@ -482,7 +482,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should not change rc.conf.local since it is already disabled" do
expect(::File).not_to receive(:write)
@@ -496,10 +496,10 @@ describe Chef::Provider::Service::Openbsd do
end
context "is enabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should disable the service by adding a line to rc.conf.local" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', include("#{provider.builtin_service_enable_variable_name}=\"NO\""))
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", include("#{provider.builtin_service_enable_variable_name}=\"NO\""))
expect(provider.is_enabled?).to be true
provider.disable_service
expect(provider.is_enabled?).to be false
@@ -517,14 +517,14 @@ describe Chef::Provider::Service::Openbsd do
end
context "is not builtin" do
before do
- provider.rc_conf = ''
+ provider.rc_conf = ""
end
context "is enabled" do
before do
provider.rc_conf_local = "pkg_scripts=\"#{new_resource.service_name}\"\n"
end
it "should disable the service by removing it from the pkg_scripts list" do
- expect(::File).to receive(:write).with('/etc/rc.conf.local', /^(?!#{new_resource.service_name})$/)
+ expect(::File).to receive(:write).with("/etc/rc.conf.local", /^(?!#{new_resource.service_name})$/)
expect(provider.is_enabled?).to be true
provider.disable_service
expect(provider.is_enabled?).to be false
@@ -532,7 +532,7 @@ describe Chef::Provider::Service::Openbsd do
end
context "is disabled" do
before do
- provider.rc_conf_local = ''
+ provider.rc_conf_local = ""
end
it "should not change rc.conf.local since it is already disabled" do
expect(::File).not_to receive(:write)
diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb
index 5aaf54d9f5..d79e179898 100644
--- a/spec/unit/provider/service/redhat_spec.rb
+++ b/spec/unit/provider/service/redhat_spec.rb
@@ -17,7 +17,7 @@
#
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "spec_helper"))
-require 'ostruct'
+require "ostruct"
shared_examples_for "define_resource_requirements_common" do
it "should raise an error if /sbin/chkconfig does not exist" do
@@ -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)
diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb
index 895c559dff..ef5fe55a49 100644
--- a/spec/unit/provider/service/simple_service_spec.rb
+++ b/spec/unit/provider/service/simple_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Simple, "load_current_resource" do
before(:each) do
diff --git a/spec/unit/provider/service/solaris_smf_service_spec.rb b/spec/unit/provider/service/solaris_smf_service_spec.rb
index 4ff3e89ae3..a5f54f0830 100644
--- a/spec/unit/provider/service/solaris_smf_service_spec.rb
+++ b/spec/unit/provider/service/solaris_smf_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Solaris do
before(:each) do
@@ -24,69 +24,69 @@ describe Chef::Provider::Service::Solaris do
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::Service.new('chef')
+ @new_resource = Chef::Resource::Service.new("chef")
- @current_resource = Chef::Resource::Service.new('chef')
+ @current_resource = Chef::Resource::Service.new("chef")
@provider = Chef::Provider::Service::Solaris.new(@new_resource, @run_context)
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
# enabled / started service (svcs -l chef)
enabled_svc_stdout = [
- 'fmri svc:/application/chef:default',
- 'name chef service',
- 'enabled true',
- 'state online',
- 'next_state none',
- 'state_time April 2, 2015 04:25:19 PM EDT',
- 'logfile /var/svc/log/application-chef:default.log',
- 'restarter svc:/system/svc/restarter:default',
- 'contract_id 1115271',
- 'dependency require_all/error svc:/milestone/multi-user:default (online)',
+ "fmri svc:/application/chef:default",
+ "name chef service",
+ "enabled true",
+ "state online",
+ "next_state none",
+ "state_time April 2, 2015 04:25:19 PM EDT",
+ "logfile /var/svc/log/application-chef:default.log",
+ "restarter svc:/system/svc/restarter:default",
+ "contract_id 1115271",
+ "dependency require_all/error svc:/milestone/multi-user:default (online)",
].join("\n")
# disabled / stopped service (svcs -l chef)
disabled_svc_stdout = [
- 'fmri svc:/application/chef:default',
- 'name chef service',
- 'enabled false',
- 'state disabled',
- 'next_state none',
- 'state_time April 2, 2015 04:25:19 PM EDT',
- 'logfile /var/svc/log/application-chef:default.log',
- 'restarter svc:/system/svc/restarter:default',
- 'contract_id 1115271',
- 'dependency require_all/error svc:/milestone/multi-user:default (online)',
+ "fmri svc:/application/chef:default",
+ "name chef service",
+ "enabled false",
+ "state disabled",
+ "next_state none",
+ "state_time April 2, 2015 04:25:19 PM EDT",
+ "logfile /var/svc/log/application-chef:default.log",
+ "restarter svc:/system/svc/restarter:default",
+ "contract_id 1115271",
+ "dependency require_all/error svc:/milestone/multi-user:default (online)",
].join("\n")
# disabled / stopped service (svcs -l chef)
maintenance_svc_stdout = [
- 'fmri svc:/application/chef:default',
- 'name chef service',
- 'enabled true',
- 'state maintenance',
- 'next_state none',
- 'state_time April 2, 2015 04:25:19 PM EDT',
- 'logfile /var/svc/log/application-chef:default.log',
- 'restarter svc:/system/svc/restarter:default',
- 'contract_id 1115271',
- 'dependency require_all/error svc:/milestone/multi-user:default (online)',
+ "fmri svc:/application/chef:default",
+ "name chef service",
+ "enabled true",
+ "state maintenance",
+ "next_state none",
+ "state_time April 2, 2015 04:25:19 PM EDT",
+ "logfile /var/svc/log/application-chef:default.log",
+ "restarter svc:/system/svc/restarter:default",
+ "contract_id 1115271",
+ "dependency require_all/error svc:/milestone/multi-user:default (online)",
].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
diff --git a/spec/unit/provider/service/systemd_service_spec.rb b/spec/unit/provider/service/systemd_service_spec.rb
index 90b669a459..3761eb46db 100644
--- a/spec/unit/provider/service/systemd_service_spec.rb
+++ b/spec/unit/provider/service/systemd_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Systemd do
@@ -33,11 +33,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_with_systems_locale', :exitstatus => 0, :error? => false)
+ double("shell_out_with_systems_locale", :exitstatus => 0, :error? => false)
end
let(:shell_out_failure) do
- double('shell_out_with_systems_locale', :exitstatus => 1, :error? => true)
+ double("shell_out_with_systems_locale", :exitstatus => 1, :error? => true)
end
let(:current_resource) { Chef::Resource::Service.new(service_name) }
diff --git a/spec/unit/provider/service/upstart_service_spec.rb b/spec/unit/provider/service/upstart_service_spec.rb
index 6fb1f9fdbf..8a17e04f1a 100644
--- a/spec/unit/provider/service/upstart_service_spec.rb
+++ b/spec/unit/provider/service/upstart_service_spec.rb
@@ -16,18 +16,18 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service::Upstart do
let(:shell_out_success) do
- double('shell_out_with_systems_locale', :exitstatus => 0, :error? => false)
+ double("shell_out_with_systems_locale", :exitstatus => 0, :error? => false)
end
before(:each) do
@node =Chef::Node.new
- @node.name('upstarter')
- @node.automatic_attrs[:platform] = 'ubuntu'
- @node.automatic_attrs[:platform_version] = '9.10'
+ @node.name("upstarter")
+ @node.automatic_attrs[:platform] = "ubuntu"
+ @node.automatic_attrs[:platform_version] = "9.10"
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
@@ -42,7 +42,7 @@ describe Chef::Provider::Service::Upstart do
end
it "should return /etc/event.d as the upstart job directory when running on Ubuntu 9.04" do
- @node.automatic_attrs[:platform_version] = '9.04'
+ @node.automatic_attrs[:platform_version] = "9.04"
#Chef::Platform.stub(:find_platform_and_version).and_return([ "ubuntu", "9.04" ])
@provider = Chef::Provider::Service::Upstart.new(@new_resource, @run_context)
expect(@provider.instance_variable_get(:@upstart_job_dir)).to eq("/etc/event.d")
@@ -50,14 +50,14 @@ describe Chef::Provider::Service::Upstart do
end
it "should return /etc/init as the upstart job directory when running on Ubuntu 9.10" do
- @node.automatic_attrs[:platform_version] = '9.10'
+ @node.automatic_attrs[:platform_version] = "9.10"
@provider = Chef::Provider::Service::Upstart.new(@new_resource, @run_context)
expect(@provider.instance_variable_get(:@upstart_job_dir)).to eq("/etc/init")
expect(@provider.instance_variable_get(:@upstart_conf_suffix)).to eq(".conf")
end
it "should return /etc/init as the upstart job directory by default" do
- @node.automatic_attrs[:platform_version] = '9000'
+ @node.automatic_attrs[:platform_version] = "9000"
@provider = Chef::Provider::Service::Upstart.new(@new_resource, @run_context)
expect(@provider.instance_variable_get(:@upstart_job_dir)).to eq("/etc/init")
expect(@provider.instance_variable_get(:@upstart_conf_suffix)).to eq(".conf")
@@ -228,7 +228,7 @@ describe Chef::Provider::Service::Upstart do
describe "enable and disable service" do
before(:each) do
- @current_resource = Chef::Resource::Service.new('rsyslog')
+ @current_resource = Chef::Resource::Service.new("rsyslog")
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
@provider.current_resource = @current_resource
allow(Chef::Util::FileEdit).to receive(:new)
@@ -256,7 +256,7 @@ describe Chef::Provider::Service::Upstart do
describe "start and stop service" do
before(:each) do
- @current_resource = Chef::Resource::Service.new('rsyslog')
+ @current_resource = Chef::Resource::Service.new("rsyslog")
allow(Chef::Resource::Service).to receive(:new).and_return(@current_resource)
@provider.current_resource = @current_resource
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 34140fdd7b..d478192c78 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'mixlib/shellout'
+require "spec_helper"
+require "mixlib/shellout"
describe Chef::Provider::Service::Windows, "load_current_resource" do
include_context "Win32"
@@ -51,14 +51,14 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do
end
after(:each) do
- Win32::Service.send(:remove_const, 'AUTO_START') if defined?(Win32::Service::AUTO_START)
- Win32::Service.send(:remove_const, 'DEMAND_START') if defined?(Win32::Service::DEMAND_START)
- Win32::Service.send(:remove_const, 'DISABLED') if defined?(Win32::Service::DISABLED)
+ Win32::Service.send(:remove_const, "AUTO_START") if defined?(Win32::Service::AUTO_START)
+ Win32::Service.send(:remove_const, "DEMAND_START") if defined?(Win32::Service::DEMAND_START)
+ Win32::Service.send(:remove_const, "DISABLED") if defined?(Win32::Service::DISABLED)
end
it "sets the current resources service name to the new resources service name" do
provider.load_current_resource
- expect(provider.current_resource.service_name).to eq('chef')
+ expect(provider.current_resource.service_name).to eq("chef")
end
it "returns the current resource" do
diff --git a/spec/unit/provider/service_spec.rb b/spec/unit/provider/service_spec.rb
index 17bade55b6..38ac37d294 100644
--- a/spec/unit/provider/service_spec.rb
+++ b/spec/unit/provider/service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Service do
before do
diff --git a/spec/unit/provider/subversion_spec.rb b/spec/unit/provider/subversion_spec.rb
index 9d4a8bd218..ff04a63b93 100644
--- a/spec/unit/provider/subversion_spec.rb
+++ b/spec/unit/provider/subversion_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Subversion do
@@ -36,7 +36,7 @@ describe Chef::Provider::Subversion do
it "converts resource attributes to options for run_command and popen4" do
expect(@provider.run_options).to eq({})
- @resource.user 'deployninja'
+ @resource.user "deployninja"
expect(@provider.run_options).to eq({:user => "deployninja"})
end
@@ -64,7 +64,7 @@ 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 => ""))
expect(@provider.find_current_revision).to eql("11410")
@@ -73,7 +73,7 @@ describe Chef::Provider::Subversion do
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 => ""))
expect(@provider.find_current_revision).to be_nil
@@ -119,7 +119,7 @@ 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 => ""))
expect(@provider.revision_int).to eql("11410")
@@ -128,7 +128,7 @@ describe Chef::Provider::Subversion do
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 => ""))
expect {@provider.revision_int}.to raise_error(RuntimeError, "Could not parse `svn info` data: some random text from an error message\n")
@@ -202,7 +202,7 @@ describe Chef::Provider::Subversion do
allow(::File).to receive(:exist?).with("/my/deploy/dir/.svn").and_return(false)
allow(::File).to receive(:exist?).with("/my/deploy/dir").and_return(true)
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
- allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return(['.','..','foo','bar'])
+ allow(::Dir).to receive(:entries).with("/my/deploy/dir").and_return([".","..","foo","bar"])
expect(@provider).not_to receive(:checkout_command)
@provider.run_action(:checkout)
expect(@resource).not_to be_updated
@@ -246,7 +246,7 @@ describe Chef::Provider::Subversion do
it "does not fetch any updates if the remote revision matches the current revision" do
allow(::File).to receive(:directory?).with("/my/deploy").and_return(true)
expect(::File).to receive(:exist?).with("/my/deploy/dir/.svn").and_return(true)
- allow(@provider).to receive(:find_current_revision).and_return('12345')
+ allow(@provider).to receive(:find_current_revision).and_return("12345")
allow(@provider).to receive(:current_revision_matches_target_revision?).and_return(true)
@provider.run_action(:sync)
expect(@resource).not_to be_updated
@@ -267,29 +267,29 @@ describe Chef::Provider::Subversion do
it "selects 'svn' as the binary by default" do
@resource.svn_binary nil
allow(ChefConfig).to receive(:windows?) { false }
- expect(@provider).to receive(:svn_binary).and_return('svn')
+ expect(@provider).to receive(:svn_binary).and_return("svn")
expect(@provider.export_command).to eql(
- 'svn export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir')
+ "svn export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir")
end
it "selects an svn binary with an exe extension on windows" do
@resource.svn_binary nil
allow(ChefConfig).to receive(:windows?) { true }
- expect(@provider).to receive(:svn_binary).and_return('svn.exe')
+ expect(@provider).to receive(:svn_binary).and_return("svn.exe")
expect(@provider.export_command).to eql(
- 'svn.exe export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir')
+ "svn.exe export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir")
end
it "uses a custom svn binary as part of the svn command" do
- @resource.svn_binary 'teapot'
- expect(@provider).to receive(:svn_binary).and_return('teapot')
+ @resource.svn_binary "teapot"
+ expect(@provider).to receive(:svn_binary).and_return("teapot")
expect(@provider.export_command).to eql(
- 'teapot export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir')
+ "teapot export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir")
end
it "wraps custom svn binary with quotes if it contains whitespace" do
- @resource.svn_binary 'c:/program files (x86)/subversion/svn.exe'
- expect(@provider).to receive(:svn_binary).and_return('c:/program files (x86)/subversion/svn.exe')
+ @resource.svn_binary "c:/program files (x86)/subversion/svn.exe"
+ expect(@provider).to receive(:svn_binary).and_return("c:/program files (x86)/subversion/svn.exe")
expect(@provider.export_command).to eql(
'"c:/program files (x86)/subversion/svn.exe" export --force -q -r12345 http://svn.example.org/trunk/ /my/deploy/dir')
end
diff --git a/spec/unit/provider/template/content_spec.rb b/spec/unit/provider/template/content_spec.rb
index 509c8cf33b..7a19f59de1 100644
--- a/spec/unit/provider/template/content_spec.rb
+++ b/spec/unit/provider/template/content_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::Template::Content do
@@ -30,13 +30,13 @@ describe Chef::Provider::Template::Content do
let(:new_resource) do
double("Chef::Resource::Template (new)",
- :cookbook_name => 'openldap',
- :recipe_name => 'default',
+ :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',
+ :source => "openldap_stuff.conf.erb",
+ :name => "openldap_stuff.conf",
:path => resource_path,
:local => false,
:cookbook => nil,
@@ -47,8 +47,8 @@ describe Chef::Provider::Template::Content do
end
let(:rendered_file_locations) {
- [Dir.tmpdir + '/openldap_stuff.conf',
- enclosing_directory + '/openldap_stuff.conf']
+ [Dir.tmpdir + "/openldap_stuff.conf",
+ enclosing_directory + "/openldap_stuff.conf"]
}
let(:run_context) do
@@ -73,20 +73,20 @@ describe Chef::Provider::Template::Content do
end
it "finds the template file in the cookbook cache if it isn't local" do
- expect(content.template_location).to eq(CHEF_SPEC_DATA + '/cookbooks/openldap/templates/default/openldap_stuff.conf.erb')
+ expect(content.template_location).to eq(CHEF_SPEC_DATA + "/cookbooks/openldap/templates/default/openldap_stuff.conf.erb")
end
it "finds the template file locally if it is local" do
allow(new_resource).to receive(:local).and_return(true)
- allow(new_resource).to receive(:source).and_return('/tmp/its_on_disk.erb')
- expect(content.template_location).to eq('/tmp/its_on_disk.erb')
+ allow(new_resource).to receive(:source).and_return("/tmp/its_on_disk.erb")
+ expect(content.template_location).to eq("/tmp/its_on_disk.erb")
end
it "should use the cookbook name if defined in the template resource" do
- allow(new_resource).to receive(:cookbook_name).and_return('apache2')
- allow(new_resource).to receive(:cookbook).and_return('openldap')
+ allow(new_resource).to receive(:cookbook_name).and_return("apache2")
+ allow(new_resource).to receive(:cookbook).and_return("openldap")
allow(new_resource).to receive(:source).and_return("test.erb")
- expect(content.template_location).to eq(CHEF_SPEC_DATA + '/cookbooks/openldap/templates/default/test.erb')
+ expect(content.template_location).to eq(CHEF_SPEC_DATA + "/cookbooks/openldap/templates/default/test.erb")
end
it "returns a tempfile in the tempdir when :file_staging_uses_destdir is not set" do
@@ -130,14 +130,14 @@ 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',
+ :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',
+ :source => "helpers.erb",
+ :name => "helpers.erb",
+ :path => CHEF_SPEC_DATA + "/cookbooks/openldap/templates/default/helpers.erb",
:local => false,
:cookbook => nil,
:variables => {},
diff --git a/spec/unit/provider/template_spec.rb b/spec/unit/provider/template_spec.rb
index 713303d818..5340cc8d12 100644
--- a/spec/unit/provider/template_spec.rb
+++ b/spec/unit/provider/template_spec.rb
@@ -17,17 +17,17 @@
# limitations under the License.
#
-require 'stringio'
-require 'spec_helper'
-require 'etc'
-require 'ostruct'
-require 'support/shared/unit/provider/file'
+require "stringio"
+require "spec_helper"
+require "etc"
+require "ostruct"
+require "support/shared/unit/provider/file"
describe Chef::Provider::Template 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(: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(:enclosing_directory) {
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
}
@@ -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
@@ -59,9 +59,9 @@ describe Chef::Provider::Template do
context "when creating the template" 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(: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(:enclosing_directory) {
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
}
diff --git a/spec/unit/provider/user/dscl_spec.rb b/spec/unit/provider/user/dscl_spec.rb
index a9407a4d7e..8195bdfc25 100644
--- a/spec/unit/provider/user/dscl_spec.rb
+++ b/spec/unit/provider/user/dscl_spec.rb
@@ -18,9 +18,9 @@
ShellCmdResult = Struct.new(:stdout, :stderr, :exitstatus)
-require 'spec_helper'
-require 'ostruct'
-require 'mixlib/shellout'
+require "spec_helper"
+require "ostruct"
+require "mixlib/shellout"
describe Chef::Provider::User::Dscl do
before do
@@ -114,32 +114,32 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
describe "when shelling out to dscl" do
it "should run dscl with the supplied cmd /Path args" do
- shell_return = ShellCmdResult.new('stdout', 'err', 0)
+ shell_return = ShellCmdResult.new("stdout", "err", 0)
expect(provider).to receive(:shell_out).with("dscl . -cmd /Path args").and_return(shell_return)
- expect(provider.run_dscl("cmd /Path args")).to eq('stdout')
+ expect(provider.run_dscl("cmd /Path args")).to eq("stdout")
end
it "returns an empty string from delete commands" do
- shell_return = ShellCmdResult.new('out', 'err', 23)
+ shell_return = ShellCmdResult.new("out", "err", 23)
expect(provider).to receive(:shell_out).with("dscl . -delete /Path args").and_return(shell_return)
expect(provider.run_dscl("delete /Path args")).to eq("")
end
it "should raise an exception for any other command" do
- shell_return = ShellCmdResult.new('out', 'err', 23)
- expect(provider).to receive(:shell_out).with('dscl . -cmd /Path arguments').and_return(shell_return)
+ shell_return = ShellCmdResult.new("out", "err", 23)
+ expect(provider).to receive(:shell_out).with("dscl . -cmd /Path arguments").and_return(shell_return)
expect { provider.run_dscl("cmd /Path arguments") }.to raise_error(Chef::Exceptions::DsclCommandFailed)
end
it "raises an exception when dscl reports 'no such key'" do
- shell_return = ShellCmdResult.new("No such key: ", 'err', 23)
- expect(provider).to receive(:shell_out).with('dscl . -cmd /Path args').and_return(shell_return)
+ shell_return = ShellCmdResult.new("No such key: ", "err", 23)
+ expect(provider).to receive(:shell_out).with("dscl . -cmd /Path args").and_return(shell_return)
expect { provider.run_dscl("cmd /Path args") }.to raise_error(Chef::Exceptions::DsclCommandFailed)
end
it "raises an exception when dscl reports 'eDSRecordNotFound'" do
- shell_return = ShellCmdResult.new("<dscl_cmd> DS Error: -14136 (eDSRecordNotFound)", 'err', -14136)
- expect(provider).to receive(:shell_out).with('dscl . -cmd /Path args').and_return(shell_return)
+ shell_return = ShellCmdResult.new("<dscl_cmd> DS Error: -14136 (eDSRecordNotFound)", "err", -14136)
+ expect(provider).to receive(:shell_out).with("dscl . -cmd /Path args").and_return(shell_return)
expect { provider.run_dscl("cmd /Path args") }.to raise_error(Chef::Exceptions::DsclCommandFailed)
end
end
@@ -197,7 +197,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
end
it "finds a valid, unused uid when none is specified" do
- expect(provider).to receive(:run_dscl).with("list /Users uid").and_return('')
+ expect(provider).to receive(:run_dscl).with("list /Users uid").and_return("")
expect(provider).to receive(:run_dscl).with("create /Users/toor UniqueID 501")
expect(provider).to receive(:get_free_uid).and_return(501)
provider.dscl_set_uid
@@ -207,7 +207,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
it "sets the uid specified in the resource" do
new_resource.uid(1000)
expect(provider).to receive(:run_dscl).with("create /Users/toor UniqueID 1000").and_return(true)
- expect(provider).to receive(:run_dscl).with("list /Users uid").and_return('')
+ expect(provider).to receive(:run_dscl).with("list /Users uid").and_return("")
provider.dscl_set_uid
end
end
@@ -219,7 +219,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
before do
new_resource.supports({ :manage_home => true })
- new_resource.home('/Users/toor')
+ new_resource.home("/Users/toor")
provider.current_resource = current_resource
end
@@ -232,25 +232,25 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
it "raises InvalidHomeDirectory when the resource's home directory doesn't look right" do
- new_resource.home('epic-fail')
+ new_resource.home("epic-fail")
expect { provider.dscl_set_home }.to raise_error(Chef::Exceptions::InvalidHomeDirectory)
end
it "moves the users home to the new location if it exists and the target location is different" do
new_resource.supports(:manage_home => true)
- current_home = CHEF_SPEC_DATA + '/old_home_dir'
- current_home_files = [current_home + '/my-dot-emacs', current_home + '/my-dot-vim']
+ current_home = CHEF_SPEC_DATA + "/old_home_dir"
+ current_home_files = [current_home + "/my-dot-emacs", current_home + "/my-dot-vim"]
current_resource.home(current_home)
new_resource.gid(23)
- allow(::File).to receive(:exists?).with('/old/home/toor').and_return(true)
- allow(::File).to receive(:exists?).with('/Users/toor').and_return(true)
+ allow(::File).to receive(:exists?).with("/old/home/toor").and_return(true)
+ allow(::File).to receive(:exists?).with("/Users/toor").and_return(true)
- expect(FileUtils).to receive(:mkdir_p).with('/Users/toor').and_return(true)
+ expect(FileUtils).to receive(:mkdir_p).with("/Users/toor").and_return(true)
expect(FileUtils).to receive(:rmdir).with(current_home)
expect(::Dir).to receive(:glob).with("#{CHEF_SPEC_DATA}/old_home_dir/*",::File::FNM_DOTMATCH).and_return(current_home_files)
expect(FileUtils).to receive(:mv).with(current_home_files, "/Users/toor", :force => true)
- expect(FileUtils).to receive(:chown_R).with('toor','23','/Users/toor')
+ expect(FileUtils).to receive(:chown_R).with("toor","23","/Users/toor")
expect(provider).to receive(:run_dscl).with("create /Users/toor NFSHomeDirectory '/Users/toor'")
provider.dscl_set_home
@@ -263,7 +263,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
it "should run ditto to copy any missing files from skel to the new home dir" do
expect(::File).to receive(:exists?).with("/System/Library/User\ Template/English.lproj").and_return(true)
- expect(FileUtils).to receive(:chown_R).with('toor', '', '/Users/toor')
+ expect(FileUtils).to receive(:chown_R).with("toor", "", "/Users/toor")
expect(provider).to receive(:shell_out!).with("ditto '/System/Library/User Template/English.lproj' '/Users/toor'")
provider.ditto_home
end
@@ -382,7 +382,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
expect(provider).to receive(:shell_out).with("dscacheutil '-flushcache'")
expect(provider).to receive(:shell_out).with("plutil -convert xml1 -o - /var/db/dslocal/nodes/Default/users/toor.plist") do
if user_plist_file.nil?
- ShellCmdResult.new('Can not find the file', 'Sorry!!', 1)
+ ShellCmdResult.new("Can not find the file", "Sorry!!", 1)
else
ShellCmdResult.new(File.read(File.join(CHEF_SPEC_DATA, "mac_users/#{user_plist_file}.plist.xml")), "", 0)
end
@@ -656,7 +656,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
it "password_shadow_info should have salted-sha-512 format" do
shadow_info = provider.prepare_password_shadow_info
expect(shadow_info).to have_key("SALTED-SHA512")
- info = shadow_info["SALTED-SHA512"].string.unpack('H*').first
+ info = shadow_info["SALTED-SHA512"].string.unpack("H*").first
expect(provider.salted_sha512?(info)).to be_truthy
end
end
@@ -667,7 +667,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
it "password_shadow_info should have salted-sha-512 format" do
shadow_info = provider.prepare_password_shadow_info
expect(shadow_info).to have_key("SALTED-SHA512")
- info = shadow_info["SALTED-SHA512"].string.unpack('H*').first
+ info = shadow_info["SALTED-SHA512"].string.unpack("H*").first
expect(provider.salted_sha512?(info)).to be_truthy
expect(info).to eq(vagrant_sha_512)
end
@@ -689,7 +689,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("entropy")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("salt")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("iterations")
- info = shadow_info["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack('H*').first
+ info = shadow_info["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack("H*").first
expect(provider.salted_sha512_pbkdf2?(info)).to be_truthy
end
end
@@ -705,7 +705,7 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("entropy")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("salt")
expect(shadow_info["SALTED-SHA512-PBKDF2"]).to have_key("iterations")
- info = shadow_info["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack('H*').first
+ info = shadow_info["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack("H*").first
expect(provider.salted_sha512_pbkdf2?(info)).to be_truthy
expect(info).to eq(vagrant_sha_512_pbkdf2)
end
@@ -791,8 +791,8 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
end
it "should raise an exception when the group does not exist" do
- shell_return = ShellCmdResult.new("<dscl_cmd> DS Error: -14136 (eDSRecordNotFound)", 'err', -14136)
- expect(provider).to receive(:shell_out).with('dscl . -read /Groups/newgroup PrimaryGroupID').and_return(shell_return)
+ shell_return = ShellCmdResult.new("<dscl_cmd> DS Error: -14136 (eDSRecordNotFound)", "err", -14136)
+ expect(provider).to receive(:shell_out).with("dscl . -read /Groups/newgroup PrimaryGroupID").and_return(shell_return)
expect { provider.dscl_set_gid }.to raise_error(Chef::Exceptions::GroupIDNotFound)
end
end
@@ -814,8 +814,8 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
new_resource.username "mud"
new_resource.uid 2342
new_resource.gid 2342
- new_resource.home '/Users/death'
- new_resource.password 'goaway'
+ new_resource.home "/Users/death"
+ new_resource.password "goaway"
end
it "sets the user, comment field, uid, gid, moves the home directory, sets the shell, and sets the password" do
diff --git a/spec/unit/provider/user/pw_spec.rb b/spec/unit/provider/user/pw_spec.rb
index 6683a75f42..4b58fdc58e 100644
--- a/spec/unit/provider/user/pw_spec.rb
+++ b/spec/unit/provider/user/pw_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::User::Pw do
before(:each) do
@@ -48,11 +48,11 @@ describe Chef::Provider::User::Pw do
describe "setting options to the pw command" do
field_list = {
- 'comment' => "-c",
- 'home' => "-d",
- 'gid' => "-g",
- 'uid' => "-u",
- 'shell' => "-s",
+ "comment" => "-c",
+ "home" => "-d",
+ "gid" => "-g",
+ "uid" => "-u",
+ "shell" => "-s",
}
field_list.each do |attribute, option|
it "should check for differences in #{attribute} between the new and current resources" do
diff --git a/spec/unit/provider/user/solaris_spec.rb b/spec/unit/provider/user/solaris_spec.rb
index a3c17a9a56..f3299aaf63 100644
--- a/spec/unit/provider/user/solaris_spec.rb
+++ b/spec/unit/provider/user/solaris_spec.rb
@@ -22,8 +22,8 @@
ShellCmdResult = Struct.new(:stdout, :stderr, :exitstatus)
-require 'mixlib/shellout'
-require 'spec_helper'
+require "mixlib/shellout"
+require "spec_helper"
describe Chef::Provider::User::Solaris do
@@ -73,63 +73,63 @@ describe Chef::Provider::User::Solaris do
end
end
- describe 'when managing user locked status' do
+ describe "when managing user locked status" do
before(:each) do
@node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, {}, @events)
- @new_resource = Chef::Resource::User.new('dave')
+ @new_resource = Chef::Resource::User.new("dave")
@current_resource = @new_resource.dup
@provider = Chef::Provider::User::Solaris.new(@new_resource, @run_context)
@provider.current_resource = @current_resource
end
- describe 'when determining if the user is locked' do
+ describe "when determining if the user is locked" do
# locked shadow lines
[
- 'dave:LK:::::::',
- 'dave:*LK*:::::::',
- 'dave:*LK*foobar:::::::',
- 'dave:*LK*bahamas10:::::::',
- 'dave:*LK*L....:::::::',
+ "dave:LK:::::::",
+ "dave:*LK*:::::::",
+ "dave:*LK*foobar:::::::",
+ "dave:*LK*bahamas10:::::::",
+ "dave:*LK*L....:::::::",
].each do |shadow|
it "should return true if user is locked with #{shadow}" do
- shell_return = ShellCmdResult.new(shadow + "\n", '', 0)
- expect(provider).to receive(:shell_out!).with('getent', 'shadow', @new_resource.username).and_return(shell_return)
+ shell_return = ShellCmdResult.new(shadow + "\n", "", 0)
+ expect(provider).to receive(:shell_out!).with("getent", "shadow", @new_resource.username).and_return(shell_return)
expect(provider.check_lock).to eql(true)
end
end
# unlocked shadow lines
[
- 'dave:NP:::::::',
- 'dave:*NP*:::::::',
- 'dave:foobar:::::::',
- 'dave:bahamas10:::::::',
- 'dave:L...:::::::',
+ "dave:NP:::::::",
+ "dave:*NP*:::::::",
+ "dave:foobar:::::::",
+ "dave:bahamas10:::::::",
+ "dave:L...:::::::",
].each do |shadow|
it "should return false if user is unlocked with #{shadow}" do
- shell_return = ShellCmdResult.new(shadow + "\n", '', 0)
- expect(provider).to receive(:shell_out!).with('getent', 'shadow', @new_resource.username).and_return(shell_return)
+ shell_return = ShellCmdResult.new(shadow + "\n", "", 0)
+ expect(provider).to receive(:shell_out!).with("getent", "shadow", @new_resource.username).and_return(shell_return)
expect(provider.check_lock).to eql(false)
end
end
end
- describe 'when locking the user' do
- it 'should run passwd -l with the new resources username' do
- shell_return = ShellCmdResult.new('', '', 0)
- expect(provider).to receive(:shell_out!).with('passwd', '-l', @new_resource.username).and_return(shell_return)
+ describe "when locking the user" do
+ it "should run passwd -l with the new resources username" do
+ shell_return = ShellCmdResult.new("", "", 0)
+ expect(provider).to receive(:shell_out!).with("passwd", "-l", @new_resource.username).and_return(shell_return)
provider.lock_user
end
end
- describe 'when unlocking the user' do
- it 'should run passwd -u with the new resources username' do
- shell_return = ShellCmdResult.new('', '', 0)
- expect(provider).to receive(:shell_out!).with('passwd', '-u', @new_resource.username).and_return(shell_return)
+ describe "when unlocking the user" do
+ it "should run passwd -u with the new resources username" do
+ shell_return = ShellCmdResult.new("", "", 0)
+ expect(provider).to receive(:shell_out!).with("passwd", "-u", @new_resource.username).and_return(shell_return)
provider.unlock_user
end
end
diff --git a/spec/unit/provider/user/useradd_spec.rb b/spec/unit/provider/user/useradd_spec.rb
index a295dff679..f8bcb13363 100644
--- a/spec/unit/provider/user/useradd_spec.rb
+++ b/spec/unit/provider/user/useradd_spec.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/provider/user/useradd'
+require "spec_helper"
+require "chef/provider/user/useradd"
describe Chef::Provider::User::Useradd do
@@ -30,11 +30,11 @@ describe Chef::Provider::User::Useradd do
end
supported_useradd_options = {
- 'comment' => "-c",
- 'gid' => "-g",
- 'uid' => "-u",
- 'shell' => "-s",
- 'password' => "-p",
+ "comment" => "-c",
+ "gid" => "-g",
+ "uid" => "-u",
+ "shell" => "-s",
+ "password" => "-p",
}
include_examples "a useradd-based user provider", supported_useradd_options
diff --git a/spec/unit/provider/user/windows_spec.rb b/spec/unit/provider/user/windows_spec.rb
index 7e08f971a9..7a8cb29963 100644
--- a/spec/unit/provider/user/windows_spec.rb
+++ b/spec/unit/provider/user/windows_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class Chef
class Util
@@ -104,7 +104,7 @@ describe Chef::Provider::User::Windows do
end
it "marks the home_dir attribute to be updated" do
- expect(@provider.set_options[:home_dir]).to eq('/home/adam')
+ expect(@provider.set_options[:home_dir]).to eq("/home/adam")
end
it "ignores the primary_group_id attribute" do
@@ -116,11 +116,11 @@ describe Chef::Provider::User::Windows do
end
it "marks the script_path attribute to be updated" do
- expect(@provider.set_options[:script_path]).to eq('/usr/bin/zsh')
+ expect(@provider.set_options[:script_path]).to eq("/usr/bin/zsh")
end
it "marks the password attribute to be updated" do
- expect(@provider.set_options[:password]).to eq('abracadabra')
+ expect(@provider.set_options[:password]).to eq("abracadabra")
end
end
end
diff --git a/spec/unit/provider/user_spec.rb b/spec/unit/provider/user_spec.rb
index c38abcc049..043a67df1b 100644
--- a/spec/unit/provider/user_spec.rb
+++ b/spec/unit/provider/user_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
EtcPwnamIsh = Struct.new(:name, :passwd, :uid, :gid, :gecos, :dir, :shell, :change, :uclass, :expire)
EtcGrnamIsh = Struct.new(:name, :passwd, :gid, :mem)
@@ -83,7 +83,7 @@ describe Chef::Provider::User do
it "should create a current resource with the same name as the new resource" do
@provider.load_current_resource
- expect(@provider.current_resource.name).to eq('adam')
+ expect(@provider.current_resource.name).to eq("adam")
end
it "should set the username of the current resource to the username of the new resource" do
@@ -92,7 +92,7 @@ describe Chef::Provider::User do
end
it "should change the encoding of gecos to the encoding of the new resource" do
- @pw_user.gecos.force_encoding('ASCII-8BIT')
+ @pw_user.gecos.force_encoding("ASCII-8BIT")
@provider.load_current_resource
expect(@provider.current_resource.comment.encoding).to eq(@new_resource.comment.encoding)
end
@@ -141,8 +141,8 @@ describe Chef::Provider::User do
describe "and running assertions" do
def self.shadow_lib_unavail?
begin
- require 'rubygems'
- require 'shadow'
+ require "rubygems"
+ require "shadow"
rescue LoadError
skip "ruby-shadow gem not installed for dynamic load test"
true
@@ -165,7 +165,7 @@ describe Chef::Provider::User do
context "and we are root", :requires_root => true do
it "should pass assertions when ruby-shadow can be loaded" do
- @provider.action = 'create'
+ @provider.action = "create"
original_method = @provider.method(:require)
expect(@provider).to receive(:require) { |*args| original_method.call(*args) }
passwd_info = Struct::PasswdEntry.new(:sp_namp => "adm ", :sp_pwdp => "$1$T0N0Q.lc$nyG6pFI3Dpqa5cxUz/57j0", :sp_lstchg => 14861, :sp_min => 0, :sp_max => 99999,
@@ -192,13 +192,13 @@ describe Chef::Provider::User do
describe "compare_user" do
let(:mapping) {
{
- 'username' => ["adam", "Adam"],
- 'comment' => ["Adam Jacob", "adam jacob"],
- 'uid' => [1000, 1001],
- 'gid' => [1000, 1001],
- 'home' => ["/home/adam", "/Users/adam"],
- 'shell'=> ["/usr/bin/zsh", "/bin/bash"],
- 'password'=> ["abcd","12345"],
+ "username" => ["adam", "Adam"],
+ "comment" => ["Adam Jacob", "adam jacob"],
+ "uid" => [1000, 1001],
+ "gid" => [1000, 1001],
+ "home" => ["/home/adam", "/Users/adam"],
+ "shell"=> ["/usr/bin/zsh", "/bin/bash"],
+ "password"=> ["abcd","12345"],
}
}
@@ -441,8 +441,8 @@ describe Chef::Provider::User do
describe "convert_group_name" do
before do
- @new_resource.gid('999')
- @group = EtcGrnamIsh.new('wheel', '*', 999, [])
+ @new_resource.gid("999")
+ @group = EtcGrnamIsh.new("wheel", "*", 999, [])
end
it "should lookup the group name locally" do
diff --git a/spec/unit/provider/whyrun_safe_ruby_block_spec.rb b/spec/unit/provider/whyrun_safe_ruby_block_spec.rb
index 2a4dccdad7..6f8949bba3 100644
--- a/spec/unit/provider/whyrun_safe_ruby_block_spec.rb
+++ b/spec/unit/provider/whyrun_safe_ruby_block_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Provider::WhyrunSafeRubyBlock, "initialize" do
before(:each) do
diff --git a/spec/unit/provider_resolver_spec.rb b/spec/unit/provider_resolver_spec.rb
index cee097e715..16befad5ca 100644
--- a/spec/unit/provider_resolver_spec.rb
+++ b/spec/unit/provider_resolver_spec.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/convert_to_class_name'
-require 'chef/provider_resolver'
-require 'chef/platform/service_helpers'
-require 'support/shared/integration/integration_helper'
-require 'tmpdir'
-require 'fileutils'
+require "spec_helper"
+require "chef/mixin/convert_to_class_name"
+require "chef/provider_resolver"
+require "chef/platform/service_helpers"
+require "support/shared/integration/integration_helper"
+require "tmpdir"
+require "fileutils"
include Chef::Mixin::ConvertToClassName
@@ -48,7 +48,7 @@ describe Chef::ProviderResolver do
node.automatic[:platform_family] = platform_family
node.automatic[:platform] = platform
node.automatic[:platform_version] = platform_version
- node.automatic[:kernel] = { machine: 'i386' }
+ node.automatic[:kernel] = { machine: "i386" }
node
end
let(:run_context) { Chef::RunContext.new(node, nil, nil) }
@@ -73,7 +73,7 @@ describe Chef::ProviderResolver do
end
def self.on_platform(platform, *tags,
- platform_version: '11.0.1',
+ platform_version: "11.0.1",
platform_family: nil,
os: nil,
&block)
@@ -147,17 +147,17 @@ describe Chef::ProviderResolver do
services.each do |service|
case service
when :debian
- file 'usr/sbin/update-rc.d', ''
+ file "usr/sbin/update-rc.d", ""
when :invokercd
- file 'usr/sbin/invoke-rc.d', ''
+ file "usr/sbin/invoke-rc.d", ""
when :insserv
- file 'sbin/insserv', ''
+ file "sbin/insserv", ""
when :upstart
- file 'sbin/initctl', ''
+ file "sbin/initctl", ""
when :redhat
- file 'sbin/chkconfig', ''
+ file "sbin/chkconfig", ""
when :systemd
- file 'proc/1/comm', "systemd\n"
+ file "proc/1/comm", "systemd\n"
else
raise ArgumentError, service
end
@@ -178,7 +178,7 @@ describe Chef::ProviderResolver do
when :usr_local_etc_rcd
file "usr/local/etc/rc.d/#{service_name}", ""
when :systemd
- file 'proc/1/comm', "systemd\n"
+ file "proc/1/comm", "systemd\n"
file "etc/systemd/system/#{service_name}.service", ""
else
raise ArgumentError, config
@@ -480,7 +480,7 @@ describe Chef::ProviderResolver do
end
end
- on_platform %w(freebsd netbsd), platform_version: '3.1.4' do
+ on_platform %w(freebsd netbsd), platform_version: "3.1.4" do
it "returns a Freebsd provider if it finds the /usr/local/etc/rc.d initscript" do
stub_service_providers
stub_service_configs(:usr_local_etc_rcd)
diff --git a/spec/unit/provider_spec.rb b/spec/unit/provider_spec.rb
index 97b88b1732..dae5839d6c 100644
--- a/spec/unit/provider_spec.rb
+++ b/spec/unit/provider_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class NoWhyrunDemonstrator < Chef::Provider
diff --git a/spec/unit/pure_application_spec.rb b/spec/unit/pure_application_spec.rb
index 5d879a7b85..de9650e381 100644
--- a/spec/unit/pure_application_spec.rb
+++ b/spec/unit/pure_application_spec.rb
@@ -19,7 +19,7 @@
# be able to test only Chef::Application.
# Regression test for CHEF-5169
-require 'chef/application'
+require "chef/application"
describe "Chef::Application" do
let(:app) { Chef::Application.new }
diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb
index 34f852e2ce..d247a1bb5e 100644
--- a/spec/unit/recipe_spec.rb
+++ b/spec/unit/recipe_spec.rb
@@ -19,8 +19,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/platform/resource_priority_map'
+require "spec_helper"
+require "chef/platform/resource_priority_map"
describe Chef::Recipe do
diff --git a/spec/unit/resource/apt_package_spec.rb b/spec/unit/resource/apt_package_spec.rb
index 3c31f63dd7..cf425519b5 100644
--- a/spec/unit/resource/apt_package_spec.rb
+++ b/spec/unit/resource/apt_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::AptPackage, "initialize" do
diff --git a/spec/unit/resource/bash_spec.rb b/spec/unit/resource/bash_spec.rb
index f313900433..71805a44a2 100644
--- a/spec/unit/resource/bash_spec.rb
+++ b/spec/unit/resource/bash_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Bash do
diff --git a/spec/unit/resource/batch_spec.rb b/spec/unit/resource/batch_spec.rb
index b8c2897f42..965e48d9fa 100644
--- a/spec/unit/resource/batch_spec.rb
+++ b/spec/unit/resource/batch_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Batch do
@@ -25,7 +25,7 @@ describe Chef::Resource::Batch do
node.default["kernel"] = Hash.new
node.default["kernel"][:machine] = :x86_64.to_s
- node.automatic[:os] = 'windows'
+ node.automatic[:os] = "windows"
run_context = Chef::RunContext.new(node, nil, nil)
@@ -41,7 +41,7 @@ describe Chef::Resource::Batch do
let(:resource_instance) { @resource }
let(:resource_instance_name ) { @resource.command }
let(:resource_name) { :batch }
- let(:interpreter_file_name) { 'cmd.exe' }
+ let(:interpreter_file_name) { "cmd.exe" }
it_should_behave_like "a Windows script resource"
end
diff --git a/spec/unit/resource/breakpoint_spec.rb b/spec/unit/resource/breakpoint_spec.rb
index 88ab34d568..63a1753a2f 100644
--- a/spec/unit/resource/breakpoint_spec.rb
+++ b/spec/unit/resource/breakpoint_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::Breakpoint do
diff --git a/spec/unit/resource/chef_gem_spec.rb b/spec/unit/resource/chef_gem_spec.rb
index df37779d1b..3e6002e4f2 100644
--- a/spec/unit/resource/chef_gem_spec.rb
+++ b/spec/unit/resource/chef_gem_spec.rb
@@ -17,8 +17,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::ChefGem, "initialize" do
diff --git a/spec/unit/resource/chocolatey_package_spec.rb b/spec/unit/resource/chocolatey_package_spec.rb
index 38f1d2905c..b125279909 100644
--- a/spec/unit/resource/chocolatey_package_spec.rb
+++ b/spec/unit/resource/chocolatey_package_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::ChocolateyPackage do
diff --git a/spec/unit/resource/conditional_action_not_nothing_spec.rb b/spec/unit/resource/conditional_action_not_nothing_spec.rb
index d140615cfc..bc22ae7a47 100644
--- a/spec/unit/resource/conditional_action_not_nothing_spec.rb
+++ b/spec/unit/resource/conditional_action_not_nothing_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::ConditionalActionNotNothing do
diff --git a/spec/unit/resource/conditional_spec.rb b/spec/unit/resource/conditional_spec.rb
index 489c1136b1..7d153df24a 100644
--- a/spec/unit/resource/conditional_spec.rb
+++ b/spec/unit/resource/conditional_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Resource::Conditional do
before do
@@ -89,17 +89,17 @@ describe Chef::Resource::Conditional do
end
end
- describe 'after running a command which timed out' do
+ describe "after running a command which timed out" do
before do
@conditional = Chef::Resource::Conditional.only_if(@parent_resource, "false")
allow_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).to receive(:shell_out).and_raise(Chef::Exceptions::CommandTimeout)
end
- it 'indicates that resource convergence should not continue' do
+ it "indicates that resource convergence should not continue" do
expect(@conditional.continue?).to be_falsey
end
- it 'should log a warning' do
+ it "should log a warning" do
expect(Chef::Log).to receive(:warn).with("Command 'false' timed out")
@conditional.continue?
end
@@ -169,17 +169,17 @@ describe Chef::Resource::Conditional do
end
end
- describe 'after running a command which timed out' do
+ describe "after running a command which timed out" do
before do
@conditional = Chef::Resource::Conditional.not_if(@parent_resource, "false")
allow_any_instance_of(Chef::GuardInterpreter::DefaultGuardInterpreter).to receive(:shell_out).and_raise(Chef::Exceptions::CommandTimeout)
end
- it 'indicates that resource convergence should continue' do
+ it "indicates that resource convergence should continue" do
expect(@conditional.continue?).to be_truthy
end
- it 'should log a warning' do
+ it "should log a warning" do
expect(Chef::Log).to receive(:warn).with("Command 'false' timed out")
@conditional.continue?
end
diff --git a/spec/unit/resource/cookbook_file_spec.rb b/spec/unit/resource/cookbook_file_spec.rb
index bd437893ce..442e175f63 100644
--- a/spec/unit/resource/cookbook_file_spec.rb
+++ b/spec/unit/resource/cookbook_file_spec.rb
@@ -17,20 +17,20 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::CookbookFile do
before do
- @cookbook_file = Chef::Resource::CookbookFile.new('sourcecode_tarball.tgz')
+ @cookbook_file = Chef::Resource::CookbookFile.new("sourcecode_tarball.tgz")
end
it "uses the name parameter for the source parameter" do
- expect(@cookbook_file.name).to eq('sourcecode_tarball.tgz')
+ expect(@cookbook_file.name).to eq("sourcecode_tarball.tgz")
end
it "has a source parameter" do
- @cookbook_file.name('config_file.conf')
- expect(@cookbook_file.name).to eq('config_file.conf')
+ @cookbook_file.name("config_file.conf")
+ expect(@cookbook_file.name).to eq("config_file.conf")
end
it "defaults to a nil cookbook parameter (current cookbook will be used)" do
@@ -39,7 +39,7 @@ describe Chef::Resource::CookbookFile do
it "has a cookbook parameter" do
@cookbook_file.cookbook("munin")
- expect(@cookbook_file.cookbook).to eq('munin')
+ expect(@cookbook_file.cookbook).to eq("munin")
end
it "sets the provider to Chef::Provider::CookbookFile" do
diff --git a/spec/unit/resource/cron_spec.rb b/spec/unit/resource/cron_spec.rb
index 0978be6930..1ba48641ed 100644
--- a/spec/unit/resource/cron_spec.rb
+++ b/spec/unit/resource/cron_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Cron do
diff --git a/spec/unit/resource/csh_spec.rb b/spec/unit/resource/csh_spec.rb
index 5fb3b00507..fee96eb75e 100644
--- a/spec/unit/resource/csh_spec.rb
+++ b/spec/unit/resource/csh_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Csh do
diff --git a/spec/unit/resource/deploy_revision_spec.rb b/spec/unit/resource/deploy_revision_spec.rb
index d136aa251e..45df9c3dc2 100644
--- a/spec/unit/resource/deploy_revision_spec.rb
+++ b/spec/unit/resource/deploy_revision_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::DeployRevision do
diff --git a/spec/unit/resource/deploy_spec.rb b/spec/unit/resource/deploy_spec.rb
index 2338e37173..c53978a127 100644
--- a/spec/unit/resource/deploy_spec.rb
+++ b/spec/unit/resource/deploy_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::Deploy do
diff --git a/spec/unit/resource/directory_spec.rb b/spec/unit/resource/directory_spec.rb
index e9e80806db..a6d353ce06 100644
--- a/spec/unit/resource/directory_spec.rb
+++ b/spec/unit/resource/directory_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Directory do
diff --git a/spec/unit/resource/dpkg_package_spec.rb b/spec/unit/resource/dpkg_package_spec.rb
index 931e6763bd..4c35f0cb41 100644
--- a/spec/unit/resource/dpkg_package_spec.rb
+++ b/spec/unit/resource/dpkg_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::DpkgPackage, "initialize" do
@@ -26,7 +26,7 @@ describe Chef::Resource::DpkgPackage, "initialize" do
provider: Chef::Provider::Package::Dpkg,
name: :dpkg_package,
action: :install,
- os: 'linux',
+ os: "linux",
)
end
diff --git a/spec/unit/resource/dsc_resource_spec.rb b/spec/unit/resource/dsc_resource_spec.rb
index 276aa74111..4c98442d13 100644
--- a/spec/unit/resource/dsc_resource_spec.rb
+++ b/spec/unit/resource/dsc_resource_spec.rb
@@ -15,18 +15,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::DscResource do
- let(:dsc_test_resource_name) { 'DSCTest' }
+ let(:dsc_test_resource_name) { "DSCTest" }
let(:dsc_test_property_name) { :DSCTestProperty }
- let(:dsc_test_property_value) { 'DSCTestValue' }
+ let(:dsc_test_property_value) { "DSCTestValue" }
let(:dsc_test_reboot_action) { :reboot_now }
let(:dsc_test_timeout) { 101 }
- context 'when Powershell supports Dsc' do
+ context "when Powershell supports Dsc" do
let(:dsc_test_run_context) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '5.0.10018.0'
+ node.automatic[:languages][:powershell][:version] = "5.0.10018.0"
empty_events = Chef::EventDispatch::Dispatcher.new
Chef::RunContext.new(node, {}, empty_events)
}
@@ -72,7 +72,7 @@ describe Chef::Resource::DscResource do
it "raises a TypeError if property_name is not a symbol" do
expect{
- dsc_test_resource.property('Foo', dsc_test_property_value)
+ dsc_test_resource.property("Foo", dsc_test_property_value)
}.to raise_error(TypeError)
end
@@ -87,7 +87,7 @@ describe Chef::Resource::DscResource do
end
end
- context 'Powershell DSL methods' do
+ context "Powershell DSL methods" do
it "responds to :ps_credential" do
expect(dsc_test_resource.respond_to?(:ps_credential)).to be true
end
diff --git a/spec/unit/resource/dsc_script_spec.rb b/spec/unit/resource/dsc_script_spec.rb
index 1fa865a2d5..3afa46dd48 100644
--- a/spec/unit/resource/dsc_script_spec.rb
+++ b/spec/unit/resource/dsc_script_spec.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::DscScript do
- let(:dsc_test_resource_name) { 'DSCTest' }
+ let(:dsc_test_resource_name) { "DSCTest" }
- context 'when Powershell supports Dsc' do
+ context "when Powershell supports Dsc" do
let(:dsc_test_run_context) {
node = Chef::Node.new
- node.automatic[:languages][:powershell][:version] = '4.0'
+ node.automatic[:languages][:powershell][:version] = "4.0"
empty_events = Chef::EventDispatch::Dispatcher.new
Chef::RunContext.new(node, {}, empty_events)
}
@@ -32,10 +32,10 @@ describe Chef::Resource::DscScript do
Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context)
}
let(:configuration_code) {'echo "This is supposed to create a configuration document."'}
- let(:configuration_path) {'c:/myconfigs/formatc.ps1'}
- let(:configuration_name) { 'formatme' }
+ let(:configuration_path) {"c:/myconfigs/formatc.ps1"}
+ let(:configuration_name) { "formatme" }
let(:configuration_data) { '@{AllNodes = @( @{ NodeName = "localhost"; PSDscAllowPlainTextPassword = $true })}' }
- let(:configuration_data_script) { 'c:/myconfigs/data/safedata.psd1' }
+ let(:configuration_data_script) { "c:/myconfigs/data/safedata.psd1" }
it "has a default action of `:run`" do
expect(dsc_test_resource.action).to eq([:run])
@@ -75,9 +75,9 @@ describe Chef::Resource::DscScript do
end
context "when calling imports" do
- let(:module_name) { 'FooModule' }
- let(:module_name_b) { 'BarModule' }
- let(:dsc_resources) { ['ResourceA', 'ResourceB'] }
+ let(:module_name) { "FooModule" }
+ let(:module_name_b) { "BarModule" }
+ let(:dsc_resources) { ["ResourceA", "ResourceB"] }
it "allows an arbitrary number of resources to be set for a module to be set" do
dsc_test_resource.imports module_name, *dsc_resources
@@ -88,7 +88,7 @@ describe Chef::Resource::DscScript do
it "adds * to the imports when no resources are set for a moudle" do
dsc_test_resource.imports module_name
module_imports = dsc_test_resource.imports[module_name]
- expect(module_imports).to eq(['*'])
+ expect(module_imports).to eq(["*"])
end
it "allows an arbitrary number of modules" do
diff --git a/spec/unit/resource/easy_install_package_spec.rb b/spec/unit/resource/easy_install_package_spec.rb
index c68b026b39..52e0e91994 100644
--- a/spec/unit/resource/easy_install_package_spec.rb
+++ b/spec/unit/resource/easy_install_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::EasyInstallPackage, "initialize" do
diff --git a/spec/unit/resource/env_spec.rb b/spec/unit/resource/env_spec.rb
index 60e85ac31e..8a10ca7e81 100644
--- a/spec/unit/resource/env_spec.rb
+++ b/spec/unit/resource/env_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Env do
diff --git a/spec/unit/resource/erl_call_spec.rb b/spec/unit/resource/erl_call_spec.rb
index 9abf2e7812..7cdb5bda16 100644
--- a/spec/unit/resource/erl_call_spec.rb
+++ b/spec/unit/resource/erl_call_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::ErlCall do
diff --git a/spec/unit/resource/execute_spec.rb b/spec/unit/resource/execute_spec.rb
index 09160ddbd0..493508f08b 100644
--- a/spec/unit/resource/execute_spec.rb
+++ b/spec/unit/resource/execute_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Execute do
let(:resource_instance_name) { "some command" }
diff --git a/spec/unit/resource/file/verification_spec.rb b/spec/unit/resource/file/verification_spec.rb
index 6b929789c8..30956c04ba 100644
--- a/spec/unit/resource/file/verification_spec.rb
+++ b/spec/unit/resource/file/verification_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::File::Verification do
let(:t_block) { Proc.new { true } }
@@ -82,27 +82,27 @@ describe Chef::Resource::File::Verification do
end
it "substitutes \%{file} with the path" do
- test_command = platform_specific_verify_command('file')
+ test_command = platform_specific_verify_command("file")
v = Chef::Resource::File::Verification.new(parent_resource, test_command, {})
expect(v.verify(temp_path)).to eq(true)
end
it "warns about deprecation when \%{file} is used" do
expect(Chef::Log).to receive(:deprecation).with(/%{file} is deprecated/, /verification_spec\.rb/)
- test_command = platform_specific_verify_command('file')
+ test_command = platform_specific_verify_command("file")
Chef::Resource::File::Verification.new(parent_resource, test_command, {})
.verify(temp_path)
end
it "does not warn about deprecation when \%{file} is not used" do
expect(Chef::Log).to_not receive(:deprecation)
- test_command = platform_specific_verify_command('path')
+ test_command = platform_specific_verify_command("path")
Chef::Resource::File::Verification.new(parent_resource, test_command, {})
.verify(temp_path)
end
it "substitutes \%{path} with the path" do
- test_command = platform_specific_verify_command('path')
+ test_command = platform_specific_verify_command("path")
v = Chef::Resource::File::Verification.new(parent_resource, test_command, {})
expect(v.verify(temp_path)).to eq(true)
end
diff --git a/spec/unit/resource/file_spec.rb b/spec/unit/resource/file_spec.rb
index 76beaf15e1..3dec8145a4 100644
--- a/spec/unit/resource/file_spec.rb
+++ b/spec/unit/resource/file_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::File do
diff --git a/spec/unit/resource/freebsd_package_spec.rb b/spec/unit/resource/freebsd_package_spec.rb
index 7263d3a7ba..5c9c613771 100644
--- a/spec/unit/resource/freebsd_package_spec.rb
+++ b/spec/unit/resource/freebsd_package_spec.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Resource::FreebsdPackage do
before(:each) do
@@ -48,7 +48,7 @@ describe Chef::Resource::FreebsdPackage do
describe "Assigning provider after creation" do
describe "if ports specified as source" do
it "should be Freebsd::Port" do
- @resource.source('ports')
+ @resource.source("ports")
@resource.after_created
expect(@resource.provider).to eq(Chef::Provider::Package::Freebsd::Port)
end
diff --git a/spec/unit/resource/gem_package_spec.rb b/spec/unit/resource/gem_package_spec.rb
index 0f3eae70bb..6992d8ef17 100644
--- a/spec/unit/resource/gem_package_spec.rb
+++ b/spec/unit/resource/gem_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::GemPackage, "initialize" do
diff --git a/spec/unit/resource/git_spec.rb b/spec/unit/resource/git_spec.rb
index 6a39b3d172..5bdccc87b8 100644
--- a/spec/unit/resource/git_spec.rb
+++ b/spec/unit/resource/git_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::Git do
diff --git a/spec/unit/resource/group_spec.rb b/spec/unit/resource/group_spec.rb
index a4029fc911..56db882191 100644
--- a/spec/unit/resource/group_spec.rb
+++ b/spec/unit/resource/group_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Group, "initialize" do
before(:each) do
diff --git a/spec/unit/resource/homebrew_package_spec.rb b/spec/unit/resource/homebrew_package_spec.rb
index bb248d1189..6a3f88ceed 100644
--- a/spec/unit/resource/homebrew_package_spec.rb
+++ b/spec/unit/resource/homebrew_package_spec.rb
@@ -15,10 +15,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
-describe Chef::Resource::HomebrewPackage, 'initialize' do
+describe Chef::Resource::HomebrewPackage, "initialize" do
static_provider_resolution(
resource: Chef::Resource::HomebrewPackage,
@@ -28,22 +28,22 @@ describe Chef::Resource::HomebrewPackage, 'initialize' do
os: "mac_os_x",
)
- let(:resource) { Chef::Resource::HomebrewPackage.new('emacs') }
+ let(:resource) { Chef::Resource::HomebrewPackage.new("emacs") }
- shared_examples 'home_brew user set and returned' do
- it 'returns the configured homebrew_user' do
+ shared_examples "home_brew user set and returned" do
+ it "returns the configured homebrew_user" do
resource.homebrew_user user
expect(resource.homebrew_user).to eql(user)
end
end
- context 'homebrew_user is set' do
- let(:user) { 'Captain Picard' }
- include_examples 'home_brew user set and returned'
+ context "homebrew_user is set" do
+ let(:user) { "Captain Picard" }
+ include_examples "home_brew user set and returned"
- context 'as an integer' do
+ context "as an integer" do
let(:user) { 1001 }
- include_examples 'home_brew user set and returned'
+ include_examples "home_brew user set and returned"
end
end
diff --git a/spec/unit/resource/http_request_spec.rb b/spec/unit/resource/http_request_spec.rb
index aa4ce4dfbc..d8461854f9 100644
--- a/spec/unit/resource/http_request_spec.rb
+++ b/spec/unit/resource/http_request_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::HttpRequest do
diff --git a/spec/unit/resource/ifconfig_spec.rb b/spec/unit/resource/ifconfig_spec.rb
index e3e1f6daa2..9d775e7257 100644
--- a/spec/unit/resource/ifconfig_spec.rb
+++ b/spec/unit/resource/ifconfig_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Ifconfig do
@@ -49,8 +49,8 @@ describe Chef::Resource::Ifconfig do
shared_examples "being a platform based on an old Debian" do |platform, version|
before do
- @node.automatic_attrs[:os] = 'linux'
- @node.automatic_attrs[:platform_family] = 'debian'
+ @node.automatic_attrs[:os] = "linux"
+ @node.automatic_attrs[:platform_family] = "debian"
@node.automatic_attrs[:platform] = platform
@node.automatic_attrs[:platform_version] = version
end
@@ -62,8 +62,8 @@ describe Chef::Resource::Ifconfig do
shared_examples "being a platform based on RedHat" do |platform, version|
before do
- @node.automatic_attrs[:os] = 'linux'
- @node.automatic_attrs[:platform_family] = 'rhel'
+ @node.automatic_attrs[:os] = "linux"
+ @node.automatic_attrs[:platform_family] = "rhel"
@node.automatic_attrs[:platform] = platform
@node.automatic_attrs[:platform_version] = version
end
@@ -75,8 +75,8 @@ describe Chef::Resource::Ifconfig do
shared_examples "being a platform based on a recent Debian" do |platform, version|
before do
- @node.automatic_attrs[:os] = 'linux'
- @node.automatic_attrs[:platform_family] = 'debian'
+ @node.automatic_attrs[:os] = "linux"
+ @node.automatic_attrs[:platform_family] = "debian"
@node.automatic_attrs[:platform] = platform
@node.automatic_attrs[:platform_version] = version
end
diff --git a/spec/unit/resource/ips_package_spec.rb b/spec/unit/resource/ips_package_spec.rb
index 126ae00224..0725380620 100644
--- a/spec/unit/resource/ips_package_spec.rb
+++ b/spec/unit/resource/ips_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::IpsPackage, "initialize" do
diff --git a/spec/unit/resource/ksh_spec.rb b/spec/unit/resource/ksh_spec.rb
index 04bd8148fd..a188ed9802 100644
--- a/spec/unit/resource/ksh_spec.rb
+++ b/spec/unit/resource/ksh_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Ksh do
diff --git a/spec/unit/resource/link_spec.rb b/spec/unit/resource/link_spec.rb
index 220ad735bd..0ce5be1caf 100644
--- a/spec/unit/resource/link_spec.rb
+++ b/spec/unit/resource/link_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Link do
diff --git a/spec/unit/resource/log_spec.rb b/spec/unit/resource/log_spec.rb
index b2af194238..d6169ae315 100644
--- a/spec/unit/resource/log_spec.rb
+++ b/spec/unit/resource/log_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Log do
diff --git a/spec/unit/resource/macports_package_spec.rb b/spec/unit/resource/macports_package_spec.rb
index 0a203b2e97..488615f594 100644
--- a/spec/unit/resource/macports_package_spec.rb
+++ b/spec/unit/resource/macports_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::MacportsPackage, "initialize" do
diff --git a/spec/unit/resource/mdadm_spec.rb b/spec/unit/resource/mdadm_spec.rb
index 6ca99c58e5..f2d0e157af 100644
--- a/spec/unit/resource/mdadm_spec.rb
+++ b/spec/unit/resource/mdadm_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Mdadm do
diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb
index acce26dcab..1dac2d5dd9 100644
--- a/spec/unit/resource/mount_spec.rb
+++ b/spec/unit/resource/mount_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Mount do
before(:each) do
@@ -54,7 +54,7 @@ describe Chef::Resource::Mount do
end
it "should set fsck_device to '-' by default" do
- expect(@resource.fsck_device).to eql('-')
+ expect(@resource.fsck_device).to eql("-")
end
it "should allow you to set the fsck_device attribute" do
diff --git a/spec/unit/resource/ohai_spec.rb b/spec/unit/resource/ohai_spec.rb
index 3bc21a41d2..0bf904ab0c 100644
--- a/spec/unit/resource/ohai_spec.rb
+++ b/spec/unit/resource/ohai_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Ohai do
diff --git a/spec/unit/resource/openbsd_package_spec.rb b/spec/unit/resource/openbsd_package_spec.rb
index 95921c2f02..34de97f931 100644
--- a/spec/unit/resource/openbsd_package_spec.rb
+++ b/spec/unit/resource/openbsd_package_spec.rb
@@ -19,8 +19,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Chef::Resource::OpenbsdPackage do
diff --git a/spec/unit/resource/osx_profile_spec.rb b/spec/unit/resource/osx_profile_spec.rb
index d7d72e5836..06a147ad84 100644
--- a/spec/unit/resource/osx_profile_spec.rb
+++ b/spec/unit/resource/osx_profile_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::OsxProfile do
let(:resource) { Chef::Resource::OsxProfile.new(
@@ -54,7 +54,7 @@ describe Chef::Resource::OsxProfile do
end
it "should allow you to set the profile attribute to a hash" do
- test_profile = { 'profile' => false }
+ test_profile = { "profile" => false }
resource.profile test_profile
expect(resource.profile).to be_a(Hash)
end
diff --git a/spec/unit/resource/package_spec.rb b/spec/unit/resource/package_spec.rb
index 449732a3c4..7f7a27e2b2 100644
--- a/spec/unit/resource/package_spec.rb
+++ b/spec/unit/resource/package_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Package do
diff --git a/spec/unit/resource/pacman_package_spec.rb b/spec/unit/resource/pacman_package_spec.rb
index 975863d04f..a383601d93 100644
--- a/spec/unit/resource/pacman_package_spec.rb
+++ b/spec/unit/resource/pacman_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::PacmanPackage, "initialize" do
diff --git a/spec/unit/resource/perl_spec.rb b/spec/unit/resource/perl_spec.rb
index 7247cce6e3..9a1ec22a95 100644
--- a/spec/unit/resource/perl_spec.rb
+++ b/spec/unit/resource/perl_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Perl do
diff --git a/spec/unit/resource/powershell_script_spec.rb b/spec/unit/resource/powershell_script_spec.rb
index 42fcd61a58..16d2d37c9e 100644
--- a/spec/unit/resource/powershell_script_spec.rb
+++ b/spec/unit/resource/powershell_script_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::PowershellScript do
@@ -25,7 +25,7 @@ describe Chef::Resource::PowershellScript do
node.default["kernel"] = Hash.new
node.default["kernel"][:machine] = :x86_64.to_s
- node.automatic[:os] = 'windows'
+ node.automatic[:os] = "windows"
run_context = Chef::RunContext.new(node, nil, nil)
@@ -94,7 +94,7 @@ describe Chef::Resource::PowershellScript do
it "enables convert_boolean_return by default for guards in non-Chef::Resource::Script derived resources when no guard params are specified" do
node = Chef::Node.new
run_context = Chef::RunContext.new(node, nil, nil)
- file_resource = Chef::Resource::File.new('idontexist', run_context)
+ file_resource = Chef::Resource::File.new("idontexist", run_context)
file_resource.guard_interpreter :powershell_script
allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with(
@@ -103,21 +103,21 @@ describe Chef::Resource::PowershellScript do
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 {})
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 {})
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}
+ 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 {})
@@ -129,7 +129,7 @@ describe Chef::Resource::PowershellScript do
let(:resource_instance) { @resource }
let(:resource_instance_name ) { @resource.command }
let(:resource_name) { :powershell_script }
- let(:interpreter_file_name) { 'powershell.exe' }
+ let(:interpreter_file_name) { "powershell.exe" }
it_behaves_like "a Windows script resource"
end
diff --git a/spec/unit/resource/python_spec.rb b/spec/unit/resource/python_spec.rb
index 8a3f7e48ca..a579eacdff 100644
--- a/spec/unit/resource/python_spec.rb
+++ b/spec/unit/resource/python_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Python do
diff --git a/spec/unit/resource/registry_key_spec.rb b/spec/unit/resource/registry_key_spec.rb
index 2d82f1a51c..05a0f5ce83 100644
--- a/spec/unit/resource/registry_key_spec.rb
+++ b/spec/unit/resource/registry_key_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::RegistryKey, "initialize" do
before(:each) do
@@ -80,38 +80,38 @@ describe Chef::Resource::RegistryKey, "values" do
end
it "should allow 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 "should allow 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 "should return 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 "should throw 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 "should throw an exception if the type field is missing" do
- expect { @resource.values [ { :name => 'poosh', :data => 'carmen' } ] }.to raise_error(ArgumentError)
+ expect { @resource.values [ { :name => "poosh", :data => "carmen" } ] }.to raise_error(ArgumentError)
end
it "should throw an exception if the data field is missing" do
- expect { @resource.values [ { :name => 'poosh', :type => :string } ] }.to raise_error(ArgumentError)
+ expect { @resource.values [ { :name => "poosh", :type => :string } ] }.to raise_error(ArgumentError)
end
it "should throw 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 "should not allow a string" do
- expect { @resource.send(:values, 'souffle') }.to raise_error(ArgumentError)
+ expect { @resource.send(:values, "souffle") }.to raise_error(ArgumentError)
end
it "should not allow an integer" do
@@ -138,7 +138,7 @@ describe Chef::Resource::RegistryKey, "recursive" do
end
it "should not allow a string" do
- expect { @resource.recursive('souffle') }.to raise_error(ArgumentError)
+ expect { @resource.recursive("souffle") }.to raise_error(ArgumentError)
end
it "should not allow an integer" do
@@ -167,7 +167,7 @@ describe Chef::Resource::RegistryKey, "architecture" do
end
it "should not allow a string" do
- expect { @resource.architecture('souffle') }.to raise_error(ArgumentError)
+ expect { @resource.architecture("souffle") }.to raise_error(ArgumentError)
end
it "should not allow an integer" do
@@ -181,7 +181,7 @@ describe Chef::Resource::RegistryKey, ":unscrubbed_values" do
end
it "should return 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
@@ -193,7 +193,7 @@ describe Chef::Resource::RegistryKey, "state" do
end
it "should return scrubbed values" do
- @resource.values([ { :name => 'poosh', :type => :binary, :data => 255.chr * 1 } ])
- expect(@resource.state).to eql( { :values => [{ :name => 'poosh', :type => :binary, :data => 'a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89'}] } )
+ @resource.values([ { :name => "poosh", :type => :binary, :data => 255.chr * 1 } ])
+ expect(@resource.state).to eql( { :values => [{ :name => "poosh", :type => :binary, :data => "a8100ae6aa1940d0b663bb31cd466142ebbdbd5187131b92d93818987832eb89"}] } )
end
end
diff --git a/spec/unit/resource/remote_directory_spec.rb b/spec/unit/resource/remote_directory_spec.rb
index 1ab75586b6..ac0cfcf8d5 100644
--- a/spec/unit/resource/remote_directory_spec.rb
+++ b/spec/unit/resource/remote_directory_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::RemoteDirectory do
diff --git a/spec/unit/resource/remote_file_spec.rb b/spec/unit/resource/remote_file_spec.rb
index 0a379ff574..746cdb195c 100644
--- a/spec/unit/resource/remote_file_spec.rb
+++ b/spec/unit/resource/remote_file_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::RemoteFile do
@@ -36,13 +36,13 @@ describe Chef::Resource::RemoteFile do
it "says its provider is RemoteFile when the source is an absolute URI" do
@resource.source("http://www.google.com/robots.txt")
expect(@resource.provider).to eq(Chef::Provider::RemoteFile)
- expect(Chef::Platform.find_provider(:noplatform, 'noversion', @resource)).to eq(Chef::Provider::RemoteFile)
+ expect(Chef::Platform.find_provider(:noplatform, "noversion", @resource)).to eq(Chef::Provider::RemoteFile)
end
it "says its provider is RemoteFile when the source is a network share" do
@resource.source("\\\\fakey\\fakerton\\fake.txt")
expect(@resource.provider).to eq(Chef::Provider::RemoteFile)
- expect(Chef::Platform.find_provider(:noplatform, 'noversion', @resource)).to eq(Chef::Provider::RemoteFile)
+ expect(Chef::Platform.find_provider(:noplatform, "noversion", @resource)).to eq(Chef::Provider::RemoteFile)
end
describe "source" do
@@ -60,7 +60,7 @@ describe Chef::Resource::RemoteFile do
expect(@resource.source).to eql([ "\\\\fakey\\fakerton\\fake.txt" ])
end
- it 'should accept file URIs with spaces' do
+ it "should accept file URIs with spaces" do
@resource.source("file:///C:/foo bar")
expect(@resource.source).to eql(["file:///C:/foo bar"])
end
diff --git a/spec/unit/resource/resource_notification_spec.rb b/spec/unit/resource/resource_notification_spec.rb
index 024b6f93f7..dfe5d25cec 100644
--- a/spec/unit/resource/resource_notification_spec.rb
+++ b/spec/unit/resource/resource_notification_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/resource/resource_notification'
+require "spec_helper"
+require "chef/resource/resource_notification"
describe Chef::Resource::Notification do
diff --git a/spec/unit/resource/route_spec.rb b/spec/unit/resource/route_spec.rb
index ec1d369932..b38093887b 100644
--- a/spec/unit/resource/route_spec.rb
+++ b/spec/unit/resource/route_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Route do
diff --git a/spec/unit/resource/rpm_package_spec.rb b/spec/unit/resource/rpm_package_spec.rb
index b2e06f7f68..69412a8d06 100644
--- a/spec/unit/resource/rpm_package_spec.rb
+++ b/spec/unit/resource/rpm_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::RpmPackage, "initialize" do
diff --git a/spec/unit/resource/ruby_block_spec.rb b/spec/unit/resource/ruby_block_spec.rb
index 8664564ac5..d48fd9113c 100644
--- a/spec/unit/resource/ruby_block_spec.rb
+++ b/spec/unit/resource/ruby_block_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::RubyBlock do
diff --git a/spec/unit/resource/ruby_spec.rb b/spec/unit/resource/ruby_spec.rb
index e899810ab9..95078011ee 100644
--- a/spec/unit/resource/ruby_spec.rb
+++ b/spec/unit/resource/ruby_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Ruby do
diff --git a/spec/unit/resource/scm_spec.rb b/spec/unit/resource/scm_spec.rb
index 72319277ab..fadc9a3e54 100644
--- a/spec/unit/resource/scm_spec.rb
+++ b/spec/unit/resource/scm_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Scm do
@@ -184,7 +184,7 @@ describe Chef::Resource::Scm do
end
describe "when it has a environment attribute" do
- let(:test_environment) { {'CHEF_ENV' => '/tmp' } }
+ let(:test_environment) { {"CHEF_ENV" => "/tmp" } }
before { @resource.environment(test_environment) }
it "stores this environment" do
expect(@resource.environment).to eq(test_environment)
diff --git a/spec/unit/resource/script_spec.rb b/spec/unit/resource/script_spec.rb
index 4affee8e8c..45ad1e6cec 100644
--- a/spec/unit/resource/script_spec.rb
+++ b/spec/unit/resource/script_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Script do
let(:resource_instance_name) { "fakey_fakerton" }
diff --git a/spec/unit/resource/service_spec.rb b/spec/unit/resource/service_spec.rb
index b9e3757255..16288d7a90 100644
--- a/spec/unit/resource/service_spec.rb
+++ b/spec/unit/resource/service_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Service do
diff --git a/spec/unit/resource/smartos_package_spec.rb b/spec/unit/resource/smartos_package_spec.rb
index c2cf546dd5..24e65e6c3c 100644
--- a/spec/unit/resource/smartos_package_spec.rb
+++ b/spec/unit/resource/smartos_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::SmartosPackage, "initialize" do
diff --git a/spec/unit/resource/solaris_package_spec.rb b/spec/unit/resource/solaris_package_spec.rb
index f5d3e669a1..a97730aea6 100644
--- a/spec/unit/resource/solaris_package_spec.rb
+++ b/spec/unit/resource/solaris_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::SolarisPackage, "initialize" do
diff --git a/spec/unit/resource/subversion_spec.rb b/spec/unit/resource/subversion_spec.rb
index aa4d1ed708..b2d3689dc9 100644
--- a/spec/unit/resource/subversion_spec.rb
+++ b/spec/unit/resource/subversion_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::Subversion do
@@ -42,7 +42,7 @@ describe Chef::Resource::Subversion do
end
it "sets svn info arguments to --no-auth-cache by default" do
- expect(@svn.svn_info_args).to eq('--no-auth-cache')
+ expect(@svn.svn_info_args).to eq("--no-auth-cache")
end
it "resets svn info arguments to nil when given false in the setter" do
@@ -51,7 +51,7 @@ describe Chef::Resource::Subversion do
end
it "sets svn arguments to --no-auth-cache by default" do
- expect(@svn.svn_arguments).to eq('--no-auth-cache')
+ expect(@svn.svn_arguments).to eq("--no-auth-cache")
end
it "sets svn binary to nil by default" do
diff --git a/spec/unit/resource/template_spec.rb b/spec/unit/resource/template_spec.rb
index 2fd951b72d..2e7c1781d1 100644
--- a/spec/unit/resource/template_spec.rb
+++ b/spec/unit/resource/template_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::Template do
diff --git a/spec/unit/resource/timestamped_deploy_spec.rb b/spec/unit/resource/timestamped_deploy_spec.rb
index 4ebfdaf059..851cbf4f35 100644
--- a/spec/unit/resource/timestamped_deploy_spec.rb
+++ b/spec/unit/resource/timestamped_deploy_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::TimestampedDeploy, "initialize" do
@@ -25,8 +25,8 @@ describe Chef::Resource::TimestampedDeploy, "initialize" do
provider: Chef::Provider::Deploy::Timestamped,
name: :timestamped_deploy,
action: :deploy,
- os: 'linux',
- platform_family: 'rhel',
+ os: "linux",
+ platform_family: "rhel",
)
end
diff --git a/spec/unit/resource/user_spec.rb b/spec/unit/resource/user_spec.rb
index 3bf7e6187b..e259653120 100644
--- a/spec/unit/resource/user_spec.rb
+++ b/spec/unit/resource/user_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::User, "initialize" do
before(:each) do
diff --git a/spec/unit/resource/windows_package_spec.rb b/spec/unit/resource/windows_package_spec.rb
index 3623c24e29..ba336a4afd 100644
--- a/spec/unit/resource/windows_package_spec.rb
+++ b/spec/unit/resource/windows_package_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::WindowsPackage, "initialize" do
before(:each) do
@@ -80,12 +80,12 @@ describe Chef::Resource::WindowsPackage, "initialize" do
end
it "supports the checksum attribute" do
- resource.checksum('somechecksum')
- expect(resource.checksum).to eq('somechecksum')
+ resource.checksum("somechecksum")
+ expect(resource.checksum).to eq("somechecksum")
end
- context 'when a URL is used' do
- let(:resource_source) { 'https://foo.bar/solitare.msi' }
+ context "when a URL is used" do
+ let(:resource_source) { "https://foo.bar/solitare.msi" }
let(:resource) { Chef::Resource::WindowsPackage.new(resource_source) }
it "should return the source unmodified" do
diff --git a/spec/unit/resource/windows_service_spec.rb b/spec/unit/resource/windows_service_spec.rb
index 64bb05afc4..04a27090a5 100644
--- a/spec/unit/resource/windows_service_spec.rb
+++ b/spec/unit/resource/windows_service_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource::WindowsService, "initialize" do
static_provider_resolution(
diff --git a/spec/unit/resource/yum_package_spec.rb b/spec/unit/resource/yum_package_spec.rb
index f24f1e3405..4c175bb905 100644
--- a/spec/unit/resource/yum_package_spec.rb
+++ b/spec/unit/resource/yum_package_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/shared/unit/resource/static_provider_resolution'
+require "spec_helper"
+require "support/shared/unit/resource/static_provider_resolution"
describe Chef::Resource::YumPackage, "initialize" do
@@ -26,8 +26,8 @@ describe Chef::Resource::YumPackage, "initialize" do
provider: Chef::Provider::Package::Yum,
name: :yum_package,
action: :install,
- os: 'linux',
- platform_family: 'rhel',
+ os: "linux",
+ platform_family: "rhel",
)
end
diff --git a/spec/unit/resource_collection/resource_list_spec.rb b/spec/unit/resource_collection/resource_list_spec.rb
index 1e6c477854..a9f30f8bac 100644
--- a/spec/unit/resource_collection/resource_list_spec.rb
+++ b/spec/unit/resource_collection/resource_list_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::ResourceCollection::ResourceList do
let(:resource_list) { Chef::ResourceCollection::ResourceList.new() }
diff --git a/spec/unit/resource_collection/resource_set_spec.rb b/spec/unit/resource_collection/resource_set_spec.rb
index 0e25934216..a5f26dd4f9 100644
--- a/spec/unit/resource_collection/resource_set_spec.rb
+++ b/spec/unit/resource_collection/resource_set_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::ResourceCollection::ResourceSet do
let(:collection) { Chef::ResourceCollection::ResourceSet.new }
diff --git a/spec/unit/resource_collection/stepable_iterator_spec.rb b/spec/unit/resource_collection/stepable_iterator_spec.rb
index b34b7140fe..c81139fecb 100644
--- a/spec/unit/resource_collection/stepable_iterator_spec.rb
+++ b/spec/unit/resource_collection/stepable_iterator_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::ResourceCollection::StepableIterator do
CRSI = Chef::ResourceCollection::StepableIterator
diff --git a/spec/unit/resource_collection_spec.rb b/spec/unit/resource_collection_spec.rb
index d52e7e2c26..ff7e111956 100644
--- a/spec/unit/resource_collection_spec.rb
+++ b/spec/unit/resource_collection_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::ResourceCollection do
let(:rc) { Chef::ResourceCollection.new() }
@@ -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
diff --git a/spec/unit/resource_definition_spec.rb b/spec/unit/resource_definition_spec.rb
index 1371a8b9a6..cd4a29bd47 100644
--- a/spec/unit/resource_definition_spec.rb
+++ b/spec/unit/resource_definition_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::ResourceDefinition do
let(:defn) { Chef::ResourceDefinition.new() }
diff --git a/spec/unit/resource_reporter_spec.rb b/spec/unit/resource_reporter_spec.rb
index 34d4b23106..aa162fd161 100644
--- a/spec/unit/resource_reporter_spec.rb
+++ b/spec/unit/resource_reporter_spec.rb
@@ -20,8 +20,8 @@
#
require File.expand_path("../../spec_helper", __FILE__)
-require 'chef/resource_reporter'
-require 'socket'
+require "chef/resource_reporter"
+require "socket"
describe Chef::ResourceReporter do
before(:all) do
@@ -51,7 +51,7 @@ describe Chef::ResourceReporter do
@run_context = Chef::RunContext.new(@node, {}, @events)
@run_status = Chef::RunStatus.new(@node, @events)
@run_list = Chef::RunList.new
- @run_list << 'recipe[lobster]' << 'role[rage]' << 'recipe[fist]'
+ @run_list << "recipe[lobster]" << "role[rage]" << "recipe[fist]"
@expansion = Chef::RunList::RunListExpansion.new("_default", @run_list.run_list_items)
@run_id = @run_status.run_id
allow(Time).to receive(:now).and_return(@start_time, @end_time)
@@ -446,7 +446,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
@@ -454,7 +454,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
@@ -568,12 +568,12 @@ describe Chef::ResourceReporter do
it "sets before to {} instead of nil" do
expect(@first_update_report).to have_key("before")
- expect(@first_update_report['before']).to eq({})
+ expect(@first_update_report["before"]).to eq({})
end
it "sets after to {} instead of 'Running'" do
expect(@first_update_report).to have_key("after")
- expect(@first_update_report['after']).to eq({})
+ expect(@first_update_report["after"]).to eq({})
end
end
@@ -593,7 +593,7 @@ describe Chef::ResourceReporter do
expect(@rest_client).to receive(:post).
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}).
+ {"X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION}).
and_raise(@error)
end
@@ -622,7 +622,7 @@ describe Chef::ResourceReporter do
@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},
- {'X-Ops-Reporting-Protocol-Version' => Chef::ResourceReporter::PROTOCOL_VERSION}).
+ {"X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION}).
and_raise(@error)
end
@@ -652,7 +652,7 @@ describe Chef::ResourceReporter do
@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},
- {'X-Ops-Reporting-Protocol-Version' => Chef::ResourceReporter::PROTOCOL_VERSION}).
+ {"X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION}).
and_raise(@error)
end
@@ -673,7 +673,7 @@ describe Chef::ResourceReporter 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},
- {'X-Ops-Reporting-Protocol-Version' => Chef::ResourceReporter::PROTOCOL_VERSION}).
+ {"X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION}).
and_return(response)
@resource_reporter.run_started(@run_status)
end
@@ -695,8 +695,8 @@ describe Chef::ResourceReporter do
expect(@rest_client).to receive(:raw_request).ordered do |method, url, headers, data|
expect(method).to eq(:POST)
- expect(headers).to eq({'Content-Encoding' => 'gzip',
- 'X-Ops-Reporting-Protocol-Version' => Chef::ResourceReporter::PROTOCOL_VERSION,
+ expect(headers).to eq({"Content-Encoding" => "gzip",
+ "X-Ops-Reporting-Protocol-Version" => Chef::ResourceReporter::PROTOCOL_VERSION,
},)
data_stream = Zlib::GzipReader.new(StringIO.new(data))
data = data_stream.read
diff --git a/spec/unit/resource_resolver_spec.rb b/spec/unit/resource_resolver_spec.rb
index b3bda9d945..05ee79144e 100644
--- a/spec/unit/resource_resolver_spec.rb
+++ b/spec/unit/resource_resolver_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/resource_resolver'
+require "spec_helper"
+require "chef/resource_resolver"
describe Chef::ResourceResolver do
@@ -29,9 +29,9 @@ describe Chef::ResourceResolver do
expect(described_class.list(:package)).to_not be_empty
end
- context 'instance methods' do
+ context "instance methods" do
let(:resolver) do
- described_class.new(Chef::Node.new, 'execute')
+ described_class.new(Chef::Node.new, "execute")
end
it '#resolve' do
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index 82d224e810..53d546d059 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -19,10 +19,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Resource do
- let(:cookbook_repo_path) { File.join(CHEF_SPEC_DATA, 'cookbooks') }
+ let(:cookbook_repo_path) { File.join(CHEF_SPEC_DATA, "cookbooks") }
let(:cookbook_collection) { Chef::CookbookCollection.new(Chef::CookbookLoader.new(cookbook_repo_path)) }
let(:node) { Chef::Node.new }
let(:events) { Chef::EventDispatch::Dispatcher.new }
@@ -205,7 +205,7 @@ describe Chef::Resource do
end
it "coerces arrays to names" do
- expect(resource.name ['a', 'b']).to eql('a, b')
+ expect(resource.name ["a", "b"]).to eql("a, b")
end
it "should coerce objects to a string" do
@@ -252,13 +252,13 @@ describe Chef::Resource do
end
it "creates a notification for a resource that is not yet in the resource collection" do
- resource.notifies(:restart, :service => 'apache')
+ 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')
+ 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
@@ -340,7 +340,7 @@ describe Chef::Resource do
c = Class.new(Chef::Resource) do
end
- r = c.new('hi')
+ r = c.new("hi")
r.declared_type = :d
expect(c.resource_name).to be_nil
expect(r.resource_name).to be_nil
@@ -355,7 +355,7 @@ describe Chef::Resource do
end
end
- r = c.new('hi')
+ r = c.new("hi")
r.declared_type = :d
expect(c.resource_name).to be_nil
expect(r.resource_name).to eq :blah
@@ -369,7 +369,7 @@ describe Chef::Resource do
end
end
- r = c.new('hi')
+ r = c.new("hi")
r.declared_type = :d
expect(c.resource_name).to be_nil
expect(r.resource_name).to be_nil
@@ -379,10 +379,10 @@ describe Chef::Resource do
it "resource_name without provides is honored" do
c = Class.new(Chef::Resource) do
- resource_name 'blah'
+ resource_name "blah"
end
- r = c.new('hi')
+ r = c.new("hi")
r.declared_type = :d
expect(c.resource_name).to eq :blah
expect(r.resource_name).to eq :blah
@@ -394,7 +394,7 @@ describe Chef::Resource do
end
c.resource_name = :blah
- r = c.new('hi')
+ r = c.new("hi")
r.declared_type = :d
expect(c.resource_name).to eq :blah
expect(r.resource_name).to eq :blah
@@ -406,7 +406,7 @@ describe Chef::Resource do
provides :self_resource_name_test_3
end
- r = c.new('hi')
+ r = c.new("hi")
r.declared_type = :d
expect(c.resource_name).to eq :blah
expect(r.resource_name).to eq :blah
@@ -512,7 +512,7 @@ describe Chef::Resource do
before do
node.automatic_attrs[:platform] = "fubuntu"
- node.automatic_attrs[:platform_version] = '10.04'
+ node.automatic_attrs[:platform_version] = "10.04"
end
it "should default to not retrying if a provider fails for a resource" do
@@ -614,7 +614,7 @@ describe Chef::Resource do
}
before do
node.automatic_attrs[:platform] = "fubuntu"
- node.automatic_attrs[:platform_version] = '10.04'
+ node.automatic_attrs[:platform_version] = "10.04"
end
it "does not run only_if if no only_if command is given" do
@@ -643,8 +643,8 @@ describe Chef::Resource do
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
@@ -656,7 +656,7 @@ describe Chef::Resource do
it "runs not_if as a block when it is a ruby block" do
expect_any_instance_of(Chef::Resource::Conditional).to receive(:evaluate_block).at_least(1).times
- resource.not_if { puts 'foo' }
+ resource.not_if { puts "foo" }
resource.run_action(:purr)
end
@@ -667,8 +667,8 @@ describe Chef::Resource do
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
@@ -698,7 +698,7 @@ describe Chef::Resource do
end
it "should raise Chef::Exceptions::ValidationFailed on an attempt to set the guard_interpreter attribute to something other than a Symbol" do
- expect { resource.guard_interpreter('command_dot_com') }.to raise_error(Chef::Exceptions::ValidationFailed)
+ expect { resource.guard_interpreter("command_dot_com") }.to raise_error(Chef::Exceptions::ValidationFailed)
end
it "should not raise an exception when setting the guard interpreter attribute to a Symbol" do
@@ -804,7 +804,7 @@ describe Chef::Resource do
}
before do
node.automatic_attrs[:platform] = "fubuntu"
- node.automatic_attrs[:platform_version] = '10.04'
+ node.automatic_attrs[:platform_version] = "10.04"
end
it "should not run only_if/not_if conditionals (CHEF-972)" do
@@ -850,21 +850,21 @@ describe Chef::Resource do
Chef::Resource.send(:remove_const, :Klz)
end
- it 'adds mappings for a single platform' do
+ it "adds mappings for a single platform" do
expect(Chef.resource_handler_map).to receive(:set).with(
- :dinobot, Chef::Resource::Klz, { platform: ['autobots'] }
+ :dinobot, Chef::Resource::Klz, { platform: ["autobots"] }
)
- klz.provides :dinobot, platform: ['autobots']
+ klz.provides :dinobot, platform: ["autobots"]
end
- it 'adds mappings for multiple platforms' do
+ it "adds mappings for multiple platforms" do
expect(Chef.resource_handler_map).to receive(:set).with(
- :energy, Chef::Resource::Klz, { platform: ['autobots', 'decepticons']}
+ :energy, Chef::Resource::Klz, { platform: ["autobots", "decepticons"]}
)
- klz.provides :energy, platform: ['autobots', 'decepticons']
+ klz.provides :energy, platform: ["autobots", "decepticons"]
end
- it 'adds mappings for all platforms' do
+ it "adds mappings for all platforms" do
expect(Chef.resource_handler_map).to receive(:set).with(
:tape_deck, Chef::Resource::Klz, {}
)
@@ -883,7 +883,7 @@ describe Chef::Resource do
node.name("bumblebee")
node.automatic[:platform] = "autobots"
node.automatic[:platform_version] = "6.1"
- Object.const_set('Soundwave', klz1)
+ Object.const_set("Soundwave", klz1)
klz1.provides :soundwave
end
@@ -905,8 +905,8 @@ describe Chef::Resource do
node.name("bumblebee")
node.automatic[:platform] = "autobots"
node.automatic[:platform_version] = "6.1"
- klz2.provides :dinobot, :platform => ['autobots']
- Object.const_set('Grimlock', klz2)
+ klz2.provides :dinobot, :platform => ["autobots"]
+ Object.const_set("Grimlock", klz2)
klz2.provides :grimlock
end
@@ -1019,7 +1019,7 @@ describe Chef::Resource do
allowed_actions(%i{one two})
end
end
- let(:resource) { resource_class.new('test', nil) }
+ let(:resource) { resource_class.new("test", nil) }
subject { resource.action }
context "with a no action" do
@@ -1041,7 +1041,7 @@ describe Chef::Resource do
end
context "with a string action" do
- before { resource.action('two') }
+ before { resource.action("two") }
it { is_expected.to eq [:two] }
end
@@ -1089,7 +1089,7 @@ describe Chef::Resource do
end
context "with a string default action" do
- let(:default_action) { 'one' }
+ let(:default_action) { "one" }
it { is_expected.to eq [:one] }
end
diff --git a/spec/unit/rest/auth_credentials_spec.rb b/spec/unit/rest/auth_credentials_spec.rb
index dc66d12a19..88da44319b 100644
--- a/spec/unit/rest/auth_credentials_spec.rb
+++ b/spec/unit/rest/auth_credentials_spec.rb
@@ -19,9 +19,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'uri'
-require 'net/https'
+require "spec_helper"
+require "uri"
+require "net/https"
KEY_DOT_PEM=<<-END_RSA_KEY
-----BEGIN RSA PRIVATE KEY-----
@@ -56,7 +56,7 @@ Y6S6MeZ69Rp89ma4ttMZ+kwi1+XyHqC/dlcVRW42Zl5Dc7BALRlJjQ==
describe Chef::REST::AuthCredentials do
before do
- @key_file_fixture = CHEF_SPEC_DATA + '/ssl/private_key.pem'
+ @key_file_fixture = CHEF_SPEC_DATA + "/ssl/private_key.pem"
@key = OpenSSL::PKey::RSA.new(IO.read(@key_file_fixture).strip)
@auth_credentials = Chef::REST::AuthCredentials.new("client-name", @key)
end
@@ -72,7 +72,7 @@ describe Chef::REST::AuthCredentials do
describe "when loading the private key" do
it "strips extra whitespace before checking the key" do
- key_file_fixture = CHEF_SPEC_DATA + '/ssl/private_key_with_whitespace.pem'
+ key_file_fixture = CHEF_SPEC_DATA + "/ssl/private_key_with_whitespace.pem"
expect {Chef::REST::AuthCredentials.new("client-name", @key_file_fixture)}.not_to raise_error
end
end
@@ -131,7 +131,7 @@ describe Chef::REST::RESTRequest do
end
before do
- @auth_credentials = Chef::REST::AuthCredentials.new("client-name", CHEF_SPEC_DATA + '/ssl/private_key.pem')
+ @auth_credentials = Chef::REST::AuthCredentials.new("client-name", CHEF_SPEC_DATA + "/ssl/private_key.pem")
@url = URI.parse("http://chef.example.com:4000/?q=chef_is_awesome")
@req_body = '{"json_data":"as_a_string"}'
@headers = { "Content-type" =>"application/json",
diff --git a/spec/unit/rest_spec.rb b/spec/unit/rest_spec.rb
index 3ecbbd14b8..ba5f837c07 100644
--- a/spec/unit/rest_spec.rb
+++ b/spec/unit/rest_spec.rb
@@ -19,10 +19,10 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'uri'
-require 'net/https'
-require 'stringio'
+require "spec_helper"
+require "uri"
+require "net/https"
+require "stringio"
SIGNING_KEY_DOT_PEM="-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA49TA0y81ps0zxkOpmf5V4/c4IeR5yVyQFpX3JpxO4TquwnRh
@@ -69,8 +69,8 @@ describe Chef::REST do
rest
end
- let(:standard_read_headers) {{"Accept"=>"application/json", "Accept-Encoding"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "X-REMOTE-REQUEST-ID"=>request_id, 'X-Ops-Server-API-Version' => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION}}
- let(:standard_write_headers) {{"Accept"=>"application/json", "Content-Type"=>"application/json", "Accept-Encoding"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "X-REMOTE-REQUEST-ID"=>request_id, 'X-Ops-Server-API-Version' => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION}}
+ let(:standard_read_headers) {{"Accept"=>"application/json", "Accept-Encoding"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "X-REMOTE-REQUEST-ID"=>request_id, "X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION}}
+ let(:standard_write_headers) {{"Accept"=>"application/json", "Content-Type"=>"application/json", "Accept-Encoding"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "X-REMOTE-REQUEST-ID"=>request_id, "X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION}}
before(:each) do
Chef::Log.init(log_stringio)
@@ -92,7 +92,7 @@ describe Chef::REST do
Chef::REST.new(base_url, nil, nil, options)
end
- context 'when created with a chef zero URL' do
+ context "when created with a chef zero URL" do
let(:url) { "chefzero://localhost:1" }
@@ -115,12 +115,12 @@ describe Chef::REST do
with(:GET, monkey_uri, standard_read_headers, false).
and_return([1,2,3])
expect(rest).to receive(:apply_response_middleware).with(1,2,3).and_return([1,2,3])
- expect(rest).to receive('success_response?'.to_sym).with(1).and_return(true)
+ expect(rest).to receive("success_response?".to_sym).with(1).and_return(true)
rest.get_rest("monkey")
end
it "makes a :GET reqest for a streaming download with the composed url" do
- expect(rest).to receive(:streaming_request).with('monkey', {})
+ expect(rest).to receive(:streaming_request).with("monkey", {})
rest.get_rest("monkey", true)
end
@@ -129,7 +129,7 @@ describe Chef::REST do
with(:DELETE, monkey_uri, standard_read_headers, false).
and_return([1,2,3])
expect(rest).to receive(:apply_response_middleware).with(1,2,3).and_return([1,2,3])
- expect(rest).to receive('success_response?'.to_sym).with(1).and_return(true)
+ expect(rest).to receive("success_response?".to_sym).with(1).and_return(true)
rest.delete_rest("monkey")
end
@@ -138,7 +138,7 @@ describe Chef::REST do
with(:POST, monkey_uri, standard_write_headers, "\"data\"").
and_return([1,2,3])
expect(rest).to receive(:apply_response_middleware).with(1,2,3).and_return([1,2,3])
- expect(rest).to receive('success_response?'.to_sym).with(1).and_return(true)
+ expect(rest).to receive("success_response?".to_sym).with(1).and_return(true)
rest.post_rest("monkey", "data")
end
@@ -147,7 +147,7 @@ describe Chef::REST do
with(:PUT, monkey_uri, standard_write_headers, "\"data\"").
and_return([1,2,3])
expect(rest).to receive(:apply_response_middleware).with(1,2,3).and_return([1,2,3])
- expect(rest).to receive('success_response?'.to_sym).with(1).and_return(true)
+ expect(rest).to receive("success_response?".to_sym).with(1).and_return(true)
rest.put_rest("monkey", "data")
end
end
@@ -162,11 +162,11 @@ describe Chef::REST do
Chef::Config[:client_key] = CHEF_SPEC_DATA + "/ssl/private_key.pem"
end
- it 'responds to raw_http_request as a public method' do
+ it "responds to raw_http_request as a public method" do
expect(rest.public_methods.map(&:to_s)).to include("raw_http_request")
end
- it 'calls the authn middleware' do
+ it "calls the authn middleware" do
data = "\"secure data\""
auth_headers = standard_write_headers.merge({"auth_done"=>"yep"})
@@ -177,18 +177,18 @@ describe Chef::REST do
expect(rest).to receive(:send_http_request).
with(:POST, monkey_uri, auth_headers, data).
and_return([1,2,3])
- expect(rest).to receive('success_response?'.to_sym).with(1).and_return(true)
+ expect(rest).to receive("success_response?".to_sym).with(1).and_return(true)
rest.raw_http_request(:POST, monkey_uri, standard_write_headers, data)
end
- it 'sets correct authn headers' do
+ it "sets correct authn headers" do
data = "\"secure data\""
method, uri, auth_headers, d = rest.authenticator.handle_request(:POST, monkey_uri, standard_write_headers, data)
expect(rest).to receive(:send_http_request).
with(:POST, monkey_uri, auth_headers, data).
and_return([1,2,3])
- expect(rest).to receive('success_response?'.to_sym).with(1).and_return(true)
+ expect(rest).to receive("success_response?".to_sym).with(1).and_return(true)
rest.raw_http_request(:POST, monkey_uri, standard_write_headers, data)
end
end
@@ -287,12 +287,12 @@ describe Chef::REST do
let(:base_headers) do #FIXME: huh?
{
- 'Accept' => 'application/json',
- 'X-Chef-Version' => Chef::VERSION,
- 'Accept-Encoding' => Chef::REST::RESTRequest::ENCODING_GZIP_DEFLATE,
- 'Host' => host_header,
- 'X-REMOTE-REQUEST-ID' => request_id,
- 'X-Ops-Server-API-Version' => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION,
+ "Accept" => "application/json",
+ "X-Chef-Version" => Chef::VERSION,
+ "Accept-Encoding" => Chef::REST::RESTRequest::ENCODING_GZIP_DEFLATE,
+ "Host" => host_header,
+ "X-REMOTE-REQUEST-ID" => request_id,
+ "X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION,
}
end
@@ -314,7 +314,7 @@ describe Chef::REST do
# XXX: must reset to default b/c knife changes the UA
Chef::REST::RESTRequest.user_agent = Chef::REST::RESTRequest::DEFAULT_UA
rest.request(:GET, url, {})
- expect(request_mock['User-Agent']).to match(/^Chef Client\/#{Chef::VERSION}/)
+ expect(request_mock["User-Agent"]).to match(/^Chef Client\/#{Chef::VERSION}/)
end
# CHEF-3140
@@ -340,8 +340,8 @@ describe Chef::REST do
context "when configured with custom http headers" do
let(:custom_headers) do
{
- 'X-Custom-ChefSecret' => 'sharpknives',
- 'X-Custom-RequestPriority' => 'extremely low',
+ "X-Custom-ChefSecret" => "sharpknives",
+ "X-Custom-RequestPriority" => "extremely low",
}
end
@@ -371,7 +371,7 @@ describe Chef::REST do
end
it "should set the cookie for this request if one exists for the given host:port" do
- expect(Net::HTTP::Get).to receive(:new).with("/?foo=bar", base_headers.merge('Cookie' => "cookie monster")).and_return(request_mock)
+ expect(Net::HTTP::Get).to receive(:new).with("/?foo=bar", base_headers.merge("Cookie" => "cookie monster")).and_return(request_mock)
rest.request(:GET, url, {})
end
end
@@ -383,7 +383,7 @@ describe Chef::REST do
it "should build a new HTTP POST request" do
request = Net::HTTP::Post.new(url.path)
- expected_headers = base_headers.merge("Content-Type" => 'application/json', 'Content-Length' => '13')
+ expected_headers = base_headers.merge("Content-Type" => "application/json", "Content-Length" => "13")
expect(Net::HTTP::Post).to receive(:new).with("/?foo=bar", expected_headers).and_return(request)
rest.request(:POST, url, {}, {:one=>:two})
@@ -392,7 +392,7 @@ describe Chef::REST do
it "should build a new HTTP PUT request" do
request = Net::HTTP::Put.new(url.path)
- expected_headers = base_headers.merge("Content-Type" => 'application/json', 'Content-Length' => '13')
+ expected_headers = base_headers.merge("Content-Type" => "application/json", "Content-Length" => "13")
expect(Net::HTTP::Put).to receive(:new).with("/?foo=bar",expected_headers).and_return(request)
rest.request(:PUT, url, {}, {:one=>:two})
expect(request.body).to eq('{"one":"two"}')
@@ -419,12 +419,12 @@ describe Chef::REST do
context "when JSON is returned" do
let(:body) { '{"ohai2u":"json_api"}' }
it "should inflate the body as to an object" do
- http_response.add_field('content-type', "application/json")
+ http_response.add_field("content-type", "application/json")
expect(rest.request(:GET, url, {})).to eq({"ohai2u"=>"json_api"})
end
it "should fail if the response is truncated" do
- http_response.add_field('content-type', "application/json")
+ http_response.add_field("content-type", "application/json")
http_response["Content-Length"] = (body.bytesize + 99).to_s
expect { rest.request(:GET, url, {}) }.to raise_error(Chef::Exceptions::ContentLengthMismatch)
end
@@ -486,7 +486,7 @@ describe Chef::REST do
allow(rest).to receive(:sleep)
expect {rest.request(:GET, url)}.to raise_error(Net::HTTPFatalError)
- expect(log_stringio.string).to match(Regexp.escape('INFO: HTTP Request Returned 500 drooling from inside of mouth: Ears get sore!, Not even four'))
+ expect(log_stringio.string).to match(Regexp.escape("INFO: HTTP Request Returned 500 drooling from inside of mouth: Ears get sore!, Not even four"))
end
end
@@ -511,7 +511,7 @@ describe Chef::REST do
it "decompresses the JSON error message" do
expect {rest.request(:GET, url)}.to raise_error(Net::HTTPFatalError)
- expect(log_stringio.string).to match(Regexp.escape('INFO: HTTP Request Returned 500 drooling from inside of mouth: Ears get sore!, Not even four'))
+ expect(log_stringio.string).to match(Regexp.escape("INFO: HTTP Request Returned 500 drooling from inside of mouth: Ears get sore!, Not even four"))
end
it "fails when the compressed body is truncated" do
@@ -544,7 +544,7 @@ describe Chef::REST do
let(:request_mock) { {} }
let(:http_response) do
- http_response = Net::HTTPSuccess.new("1.1",'200', "it-works")
+ http_response = Net::HTTPSuccess.new("1.1","200", "it-works")
allow(http_response).to receive(:read_body)
expect(http_response).not_to receive(:body)
@@ -570,24 +570,24 @@ describe Chef::REST do
end
it " build a new HTTP GET request without the application/json accept header" do
- expected_headers = {'Accept' => "*/*",
- 'X-Chef-Version' => Chef::VERSION,
- 'Accept-Encoding' => Chef::REST::RESTRequest::ENCODING_GZIP_DEFLATE,
- 'Host' => host_header,
- 'X-REMOTE-REQUEST-ID'=> request_id,
- 'X-Ops-Server-API-Version' => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION,
+ expected_headers = {"Accept" => "*/*",
+ "X-Chef-Version" => Chef::VERSION,
+ "Accept-Encoding" => Chef::REST::RESTRequest::ENCODING_GZIP_DEFLATE,
+ "Host" => host_header,
+ "X-REMOTE-REQUEST-ID"=> request_id,
+ "X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION,
}
expect(Net::HTTP::Get).to receive(:new).with("/?foo=bar", expected_headers).and_return(request_mock)
rest.streaming_request(url, {})
end
it "build a new HTTP GET request with the X-Remote-Request-Id header" do
- expected_headers = {'Accept' => "*/*",
- 'X-Chef-Version' => Chef::VERSION,
- 'Accept-Encoding' => Chef::REST::RESTRequest::ENCODING_GZIP_DEFLATE,
- 'Host' => host_header,
- 'X-REMOTE-REQUEST-ID'=> request_id,
- 'X-Ops-Server-API-Version' => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION,
+ expected_headers = {"Accept" => "*/*",
+ "X-Chef-Version" => Chef::VERSION,
+ "Accept-Encoding" => Chef::REST::RESTRequest::ENCODING_GZIP_DEFLATE,
+ "Host" => host_header,
+ "X-REMOTE-REQUEST-ID"=> request_id,
+ "X-Ops-Server-API-Version" => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION,
}
expect(Net::HTTP::Get).to receive(:new).with("/?foo=bar", expected_headers).and_return(request_mock)
rest.streaming_request(url, {})
@@ -622,13 +622,13 @@ describe Chef::REST do
end
it "does not raise a divide by zero exception if the content's actual size is 0" do
- http_response['Content-Length'] = "5"
- allow(http_response).to receive(:read_body).and_yield('')
+ http_response["Content-Length"] = "5"
+ allow(http_response).to receive(:read_body).and_yield("")
expect { rest.streaming_request(url, {}) }.to raise_error(Chef::Exceptions::ContentLengthMismatch)
end
it "does not raise a divide by zero exception when the Content-Length is 0" do
- http_response['Content-Length'] = "0"
+ http_response["Content-Length"] = "0"
allow(http_response).to receive(:read_body).and_yield("ninja")
expect { rest.streaming_request(url, {}) }.to raise_error(Chef::Exceptions::ContentLengthMismatch)
end
diff --git a/spec/unit/role_spec.rb b/spec/unit/role_spec.rb
index 6e9b133c50..a48137d28a 100644
--- a/spec/unit/role_spec.rb
+++ b/spec/unit/role_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/role'
+require "spec_helper"
+require "chef/role"
describe Chef::Role do
before(:each) do
@@ -108,12 +108,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
@@ -123,12 +123,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
@@ -138,18 +138,18 @@ describe Chef::Role do
describe "update_from!" 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.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" })
@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.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" })
end
it "should update all fields except for name" do
@@ -164,11 +164,11 @@ describe Chef::Role 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.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" })
@serialized_role = Chef::JSONCompat.to_json(@role)
end
@@ -200,14 +200,14 @@ 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]"])
+ @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)
end
it "includes the per-environment run lists" do
#Activesupport messes with Chef json formatting
#This test should pass with and without activesupport
- expect(@serialized_role["env_run_lists"]["production"]).to eq(['role[monitoring]', 'role[auditing]', 'role[apache]'])
+ expect(@serialized_role["env_run_lists"]["production"]).to eq(["role[monitoring]", "role[auditing]", "role[apache]"])
expect(@serialized_role["env_run_lists"]["dev"]).to eq(["role[nginx]"])
end
@@ -224,11 +224,11 @@ describe Chef::Role do
describe "when created from 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.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" })
@deserial = Chef::Role.from_hash(Chef::JSONCompat.parse(Chef::JSONCompat.to_json(@role)))
end
@@ -256,13 +256,13 @@ EOR
describe "when loading from disk" do
before do
- default_cache_path = windows? ? 'C:\chef' : '/var/chef'
+ default_cache_path = windows? ? 'C:\chef' : "/var/chef"
allow(Chef::Config).to receive(:cache_path).and_return(default_cache_path)
end
it "should return a Chef::Role object from JSON" do
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes", "#{Chef::Config[:role_path]}/memes/lolcat.json"])
- file_path = File.join(Chef::Config[:role_path], 'memes/lolcat.json')
+ file_path = File.join(Chef::Config[:role_path], "memes/lolcat.json")
expect(File).to receive(:exists?).with(file_path).exactly(1).times.and_return(true)
expect(IO).to receive(:read).with(file_path).and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
expect(@role).to be_a_kind_of(Chef::Role)
@@ -271,7 +271,7 @@ EOR
it "should return a Chef::Role object from a Ruby DSL" do
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes", "#{Chef::Config[:role_path]}/memes/lolcat.rb"])
- rb_path = File.join(Chef::Config[:role_path], 'memes/lolcat.rb')
+ rb_path = File.join(Chef::Config[:role_path], "memes/lolcat.rb")
expect(File).to receive(:exists?).with(rb_path).exactly(2).times.and_return(true)
expect(File).to receive(:readable?).with(rb_path).exactly(1).times.and_return(true)
expect(IO).to receive(:read).with(rb_path).and_return(ROLE_DSL)
@@ -281,8 +281,8 @@ EOR
it "should prefer a Chef::Role Object from JSON over one from a Ruby DSL" do
expect(Dir).to receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes", "#{Chef::Config[:role_path]}/memes/lolcat.json", "#{Chef::Config[:role_path]}/memes/lolcat.rb"])
- js_path = File.join(Chef::Config[:role_path], 'memes/lolcat.json')
- rb_path = File.join(Chef::Config[:role_path], 'memes/lolcat.rb')
+ js_path = File.join(Chef::Config[:role_path], "memes/lolcat.json")
+ rb_path = File.join(Chef::Config[:role_path], "memes/lolcat.rb")
expect(File).to receive(:exists?).with(js_path).exactly(1).times.and_return(true)
expect(File).not_to receive(:exists?).with(rb_path)
expect(IO).to receive(:read).with(js_path).and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
@@ -313,48 +313,48 @@ EOR
describe "when loading from disk and role_path is an array" do
before(:each) do
- Chef::Config[:role_path] = ['/path1', '/path/path2']
+ Chef::Config[:role_path] = ["/path1", "/path/path2"]
end
it "should return a Chef::Role object from JSON" do
- expect(Dir).to receive(:glob).with(File.join('/path1', '**', '**')).exactly(1).times.and_return(['/path1/lolcat.json'])
- expect(File).to receive(:exists?).with('/path1/lolcat.json').exactly(1).times.and_return(true)
- expect(IO).to receive(:read).with('/path1/lolcat.json').and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
+ expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return(["/path1/lolcat.json"])
+ expect(File).to receive(:exists?).with("/path1/lolcat.json").exactly(1).times.and_return(true)
+ expect(IO).to receive(:read).with("/path1/lolcat.json").and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
expect(@role).to be_a_kind_of(Chef::Role)
@role.class.from_disk("lolcat")
end
it "should return a Chef::Role object from JSON when role is in the second path" do
- expect(Dir).to receive(:glob).with(File.join('/path1', '**', '**')).exactly(1).times.and_return([])
- expect(Dir).to receive(:glob).with(File.join('/path/path2', '**', '**')).exactly(1).times.and_return(['/path/path2/lolcat.json'])
- expect(File).to receive(:exists?).with('/path/path2/lolcat.json').exactly(1).times.and_return(true)
- expect(IO).to receive(:read).with('/path/path2/lolcat.json').and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
+ expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return([])
+ expect(Dir).to receive(:glob).with(File.join("/path/path2", "**", "**")).exactly(1).times.and_return(["/path/path2/lolcat.json"])
+ expect(File).to receive(:exists?).with("/path/path2/lolcat.json").exactly(1).times.and_return(true)
+ expect(IO).to receive(:read).with("/path/path2/lolcat.json").and_return('{"name": "ceiling_cat", "json_class": "Chef::Role" }')
expect(@role).to be_a_kind_of(Chef::Role)
@role.class.from_disk("lolcat")
end
it "should return a Chef::Role object from a Ruby DSL" do
- expect(Dir).to receive(:glob).with(File.join('/path1', '**', '**')).exactly(1).times.and_return(['/path1/lolcat.rb'])
- expect(File).to receive(:exists?).with('/path1/lolcat.rb').exactly(2).times.and_return(true)
- expect(File).to receive(:readable?).with('/path1/lolcat.rb').and_return(true)
- expect(IO).to receive(:read).with('/path1/lolcat.rb').exactly(1).times.and_return(ROLE_DSL)
+ expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return(["/path1/lolcat.rb"])
+ expect(File).to receive(:exists?).with("/path1/lolcat.rb").exactly(2).times.and_return(true)
+ expect(File).to receive(:readable?).with("/path1/lolcat.rb").and_return(true)
+ expect(IO).to receive(:read).with("/path1/lolcat.rb").exactly(1).times.and_return(ROLE_DSL)
expect(@role).to be_a_kind_of(Chef::Role)
@role.class.from_disk("lolcat")
end
it "should return a Chef::Role object from a Ruby DSL when role is in the second path" do
- expect(Dir).to receive(:glob).with(File.join('/path1', '**', '**')).exactly(1).times.and_return([])
- expect(Dir).to receive(:glob).with(File.join('/path/path2', '**', '**')).exactly(1).times.and_return(['/path/path2/lolcat.rb'])
- expect(File).to receive(:exists?).with('/path/path2/lolcat.rb').exactly(2).times.and_return(true)
- expect(File).to receive(:readable?).with('/path/path2/lolcat.rb').and_return(true)
- expect(IO).to receive(:read).with('/path/path2/lolcat.rb').exactly(1).times.and_return(ROLE_DSL)
+ expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return([])
+ expect(Dir).to receive(:glob).with(File.join("/path/path2", "**", "**")).exactly(1).times.and_return(["/path/path2/lolcat.rb"])
+ expect(File).to receive(:exists?).with("/path/path2/lolcat.rb").exactly(2).times.and_return(true)
+ expect(File).to receive(:readable?).with("/path/path2/lolcat.rb").and_return(true)
+ expect(IO).to receive(:read).with("/path/path2/lolcat.rb").exactly(1).times.and_return(ROLE_DSL)
expect(@role).to be_a_kind_of(Chef::Role)
@role.class.from_disk("lolcat")
end
it "should raise an exception if the file does not exist" do
- expect(Dir).to receive(:glob).with(File.join('/path1', '**', '**')).exactly(1).times.and_return([])
- expect(Dir).to receive(:glob).with(File.join('/path/path2', '**', '**')).exactly(1).times.and_return([])
+ expect(Dir).to receive(:glob).with(File.join("/path1", "**", "**")).exactly(1).times.and_return([])
+ expect(Dir).to receive(:glob).with(File.join("/path/path2", "**", "**")).exactly(1).times.and_return([])
expect {@role.class.from_disk("lolcat")}.to raise_error(Chef::Exceptions::RoleNotFound)
end
diff --git a/spec/unit/run_context/child_run_context_spec.rb b/spec/unit/run_context/child_run_context_spec.rb
index 63586e459c..3654125a79 100644
--- a/spec/unit/run_context/child_run_context_spec.rb
+++ b/spec/unit/run_context/child_run_context_spec.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/lib/library_load_order'
+require "spec_helper"
+require "support/lib/library_load_order"
describe Chef::RunContext::ChildRunContext do
context "with a run context with stuff in it" do
@@ -46,14 +46,14 @@ describe Chef::RunContext::ChildRunContext do
it "audits is not the same as the parent" do
expect(child.audits.object_id).not_to eq run_context.audits.object_id
- child.audits['hi'] = 'lo'
- expect(child.audits['hi']).to eq('lo')
- expect(run_context.audits['hi']).not_to eq('lo')
+ child.audits["hi"] = "lo"
+ expect(child.audits["hi"]).to eq("lo")
+ expect(run_context.audits["hi"]).not_to eq("lo")
end
it "resource_collection is not the same as the parent" do
expect(child.resource_collection.object_id).not_to eq run_context.resource_collection.object_id
- f = Chef::Resource::File.new('hi', child)
+ f = Chef::Resource::File.new("hi", child)
child.resource_collection.insert(f)
expect(child.resource_collection).to include f
expect(run_context.resource_collection).not_to include f
@@ -61,17 +61,17 @@ describe Chef::RunContext::ChildRunContext do
it "immediate_notification_collection is not the same as the parent" do
expect(child.immediate_notification_collection.object_id).not_to eq run_context.immediate_notification_collection.object_id
- src = Chef::Resource::File.new('hi', child)
- dest = Chef::Resource::File.new('argh', child)
+ src = Chef::Resource::File.new("hi", child)
+ dest = Chef::Resource::File.new("argh", child)
notification = Chef::Resource::Notification.new(dest, :create, src)
child.notifies_immediately(notification)
- expect(child.immediate_notification_collection['file[hi]']).to eq([notification])
- expect(run_context.immediate_notification_collection['file[hi]']).not_to eq([notification])
+ expect(child.immediate_notification_collection["file[hi]"]).to eq([notification])
+ expect(run_context.immediate_notification_collection["file[hi]"]).not_to eq([notification])
end
it "immediate_notifications is not the same as the parent" do
- src = Chef::Resource::File.new('hi', child)
- dest = Chef::Resource::File.new('argh', child)
+ src = Chef::Resource::File.new("hi", child)
+ dest = Chef::Resource::File.new("argh", child)
notification = Chef::Resource::Notification.new(dest, :create, src)
child.notifies_immediately(notification)
expect(child.immediate_notifications(src)).to eq([notification])
@@ -80,17 +80,17 @@ describe Chef::RunContext::ChildRunContext do
it "delayed_notification_collection is not the same as the parent" do
expect(child.delayed_notification_collection.object_id).not_to eq run_context.delayed_notification_collection.object_id
- src = Chef::Resource::File.new('hi', child)
- dest = Chef::Resource::File.new('argh', child)
+ src = Chef::Resource::File.new("hi", child)
+ dest = Chef::Resource::File.new("argh", child)
notification = Chef::Resource::Notification.new(dest, :create, src)
child.notifies_delayed(notification)
- expect(child.delayed_notification_collection['file[hi]']).to eq([notification])
- expect(run_context.delayed_notification_collection['file[hi]']).not_to eq([notification])
+ expect(child.delayed_notification_collection["file[hi]"]).to eq([notification])
+ expect(run_context.delayed_notification_collection["file[hi]"]).not_to eq([notification])
end
it "delayed_notifications is not the same as the parent" do
- src = Chef::Resource::File.new('hi', child)
- dest = Chef::Resource::File.new('argh', child)
+ src = Chef::Resource::File.new("hi", child)
+ dest = Chef::Resource::File.new("argh", child)
notification = Chef::Resource::Notification.new(dest, :create, src)
child.notifies_delayed(notification)
expect(child.delayed_notifications(src)).to eq([notification])
@@ -104,7 +104,7 @@ describe Chef::RunContext::ChildRunContext do
context "after load('include::default')" do
before do
- run_list = Chef::RunList.new('include::default').expand('_default')
+ run_list = Chef::RunList.new("include::default").expand("_default")
# TODO not sure why we had to do this to get everything to work ...
node.automatic_attrs[:recipes] = []
child.load(run_list)
diff --git a/spec/unit/run_context/cookbook_compiler_spec.rb b/spec/unit/run_context/cookbook_compiler_spec.rb
index 20ec1d2ef7..43d14addb8 100644
--- a/spec/unit/run_context/cookbook_compiler_spec.rb
+++ b/spec/unit/run_context/cookbook_compiler_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/lib/library_load_order'
+require "spec_helper"
+require "support/lib/library_load_order"
# These tests rely on fixture data in spec/data/run_context/cookbooks.
#
@@ -45,7 +45,7 @@ describe Chef::RunContext::CookbookCompiler do
let(:cookbook_collection) { Chef::CookbookCollection.new(cookbook_loader) }
# Lazy evaluation of `expansion` here is used to mutate the run list before expanding it
- let(:run_list_expansion) { node.run_list.expand('_default') }
+ let(:run_list_expansion) { node.run_list.expand("_default") }
let(:compiler) do
Chef::RunContext::CookbookCompiler.new(run_context, run_list_expansion, events)
diff --git a/spec/unit/run_context_spec.rb b/spec/unit/run_context_spec.rb
index efc2a6f63f..ca45ca415f 100644
--- a/spec/unit/run_context_spec.rb
+++ b/spec/unit/run_context_spec.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'support/lib/library_load_order'
+require "spec_helper"
+require "support/lib/library_load_order"
describe Chef::RunContext do
let(:chef_repo_path) { File.expand_path(File.join(CHEF_SPEC_DATA, "run_context", "cookbooks")) }
@@ -104,7 +104,7 @@ describe Chef::RunContext do
expect(node).to receive(:loaded_recipe).with(:test, "default")
expect(node).to receive(:loaded_recipe).with(:test, "one")
expect(node).to receive(:loaded_recipe).with(:test, "two")
- run_context.load(node.run_list.expand('_default'))
+ run_context.load(node.run_list.expand("_default"))
end
it "should load all the definitions in the cookbooks for this node" do
diff --git a/spec/unit/run_list/run_list_expansion_spec.rb b/spec/unit/run_list/run_list_expansion_spec.rb
index a7df9e749b..1e509ac4d5 100644
--- a/spec/unit/run_list/run_list_expansion_spec.rb
+++ b/spec/unit/run_list/run_list_expansion_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::RunList::RunListExpansion do
before do
@run_list = Chef::RunList.new
- @run_list << 'recipe[lobster::mastercookbook@0.1.0]' << 'role[rage]' << 'recipe[fist@0.1]'
+ @run_list << "recipe[lobster::mastercookbook@0.1.0]" << "role[rage]" << "recipe[fist@0.1]"
@expansion = Chef::RunList::RunListExpansion.new("_default", @run_list.run_list_items)
end
@@ -43,7 +43,7 @@ describe Chef::RunList::RunListExpansion do
end
it "has not applied its roles" do
- expect(@expansion.applied_role?('rage')).to be_falsey
+ expect(@expansion.applied_role?("rage")).to be_falsey
end
end
@@ -51,7 +51,7 @@ describe Chef::RunList::RunListExpansion do
before do
@rage_role = Chef::Role.new.tap do |r|
r.name("rage")
- r.env_run_lists('_default' => [], "prod" => ["recipe[prod-only]"])
+ r.env_run_lists("_default" => [], "prod" => ["recipe[prod-only]"])
end
@expansion = Chef::RunList::RunListExpansion.new("prod", @run_list.run_list_items)
expect(@expansion).to receive(:fetch_role).and_return(@rage_role)
@@ -67,30 +67,30 @@ describe Chef::RunList::RunListExpansion do
describe "after applying a role" do
before do
allow(@expansion).to receive(:fetch_role).and_return(Chef::Role.new)
- @expansion.inflate_role('rage', "role[base]")
+ @expansion.inflate_role("rage", "role[base]")
end
it "tracks the applied role" do
- expect(@expansion.applied_role?('rage')).to be_truthy
+ expect(@expansion.applied_role?("rage")).to be_truthy
end
it "does not inflate the role again" do
- expect(@expansion.inflate_role('rage', "role[base]")).to be_falsey
+ expect(@expansion.inflate_role("rage", "role[base]")).to be_falsey
end
end
describe "after expanding a run list" do
before do
@first_role = Chef::Role.new
- @first_role.name('rage')
- @first_role.run_list('role[mollusk]')
- @first_role.default_attributes({'foo' => 'bar'})
- @first_role.override_attributes({'baz' => 'qux'})
+ @first_role.name("rage")
+ @first_role.run_list("role[mollusk]")
+ @first_role.default_attributes({"foo" => "bar"})
+ @first_role.override_attributes({"baz" => "qux"})
@second_role = Chef::Role.new
- @second_role.name('rage')
- @second_role.run_list('recipe[crabrevenge]')
- @second_role.default_attributes({'foo' => 'boo'})
- @second_role.override_attributes({'baz' => 'bux'})
+ @second_role.name("rage")
+ @second_role.run_list("recipe[crabrevenge]")
+ @second_role.default_attributes({"foo" => "boo"})
+ @second_role.override_attributes({"baz" => "bux"})
allow(@expansion).to receive(:fetch_role).and_return(@first_role, @second_role)
@expansion.expand
@json = '{"id":"_default","run_list":[{"type":"recipe","name":"lobster::mastercookbook","version":"0.1.0",'
@@ -109,24 +109,24 @@ describe Chef::RunList::RunListExpansion do
end
it "has the ordered list of recipes" do
- expect(@expansion.recipes).to eq(['lobster::mastercookbook', 'crabrevenge', 'fist'])
+ expect(@expansion.recipes).to eq(["lobster::mastercookbook", "crabrevenge", "fist"])
end
it "has the merged attributes from the roles with outer roles overriding inner" do
- expect(@expansion.default_attrs).to eq({'foo' => 'bar'})
- expect(@expansion.override_attrs).to eq({'baz' => 'qux'})
+ expect(@expansion.default_attrs).to eq({"foo" => "bar"})
+ expect(@expansion.override_attrs).to eq({"baz" => "qux"})
end
it "has the list of all roles applied" do
# this is the correct order, but 1.8 hash order is not stable
- expect(@expansion.roles).to match_array(['rage', 'mollusk'])
+ expect(@expansion.roles).to match_array(["rage", "mollusk"])
end
end
describe "after expanding a run list with a non existent role" do
before do
- allow(@expansion).to receive(:fetch_role) { @expansion.role_not_found('crabrevenge', "role[base]") }
+ allow(@expansion).to receive(:fetch_role) { @expansion.role_not_found("crabrevenge", "role[base]") }
@expansion.expand
end
@@ -136,7 +136,7 @@ describe Chef::RunList::RunListExpansion do
end
it "has a list of invalid role names" do
- expect(@expansion.errors).to include('crabrevenge')
+ expect(@expansion.errors).to include("crabrevenge")
end
end
diff --git a/spec/unit/run_list/run_list_item_spec.rb b/spec/unit/run_list/run_list_item_spec.rb
index 16832c1b7d..c69ca8f220 100644
--- a/spec/unit/run_list/run_list_item_spec.rb
+++ b/spec/unit/run_list/run_list_item_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::RunList::RunListItem do
@@ -26,12 +26,12 @@ describe Chef::RunList::RunListItem do
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')
- expect(item.to_s).to eq('fuuu[uuuu]')
+ item = Chef::RunList::RunListItem.new(:type => "fuuu", :name => "uuuu")
+ expect(item.to_s).to eq("fuuu[uuuu]")
end
end
@@ -41,33 +41,33 @@ describe Chef::RunList::RunListItem do
item = Chef::RunList::RunListItem.new("recipe[rage]")
expect(item).to be_a_recipe
expect(item).not_to be_a_role
- expect(item.to_s).to eq('recipe[rage]')
- expect(item.name).to eq('rage')
+ expect(item.to_s).to eq("recipe[rage]")
+ expect(item.name).to eq("rage")
end
it "parses a qualified recipe with a version" do
item = Chef::RunList::RunListItem.new("recipe[rage@0.1.0]")
expect(item).to be_a_recipe
expect(item).not_to be_a_role
- expect(item.to_s).to eq('recipe[rage@0.1.0]')
- expect(item.name).to eq('rage')
- expect(item.version).to eq('0.1.0')
+ expect(item.to_s).to eq("recipe[rage@0.1.0]")
+ expect(item.name).to eq("rage")
+ expect(item.version).to eq("0.1.0")
end
it "parses a qualified role" do
item = Chef::RunList::RunListItem.new("role[fist]")
expect(item).to be_a_role
expect(item).not_to be_a_recipe
- expect(item.to_s).to eq('role[fist]')
- expect(item.name).to eq('fist')
+ expect(item.to_s).to eq("role[fist]")
+ expect(item.name).to eq("fist")
end
it "parses an unqualified recipe" do
item = Chef::RunList::RunListItem.new("lobster")
expect(item).to be_a_recipe
expect(item).not_to be_a_role
- expect(item.to_s).to eq('recipe[lobster]')
- expect(item.name).to eq('lobster')
+ expect(item.to_s).to eq("recipe[lobster]")
+ expect(item.name).to eq("lobster")
end
it "raises an exception when the string has typo on the type part" do
@@ -85,33 +85,33 @@ describe Chef::RunList::RunListItem do
describe "comparing to other run list items" do
it "is equal to another run list item that has the same name and type" do
- item1 = Chef::RunList::RunListItem.new('recipe[lrf]')
- item2 = Chef::RunList::RunListItem.new('recipe[lrf]')
+ item1 = Chef::RunList::RunListItem.new("recipe[lrf]")
+ item2 = Chef::RunList::RunListItem.new("recipe[lrf]")
expect(item1).to eq(item2)
end
it "is not equal to another run list item with the same name and different type" do
- item1 = Chef::RunList::RunListItem.new('recipe[lrf]')
- item2 = Chef::RunList::RunListItem.new('role[lrf]')
+ item1 = Chef::RunList::RunListItem.new("recipe[lrf]")
+ item2 = Chef::RunList::RunListItem.new("role[lrf]")
expect(item1).not_to eq(item2)
end
it "is not equal to another run list item with the same type and different name" do
- item1 = Chef::RunList::RunListItem.new('recipe[lrf]')
- item2 = Chef::RunList::RunListItem.new('recipe[lobsterragefist]')
+ item1 = Chef::RunList::RunListItem.new("recipe[lrf]")
+ item2 = Chef::RunList::RunListItem.new("recipe[lobsterragefist]")
expect(item1).not_to eq(item2)
end
it "is not equal to another run list item with the same name and type but different version" do
- item1 = Chef::RunList::RunListItem.new('recipe[lrf,0.1.0]')
- item2 = Chef::RunList::RunListItem.new('recipe[lrf,0.2.0]')
+ item1 = Chef::RunList::RunListItem.new("recipe[lrf,0.1.0]")
+ item2 = Chef::RunList::RunListItem.new("recipe[lrf,0.2.0]")
expect(item1).not_to eq(item2)
end
end
describe "comparing to strings" do
it "is equal to a string if that string matches its to_s representation" do
- expect(Chef::RunList::RunListItem.new('recipe[lrf]')).to eq('recipe[lrf]')
+ expect(Chef::RunList::RunListItem.new("recipe[lrf]")).to eq("recipe[lrf]")
end
end
end
diff --git a/spec/unit/run_list/versioned_recipe_list_spec.rb b/spec/unit/run_list/versioned_recipe_list_spec.rb
index 356b9d682c..e1927f8310 100644
--- a/spec/unit/run_list/versioned_recipe_list_spec.rb
+++ b/spec/unit/run_list/versioned_recipe_list_spec.rb
@@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
+require "spec_helper"
describe Chef::RunList::VersionedRecipeList do
diff --git a/spec/unit/run_list_spec.rb b/spec/unit/run_list_spec.rb
index 634b5c54cf..da5bcf83cb 100644
--- a/spec/unit/run_list_spec.rb
+++ b/spec/unit/run_list_spec.rb
@@ -18,10 +18,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/version_class'
-require 'chef/version_constraint'
+require "chef/version_class"
+require "chef/version_constraint"
describe Chef::RunList do
before(:each) do
@@ -30,21 +30,21 @@ describe Chef::RunList do
describe "<<" do
it "should add a recipe to the run list and recipe list with the fully qualified name" do
- @run_list << 'recipe[needy]'
- expect(@run_list).to include('recipe[needy]')
+ @run_list << "recipe[needy]"
+ expect(@run_list).to include("recipe[needy]")
expect(@run_list.recipes).to include("needy")
end
it "should add a role to the run list and role list with the fully qualified name" do
@run_list << "role[woot]"
- expect(@run_list).to include('role[woot]')
- expect(@run_list.roles).to include('woot')
+ expect(@run_list).to include("role[woot]")
+ expect(@run_list.roles).to include("woot")
end
it "should accept recipes that are unqualified" do
@run_list << "needy"
- expect(@run_list).to include('recipe[needy]')
- expect(@run_list.recipes.include?('needy')).to eq(true)
+ expect(@run_list).to include("recipe[needy]")
+ expect(@run_list.recipes.include?("needy")).to eq(true)
end
it "should not allow duplicates" do
@@ -59,7 +59,7 @@ describe Chef::RunList do
@run_list << "recipe[needy@0.1.0]"
expect(@run_list.run_list.length).to eq(2)
expect(@run_list.recipes.length).to eq(2)
- expect(@run_list.recipes.include?('needy')).to eq(true)
+ expect(@run_list.recipes.include?("needy")).to eq(true)
end
it "should not allow duplicate versions of a recipe" do
@@ -74,13 +74,13 @@ describe Chef::RunList do
# Testing only the basic functionality here
# since full behavior is tested above.
it "should add a recipe to the run_list" do
- @run_list.add 'recipe[needy]'
- expect(@run_list).to include('recipe[needy]')
+ @run_list.add "recipe[needy]"
+ expect(@run_list).to include("recipe[needy]")
end
it "should add a role to the run_list" do
- @run_list.add 'role[needy]'
- expect(@run_list).to include('role[needy]')
+ @run_list.add "role[needy]"
+ expect(@run_list).to include("role[needy]")
end
end
@@ -112,20 +112,20 @@ describe Chef::RunList do
describe "[]" do
it "should let you look up a member in the run list by position" do
- @run_list << 'recipe[loulou]'
- expect(@run_list[0]).to eq('recipe[loulou]')
+ @run_list << "recipe[loulou]"
+ expect(@run_list[0]).to eq("recipe[loulou]")
end
end
describe "[]=" do
it "should let you set a member of the run list by position" do
- @run_list[0] = 'recipe[loulou]'
- expect(@run_list[0]).to eq('recipe[loulou]')
+ @run_list[0] = "recipe[loulou]"
+ expect(@run_list[0]).to eq("recipe[loulou]")
end
it "should properly expand a member of the run list given by position" do
- @run_list[0] = 'loulou'
- expect(@run_list[0]).to eq('recipe[loulou]')
+ @run_list[0] = "loulou"
+ expect(@run_list[0]).to eq("recipe[loulou]")
end
end
@@ -199,7 +199,7 @@ describe Chef::RunList do
it "should load the role from the chef server" do
#@rest.should_receive(:get).with("roles/stubby")
expansion = @run_list.expand("_default", "server")
- expect(expansion.recipes).to eq(['one', 'two', 'kitty'])
+ expect(expansion.recipes).to eq(["one", "two", "kitty"])
end
it "should default to expanding from the server" do
@@ -270,7 +270,7 @@ describe Chef::RunList do
allow(Chef::Role).to receive(:from_disk).with("stubby").and_return(@role)
allow(Chef::Role).to receive(:from_disk).with("dog").and_return(dog)
- expansion = @run_list.expand("_default", 'disk')
+ expansion = @run_list.expand("_default", "disk")
expect(expansion.recipes[2]).to eq("three")
expect(expansion.default_attrs[:seven]).to eq(:nine)
end
@@ -284,7 +284,7 @@ describe Chef::RunList do
allow(Chef::Role).to receive(:from_disk).with("stubby").and_return(@role)
expect(Chef::Role).to receive(:from_disk).with("dog").once.and_return(dog)
- expansion = @run_list.expand("_default", 'disk')
+ expansion = @run_list.expand("_default", "disk")
expect(expansion.recipes[2]).to eq("three")
expect(expansion.recipes[3]).to eq("kitty")
expect(expansion.default_attrs[:seven]).to eq(:nine)
diff --git a/spec/unit/run_lock_spec.rb b/spec/unit/run_lock_spec.rb
index 51e6ba1b84..7b474919e9 100644
--- a/spec/unit/run_lock_spec.rb
+++ b/spec/unit/run_lock_spec.rb
@@ -15,13 +15,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require File.expand_path('../../spec_helper', __FILE__)
-require 'chef/client'
+require File.expand_path("../../spec_helper", __FILE__)
+require "chef/client"
describe Chef::RunLock do
- default_cache_path = windows? ? 'C:\chef' : '/var/chef'
- default_pid_location = windows? ? 'C:\chef\cache\chef-client-running.pid' : '/var/chef/cache/chef-client-running.pid'
+ default_cache_path = windows? ? 'C:\chef' : "/var/chef"
+ default_pid_location = windows? ? 'C:\chef\cache\chef-client-running.pid' : "/var/chef/cache/chef-client-running.pid"
describe "when first created" do
it "locates the lockfile in the file cache path by default" do
diff --git a/spec/unit/run_status_spec.rb b/spec/unit/run_status_spec.rb
index d658cb5a5a..970635cc0d 100644
--- a/spec/unit/run_status_spec.rb
+++ b/spec/unit/run_status_spec.rb
@@ -17,7 +17,7 @@
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::RunStatus do
before do
@@ -82,7 +82,7 @@ describe Chef::RunStatus do
describe "with resources in the resource_collection" do
before do
- @all_resources = [Chef::Resource::Cat.new("whiskers"), Chef::Resource::ZenMaster.new('dtz')]
+ @all_resources = [Chef::Resource::Cat.new("whiskers"), Chef::Resource::ZenMaster.new("dtz")]
@run_context.resource_collection.all_resources.replace(@all_resources)
end
diff --git a/spec/unit/runner_spec.rb b/spec/unit/runner_spec.rb
index 46074728c2..44c40463ee 100644
--- a/spec/unit/runner_spec.rb
+++ b/spec/unit/runner_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class SnitchyProvider < Chef::Provider
def self.all_actions_called
diff --git a/spec/unit/scan_access_control_spec.rb b/spec/unit/scan_access_control_spec.rb
index 8cf681e994..02928851b1 100644
--- a/spec/unit/scan_access_control_spec.rb
+++ b/spec/unit/scan_access_control_spec.rb
@@ -16,7 +16,7 @@
#
require File.expand_path("../../spec_helper", __FILE__)
-require 'chef/scan_access_control'
+require "chef/scan_access_control"
describe Chef::ScanAccessControl do
@@ -33,7 +33,7 @@ describe Chef::ScanAccessControl do
@new_resource.tap do |f|
f.owner("root")
f.group("root")
- f.mode('0755')
+ f.mode("0755")
end
@scanner.set_all!
end
diff --git a/spec/unit/search/query_spec.rb b/spec/unit/search/query_spec.rb
index d54e8b5391..84ac0c661f 100644
--- a/spec/unit/search/query_spec.rb
+++ b/spec/unit/search/query_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/search/query'
+require "spec_helper"
+require "chef/search/query"
describe Chef::Search::Query do
let(:rest) { double("Chef::ServerAPI") }
@@ -29,8 +29,8 @@ describe Chef::Search::Query do
let(:args) { { filter_key => filter_hash } }
let(:filter_hash) {
{
- 'env' => [ 'chef_environment' ],
- 'ruby_plat' => [ 'languages', 'ruby', 'platform' ],
+ "env" => [ "chef_environment" ],
+ "ruby_plat" => [ "languages", "ruby", "platform" ],
}
}
let(:response) {
@@ -251,12 +251,12 @@ describe Chef::Search::Query do
it "returns start" do
start = query.search(:node, "platform:rhel", args)[1]
- expect(start).to eq(response['start'])
+ expect(start).to eq(response["start"])
end
it "returns total" do
total = query.search(:node, "platform:rhel", args)[2]
- expect(total).to eq(response['total'])
+ expect(total).to eq(response["total"])
end
it "returns rows with the filter applied" do
diff --git a/spec/unit/shell/model_wrapper_spec.rb b/spec/unit/shell/model_wrapper_spec.rb
index d6da2dcffc..d4a0b6df09 100644
--- a/spec/unit/shell/model_wrapper_spec.rb
+++ b/spec/unit/shell/model_wrapper_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'ostruct'
+require "spec_helper"
+require "ostruct"
describe Shell::ModelWrapper do
before do
@@ -81,14 +81,14 @@ describe Shell::ModelWrapper do
end
it "searches for objects using the given query string" do
- expect(@searcher).to receive(:search).with(:node, 'name:app*').and_yield(@node_1).and_yield(@node_2)
+ expect(@searcher).to receive(:search).with(:node, "name:app*").and_yield(@node_1).and_yield(@node_2)
expect(@wrapper.find("name:app*")).to include(@node_1, @node_2)
end
it "creates a 'AND'-joined query string from a HASH" do
# Hash order woes
- expect(@searcher).to receive(:search).with(:node, 'name:app* AND name:app*').and_yield(@node_1).and_yield(@node_2)
- expect(@wrapper.find(:name=>"app*",'name'=>"app*")).to include(@node_1, @node_2)
+ expect(@searcher).to receive(:search).with(:node, "name:app* AND name:app*").and_yield(@node_1).and_yield(@node_2)
+ expect(@wrapper.find(:name=>"app*","name"=>"app*")).to include(@node_1, @node_2)
end
end
diff --git a/spec/unit/shell/shell_ext_spec.rb b/spec/unit/shell/shell_ext_spec.rb
index 9521ae646b..eaff3cc807 100644
--- a/spec/unit/shell/shell_ext_spec.rb
+++ b/spec/unit/shell/shell_ext_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Shell::Extensions do
describe "extending object for top level methods" do
diff --git a/spec/unit/shell/shell_session_spec.rb b/spec/unit/shell/shell_session_spec.rb
index d1cedb3236..218c814d43 100644
--- a/spec/unit/shell/shell_session_spec.rb
+++ b/spec/unit/shell/shell_session_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
require "ostruct"
@@ -49,7 +49,7 @@ end
describe Shell::ClientSession do
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_rest = double("Chef::ServerAPI")
@session = Shell::ClientSession.instance
@node = Chef::Node.build("foo")
@@ -80,7 +80,7 @@ end
describe Shell::StandAloneSession do
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 = Shell::StandAloneSession.instance
@node = @session.node = Chef::Node.new
@events = Chef::EventDispatch::Dispatcher.new
@@ -131,7 +131,7 @@ end
describe Shell::SoloSession do
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::SoloSession.instance
@node = Chef::Node.new
diff --git a/spec/unit/shell_out_spec.rb b/spec/unit/shell_out_spec.rb
index 50b0b61cb7..35844f4961 100644
--- a/spec/unit/shell_out_spec.rb
+++ b/spec/unit/shell_out_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../spec_helper', __FILE__)
+require File.expand_path("../../spec_helper", __FILE__)
describe "Chef::ShellOut deprecation notices" do
it "logs a warning when initializing a new Chef::ShellOut object" do
diff --git a/spec/unit/shell_spec.rb b/spec/unit/shell_spec.rb
index 379043a017..6add9991e8 100644
--- a/spec/unit/shell_spec.rb
+++ b/spec/unit/shell_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
require "ostruct"
ObjectTestHarness = Proc.new do
@@ -44,7 +44,7 @@ describe Shell do
Shell.irb_conf = {}
allow(Shell::ShellSession.instance).to receive(:reset!)
allow(ChefConfig).to receive(:windows?).and_return(false)
- allow(Chef::Util::PathHelper).to receive(:home).and_return('/home/foo')
+ allow(Chef::Util::PathHelper).to receive(:home).and_return("/home/foo")
end
describe "reporting its status" do
@@ -58,7 +58,7 @@ describe Shell do
describe "configuring IRB" do
it "configures irb history" do
Shell.configure_irb
- expect(Shell.irb_conf[:HISTORY_FILE]).to eq(Chef::Util::PathHelper.home('.chef', 'chef_shell_history'))
+ expect(Shell.irb_conf[:HISTORY_FILE]).to eq(Chef::Util::PathHelper.home(".chef", "chef_shell_history"))
expect(Shell.irb_conf[:SAVE_HISTORY]).to eq(1000)
end
diff --git a/spec/unit/user_spec.rb b/spec/unit/user_spec.rb
index 97cc32eb3e..0bf3c2d332 100644
--- a/spec/unit/user_spec.rb
+++ b/spec/unit/user_spec.rb
@@ -21,10 +21,10 @@
# Open Source Chef Server 11 and should be removed once support
# for OSC 11 ends. New development should occur in user_spec.rb.
-require 'spec_helper'
+require "spec_helper"
-require 'chef/user'
-require 'tempfile'
+require "chef/user"
+require "tempfile"
describe Chef::User do
before(:each) do
diff --git a/spec/unit/user_v1_spec.rb b/spec/unit/user_v1_spec.rb
index d2ba0cf4de..8bf27168d9 100644
--- a/spec/unit/user_v1_spec.rb
+++ b/spec/unit/user_v1_spec.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'chef/user_v1'
-require 'tempfile'
+require "chef/user_v1"
+require "tempfile"
describe Chef::UserV1 do
before(:each) do
@@ -312,13 +312,13 @@ 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
@user = Chef::UserV1.new
- allow(@user).to receive(:chef_root_rest_v0).and_return(double('chef rest root v0 object'))
- allow(@user).to receive(:chef_root_rest_v1).and_return(double('chef rest root v1 object'))
+ allow(@user).to receive(:chef_root_rest_v0).and_return(double("chef rest root v0 object"))
+ allow(@user).to receive(:chef_root_rest_v1).and_return(double("chef rest root v1 object"))
end
describe "update" do
@@ -374,7 +374,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
diff --git a/spec/unit/util/backup_spec.rb b/spec/unit/util/backup_spec.rb
index f548e8241d..ab44c9fdc2 100644
--- a/spec/unit/util/backup_spec.rb
+++ b/spec/unit/util/backup_spec.rb
@@ -17,8 +17,8 @@
#
-require 'spec_helper'
-require 'tmpdir'
+require "spec_helper"
+require "tmpdir"
describe Chef::Util::Backup do
@@ -71,15 +71,15 @@ describe Chef::Util::Backup do
end
it "should not delete anything if this is the only backup" do
- expect(@backup).to receive(:sorted_backup_files).and_return(['a'])
+ expect(@backup).to receive(:sorted_backup_files).and_return(["a"])
expect(@backup).not_to receive(:delete_backup)
@backup.backup!
end
it "should keep only 1 backup copy" do
- expect(@backup).to receive(:sorted_backup_files).and_return(['a', 'b', 'c'])
- expect(@backup).to receive(:delete_backup).with('b')
- expect(@backup).to receive(:delete_backup).with('c')
+ expect(@backup).to receive(:sorted_backup_files).and_return(["a", "b", "c"])
+ expect(@backup).to receive(:delete_backup).with("b")
+ expect(@backup).to receive(:delete_backup).with("c")
@backup.backup!
end
end
@@ -90,15 +90,15 @@ describe Chef::Util::Backup do
end
it "should not delete anything if we only have one other backup" do
- expect(@backup).to receive(:sorted_backup_files).and_return(['a', 'b'])
+ expect(@backup).to receive(:sorted_backup_files).and_return(["a", "b"])
expect(@backup).not_to receive(:delete_backup)
@backup.backup!
end
it "should keep only 2 backup copies" do
- expect(@backup).to receive(:sorted_backup_files).and_return(['a', 'b', 'c', 'd'])
- expect(@backup).to receive(:delete_backup).with('c')
- expect(@backup).to receive(:delete_backup).with('d')
+ expect(@backup).to receive(:sorted_backup_files).and_return(["a", "b", "c", "d"])
+ expect(@backup).to receive(:delete_backup).with("c")
+ expect(@backup).to receive(:delete_backup).with("d")
@backup.backup!
end
end
@@ -106,7 +106,7 @@ describe Chef::Util::Backup do
describe "backup_filename" do
it "should return a timestamped path" do
- expect(@backup).to receive(:path).and_return('/a/b/c.txt')
+ expect(@backup).to receive(:path).and_return("/a/b/c.txt")
expect(@backup.send(:backup_filename)).to match(%r|^/a/b/c.txt.chef-\d{14}.\d{6}$|)
end
it "should strip the drive letter off for windows" do
@@ -114,21 +114,21 @@ describe Chef::Util::Backup do
expect(@backup.send(:backup_filename)).to match(%r|^\\a\\b\\c.txt.chef-\d{14}.\d{6}$|)
end
it "should strip the drive letter off for windows (with forwardslashes)" do
- expect(@backup).to receive(:path).and_return('c:/a/b/c.txt')
+ expect(@backup).to receive(:path).and_return("c:/a/b/c.txt")
expect(@backup.send(:backup_filename)).to match(%r|^/a/b/c.txt.chef-\d{14}.\d{6}$|)
end
end
describe "backup_path" do
it "uses the file's directory when Chef::Config[:file_backup_path] is nil" do
- expect(@backup).to receive(:path).and_return('/a/b/c.txt')
+ expect(@backup).to receive(:path).and_return("/a/b/c.txt")
Chef::Config[:file_backup_path] = nil
expect(@backup.send(:backup_path)).to match(%r|^/a/b/c.txt.chef-\d{14}.\d{6}$|)
end
it "uses the configured Chef::Config[:file_backup_path]" do
- expect(@backup).to receive(:path).and_return('/a/b/c.txt')
- Chef::Config[:file_backup_path] = '/backupdir'
+ expect(@backup).to receive(:path).and_return("/a/b/c.txt")
+ Chef::Config[:file_backup_path] = "/backupdir"
expect(@backup.send(:backup_path)).to match(%r|^/backupdir[\\/]+a/b/c.txt.chef-\d{14}.\d{6}$|)
end
diff --git a/spec/unit/util/diff_spec.rb b/spec/unit/util/diff_spec.rb
index b0a57a32c0..f46bc31488 100644
--- a/spec/unit/util/diff_spec.rb
+++ b/spec/unit/util/diff_spec.rb
@@ -17,8 +17,8 @@
#
-require 'spec_helper'
-require 'tmpdir'
+require "spec_helper"
+require "tmpdir"
shared_context "using file paths with spaces" do
let!(:old_tempfile) { Tempfile.new("chef-util diff-spec") }
diff --git a/spec/unit/util/dsc/configuration_generator_spec.rb b/spec/unit/util/dsc/configuration_generator_spec.rb
index 9fbd3aaa51..f05780285f 100644
--- a/spec/unit/util/dsc/configuration_generator_spec.rb
+++ b/spec/unit/util/dsc/configuration_generator_spec.rb
@@ -16,25 +16,25 @@
# limitations under the License.
#
-require 'chef'
-require 'chef/util/dsc/configuration_generator'
+require "chef"
+require "chef/util/dsc/configuration_generator"
describe Chef::Util::DSC::ConfigurationGenerator do
let(:conf_man) do
node = Chef::Node.new
- Chef::Util::DSC::ConfigurationGenerator.new(node, 'tmp')
+ Chef::Util::DSC::ConfigurationGenerator.new(node, "tmp")
end
describe '#validate_configuration_name!' do
- it 'should not raise an error if a name contains all upper case letters' do
+ it "should not raise an error if a name contains all upper case letters" do
conf_man.send(:validate_configuration_name!, "HELLO")
end
- it 'should not raise an error if the name contains all lower case letters' do
+ it "should not raise an error if the name contains all lower case letters" do
conf_man.send(:validate_configuration_name!, "hello")
end
- it 'should not raise an error if no special characters are used except _' do
+ it "should not raise an error if no special characters are used except _" do
conf_man.send(:validate_configuration_name!, "hello_world")
end
@@ -48,67 +48,67 @@ describe Chef::Util::DSC::ConfigurationGenerator do
end
describe "#get_merged_configuration_flags" do
- context 'when strings 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')
+ context "when strings 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")
expect(merged).to include(:flag)
- expect(merged[:flag]).to eql('a')
+ expect(merged[:flag]).to eql("a")
expect(merged).to include(:outputpath)
end
- it 'should raise an ArgumentError if you try to override outputpath' do
+ it "should raise an ArgumentError if you try to override outputpath" do
expect {
- conf_man.send(:get_merged_configuration_flags!, {'outputpath' => 'a'}, 'hello')
+ conf_man.send(:get_merged_configuration_flags!, {"outputpath" => "a"}, "hello")
}.to raise_error(ArgumentError)
end
- it 'should be case insensitive for switches that are not allowed' do
+ it "should be case insensitive for switches that are not allowed" do
expect {
- conf_man.send(:get_merged_configuration_flags!, {'OutputPath' => 'a'}, 'hello')
+ conf_man.send(:get_merged_configuration_flags!, {"OutputPath" => "a"}, "hello")
}.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')
+ it "should be case insensitive to switches that are allowed" do
+ merged = conf_man.send(:get_merged_configuration_flags!, {"FLAG" => "a"}, "hello")
expect(merged).to include(:flag)
end
end
- 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')
+ 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")
expect(merged).to include(:flag)
- expect(merged[:flag]).to eql('a')
+ expect(merged[:flag]).to eql("a")
expect(merged).to include(:outputpath)
end
- it 'should raise an ArgumentError if you try to override outputpath' do
+ it "should raise an ArgumentError if you try to override outputpath" do
expect {
- conf_man.send(:get_merged_configuration_flags!, {:outputpath => 'a'}, 'hello')
+ conf_man.send(:get_merged_configuration_flags!, {:outputpath => "a"}, "hello")
}.to raise_error(ArgumentError)
end
- it 'should be case insensitive for switches that are not allowed' do
+ it "should be case insensitive for switches that are not allowed" do
expect {
- conf_man.send(:get_merged_configuration_flags!, {:OutputPath => 'a'}, 'hello')
+ conf_man.send(:get_merged_configuration_flags!, {:OutputPath => "a"}, "hello")
}.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')
+ it "should be case insensitive to switches that are allowed" do
+ merged = conf_man.send(:get_merged_configuration_flags!, {:FLAG => "a"}, "hello")
expect(merged).to include(:flag)
end
end
- context 'when there are no flags' do
- it 'should supply an output path if configuration_flags is an empty hash' do
- merged = conf_man.send(:get_merged_configuration_flags!, {}, 'hello')
+ context "when there are no flags" do
+ it "should supply an output path if configuration_flags is an empty hash" do
+ merged = conf_man.send(:get_merged_configuration_flags!, {}, "hello")
expect(merged).to include(:outputpath)
expect(merged.length).to eql(1)
end
- it 'should supply an output path if configuration_flags is an empty hash' do
- merged = conf_man.send(:get_merged_configuration_flags!, nil, 'hello')
+ it "should supply an output path if configuration_flags is an empty hash" do
+ merged = conf_man.send(:get_merged_configuration_flags!, nil, "hello")
expect(merged).to include(:outputpath)
expect(merged.length).to eql(1)
end
@@ -130,7 +130,7 @@ describe Chef::Util::DSC::ConfigurationGenerator do
[a,b].join("++")
end
allow(file_like_object).to receive(:write)
- conf_man.send(:write_document_generation_script, 'file', 'hello', {})
+ conf_man.send(:write_document_generation_script, "file", "hello", {})
expect(file_like_object).to have_received(:write)
end
end
@@ -143,24 +143,24 @@ describe Chef::Util::DSC::ConfigurationGenerator do
[a,b].join("++")
end
- allow(Dir).to receive(:entries).with("tmp++hello") {['f1', 'f2', 'hello.mof', 'f3']}
- expect(conf_man.send(:find_configuration_document, 'hello')).to eql('tmp++hello++hello.mof')
+ allow(Dir).to receive(:entries).with("tmp++hello") {["f1", "f2", "hello.mof", "f3"]}
+ expect(conf_man.send(:find_configuration_document, "hello")).to eql("tmp++hello++hello.mof")
end
it "should return nil if the mof file is not found" do
allow(File).to receive(:join) do |a, b|
[a,b].join("++")
end
- allow(Dir).to receive(:entries).with("tmp++hello") {['f1', 'f2', 'f3']}
- expect(conf_man.send(:find_configuration_document, 'hello')).to be_nil
+ allow(Dir).to receive(:entries).with("tmp++hello") {["f1", "f2", "f3"]}
+ expect(conf_man.send(:find_configuration_document, "hello")).to be_nil
end
end
describe "#configuration_code" do
it "should build dsc" do
- dsc = conf_man.send(:configuration_code, 'archive{}', 'hello', {})
+ dsc = conf_man.send(:configuration_code, "archive{}", "hello", {})
found_configuration = false
- dsc.split(';').each do |command|
+ dsc.split(";").each do |command|
if command.downcase =~ /\s*configuration\s+'hello'\s*\{\s*node\s+'localhost'\s*\{\s*archive\s*\{\s*\}\s*\}\s*\}\s*/
found_configuration = true
end
@@ -169,22 +169,22 @@ describe Chef::Util::DSC::ConfigurationGenerator do
end
context "with imports" do
it "should import all resources when a module has an empty list" do
- dsc = conf_man.send(:configuration_code, 'archive{}', 'hello', {'FooModule' => []})
+ dsc = conf_man.send(:configuration_code, "archive{}", "hello", {"FooModule" => []})
expect(dsc).to match(/Import-DscResource -ModuleName FooModule\s*\n/)
end
it "should import all resources when a module has a list with *" do
- dsc = conf_man.send(:configuration_code, 'archive{}', 'hello', {'FooModule' => ['FooResource', '*', 'BarResource']})
+ dsc = conf_man.send(:configuration_code, "archive{}", "hello", {"FooModule" => ["FooResource", "*", "BarResource"]})
expect(dsc).to match(/Import-DscResource -ModuleName FooModule\s*\n/)
end
it "should import specific resources when a module has list without * that is not empty" do
- dsc = conf_man.send(:configuration_code, 'archive{}', 'hello', {'FooModule' => ['FooResource', 'BarResource']})
+ dsc = conf_man.send(:configuration_code, "archive{}", "hello", {"FooModule" => ["FooResource", "BarResource"]})
expect(dsc).to match(/Import-DscResource -ModuleName FooModule -Name FooResource,BarResource/)
end
it "should import multiple modules with multiple import statements" do
- dsc = conf_man.send(:configuration_code, 'archive{}', 'hello', {'FooModule' => ['FooResource', 'BarResource'], 'BazModule' => []})
+ dsc = conf_man.send(:configuration_code, "archive{}", "hello", {"FooModule" => ["FooResource", "BarResource"], "BazModule" => []})
expect(dsc).to match(/Import-DscResource -ModuleName FooModule -Name FooResource,BarResource/)
expect(dsc).to match(/Import-DscResource -ModuleName BazModule\s*\n/)
end
diff --git a/spec/unit/util/dsc/lcm_output_parser_spec.rb b/spec/unit/util/dsc/lcm_output_parser_spec.rb
index 3d44e07885..2990e1f28e 100644
--- a/spec/unit/util/dsc/lcm_output_parser_spec.rb
+++ b/spec/unit/util/dsc/lcm_output_parser_spec.rb
@@ -16,24 +16,24 @@
# limitations under the License.
#
-require 'chef/util/dsc/lcm_output_parser'
+require "chef/util/dsc/lcm_output_parser"
describe Chef::Util::DSC::LocalConfigurationManager::Parser do
- context 'empty input parameter' do
- it 'raises an exception when there are no valid lines' do
+ context "empty input parameter" do
+ it "raises an exception when there are no valid lines" do
str = <<-EOF
EOF
expect {Chef::Util::DSC::LocalConfigurationManager::Parser::parse(str)}.to raise_error(Chef::Exceptions::LCMParser)
end
- it 'raises an exception for a nil input' do
+ it "raises an exception for a nil input" do
expect {Chef::Util::DSC::LocalConfigurationManager::Parser::parse(nil)}.to raise_error(Chef::Exceptions::LCMParser)
end
end
- context 'correctly formatted output from lcm' do
- it 'returns a single resource when only 1 logged with the correct name' do
+ context "correctly formatted output from lcm" do
+ it "returns a single resource when only 1 logged with the correct name" do
str = <<EOF
logtype: [machinename]: LCM: [ Start Set ]
logtype: [machinename]: LCM: [ Start Resource ] [name]
@@ -42,10 +42,10 @@ logtype: [machinename]: LCM: [ End Set ]
EOF
resources = Chef::Util::DSC::LocalConfigurationManager::Parser::parse(str)
expect(resources.length).to eq(1)
- expect(resources[0].name).to eq('[name]')
+ expect(resources[0].name).to eq("[name]")
end
- it 'identifies when a resource changes the state of the system' do
+ it "identifies when a resource changes the state of the system" do
str = <<EOF
logtype: [machinename]: LCM: [ Start Set ]
logtype: [machinename]: LCM: [ Start Resource ] [name]
@@ -58,7 +58,7 @@ EOF
expect(resources[0].changes_state?).to be_truthy
end
- it 'preserves the log provided for how the system changed the state' do
+ it "preserves the log provided for how the system changed the state" do
str = <<EOF
logtype: [machinename]: LCM: [ Start Set ]
logtype: [machinename]: LCM: [ Start Resource ] [name]
@@ -72,7 +72,7 @@ EOF
expect(resources[0].change_log).to match_array(["[name]","[message]","[name]"])
end
- it 'should return false for changes_state?' do
+ it "should return false for changes_state?" do
str = <<EOF
logtype: [machinename]: LCM: [ Start Set ]
logtype: [machinename]: LCM: [ Start Resource ] [name]
@@ -84,7 +84,7 @@ EOF
expect(resources[0].changes_state?).to be_falsey
end
- it 'should return an empty array for change_log if changes_state? is false' do
+ it "should return an empty array for change_log if changes_state? is false" do
str = <<EOF
logtype: [machinename]: LCM: [ Start Set ]
logtype: [machinename]: LCM: [ Start Resource ] [name]
@@ -97,8 +97,8 @@ EOF
end
end
- context 'Incorrectly formatted output from LCM' do
- it 'should allow missing a [End Resource] when its the last one and still find all the resource' do
+ context "Incorrectly formatted output from LCM" do
+ it "should allow missing a [End Resource] when its the last one and still find all the resource" do
str = <<-EOF
logtype: [machinename]: LCM: [ Start Set ]
logtype: [machinename]: LCM: [ Start Resource ] [name]
@@ -119,7 +119,7 @@ EOF
expect(resources[1].changes_state?).to be_truthy
end
- it 'should allow missing a [End Resource] when its the first one and still find all the resource' do
+ it "should allow missing a [End Resource] when its the first one and still find all the resource" do
str = <<-EOF
logtype: [machinename]: LCM: [ Start Set ]
logtype: [machinename]: LCM: [ Start Resource ] [name]
@@ -140,7 +140,7 @@ EOF
expect(resources[1].changes_state?).to be_truthy
end
- it 'should allow missing set and end resource and assume an unconverged resource in this case' do
+ it "should allow missing set and end resource and assume an unconverged resource in this case" do
str = <<-EOF
logtype: [machinename]: LCM: [ Start Set ]
logtype: [machinename]: LCM: [ Start Resource ] [name]
@@ -156,9 +156,9 @@ logtype: [machinename]: LCM: [ End Set ]
EOF
resources = Chef::Util::DSC::LocalConfigurationManager::Parser::parse(str)
expect(resources[0].changes_state?).to be_truthy
- expect(resources[0].name).to eql('[name]')
+ expect(resources[0].name).to eql("[name]")
expect(resources[1].changes_state?).to be_truthy
- expect(resources[1].name).to eql('[name2]')
+ expect(resources[1].name).to eql("[name2]")
end
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 1cff9e445b..eb860b5c30 100644
--- a/spec/unit/util/dsc/local_configuration_manager_spec.rb
+++ b/spec/unit/util/dsc/local_configuration_manager_spec.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef'
-require 'chef/util/dsc/local_configuration_manager'
+require "chef"
+require "chef/util/dsc/local_configuration_manager"
describe Chef::Util::DSC::LocalConfigurationManager do
- let(:lcm) { Chef::Util::DSC::LocalConfigurationManager.new(nil, 'tmp') }
+ let(:lcm) { Chef::Util::DSC::LocalConfigurationManager.new(nil, "tmp") }
let(:normal_lcm_output) { <<-EOH
logtype: [machinename]: LCM: [ Start Set ]
@@ -50,12 +50,12 @@ EOH
double("LCM cmdlet status", :stderr => lcm_standard_error, :return_value => lcm_standard_output, :succeeded? => lcm_cmdlet_success)
}
- describe 'test_configuration method invocation' do
- context 'when interacting with the LCM using a PowerShell cmdlet' do
+ describe "test_configuration method invocation" do
+ context "when interacting with the LCM using a PowerShell cmdlet" do
before(:each) do
allow(lcm).to receive(:run_configuration_cmdlet).and_return(lcm_status)
end
- context 'that returns successfully' do
+ context "that returns successfully" do
before(:each) do
allow(lcm).to receive(:run_configuration_cmdlet).and_return(lcm_status)
end
@@ -64,16 +64,16 @@ EOH
let(:lcm_standard_error) { nil }
let(:lcm_cmdlet_success) { true }
- it 'should successfully return resource information for normally formatted output when cmdlet the cmdlet succeeds' do
- test_configuration_result = lcm.test_configuration('config', {})
+ it "should successfully return resource information for normally formatted output when cmdlet the cmdlet succeeds" do
+ test_configuration_result = lcm.test_configuration("config", {})
expect(test_configuration_result.class).to be(Array)
expect(test_configuration_result.length).to be > 0
expect(Chef::Log).not_to receive(:warn)
end
end
- context 'that fails due to missing what-if switch in DSC resource cmdlet implementation' do
- let(:lcm_standard_output) { '' }
+ context "that fails due to missing what-if switch in DSC resource cmdlet implementation" do
+ let(:lcm_standard_output) { "" }
let(:lcm_standard_error) { no_whatif_lcm_output }
let(:lcm_cmdlet_success) { false }
@@ -81,58 +81,58 @@ EOH
expect(lcm.send(:whatif_not_supported?, no_whatif_lcm_output)).to be_truthy
end
- it 'should should return a (possibly empty) array of ResourceInfo instances' do
+ it "should should return a (possibly empty) array of ResourceInfo instances" do
expect(Chef::Log).to receive(:warn).at_least(:once)
expect(lcm).to receive(:whatif_not_supported?).and_call_original
test_configuration_result = nil
- expect {test_configuration_result = lcm.test_configuration('config', {})}.not_to raise_error
+ expect {test_configuration_result = lcm.test_configuration("config", {})}.not_to raise_error
expect(test_configuration_result.class).to be(Array)
end
end
- context 'that fails due to a DSC resource not being imported before StartDSCConfiguration -whatif is executed' do
- let(:lcm_standard_output) { '' }
+ context "that fails due to a DSC resource not being imported before StartDSCConfiguration -whatif is executed" do
+ let(:lcm_standard_output) { "" }
let(:lcm_standard_error) { dsc_resource_import_failure_output }
let(:lcm_cmdlet_success) { false }
- it 'should log a warning if the message is formatted as expected when a resource import failure occurs' do
+ it "should log a warning if the message is formatted as expected when a resource import failure occurs" do
expect(Chef::Log).to receive(:warn).at_least(:once)
expect(lcm).to receive(:dsc_module_import_failure?).and_call_original
test_configuration_result = nil
- expect {test_configuration_result = lcm.test_configuration('config', {})}.not_to raise_error
+ expect {test_configuration_result = lcm.test_configuration("config", {})}.not_to raise_error
end
- it 'should return a (possibly empty) array of ResourceInfo instances' do
+ it "should return a (possibly empty) array of ResourceInfo instances" do
expect(Chef::Log).to receive(:warn).at_least(:once)
test_configuration_result = nil
- expect {test_configuration_result = lcm.test_configuration('config', {})}.not_to raise_error
+ expect {test_configuration_result = lcm.test_configuration("config", {})}.not_to raise_error
expect(test_configuration_result.class).to be(Array)
end
end
- context 'that fails due to an unknown PowerShell cmdlet error' do
- let(:lcm_standard_output) { 'some output' }
- let(:lcm_standard_error) { 'Abort, Retry, Fail?' }
+ context "that fails due to an unknown PowerShell cmdlet error" do
+ let(:lcm_standard_output) { "some output" }
+ let(:lcm_standard_error) { "Abort, Retry, Fail?" }
let(:lcm_cmdlet_success) { false }
- it 'should log a warning' do
+ it "should log a warning" do
expect(Chef::Log).to receive(:warn).at_least(:once)
expect(lcm).to receive(:dsc_module_import_failure?).and_call_original
- expect {lcm.test_configuration('config', {})}.not_to raise_error
+ expect {lcm.test_configuration("config", {})}.not_to raise_error
end
end
end
- it 'should identify a correctly formatted error message as a resource import failure' do
+ it "should identify a correctly formatted error message as a resource import failure" do
expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output)).to be(true)
end
- it 'should not identify an incorrectly formatted error message as a resource import failure' do
- expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub('module', 'gibberish'))).to be(false)
+ it "should not identify an incorrectly formatted error message as a resource import failure" do
+ expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub("module", "gibberish"))).to be(false)
end
- it 'should not identify a message without a CimException reference as a resource import failure' do
- expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub('CimException', 'ArgumentException'))).to be(false)
+ it "should not identify a message without a CimException reference as a resource import failure" do
+ expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub("CimException", "ArgumentException"))).to be(false)
end
end
end
diff --git a/spec/unit/util/dsc/resource_store.rb b/spec/unit/util/dsc/resource_store.rb
index 181ac2bb6c..97652a3d1c 100644
--- a/spec/unit/util/dsc/resource_store.rb
+++ b/spec/unit/util/dsc/resource_store.rb
@@ -16,61 +16,61 @@
# limitations under the License.
#
-require 'chef'
-require 'chef/util/dsc/resource_store'
+require "chef"
+require "chef/util/dsc/resource_store"
describe Chef::Util::DSC::ResourceStore do
let(:resource_store) { Chef::Util::DSC::ResourceStore.new }
let(:resource_a) { {
- 'ResourceType' => 'AFoo',
- 'Name' => 'Foo',
- 'Module' => {'Name' => 'ModuleA'},
+ "ResourceType" => "AFoo",
+ "Name" => "Foo",
+ "Module" => {"Name" => "ModuleA"},
}
}
let(:resource_b) { {
- 'ResourceType' => 'BFoo',
- 'Name' => 'Foo',
- 'Module' => {'Name' => 'ModuleB'},
+ "ResourceType" => "BFoo",
+ "Name" => "Foo",
+ "Module" => {"Name" => "ModuleB"},
}
}
- context 'when resources are not cached' do
+ context "when resources are not cached" do
context 'when calling #resources' do
- it 'returns an empty array' do
+ it "returns an empty array" do
expect(resource_store.resources).to eql([])
end
end
context 'when calling #find' do
- it 'returns an empty list if it cannot find any matching resources' do
+ it "returns an empty list if it cannot find any matching resources" do
expect(resource_store).to receive(:query_resource).and_return([])
- expect(resource_store.find('foo')).to eql([])
+ expect(resource_store.find("foo")).to eql([])
end
- it 'returns the resource if it is found (comparisons are case insensitive)' do
+ it "returns the resource if it is found (comparisons are case insensitive)" do
expect(resource_store).to receive(:query_resource).and_return([resource_a])
- expect(resource_store.find('foo')).to eql([resource_a])
+ expect(resource_store.find("foo")).to eql([resource_a])
end
- it 'returns multiple resoures if they are found' do
+ it "returns multiple resoures if they are found" do
expect(resource_store).to receive(:query_resource).and_return([resource_a, resource_b])
- expect(resource_store.find('foo')).to include(resource_a, resource_b)
+ expect(resource_store.find("foo")).to include(resource_a, resource_b)
end
- it 'deduplicates resources by ResourceName' do
+ it "deduplicates resources by ResourceName" do
expect(resource_store).to receive(:query_resource).and_return([resource_a, resource_a])
- resource_store.find('foo')
+ resource_store.find("foo")
expect(resource_store.resources).to eq([resource_a])
end
end
end
- context 'when resources are cached' do
- it 'recalls resources from the cache if present' do
+ context "when resources are cached" do
+ it "recalls resources from the cache if present" do
expect(resource_store).not_to receive(:query_resource)
expect(resource_store).to receive(:resources).and_return([resource_a])
- resource_store.find('foo')
+ resource_store.find("foo")
end
end
end
diff --git a/spec/unit/util/editor_spec.rb b/spec/unit/util/editor_spec.rb
index 968302df17..9db7e85931 100644
--- a/spec/unit/util/editor_spec.rb
+++ b/spec/unit/util/editor_spec.rb
@@ -1,14 +1,14 @@
-require 'spec_helper'
-require 'chef/util/editor'
+require "spec_helper"
+require "chef/util/editor"
describe Chef::Util::Editor do
describe '#initialize' do
- it 'takes an Enumerable of lines' do
+ it "takes an Enumerable of lines" do
editor = described_class.new(File.open(__FILE__))
expect(editor.lines).to be == IO.readlines(__FILE__)
end
- it 'makes a copy of an Array' do
+ it "makes a copy of an Array" do
array = Array.new
editor = described_class.new(array)
expect(editor.lines).to_not be(array)
@@ -16,137 +16,137 @@ describe Chef::Util::Editor do
end
subject(:editor) { described_class.new(input_lines) }
- let(:input_lines) { ['one', 'two', 'two', 'three'] }
+ let(:input_lines) { ["one", "two", "two", "three"] }
describe '#append_line_after' do
- context 'when there is no match' do
- subject(:execute) { editor.append_line_after('missing', 'new') }
+ context "when there is no match" do
+ subject(:execute) { editor.append_line_after("missing", "new") }
- it('returns the number of added lines') { is_expected.to eq(0) }
- it 'does not add any lines' do
+ it("returns the number of added lines") { is_expected.to eq(0) }
+ it "does not add any lines" do
expect { execute }.to_not change { editor.lines }
end
end
- context 'when there is a match' do
- subject(:execute) { editor.append_line_after('two', 'new') }
+ context "when there is a match" do
+ subject(:execute) { editor.append_line_after("two", "new") }
- it('returns the number of added lines') { is_expected.to eq(2) }
- it 'adds a line after each match' do
+ it("returns the number of added lines") { is_expected.to eq(2) }
+ it "adds a line after each match" do
execute
- expect(editor.lines).to be == ['one', 'two', 'new', 'two', 'new', 'three']
+ expect(editor.lines).to be == ["one", "two", "new", "two", "new", "three"]
end
end
- it 'matches a Regexp' do
- expect(editor.append_line_after(/^ee/, 'new')).to be == 0
- expect(editor.append_line_after(/ee$/, 'new')).to be == 1
+ it "matches a Regexp" do
+ expect(editor.append_line_after(/^ee/, "new")).to be == 0
+ expect(editor.append_line_after(/ee$/, "new")).to be == 1
end
end
describe '#append_line_if_missing' do
- context 'when there is no match' do
- subject(:execute) { editor.append_line_if_missing('missing', 'new') }
+ context "when there is no match" do
+ subject(:execute) { editor.append_line_if_missing("missing", "new") }
- it('returns the number of added lines') { is_expected.to eq(1) }
- it 'adds a line to the end' do
+ it("returns the number of added lines") { is_expected.to eq(1) }
+ it "adds a line to the end" do
execute
- expect(editor.lines).to be == ['one', 'two', 'two', 'three', 'new']
+ expect(editor.lines).to be == ["one", "two", "two", "three", "new"]
end
end
- context 'when there is a match' do
- subject(:execute) { editor.append_line_if_missing('one', 'new') }
+ context "when there is a match" do
+ subject(:execute) { editor.append_line_if_missing("one", "new") }
- it('returns the number of added lines') { is_expected.to eq(0) }
- it 'does not add any lines' do
+ it("returns the number of added lines") { is_expected.to eq(0) }
+ it "does not add any lines" do
expect { execute }.to_not change { editor.lines }
end
end
- it 'matches a Regexp' do
- expect(editor.append_line_if_missing(/ee$/, 'new')).to be == 0
- expect(editor.append_line_if_missing(/^ee/, 'new')).to be == 1
+ it "matches a Regexp" do
+ expect(editor.append_line_if_missing(/ee$/, "new")).to be == 0
+ expect(editor.append_line_if_missing(/^ee/, "new")).to be == 1
end
end
describe '#remove_lines' do
- context 'when there is no match' do
- subject(:execute) { editor.remove_lines('missing') }
+ context "when there is no match" do
+ subject(:execute) { editor.remove_lines("missing") }
- it('returns the number of removed lines') { is_expected.to eq(0) }
- it 'does not remove any lines' do
+ it("returns the number of removed lines") { is_expected.to eq(0) }
+ it "does not remove any lines" do
expect { execute }.to_not change { editor.lines }
end
end
- context 'when there is a match' do
- subject(:execute) { editor.remove_lines('two') }
+ context "when there is a match" do
+ subject(:execute) { editor.remove_lines("two") }
- it('returns the number of removed lines') { is_expected.to eq(2) }
- it 'removes the matching lines' do
+ it("returns the number of removed lines") { is_expected.to eq(2) }
+ it "removes the matching lines" do
execute
- expect(editor.lines).to be == ['one', 'three']
+ expect(editor.lines).to be == ["one", "three"]
end
end
- it 'matches a Regexp' do
+ it "matches a Regexp" do
expect(editor.remove_lines(/^ee/)).to be == 0
expect(editor.remove_lines(/ee$/)).to be == 1
end
end
describe '#replace' do
- context 'when there is no match' do
- subject(:execute) { editor.replace('missing', 'new') }
+ context "when there is no match" do
+ subject(:execute) { editor.replace("missing", "new") }
- it('returns the number of changed lines') { is_expected.to eq(0) }
- it 'does not change any lines' do
+ it("returns the number of changed lines") { is_expected.to eq(0) }
+ it "does not change any lines" do
expect { execute }.to_not change { editor.lines }
end
end
- context 'when there is a match' do
- subject(:execute) { editor.replace('two', 'new') }
+ context "when there is a match" do
+ subject(:execute) { editor.replace("two", "new") }
- it('returns the number of changed lines') { is_expected.to eq(2) }
- it 'replaces the matching portions' do
+ it("returns the number of changed lines") { is_expected.to eq(2) }
+ it "replaces the matching portions" do
execute
- expect(editor.lines).to be == ['one', 'new', 'new', 'three']
+ expect(editor.lines).to be == ["one", "new", "new", "three"]
end
end
- it 'matches a Regexp' do
- expect(editor.replace(/^ee/, 'new')).to be == 0
- expect(editor.replace(/ee$/, 'new')).to be == 1
- expect(editor.lines).to be == ['one', 'two', 'two', 'thrnew']
+ it "matches a Regexp" do
+ expect(editor.replace(/^ee/, "new")).to be == 0
+ expect(editor.replace(/ee$/, "new")).to be == 1
+ expect(editor.lines).to be == ["one", "two", "two", "thrnew"]
end
end
describe '#replace_lines' do
- context 'when there is no match' do
- subject(:execute) { editor.replace_lines('missing', 'new') }
+ context "when there is no match" do
+ subject(:execute) { editor.replace_lines("missing", "new") }
- it('returns the number of changed lines') { is_expected.to eq(0) }
- it 'does not change any lines' do
+ it("returns the number of changed lines") { is_expected.to eq(0) }
+ it "does not change any lines" do
expect { execute }.to_not change { editor.lines }
end
end
- context 'when there is a match' do
- subject(:execute) { editor.replace_lines('two', 'new') }
+ context "when there is a match" do
+ subject(:execute) { editor.replace_lines("two", "new") }
- it('returns the number of replaced lines') { is_expected.to eq(2) }
- it 'replaces the matching line' do
+ it("returns the number of replaced lines") { is_expected.to eq(2) }
+ it "replaces the matching line" do
execute
- expect(editor.lines).to be == ['one', 'new', 'new', 'three']
+ expect(editor.lines).to be == ["one", "new", "new", "three"]
end
end
- it 'matches a Regexp' do
- expect(editor.replace_lines(/^ee/, 'new')).to be == 0
- expect(editor.replace_lines(/ee$/, 'new')).to be == 1
- expect(editor.lines).to be == ['one', 'two', 'two', 'new']
+ it "matches a Regexp" do
+ expect(editor.replace_lines(/^ee/, "new")).to be == 0
+ expect(editor.replace_lines(/ee$/, "new")).to be == 1
+ expect(editor.lines).to be == ["one", "two", "two", "new"]
end
end
end
diff --git a/spec/unit/util/file_edit_spec.rb b/spec/unit/util/file_edit_spec.rb
index b99cf2f426..5f9b559a4c 100644
--- a/spec/unit/util/file_edit_spec.rb
+++ b/spec/unit/util/file_edit_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'tempfile'
+require "spec_helper"
+require "tempfile"
describe Chef::Util::FileEdit do
@@ -93,7 +93,7 @@ twice
end
let(:target_file) do
- f = Tempfile.open('file_edit_spec')
+ f = Tempfile.open("file_edit_spec")
f.write(starting_content)
f.close
f
diff --git a/spec/unit/util/powershell/cmdlet_spec.rb b/spec/unit/util/powershell/cmdlet_spec.rb
index 5ddf9282c4..d2a7960db2 100644
--- a/spec/unit/util/powershell/cmdlet_spec.rb
+++ b/spec/unit/util/powershell/cmdlet_spec.rb
@@ -16,25 +16,25 @@
# limitations under the License.
#
-require 'chef'
-require 'chef/util/powershell/cmdlet'
+require "chef"
+require "chef/util/powershell/cmdlet"
describe Chef::Util::Powershell::Cmdlet do
before (:all) do
@node = Chef::Node.new
- @cmdlet = Chef::Util::Powershell::Cmdlet.new(@node, 'Some-Commandlet')
+ @cmdlet = Chef::Util::Powershell::Cmdlet.new(@node, "Some-Commandlet")
end
describe '#validate_switch_name!' do
- it 'should not raise an error if a name contains all upper case letters' do
+ it "should not raise an error if a name contains all upper case letters" do
@cmdlet.send(:validate_switch_name!, "HELLO")
end
- it 'should not raise an error if the name contains all lower case letters' do
+ it "should not raise an error if the name contains all lower case letters" do
@cmdlet.send(:validate_switch_name!, "hello")
end
- it 'should not raise an error if no special characters are used except _' do
+ it "should not raise an error if no special characters are used except _" do
@cmdlet.send(:validate_switch_name!, "hello_world")
end
@@ -55,51 +55,51 @@ describe Chef::Util::Powershell::Cmdlet do
end
end
- it 'does not do anything to a string without special characters' do
- expect(@cmdlet.send(:escape_parameter_value, 'stuff')).to eql('stuff')
+ it "does not do anything to a string without special characters" do
+ expect(@cmdlet.send(:escape_parameter_value, "stuff")).to eql("stuff")
end
end
describe '#escape_string_parameter_value' do
it "surrounds a string with ''" do
- expect(@cmdlet.send(:escape_string_parameter_value, 'stuff')).to eql("'stuff'")
+ expect(@cmdlet.send(:escape_string_parameter_value, "stuff")).to eql("'stuff'")
end
end
describe '#command_switches_string' do
- it 'raises an ArgumentError if the key is not a symbol' do
+ it "raises an ArgumentError if the key is not a symbol" do
expect {
- @cmdlet.send(:command_switches_string, {'foo' => 'bar'})
+ @cmdlet.send(:command_switches_string, {"foo" => "bar"})
}.to raise_error(ArgumentError)
end
- it 'does not allow invalid switch names' do
+ it "does not allow invalid switch names" do
expect {
- @cmdlet.send(:command_switches_string, {:foo! => 'bar'})
+ @cmdlet.send(:command_switches_string, {:foo! => "bar"})
}.to raise_error(ArgumentError)
end
- it 'ignores switches with a false value' do
- expect(@cmdlet.send(:command_switches_string, {foo: false})).to eql('')
+ it "ignores switches with a false value" do
+ expect(@cmdlet.send(:command_switches_string, {foo: false})).to eql("")
end
- it 'should correctly handle a value type of string' do
- expect(@cmdlet.send(:command_switches_string, {foo: 'bar'})).to eql("-foo 'bar'")
+ it "should correctly handle a value type of string" do
+ expect(@cmdlet.send(:command_switches_string, {foo: "bar"})).to eql("-foo 'bar'")
end
- it 'should correctly handle a value type of string even when it is 0 length' do
- expect(@cmdlet.send(:command_switches_string, {foo: ''})).to eql("-foo ''")
+ it "should correctly handle a value type of string even when it is 0 length" do
+ expect(@cmdlet.send(:command_switches_string, {foo: ""})).to eql("-foo ''")
end
- it 'should not quote integers' do
+ it "should not quote integers" do
expect(@cmdlet.send(:command_switches_string, {foo: 1})).to eql("-foo 1")
end
- it 'should not quote floats' do
+ it "should not quote floats" do
expect(@cmdlet.send(:command_switches_string, {foo: 1.0})).to eql("-foo 1.0")
end
- it 'has just the switch when the value is true' do
+ it "has just the switch when the value is true" do
expect(@cmdlet.send(:command_switches_string, {foo: true})).to eql("-foo")
end
end
diff --git a/spec/unit/util/powershell/ps_credential_spec.rb b/spec/unit/util/powershell/ps_credential_spec.rb
index 668ec525c6..2ec7ff6238 100644
--- a/spec/unit/util/powershell/ps_credential_spec.rb
+++ b/spec/unit/util/powershell/ps_credential_spec.rb
@@ -16,27 +16,27 @@
# limitations under the License.
#
-require 'chef'
-require 'chef/util/powershell/ps_credential'
+require "chef"
+require "chef/util/powershell/ps_credential"
describe Chef::Util::Powershell::PSCredential do
- let (:username) { 'foo' }
- let (:password) { 'ThIsIsThEpAsSwOrD' }
+ let (:username) { "foo" }
+ let (:password) { "ThIsIsThEpAsSwOrD" }
- context 'when username and password are provided' do
+ context "when username and password are provided" do
let(:ps_credential) { Chef::Util::Powershell::PSCredential.new(username, password)}
- context 'when calling to_psobject' do
- it 'should create the script to create a PSCredential when calling' do
- allow(ps_credential).to receive(:encrypt).with(password).and_return('encrypted')
+ context "when calling to_psobject" do
+ it "should create the script to create a PSCredential when calling" do
+ allow(ps_credential).to receive(:encrypt).with(password).and_return("encrypted")
expect(ps_credential.to_psobject).to eq(
"New-Object System.Management.Automation.PSCredential("\
"'#{username}',('encrypted' | ConvertTo-SecureString))")
end
end
- context 'when to_text is called' do
- it 'should not contain the password' do
- allow(ps_credential).to receive(:encrypt).with(password).and_return('encrypted')
+ context "when to_text is called" do
+ it "should not contain the password" do
+ allow(ps_credential).to receive(:encrypt).with(password).and_return("encrypted")
expect(ps_credential.to_text).not_to match(/#{password}/)
end
end
diff --git a/spec/unit/util/selinux_spec.rb b/spec/unit/util/selinux_spec.rb
index 0ed138c7bc..60f1ba8fae 100644
--- a/spec/unit/util/selinux_spec.rb
+++ b/spec/unit/util/selinux_spec.rb
@@ -17,7 +17,7 @@
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Util::Selinux do
class TestClass
@@ -40,7 +40,7 @@ describe Chef::Util::Selinux do
end
it "each part of ENV['PATH'] should be checked" do
- expected_paths = ENV['PATH'].split(File::PATH_SEPARATOR) + [ '/bin', '/usr/bin', '/sbin', '/usr/sbin' ]
+ expected_paths = ENV["PATH"].split(File::PATH_SEPARATOR) + [ "/bin", "/usr/bin", "/sbin", "/usr/sbin" ]
expected_paths.each do |bin_path|
selinux_path = File.join(bin_path, "selinuxenabled")
diff --git a/spec/unit/util/threaded_job_queue_spec.rb b/spec/unit/util/threaded_job_queue_spec.rb
index 22626328be..e4eb58d8bd 100644
--- a/spec/unit/util/threaded_job_queue_spec.rb
+++ b/spec/unit/util/threaded_job_queue_spec.rb
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
+require "spec_helper"
class WorkerThreadError < StandardError
end
diff --git a/spec/unit/version/platform_spec.rb b/spec/unit/version/platform_spec.rb
index dd425b32a5..6c9720fe6d 100644
--- a/spec/unit/version/platform_spec.rb
+++ b/spec/unit/version/platform_spec.rb
@@ -14,13 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
-require 'chef/version/platform'
+require "spec_helper"
+require "chef/version/platform"
describe Chef::Version::Platform do
it "is a subclass of Chef::Version" do
- v = Chef::Version::Platform.new('1.1')
+ v = Chef::Version::Platform.new("1.1")
expect(v).to be_an_instance_of(Chef::Version::Platform)
expect(v).to be_a_kind_of(Chef::Version)
end
diff --git a/spec/unit/version_class_spec.rb b/spec/unit/version_class_spec.rb
index f1f55c7b05..2e70b7e00c 100644
--- a/spec/unit/version_class_spec.rb
+++ b/spec/unit/version_class_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
-require 'chef/version_class'
+require "spec_helper"
+require "chef/version_class"
describe Chef::Version do
before do
diff --git a/spec/unit/version_constraint/platform_spec.rb b/spec/unit/version_constraint/platform_spec.rb
index f38eb49689..a4ddc4e0bd 100644
--- a/spec/unit/version_constraint/platform_spec.rb
+++ b/spec/unit/version_constraint/platform_spec.rb
@@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
-require 'chef/version_constraint/platform'
+require "spec_helper"
+require "chef/version_constraint/platform"
describe Chef::VersionConstraint::Platform do
diff --git a/spec/unit/version_constraint_spec.rb b/spec/unit/version_constraint_spec.rb
index 0ae502f66d..e50fd2115c 100644
--- a/spec/unit/version_constraint_spec.rb
+++ b/spec/unit/version_constraint_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
-require 'chef/version_constraint'
+require "spec_helper"
+require "chef/version_constraint"
describe Chef::VersionConstraint do
describe "validation" do
@@ -88,7 +88,7 @@ describe Chef::VersionConstraint do
expect(@vc).to include Chef::Version.new("1.4")
end
it "Chef::CookbookVersion" do
- cv = Chef::CookbookVersion.new("alice", '/tmp/blah.txt')
+ cv = Chef::CookbookVersion.new("alice", "/tmp/blah.txt")
cv.version = "1.4"
expect(@vc).to include cv
end
@@ -149,31 +149,31 @@ describe Chef::VersionConstraint do
end
end
- describe 'to_s' do
- it 'shows a patch-level if one is given' do
- vc = Chef::VersionConstraint.new '~> 1.2.0'
+ describe "to_s" do
+ it "shows a patch-level if one is given" do
+ vc = Chef::VersionConstraint.new "~> 1.2.0"
- expect(vc.to_s).to eq('~> 1.2.0')
+ expect(vc.to_s).to eq("~> 1.2.0")
end
- it 'shows no patch-level if one is not given' do
- vc = Chef::VersionConstraint.new '~> 1.2'
+ it "shows no patch-level if one is not given" do
+ vc = Chef::VersionConstraint.new "~> 1.2"
- expect(vc.to_s).to eq('~> 1.2')
+ expect(vc.to_s).to eq("~> 1.2")
end
end
- describe 'inspect' do
- it 'shows a patch-level if one is given' do
- vc = Chef::VersionConstraint.new '~> 1.2.0'
+ describe "inspect" do
+ it "shows a patch-level if one is given" do
+ vc = Chef::VersionConstraint.new "~> 1.2.0"
- expect(vc.inspect).to eq('(~> 1.2.0)')
+ expect(vc.inspect).to eq("(~> 1.2.0)")
end
- it 'shows no patch-level if one is not given' do
- vc = Chef::VersionConstraint.new '~> 1.2'
+ it "shows no patch-level if one is not given" do
+ vc = Chef::VersionConstraint.new "~> 1.2"
- expect(vc.inspect).to eq('(~> 1.2)')
+ expect(vc.inspect).to eq("(~> 1.2)")
end
end
end
diff --git a/spec/unit/win32/registry_spec.rb b/spec/unit/win32/registry_spec.rb
index 56def30638..fc0a21242b 100644
--- a/spec/unit/win32/registry_spec.rb
+++ b/spec/unit/win32/registry_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Win32::Registry do
include_context "Win32"
@@ -25,9 +25,9 @@ describe Chef::Win32::Registry do
let(:value1_upcase_name) { {:name => "ONE", :type => :string, :data => "1"} }
let(:key_path) { 'HKCU\Software\OpscodeNumbers' }
let(:key) { 'Software\OpscodeNumbers' }
- let(:key_parent) { 'Software' }
- let(:key_to_delete) { 'OpscodeNumbers' }
- let(:sub_key) {'OpscodePrimes'}
+ let(:key_parent) { "Software" }
+ let(:key_to_delete) { "OpscodeNumbers" }
+ let(:sub_key) {"OpscodePrimes"}
let(:missing_key_path) {'HKCU\Software'}
let(:registry) { Chef::Win32::Registry.new() }
let(:hive_mock) { double("::Win32::Registry::KHKEY_CURRENT_USER") }
@@ -49,10 +49,10 @@ describe Chef::Win32::Registry do
end
after(:each) do
- Win32::Registry.send(:remove_const, 'KEY_SET_VALUE') if defined?(Win32::Registry::KEY_SET_VALUE)
- Win32::Registry.send(:remove_const, 'KEY_QUERY_VALUE') if defined?(Win32::Registry::KEY_QUERY_VALUE)
- Win32::Registry.send(:remove_const, 'KEY_READ') if defined?(Win32::Registry::KEY_READ)
- Win32::Registry.send(:remove_const, 'KEY_WRITE') if defined?(Win32::Registry::KEY_WRITE)
+ Win32::Registry.send(:remove_const, "KEY_SET_VALUE") if defined?(Win32::Registry::KEY_SET_VALUE)
+ Win32::Registry.send(:remove_const, "KEY_QUERY_VALUE") if defined?(Win32::Registry::KEY_QUERY_VALUE)
+ Win32::Registry.send(:remove_const, "KEY_READ") if defined?(Win32::Registry::KEY_READ)
+ Win32::Registry.send(:remove_const, "KEY_WRITE") if defined?(Win32::Registry::KEY_WRITE)
end
describe "get_values" do
diff --git a/spec/unit/windows_service_spec.rb b/spec/unit/windows_service_spec.rb
index adc128c9d8..a614e6630d 100644
--- a/spec/unit/windows_service_spec.rb
+++ b/spec/unit/windows_service_spec.rb
@@ -15,13 +15,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
if Chef::Platform.windows?
- require 'chef/application/windows_service'
+ require "chef/application/windows_service"
end
describe "Chef::Application::WindowsService", :windows_only do
- let(:shell_out_result) { double('shellout', stdout: nil, stderr: nil) }
+ let(:shell_out_result) { double("shellout", stdout: nil, stderr: nil) }
let(:config_options) do
{
log_location: STDOUT,
@@ -57,8 +57,8 @@ describe "Chef::Application::WindowsService", :windows_only do
subject.service_main
end
- context 'has a log location configured' do
- let(:tempfile) { Tempfile.new 'log_file' }
+ context "has a log location configured" do
+ let(:tempfile) { Tempfile.new "log_file" }
let(:config_options) do
{
log_location: tempfile.path,
@@ -79,7 +79,7 @@ describe "Chef::Application::WindowsService", :windows_only do
subject.service_main
end
- context 'configured to Event Logger' do
+ context "configured to Event Logger" do
let(:config_options) do
{
log_location: Chef::Log::WinEvt.new,
@@ -98,7 +98,7 @@ describe "Chef::Application::WindowsService", :windows_only do
end
end
- context 'configueres a watchdog timeout' do
+ context "configueres a watchdog timeout" do
let(:timeout) { 10 }
before do
diff --git a/tasks/external_tests.rb b/tasks/external_tests.rb
index 805ea323cb..f3a0da062f 100644
--- a/tasks/external_tests.rb
+++ b/tasks/external_tests.rb
@@ -1,15 +1,15 @@
-require 'tempfile'
-require 'bundler'
+require "tempfile"
+require "bundler"
-CURRENT_GEM_NAME = 'chef'
-CURRENT_GEM_PATH = File.expand_path('../..', __FILE__)
+CURRENT_GEM_NAME = "chef"
+CURRENT_GEM_PATH = File.expand_path("../..", __FILE__)
def bundle_exec_with_chef(test_gem, commands)
gem_path = Bundler.environment.specs[test_gem].first.full_gem_path
gemfile_path = File.join(gem_path, "Gemfile.#{CURRENT_GEM_NAME}-external-test")
gemfile = File.open(gemfile_path, "w")
begin
- IO.read(File.join(gem_path, 'Gemfile')).each_line do |line|
+ IO.read(File.join(gem_path, "Gemfile")).each_line do |line|
if line =~ /^\s*gemspec/
next
elsif line =~ /^\s*gem '#{CURRENT_GEM_NAME}'|\s*gem "#{CURRENT_GEM_NAME}"/
@@ -26,11 +26,11 @@ def bundle_exec_with_chef(test_gem, commands)
gemfile.close
Dir.chdir(gem_path) do
Bundler.with_clean_env do
- unless system({ 'BUNDLE_GEMFILE' => gemfile_path, 'RUBYOPT' => nil, 'GEMFILE_MOD' => nil }, "bundle update")
+ unless system({ "BUNDLE_GEMFILE" => gemfile_path, "RUBYOPT" => nil, "GEMFILE_MOD" => nil }, "bundle update")
raise "Error running bundle update of #{gemfile_path} in #{gem_path}: #{$?.exitstatus}\nGemfile:\n#{IO.read(gemfile_path)}"
end
Array(commands).each do |command|
- unless system({ 'BUNDLE_GEMFILE' => gemfile_path, 'RUBYOPT' => nil, 'GEMFILE_MOD' => nil }, "bundle exec #{command}")
+ unless system({ "BUNDLE_GEMFILE" => gemfile_path, "RUBYOPT" => nil, "GEMFILE_MOD" => nil }, "bundle exec #{command}")
raise "Error running bundle exec #{command} in #{gem_path} with BUNDLE_GEMFILE=#{gemfile_path}: #{$?.exitstatus}\nGemfile:\n#{IO.read(gemfile_path)}"
end
end
@@ -58,7 +58,7 @@ EXTERNAL_PROJECTS = {
task :external_specs => EXTERNAL_PROJECTS.keys.map { |g| :"#{g.sub("-","_")}_spec" }
EXTERNAL_PROJECTS.each do |test_gem, commands|
- task :"#{test_gem.gsub('-','_')}_spec" do
+ task :"#{test_gem.gsub("-","_")}_spec" do
bundle_exec_with_chef(test_gem, commands)
end
end
diff --git a/tasks/maintainers.rb b/tasks/maintainers.rb
index 73a422fc61..4b9f78be14 100644
--- a/tasks/maintainers.rb
+++ b/tasks/maintainers.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'rake'
+require "rake"
SOURCE = File.join(File.dirname(__FILE__), "..", "MAINTAINERS.toml")
TARGET = File.join(File.dirname(__FILE__), "..", "MAINTAINERS.md")
@@ -28,9 +28,9 @@ REPOSITORIES = ["chef/chef", "chef/chef-census", "chef/chef-repo",
"chef/mixlib-shellout", "chef/ohai", "chef/omnibus-chef"]
begin
- require 'tomlrb'
- require 'octokit'
- require 'pp'
+ require "tomlrb"
+ require "octokit"
+ require "pp"
task :default => :generate
namespace :maintainers do
diff --git a/tasks/rspec.rb b/tasks/rspec.rb
index 4d74fa0951..ff784c833c 100644
--- a/tasks/rspec.rb
+++ b/tasks/rspec.rb
@@ -17,13 +17,13 @@
# limitations under the License.
#
-require 'rubygems'
-require 'rake'
+require "rubygems"
+require "rake"
CHEF_ROOT = File.join(File.dirname(__FILE__), "..")
begin
- require 'rspec/core/rake_task'
+ require "rspec/core/rake_task"
desc "Run specs for Chef's Components"
@@ -44,13 +44,13 @@ begin
RSpec::Core::RakeTask.new(:spec) do |t|
# right now this just limits to functional + unit, but could also remove
# individual tests marked long-running
- t.pattern = FileList['spec/**/*_spec.rb']
+ t.pattern = FileList["spec/**/*_spec.rb"]
end
namespace :spec do
desc "Run all specs in spec directory with RCov"
RSpec::Core::RakeTask.new(:rcov) do |t|
- t.pattern = FileList['spec/**/*_spec.rb']
+ t.pattern = FileList["spec/**/*_spec.rb"]
t.rcov = true
t.rcov_opts = lambda do
IO.readlines("#{CHEF_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
@@ -59,19 +59,19 @@ begin
desc "Run all specs in spec directory"
RSpec::Core::RakeTask.new(:all) do |t|
- t.pattern = FileList['spec/**/*_spec.rb']
+ t.pattern = FileList["spec/**/*_spec.rb"]
end
desc "Print Specdoc for all specs"
RSpec::Core::RakeTask.new(:doc) do |t|
t.rspec_opts = ["--format", "specdoc", "--dry-run"]
- t.pattern = FileList['spec/**/*_spec.rb']
+ t.pattern = FileList["spec/**/*_spec.rb"]
end
desc "Run the specs under spec/unit with activesupport loaded"
RSpec::Core::RakeTask.new(:activesupport) do |t|
t.rspec_opts = ["--require active_support/core_ext"]
- t.pattern = FileList['spec/unit/**/*_spec.rb']
+ t.pattern = FileList["spec/unit/**/*_spec.rb"]
end
[:unit, :functional, :integration, :stress].each do |sub|