summaryrefslogtreecommitdiff
path: root/lib
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 /lib
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.
Diffstat (limited to 'lib')
-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
652 files changed, 3787 insertions, 3787 deletions
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