diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-01-15 18:24:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-15 18:24:02 -0800 |
commit | c86f10dfb9c898874a58cff92804ef437e3e8e98 (patch) | |
tree | fe6ae0d8804dfcbc7d6167433ce5e5e717173d40 | |
parent | 4be1ebe66460efb0535e500d6ecb52a147346519 (diff) | |
parent | 7400ace1926d3700ea12287b74723a7934c196a2 (diff) | |
download | chef-c86f10dfb9c898874a58cff92804ef437e3e8e98.tar.gz |
Merge pull request #8112 from chef/lcg/rubocop-upgrades
changes for rubocop engine upgrades.
171 files changed, 1228 insertions, 1230 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index e86b99f511..0ac372b149 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,10 @@ GIT remote: https://github.com/chef/chefstyle.git - revision: 5190569ae0901e1139f296a92cb448a60d98da56 + revision: 97710fcf8164ce11c64bf0d524e75eadca8c0c75 branch: master specs: - chefstyle (0.11.1) - rubocop (= 0.55.0) + chefstyle (0.12.0) + rubocop (= 0.62.0) GIT remote: https://github.com/chef/ohai.git @@ -142,7 +142,7 @@ GEM docile (1.3.1) equatable (0.5.0) erubis (2.7.0) - ethon (0.11.0) + ethon (0.12.0) ffi (>= 1.3.0) faraday (0.15.4) multipart-post (>= 1.2, < 3) @@ -192,6 +192,7 @@ GEM tty-table (~> 0.10) ipaddress (0.8.3) iso8601 (0.12.1) + jaro_winkler (1.5.2) json (2.1.0) launchy (2.4.3) addressable (~> 2.3) @@ -277,13 +278,14 @@ GEM rspec_junit_formatter (0.2.3) builder (< 4) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (0.55.0) + rubocop (0.62.0) + jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.5) + parser (>= 2.5, != 2.5.1.1) powerpack (~> 0.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.0, >= 1.0.1) + unicode-display_width (~> 1.4.0) ruby-prof (0.17.0) ruby-progressbar (1.10.0) ruby-shadow (2.5.0) @@ -424,4 +426,4 @@ DEPENDENCIES yard BUNDLED WITH - 1.17.2 + 1.17.3 diff --git a/chef-config/spec/unit/workstation_config_loader_spec.rb b/chef-config/spec/unit/workstation_config_loader_spec.rb index 28fbdf63dd..e1717b6574 100644 --- a/chef-config/spec/unit/workstation_config_loader_spec.rb +++ b/chef-config/spec/unit/workstation_config_loader_spec.rb @@ -459,7 +459,7 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do client_key = "barney_rubble.pem" chef_server_url = "https://api.chef.io/organizations/bedrock" invalid_config_option1234 = "foobar" -EOH + EOH content end @@ -484,7 +484,7 @@ EOH } [default.knife] ssh_user = "knife_ssh_user" -EOH + EOH content end @@ -506,7 +506,7 @@ EOH -----BEGIN RSA PRIVATE KEY----- foo """ -EOH + EOH content end @@ -515,7 +515,7 @@ EOH expect(ChefConfig::Config.client_key_contents).to eq(<<~EOH -----BEGIN RSA PRIVATE KEY----- foo -EOH + EOH ) end end @@ -531,7 +531,7 @@ EOH client_name = "explicit" [context] client_name = "context" -EOH + EOH content end @@ -573,7 +573,7 @@ EOH [default] node_name = 'barney' client_name = 'barney' -EOH + EOH content end diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb index ee7d1530ed..763d52226a 100644 --- a/lib/chef/application/solo.rb +++ b/lib/chef/application/solo.rb @@ -321,7 +321,7 @@ class Chef::Application::Solo < Chef::Application Early contributor to Chef Kind hearted open source advocate Rest in peace, Ezra. -EOH + EOH end def interval_run_chef_client diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb index 3c73a4925d..26154f8b1e 100644 --- a/lib/chef/application/windows_service.rb +++ b/lib/chef/application/windows_service.rb @@ -207,7 +207,7 @@ class Chef Chef::Log.error(<<-EOF) Your chef-client run timed out. You can increase the time chef-client is given to complete by configuring windows_service.watchdog_timeout in your client.rb. - EOF + EOF rescue Mixlib::ShellOut::ShellCommandFailed => e Chef::Log.warn "Not able to start chef-client in new process (#{e})" rescue => e 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 3b1fb53da6..1254d8543c 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 @@ -5,7 +5,7 @@ class Chef module ChefFS module DataHandler class DataBagItemDataHandler < DataHandlerBase - RESERVED_NAMES = /^(node|role|environment|client)$/ + RESERVED_NAMES = /^(node|role|environment|client)$/.freeze def normalize(data_bag_item, entry) # If it's wrapped with raw_data, unwrap it. 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 2a8ebd1f5a..f0d51a692f 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 @@ -1,6 +1,6 @@ # # Author:: John Keiser (<jkeiser@chef.io>) -# Copyright:: Copyright 2012-2016, Chef Software Inc. +# Copyright:: Copyright 2012-2019, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -77,11 +77,12 @@ class Chef object["policies"].each do |policy_name, policy_data| policy_path = "/policies/#{policy_name}/revisions/#{policy_data["revision_id"]}" - get_data = begin - rest.get(policy_path) - rescue Net::HTTPClientException => e - raise "Could not find policy '#{policy_name}'' with revision '#{policy_data["revision_id"]}'' on the server" - end + get_data = + begin + rest.get(policy_path) + rescue Net::HTTPClientException => e + raise "Could not find policy '#{policy_name}'' with revision '#{policy_data["revision_id"]}'' on the server" + end # GET policy data server_policy_data = Chef::JSONCompat.parse(get_data) 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 b7c96c42e1..ae4422b82e 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 @@ -25,7 +25,7 @@ class Chef class VersionedCookbookDir < CookbookDir # See Erchef code # https://github.com/chef/chef_objects/blob/968a63344d38fd507f6ace05f73d53e9cd7fb043/src/chef_regex.erl#L94 - VALID_VERSIONED_COOKBOOK_NAME = /^([.a-zA-Z0-9_-]+)-(\d+\.\d+\.\d+)$/ + VALID_VERSIONED_COOKBOOK_NAME = /^([.a-zA-Z0-9_-]+)-(\d+\.\d+\.\d+)$/.freeze def initialize(name, parent, options = {}) super(name, parent) diff --git a/lib/chef/cookbook/chefignore.rb b/lib/chef/cookbook/chefignore.rb index 00dc7c0939..27f0bcaadb 100644 --- a/lib/chef/cookbook/chefignore.rb +++ b/lib/chef/cookbook/chefignore.rb @@ -20,7 +20,7 @@ class Chef class Cookbook class Chefignore - COMMENTS_AND_WHITESPACE = /^\s*(?:#.*)?$/ + COMMENTS_AND_WHITESPACE = /^\s*(?:#.*)?$/.freeze attr_reader :ignores diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index b4d6ab6936..a14518e2fb 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -467,24 +467,24 @@ class Chef def to_h { - NAME => name, - DESCRIPTION => description, - LONG_DESCRIPTION => long_description, - MAINTAINER => maintainer, - MAINTAINER_EMAIL => maintainer_email, - LICENSE => license, - PLATFORMS => platforms, - DEPENDENCIES => dependencies, - PROVIDING => providing, - ATTRIBUTES => attributes, - RECIPES => recipes, - VERSION => version, - SOURCE_URL => source_url, - ISSUES_URL => issues_url, - PRIVACY => privacy, - CHEF_VERSIONS => gem_requirements_to_array(*chef_versions), - OHAI_VERSIONS => gem_requirements_to_array(*ohai_versions), - GEMS => gems, + NAME => name, + DESCRIPTION => description, + LONG_DESCRIPTION => long_description, + MAINTAINER => maintainer, + MAINTAINER_EMAIL => maintainer_email, + LICENSE => license, + PLATFORMS => platforms, + DEPENDENCIES => dependencies, + PROVIDING => providing, + ATTRIBUTES => attributes, + RECIPES => recipes, + VERSION => version, + SOURCE_URL => source_url, + ISSUES_URL => issues_url, + PRIVACY => privacy, + CHEF_VERSIONS => gem_requirements_to_array(*chef_versions), + OHAI_VERSIONS => gem_requirements_to_array(*ohai_versions), + GEMS => gems, } end @@ -659,7 +659,7 @@ class Chef Called by: #{caller_name} '#{dep_name}', #{version_constraints.map { |vc| vc.inspect }.join(", ")} Called from: #{caller[0...5].map { |line| " " + line }.join("\n")} -OBSOLETED + OBSOLETED raise Exceptions::ObsoleteDependencySyntax, msg end end @@ -678,7 +678,7 @@ OBSOLETED Called by: #{caller_name} '#{dep_name}', '#{constraint_str}' Called from: #{caller[0...5].map { |line| " " + line }.join("\n")} -INVALID + INVALID raise Exceptions::InvalidVersionConstraint, msg end diff --git a/lib/chef/data_bag.rb b/lib/chef/data_bag.rb index 35b014905f..2533eb2f4a 100644 --- a/lib/chef/data_bag.rb +++ b/lib/chef/data_bag.rb @@ -32,8 +32,8 @@ class Chef include Chef::Mixin::FromFile include Chef::Mixin::ParamsValidate - VALID_NAME = /^[\.\-[:alnum:]_]+$/ - RESERVED_NAMES = /^(node|role|environment|client)$/ + VALID_NAME = /^[\.\-[:alnum:]_]+$/.freeze + RESERVED_NAMES = /^(node|role|environment|client)$/.freeze def self.validate_name!(name) unless name =~ VALID_NAME @@ -60,9 +60,9 @@ class Chef def to_h result = { - "name" => @name, + "name" => @name, "json_class" => self.class.name, - "chef_type" => "data_bag", + "chef_type" => "data_bag", } result end diff --git a/lib/chef/data_bag_item.rb b/lib/chef/data_bag_item.rb index 9804c271c4..2a02ada605 100644 --- a/lib/chef/data_bag_item.rb +++ b/lib/chef/data_bag_item.rb @@ -36,7 +36,7 @@ class Chef include Chef::Mixin::FromFile include Chef::Mixin::ParamsValidate - VALID_ID = /^[\.\-[:alnum:]_]+$/ + VALID_ID = /^[\.\-[:alnum:]_]+$/.freeze def self.validate_id!(id_str) if id_str.nil? || ( id_str !~ VALID_ID ) @@ -113,11 +113,11 @@ class Chef # Serialize this object as a hash def to_json(*a) result = { - "name" => object_name, + "name" => object_name, "json_class" => self.class.name, - "chef_type" => "data_bag_item", - "data_bag" => data_bag, - "raw_data" => raw_data, + "chef_type" => "data_bag_item", + "data_bag" => data_bag, + "raw_data" => raw_data, } Chef::JSONCompat.to_json(result, *a) end diff --git a/lib/chef/data_collector/messages.rb b/lib/chef/data_collector/messages.rb index b4e30e8b5a..c375475c72 100644 --- a/lib/chef/data_collector/messages.rb +++ b/lib/chef/data_collector/messages.rb @@ -36,16 +36,16 @@ class Chef # def self.run_start_message(run_status) { - "chef_server_fqdn" => chef_server_fqdn, - "entity_uuid" => node_uuid, - "id" => run_status.run_id, - "message_version" => "1.0.0", - "message_type" => "run_start", - "node_name" => run_status.node.name, + "chef_server_fqdn" => chef_server_fqdn, + "entity_uuid" => node_uuid, + "id" => run_status.run_id, + "message_version" => "1.0.0", + "message_type" => "run_start", + "node_name" => run_status.node.name, "organization_name" => organization, - "run_id" => run_status.run_id, - "source" => collector_source, - "start_time" => run_status.start_time.utc.iso8601, + "run_id" => run_status.run_id, + "source" => collector_source, + "start_time" => run_status.start_time.utc.iso8601, } end @@ -61,34 +61,34 @@ class Chef run_status = reporter_data[:run_status] message = { - "chef_server_fqdn" => chef_server_fqdn, - "entity_uuid" => node_uuid, - "expanded_run_list" => reporter_data[:expanded_run_list], - "id" => run_status.run_id, - "message_version" => "1.1.0", - "message_type" => "run_converge", - "node" => run_status.node, - "node_name" => run_status.node.name, - "organization_name" => organization, - "resources" => reporter_data[:resources].map(&:report_data), - "run_id" => run_status.run_id, - "run_list" => run_status.node.run_list.for_json, - "policy_name" => run_status.node.policy_name, - "policy_group" => run_status.node.policy_group, - "start_time" => run_status.start_time.utc.iso8601, - "end_time" => run_status.end_time.utc.iso8601, - "source" => collector_source, - "status" => reporter_data[:status], - "total_resource_count" => reporter_data[:resources].count, + "chef_server_fqdn" => chef_server_fqdn, + "entity_uuid" => node_uuid, + "expanded_run_list" => reporter_data[:expanded_run_list], + "id" => run_status.run_id, + "message_version" => "1.1.0", + "message_type" => "run_converge", + "node" => run_status.node, + "node_name" => run_status.node.name, + "organization_name" => organization, + "resources" => reporter_data[:resources].map(&:report_data), + "run_id" => run_status.run_id, + "run_list" => run_status.node.run_list.for_json, + "policy_name" => run_status.node.policy_name, + "policy_group" => run_status.node.policy_group, + "start_time" => run_status.start_time.utc.iso8601, + "end_time" => run_status.end_time.utc.iso8601, + "source" => collector_source, + "status" => reporter_data[:status], + "total_resource_count" => reporter_data[:resources].count, "updated_resource_count" => reporter_data[:resources].select { |r| r.report_data["status"] == "updated" }.count, - "deprecations" => reporter_data[:deprecations], + "deprecations" => reporter_data[:deprecations], } if run_status.exception message["error"] = { - "class" => run_status.exception.class, - "message" => run_status.exception.message, - "backtrace" => run_status.exception.backtrace, + "class" => run_status.exception.class, + "message" => run_status.exception.message, + "backtrace" => run_status.exception.backtrace, "description" => reporter_data[:error_descriptions], } end diff --git a/lib/chef/data_collector/resource_report.rb b/lib/chef/data_collector/resource_report.rb index 6d63595cc2..9a99747f7f 100644 --- a/lib/chef/data_collector/resource_report.rb +++ b/lib/chef/data_collector/resource_report.rb @@ -67,16 +67,16 @@ class Chef def to_h hash = { - "type" => new_resource.resource_name.to_sym, - "name" => new_resource.name.to_s, - "id" => resource_identity, - "after" => new_resource_state_reporter, - "before" => current_resource_state_reporter, - "duration" => elapsed_time_in_milliseconds.to_s, - "delta" => new_resource.respond_to?(:diff) && potentially_changed? ? new_resource.diff : "", + "type" => new_resource.resource_name.to_sym, + "name" => new_resource.name.to_s, + "id" => resource_identity, + "after" => new_resource_state_reporter, + "before" => current_resource_state_reporter, + "duration" => elapsed_time_in_milliseconds.to_s, + "delta" => new_resource.respond_to?(:diff) && potentially_changed? ? new_resource.diff : "", "ignore_failure" => new_resource.ignore_failure, - "result" => action.to_s, - "status" => status, + "result" => action.to_s, + "status" => status, } if new_resource.cookbook_name diff --git a/lib/chef/dsl/resources.rb b/lib/chef/dsl/resources.rb index 9010edc5f7..4e404b44ed 100644 --- a/lib/chef/dsl/resources.rb +++ b/lib/chef/dsl/resources.rb @@ -35,7 +35,7 @@ class Chef def #{dsl_name}(args = nil, &block) declare_resource(#{dsl_name.inspect}, args, created_at: caller[0], &block) end - EOM + EOM end def self.remove_resource_dsl(dsl_name) diff --git a/lib/chef/encrypted_data_bag_item/decryptor.rb b/lib/chef/encrypted_data_bag_item/decryptor.rb index f35611d185..59911c7ca7 100644 --- a/lib/chef/encrypted_data_bag_item/decryptor.rb +++ b/lib/chef/encrypted_data_bag_item/decryptor.rb @@ -1,6 +1,6 @@ # # Author:: Seth Falcon (<seth@chef.io>) -# Copyright:: Copyright 2010-2016, Chef Software Inc. +# Copyright:: Copyright 2010-2019, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -88,13 +88,14 @@ class Chef::EncryptedDataBagItem end def decrypted_data - @decrypted_data ||= begin - plaintext = openssl_decryptor.update(encrypted_bytes) - plaintext << openssl_decryptor.final - rescue OpenSSL::Cipher::CipherError => e - # if the key length is less than 255 characters, and it contains slashes, we think it may be a path. - raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{(@key.length < 255 && @key.include?('/')) ? 'You may need to use --secret-file rather than --secret.' : ''}" - end + @decrypted_data ||= + begin + plaintext = openssl_decryptor.update(encrypted_bytes) + plaintext << openssl_decryptor.final + rescue OpenSSL::Cipher::CipherError => e + # if the key length is less than 255 characters, and it contains slashes, we think it may be a path. + raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{(@key.length < 255 && @key.include?('/')) ? 'You may need to use --secret-file rather than --secret.' : ''}" + end end def encrypted_bytes @@ -102,12 +103,13 @@ class Chef::EncryptedDataBagItem end def openssl_decryptor - @openssl_decryptor ||= begin - d = OpenSSL::Cipher.new(algorithm) - d.decrypt - d.pkcs5_keyivgen(key) - d - end + @openssl_decryptor ||= + begin + d = OpenSSL::Cipher.new(algorithm) + d.decrypt + d.pkcs5_keyivgen(key) + d + end end end @@ -139,25 +141,27 @@ class Chef::EncryptedDataBagItem end def decrypted_data - @decrypted_data ||= begin - plaintext = openssl_decryptor.update(encrypted_bytes) - plaintext << openssl_decryptor.final - rescue OpenSSL::Cipher::CipherError => e - # if the key length is less than 255 characters, and it contains slashes, we think it may be a path. - raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{( @key.length < 255 && @key.include?('/')) ? 'You may need to use --secret-file rather than --secret.' : ''}" - end + @decrypted_data ||= + begin + plaintext = openssl_decryptor.update(encrypted_bytes) + plaintext << openssl_decryptor.final + rescue OpenSSL::Cipher::CipherError => e + # if the key length is less than 255 characters, and it contains slashes, we think it may be a path. + raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{( @key.length < 255 && @key.include?('/')) ? 'You may need to use --secret-file rather than --secret.' : ''}" + end end def openssl_decryptor - @openssl_decryptor ||= begin - assert_valid_cipher!(@encrypted_data["cipher"], algorithm) - d = OpenSSL::Cipher.new(algorithm) - d.decrypt - # We must set key before iv: https://bugs.ruby-lang.org/issues/8221 - d.key = OpenSSL::Digest::SHA256.digest(key) - d.iv = iv - d - end + @openssl_decryptor ||= + begin + assert_valid_cipher!(@encrypted_data["cipher"], algorithm) + d = OpenSSL::Cipher.new(algorithm) + d.decrypt + # We must set key before iv: https://bugs.ruby-lang.org/issues/8221 + d.key = OpenSSL::Digest::SHA256.digest(key) + d.iv = iv + d + end end end @@ -213,12 +217,13 @@ class Chef::EncryptedDataBagItem end def openssl_decryptor - @openssl_decryptor ||= begin - d = super - d.auth_tag = auth_tag - d.auth_data = "" - d - end + @openssl_decryptor ||= + begin + d = super + d.auth_tag = auth_tag + d.auth_data = "" + d + end end end diff --git a/lib/chef/environment.rb b/lib/chef/environment.rb index 1ca035e594..ec3361adfb 100644 --- a/lib/chef/environment.rb +++ b/lib/chef/environment.rb @@ -34,7 +34,7 @@ class Chef include Chef::Mixin::ParamsValidate include Chef::Mixin::FromFile - COMBINED_COOKBOOK_CONSTRAINT = /(.+)(?:[\s]+)((?:#{Chef::VersionConstraint::OPS.join('|')})(?:[\s]+).+)$/ + COMBINED_COOKBOOK_CONSTRAINT = /(.+)(?:[\s]+)((?:#{Chef::VersionConstraint::OPS.join('|')})(?:[\s]+).+)$/.freeze def initialize(chef_server_rest: nil) @name = "" diff --git a/lib/chef/formatters/error_inspectors/api_error_formatting.rb b/lib/chef/formatters/error_inspectors/api_error_formatting.rb index a4a97ebb95..4ecdec7105 100644 --- a/lib/chef/formatters/error_inspectors/api_error_formatting.rb +++ b/lib/chef/formatters/error_inspectors/api_error_formatting.rb @@ -30,10 +30,10 @@ class Chef #{exception.message} Your chef_server_url may be misconfigured, or the network could be down. -E + E error_description.section("Relevant Config Settings:", <<~E) chef_server_url "#{server_url}" -E + E end def describe_eof_error(error_description) @@ -78,11 +78,11 @@ E Failed to authenticate to the chef server (http 401). The request failed because your clock has drifted by more than 15 minutes. Syncing your clock to an NTP Time source should resolve the issue. -E + E else error_description.section("Authentication Error:", <<~E) Failed to authenticate to the chef server (http 401). -E + E error_description.section("Server Response:", format_rest_error) error_description.section("Relevant Config Settings:", <<~E) @@ -92,14 +92,14 @@ E If these settings are correct, your client_key may be invalid, or you may have a chef user with the same client name as this node. -E + E end end def describe_400_error(error_description) error_description.section("Invalid Request Data:", <<~E) The data in your request was invalid (HTTP 400). -E + E error_description.section("Server Response:", format_rest_error) end @@ -115,7 +115,7 @@ E The server supports a min API version of #{min_server_version} and a max API version of #{max_server_version}. Chef just made a request with an API version of #{client_api_version}. Please either update your Chef client or server to be a compatible set. -E + E else describe_http_error(error_description) end @@ -124,7 +124,7 @@ E def describe_500_error(error_description) error_description.section("Unknown Server Error:", <<~E) The server had a fatal error attempting to load the node data. -E + E error_description.section("Server Response:", format_rest_error) 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 e87ef0da70..6801884aac 100644 --- a/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb @@ -62,7 +62,7 @@ class Chef To access its cookbooks, a client needs to be able to read its environment and all of the cookbooks in its expanded run list. -E + E error_description.section("Expanded Run List:", expanded_run_list_ul) error_description.section("Server Response:", format_rest_error) when Net::HTTPPreconditionFailed @@ -120,7 +120,7 @@ E 1-) Removing cookbook versions that depend on deleted cookbooks. 2-) Removing unused cookbook versions. 3-) Pinning exact cookbook versions using environments. -EOM + EOM error_description.section("Cookbook dependency resolution error:", explanation) end 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 7b2ccf0d9a..9617f729c1 100644 --- a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb @@ -46,10 +46,10 @@ class Chef error_description.section("Private Key Not Found:", <<~E) Your private key could not be loaded. If the key file exists, ensure that it is readable by chef-client. -E + E error_description.section("Relevant Config Settings:", <<~E) client_key "#{api_key}" -E + E when EOFError describe_eof_error(error_description) when *NETWORK_ERROR_CLASSES @@ -71,12 +71,12 @@ E # * could be no read on the node error_description.section("Authorization Error", <<~E) Your client is not authorized to load the node data (HTTP 403). -E + E error_description.section("Server Response:", format_rest_error) error_description.section("Possible Causes:", <<~E) * Your client (#{username}) may have misconfigured authorization permissions. -E + E when Net::HTTPBadRequest describe_400_error(error_description) when Net::HTTPNotFound @@ -99,10 +99,10 @@ E def describe_404_error(error_description) error_description.section("Resource Not Found:", <<~E) The server returned a HTTP 404. This usually indicates that your chef_server_url is incorrect. -E + E error_description.section("Relevant Config Settings:", <<~E) chef_server_url "#{server_url}" -E + E end def username diff --git a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb index 4ca08ca120..002870abeb 100644 --- a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb @@ -29,24 +29,24 @@ class Chef error_description.section("Network Error:", <<~E) There was a network error connecting to the Chef Server: #{exception.message} -E + E error_description.section("Relevant Config Settings:", <<~E) chef_server_url "#{server_url}" If your chef_server_url is correct, your network could be down. -E + E when Chef::Exceptions::PrivateKeyMissing error_description.section("Private Key Not Found:", <<~E) Your private key could not be loaded. If the key file exists, ensure that it is readable by chef-client. -E + E error_description.section("Relevant Config Settings:", <<~E) validation_key "#{api_key}" -E + E when Chef::Exceptions::InvalidRedirect error_description.section("Invalid Redirect:", <<~E) Change your server location in client.rb to the server's FQDN to avoid unwanted redirections. -E + E when EOFError describe_eof_error(error_description) else @@ -63,11 +63,11 @@ E Failed to authenticate to the chef server (http 401). The request failed because your clock has drifted by more than 15 minutes. Syncing your clock to an NTP Time source should resolve the issue. -E + E else error_description.section("Authentication Error:", <<~E) Failed to authenticate to the chef server (http 401). -E + E error_description.section("Server Response:", format_rest_error) error_description.section("Relevant Config Settings:", <<~E) @@ -76,34 +76,34 @@ E validation_key "#{api_key}" If these settings are correct, your validation_key may be invalid. -E + E end when Net::HTTPForbidden error_description.section("Authorization Error:", <<~E) Your validation client is not authorized to create the client for this node (HTTP 403). -E + E error_description.section("Possible Causes:", <<~E) * There may already be a client named "#{config[:node_name]}" * Your validation client (#{username}) may have misconfigured authorization permissions. -E + E when Net::HTTPBadRequest error_description.section("Invalid Request Data:", <<~E) The data in your request was invalid (HTTP 400). -E + E error_description.section("Server Response:", format_rest_error) when Net::HTTPNotFound error_description.section("Resource Not Found:", <<~E) The server returned a HTTP 404. This usually indicates that your chef_server_url is incorrect. -E + E error_description.section("Relevant Config Settings:", <<~E) chef_server_url "#{server_url}" -E + E when Net::HTTPNotAcceptable describe_406_error(error_description, response) when Net::HTTPInternalServerError error_description.section("Unknown Server Error:", <<~E) The server had a fatal error attempting to load the node data. -E + E error_description.section("Server Response:", format_rest_error) when Net::HTTPBadGateway, Net::HTTPServiceUnavailable error_description.section("Server Unavailable", "The Chef Server is temporarily unavailable") 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 ac7304df13..3efb1d4d45 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 @@ -40,7 +40,7 @@ class Chef #{exception.message} Your chef_server_url may be misconfigured, or the network could be down. -E + E when Net::HTTPClientException, Net::HTTPFatalError humanize_http_exception(error_description) when Chef::Exceptions::MissingRole @@ -78,7 +78,7 @@ E when Net::HTTPUnauthorized error_description.section("Authentication Error:", <<~E) Failed to authenticate to the chef server (http 401). -E + E error_description.section("Server Response:", format_rest_error) error_description.section("Relevant Config Settings:", <<~E) @@ -87,25 +87,25 @@ E client_key "#{api_key}" If these settings are correct, your client_key may be invalid. -E + E when Net::HTTPForbidden # TODO: we're rescuing errors from Node.find_or_create # * could be no write on nodes container # * could be no read on the node error_description.section("Authorization Error", <<~E) Your client is not authorized to load one or more of your roles (HTTP 403). -E + E error_description.section("Server Response:", format_rest_error) error_description.section("Possible Causes:", <<~E) * Your client (#{username}) may have misconfigured authorization permissions. -E + E when Net::HTTPNotAcceptable describe_406_error(error_description, response) when Net::HTTPInternalServerError error_description.section("Unknown Server Error:", <<~E) The server had a fatal error attempting to load a role. -E + E error_description.section("Server Response:", format_rest_error) when Net::HTTPBadGateway, Net::HTTPServiceUnavailable error_description.section("Server Unavailable", "The Chef Server is temporarily unavailable") diff --git a/lib/chef/http/socketless_chef_zero_client.rb b/lib/chef/http/socketless_chef_zero_client.rb index 6484a6d540..e3823481d4 100644 --- a/lib/chef/http/socketless_chef_zero_client.rb +++ b/lib/chef/http/socketless_chef_zero_client.rb @@ -163,16 +163,16 @@ class Chef def req_to_rack(method, url, body, headers) body_str = body || "" { - "SCRIPT_NAME" => "", - "SERVER_NAME" => "localhost", - "REQUEST_METHOD" => method.to_s.upcase, - "PATH_INFO" => url.path, - "QUERY_STRING" => url.query, - "SERVER_PORT" => url.port, - "HTTP_HOST" => "localhost:#{url.port}", + "SCRIPT_NAME" => "", + "SERVER_NAME" => "localhost", + "REQUEST_METHOD" => method.to_s.upcase, + "PATH_INFO" => url.path, + "QUERY_STRING" => url.query, + "SERVER_PORT" => url.port, + "HTTP_HOST" => "localhost:#{url.port}", "HTTP_X_OPS_SERVER_API_VERSION" => headers["X-Ops-Server-API-Version"], "rack.url_scheme" => "chefzero", - "rack.input" => StringIO.new(body_str), + "rack.input" => StringIO.new(body_str), } end diff --git a/lib/chef/knife/configure.rb b/lib/chef/knife/configure.rb index 18cec044a6..e24958e1fc 100644 --- a/lib/chef/knife/configure.rb +++ b/lib/chef/knife/configure.rb @@ -80,7 +80,7 @@ class Chef client_name = '#{new_client_name}' client_key = '#{new_client_key}' chef_server_url = '#{chef_server}' -EOH + EOH end if config[:initial] diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb index 02bea271b2..57a63c7b47 100644 --- a/lib/chef/knife/cookbook_upload.rb +++ b/lib/chef/knife/cookbook_upload.rb @@ -26,7 +26,7 @@ class Chef class CookbookUpload < Knife CHECKSUM = "checksum".freeze - MATCH_CHECKSUM = /[0-9a-f]{32,}/ + MATCH_CHECKSUM = /[0-9a-f]{32,}/.freeze deps do require "chef/exceptions" diff --git a/lib/chef/knife/core/cookbook_scm_repo.rb b/lib/chef/knife/core/cookbook_scm_repo.rb index f583f0bd8e..ba3a40207a 100644 --- a/lib/chef/knife/core/cookbook_scm_repo.rb +++ b/lib/chef/knife/core/cookbook_scm_repo.rb @@ -22,7 +22,7 @@ class Chef class Knife class CookbookSCMRepo - DIRTY_REPO = /^[\s]+M/ + DIRTY_REPO = /^[\s]+M/.freeze include Chef::Mixin::ShellOut diff --git a/lib/chef/knife/core/gem_glob_loader.rb b/lib/chef/knife/core/gem_glob_loader.rb index c4523d69ad..987aef754f 100644 --- a/lib/chef/knife/core/gem_glob_loader.rb +++ b/lib/chef/knife/core/gem_glob_loader.rb @@ -22,8 +22,8 @@ class Chef class Knife class SubcommandLoader class GemGlobLoader < Chef::Knife::SubcommandLoader - MATCHES_CHEF_GEM = %r{/chef-[\d]+\.[\d]+\.[\d]+} - MATCHES_THIS_CHEF_GEM = %r{/chef-#{Chef::VERSION}(-\w+)?(-\w+)?/} + MATCHES_CHEF_GEM = %r{/chef-[\d]+\.[\d]+\.[\d]+}.freeze + MATCHES_THIS_CHEF_GEM = %r{/chef-#{Chef::VERSION}(-\w+)?(-\w+)?/}.freeze def subcommand_files @subcommand_files ||= (gem_and_builtin_subcommands.values + site_subcommands).flatten.uniq diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb index 7cb0e4d6fe..5072cc4ae2 100644 --- a/lib/chef/knife/core/node_presenter.rb +++ b/lib/chef/knife/core/node_presenter.rb @@ -100,38 +100,38 @@ class Chef summarized = <<~SUMMARY #{ui.color('Node Name:', :bold)} #{ui.color(node.name, :bold)} -SUMMARY + SUMMARY show_policy = !(node.policy_name.nil? && node.policy_group.nil?) if show_policy summarized << <<~POLICY #{key('Policy Name:')} #{node.policy_name} #{key('Policy Group:')} #{node.policy_group} -POLICY + POLICY else summarized << <<~ENV #{key('Environment:')} #{node.chef_environment} -ENV + ENV end summarized << <<~SUMMARY #{key('FQDN:')} #{node[:fqdn]} #{key('IP:')} #{ip} #{key('Run List:')} #{node.run_list} -SUMMARY + SUMMARY unless show_policy summarized << <<~ROLES #{key('Roles:')} #{Array(node[:roles]).join(', ')} -ROLES + ROLES end summarized << <<~SUMMARY #{key('Recipes:')} #{Array(node[:recipes]).join(', ')} #{key('Platform:')} #{node[:platform]} #{node[:platform_version]} #{key('Tags:')} #{node.tags.join(', ')} -SUMMARY + SUMMARY if config[:medium_output] || config[:long_output] summarized += <<~MORE #{key('Attributes:')} #{text_format(node.normal_attrs)} -MORE + MORE end if config[:long_output] summarized += <<~MOST @@ -141,7 +141,7 @@ MORE #{text_format(node.override_attrs)} #{key('Automatic Attributes (Ohai Data):')} #{text_format(node.automatic_attrs)} -MOST + MOST end summarized else diff --git a/lib/chef/knife/key_create.rb b/lib/chef/knife/key_create.rb index 395bbc4bfd..f278af8b77 100644 --- a/lib/chef/knife/key_create.rb +++ b/lib/chef/knife/key_create.rb @@ -44,7 +44,7 @@ class Chef You must pass either --public-key or --key-name, or both. If you only pass --public-key, a key name will be generated from the fingerprint of your key. If you only pass --key-name, a key pair will be generated by the server. -EOS + EOS end def edit_data(key) diff --git a/lib/chef/knife/key_edit.rb b/lib/chef/knife/key_edit.rb index d05ee11d1c..4e36bdfded 100644 --- a/lib/chef/knife/key_edit.rb +++ b/lib/chef/knife/key_edit.rb @@ -46,7 +46,7 @@ class Chef Do not pass either if you do not want to change the public_key field of your key. Pass --public-key if you want to update the public_key field of your key from a specific public key. Pass --create-key if you want the server to generate a new key and use that to update the public_key field of your key. -EOS + EOS end def edit_data(key) diff --git a/lib/chef/knife/key_list.rb b/lib/chef/knife/key_list.rb index 9d3a2c0c26..3078ca44d3 100644 --- a/lib/chef/knife/key_list.rb +++ b/lib/chef/knife/key_list.rb @@ -43,7 +43,7 @@ class Chef <<~EOS You cannot pass both --only-expired and --only-non-expired. Please pass one or none. -EOS + EOS end def display_info(string) diff --git a/lib/chef/knife/ssl_check.rb b/lib/chef/knife/ssl_check.rb index 858ab3cf89..6508c5f02d 100644 --- a/lib/chef/knife/ssl_check.rb +++ b/lib/chef/knife/ssl_check.rb @@ -171,7 +171,7 @@ class Chef using SSH/SCP or some other secure method, then re-run this command to confirm that the server's certificate is now trusted. -BAD_CERTS + BAD_CERTS # @TODO: ^ needs URL once documentation is posted. end @@ -200,7 +200,7 @@ BAD_CERTS using SSH/SCP or some other secure method, then re-run this command to confirm that the server's certificate is now trusted. -ADVICE + ADVICE end def debug_invalid_host @@ -222,7 +222,7 @@ ADVICE If you are not able to connect to the server using the hostname #{cn} you will have to update the certificate on the server to use the correct hostname. -ADVICE + ADVICE end def debug_ssl_settings diff --git a/lib/chef/knife/ssl_fetch.rb b/lib/chef/knife/ssl_fetch.rb index 88eb95e97d..9e1579a5f8 100644 --- a/lib/chef/knife/ssl_fetch.rb +++ b/lib/chef/knife/ssl_fetch.rb @@ -137,7 +137,7 @@ class Chef Knife has no means to verify these are the correct certificates. You should verify the authenticity of these certificates after downloading. -TRUST_TRUST + TRUST_TRUST remote_cert_chain.each do |cert| write_cert(cert) end diff --git a/lib/chef/mixin/api_version_request_handling.rb b/lib/chef/mixin/api_version_request_handling.rb index a706e10618..a4e657ac9e 100644 --- a/lib/chef/mixin/api_version_request_handling.rb +++ b/lib/chef/mixin/api_version_request_handling.rb @@ -56,7 +56,7 @@ class Chef User keys are now managed via the key rotation commmands. Please refer to the documentation on how to manage your keys via the key rotation commands: https://docs.chef.io/server_security.html#key-rotation -EOH + EOH end end diff --git a/lib/chef/mixin/xml_escape.rb b/lib/chef/mixin/xml_escape.rb index 7011ff4f56..b591b09db0 100644 --- a/lib/chef/mixin/xml_escape.rb +++ b/lib/chef/mixin/xml_escape.rb @@ -73,8 +73,8 @@ class Chef 137 => 8240, # per mille sign 138 => 352, # latin capital letter s with caron 139 => 8249, # single left-pointing angle quotation mark - 140 => 338, # latin capital ligature oe - 142 => 381, # latin capital letter z with caron + 140 => 338, # latin capital ligature oe + 142 => 381, # latin capital letter z with caron 145 => 8216, # left single quotation mark 146 => 8217, # right single quotation mark 147 => 8220, # left double quotation mark @@ -86,16 +86,16 @@ class Chef 153 => 8482, # trade mark sign 154 => 353, # latin small letter s with caron 155 => 8250, # single right-pointing angle quotation mark - 156 => 339, # latin small ligature oe - 158 => 382, # latin small letter z with caron - 159 => 376 # latin capital letter y with diaeresis + 156 => 339, # latin small ligature oe + 158 => 382, # latin small letter z with caron + 159 => 376, # latin capital letter y with diaeresis }.freeze # http://www.w3.org/TR/REC-xml/#dt-chardata PREDEFINED = { 38 => "&", # ampersand 60 => "<", # left angle bracket - 62 => ">" # right angle bracket + 62 => ">", # right angle bracket }.freeze # http://www.w3.org/TR/REC-xml/#charsets diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb index ac60b590b6..50a763f686 100644 --- a/lib/chef/node_map.rb +++ b/lib/chef/node_map.rb @@ -40,12 +40,12 @@ class Chef COLLISION_WARNING_14 = <<~EOH.gsub(/\s+/, " ").strip %{type_caps} %{key} from a cookbook is overriding the %{type} from the client. Please upgrade your cookbook or remove the cookbook from your run_list before the next major release of Chef. -EOH + EOH COLLISION_WARNING_15 = <<~EOH.gsub(/\s+/, " ").strip %{type_caps} %{key} from the client is overriding the %{type} from a cookbook. Please upgrade your cookbook or remove the cookbook from your run_list. -EOH + EOH # # Set a key/value pair on the map with a filter. The filter must be true diff --git a/lib/chef/provider/cron.rb b/lib/chef/provider/cron.rb index f25a58a789..79245df475 100644 --- a/lib/chef/provider/cron.rb +++ b/lib/chef/provider/cron.rb @@ -29,9 +29,9 @@ class Chef CRON_ATTRIBUTES = [:minute, :hour, :day, :month, :weekday, :time, :command, :mailto, :path, :shell, :home, :environment].freeze WEEKDAY_SYMBOLS = [:sunday, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday].freeze - CRON_PATTERN = /\A([-0-9*,\/]+)\s([-0-9*,\/]+)\s([-0-9*,\/]+)\s([-0-9*,\/]+|[a-zA-Z]{3})\s([-0-9*,\/]+|[a-zA-Z]{3})\s(.*)/ - SPECIAL_PATTERN = /\A(@(#{SPECIAL_TIME_VALUES.join('|')}))\s(.*)/ - ENV_PATTERN = /\A(\S+)=(\S*)/ + CRON_PATTERN = /\A([-0-9*,\/]+)\s([-0-9*,\/]+)\s([-0-9*,\/]+)\s([-0-9*,\/]+|[a-zA-Z]{3})\s([-0-9*,\/]+|[a-zA-Z]{3})\s(.*)/.freeze + SPECIAL_PATTERN = /\A(@(#{SPECIAL_TIME_VALUES.join('|')}))\s(.*)/.freeze + ENV_PATTERN = /\A(\S+)=(\S*)/.freeze def initialize(new_resource, run_context) super(new_resource, run_context) diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb index 5845f869d8..4d27e1a52e 100644 --- a/lib/chef/provider/git.rb +++ b/lib/chef/provider/git.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo (<dan@kallistec.com>) -# Copyright:: Copyright 2008-2017, Chef Software Inc. +# Copyright:: Copyright 2008-2019, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -234,13 +234,14 @@ class Chef end def target_revision - @target_revision ||= begin - if sha_hash?(new_resource.revision) - @target_revision = new_resource.revision - else - @target_revision = remote_resolve_reference + @target_revision ||= + begin + if sha_hash?(new_resource.revision) + @target_revision = new_resource.revision + else + @target_revision = remote_resolve_reference + end end - end end alias :revision_slug :target_revision @@ -311,17 +312,18 @@ 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" - case new_resource.user - when Integer - Etc.getpwuid(new_resource.user).dir - else - Etc.getpwnam(new_resource.user.to_s).dir + env["HOME"] = + begin + require "etc" + case new_resource.user + when Integer + Etc.getpwuid(new_resource.user).dir + else + Etc.getpwnam(new_resource.user.to_s).dir + end + 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 - 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 diff --git a/lib/chef/provider/package/apt.rb b/lib/chef/provider/package/apt.rb index de1b106d45..dfc7e602dd 100644 --- a/lib/chef/provider/package/apt.rb +++ b/lib/chef/provider/package/apt.rb @@ -237,9 +237,9 @@ class Chef end { - current_version: current_version, - candidate_version: candidate_version, - virtual: virtual, + current_version: current_version, + candidate_version: candidate_version, + virtual: virtual, } end diff --git a/lib/chef/provider/package/chocolatey.rb b/lib/chef/provider/package/chocolatey.rb index 4c35d13a07..20831ac891 100644 --- a/lib/chef/provider/package/chocolatey.rb +++ b/lib/chef/provider/package/chocolatey.rb @@ -37,7 +37,7 @@ class Chef If Chocolatey is installed, ensure that the 'ChocolateyInstall' environment variable is correctly set. You can verify this with the PowerShell command '#{PATHFINDING_POWERSHELL_COMMAND}'. -EOS + EOS # Responsible for building the current_resource. # diff --git a/lib/chef/provider/package/dnf/python_helper.rb b/lib/chef/provider/package/dnf/python_helper.rb index 56706764d0..7cb4047f53 100644 --- a/lib/chef/provider/package/dnf/python_helper.rb +++ b/lib/chef/provider/package/dnf/python_helper.rb @@ -132,9 +132,7 @@ class Chef def drain_stderr output = "" - until IO.select([stderr], nil, nil, 0).nil? - output += stderr.sysread(4096).chomp - end + output += stderr.sysread(4096).chomp until IO.select([stderr], nil, nil, 0).nil? output rescue # we must rescue EOFError, and we don't much care about errors on stderr anyway diff --git a/lib/chef/provider/package/dpkg.rb b/lib/chef/provider/package/dpkg.rb index de5b2858e7..38129c8931 100644 --- a/lib/chef/provider/package/dpkg.rb +++ b/lib/chef/provider/package/dpkg.rb @@ -23,9 +23,9 @@ class Chef class Provider class Package class Dpkg < Chef::Provider::Package - DPKG_REMOVED = /^Status: deinstall ok config-files/ - DPKG_INSTALLED = /^Status: install ok installed/ - DPKG_VERSION = /^Version: (.+)$/ + DPKG_REMOVED = /^Status: deinstall ok config-files/.freeze + DPKG_INSTALLED = /^Status: install ok installed/.freeze + DPKG_VERSION = /^Version: (.+)$/.freeze provides :dpkg_package diff --git a/lib/chef/provider/package/portage.rb b/lib/chef/provider/package/portage.rb index 11cbe99d18..d9fc801225 100644 --- a/lib/chef/provider/package/portage.rb +++ b/lib/chef/provider/package/portage.rb @@ -28,7 +28,7 @@ class Chef provides :package, platform: "gentoo" provides :portage_package - PACKAGE_NAME_PATTERN = %r{(?:([^/]+)/)?([^/]+)} + PACKAGE_NAME_PATTERN = %r{(?:([^/]+)/)?([^/]+)}.freeze def load_current_resource @current_resource = Chef::Resource::PortagePackage.new(new_resource.name) diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index cd595e64f4..dc882e426c 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -281,7 +281,7 @@ class Chef end class AlternateGemEnvironment < GemEnvironment - JRUBY_PLATFORM = /(:?universal|x86_64|x86)\-java\-[0-9\.]+/ + JRUBY_PLATFORM = /(:?universal|x86_64|x86)\-java\-[0-9\.]+/.freeze def self.gempath_cache @gempath_cache ||= {} diff --git a/lib/chef/provider/package/yum/rpm_utils.rb b/lib/chef/provider/package/yum/rpm_utils.rb index eefc0b95b2..22c0ff807b 100644 --- a/lib/chef/provider/package/yum/rpm_utils.rb +++ b/lib/chef/provider/package/yum/rpm_utils.rb @@ -133,9 +133,7 @@ class Chef while (x_pos <= x_pos_max) && (isalnum(x[x_pos]) == false) x_pos += 1 # +1 over pos_max if end of string end - while (y_pos <= y_pos_max) && (isalnum(y[y_pos]) == false) - y_pos += 1 - end + y_pos += 1 while (y_pos <= y_pos_max) && (isalnum(y[y_pos]) == false) # if we hit the end of either we are done matching segments if (x_pos == x_pos_max + 1) || (y_pos == y_pos_max + 1) @@ -154,29 +152,21 @@ class Chef x_seg_pos += 1 # gather up our digits - while (x_seg_pos <= x_pos_max) && isdigit(x[x_seg_pos]) - x_seg_pos += 1 - end + x_seg_pos += 1 while (x_seg_pos <= x_pos_max) && isdigit(x[x_seg_pos]) # copy the segment but not the unmatched character that x_seg_pos will # refer to x_comp = x[x_pos, x_seg_pos - x_pos] - while (y_seg_pos <= y_pos_max) && isdigit(y[y_seg_pos]) - y_seg_pos += 1 - end + y_seg_pos += 1 while (y_seg_pos <= y_pos_max) && isdigit(y[y_seg_pos]) y_comp = y[y_pos, y_seg_pos - y_pos] else # we are comparing strings x_seg_is_num = false - while (x_seg_pos <= x_pos_max) && isalpha(x[x_seg_pos]) - x_seg_pos += 1 - end + x_seg_pos += 1 while (x_seg_pos <= x_pos_max) && isalpha(x[x_seg_pos]) x_comp = x[x_pos, x_seg_pos - x_pos] - while (y_seg_pos <= y_pos_max) && isalpha(y[y_seg_pos]) - y_seg_pos += 1 - end + y_seg_pos += 1 while (y_seg_pos <= y_pos_max) && isalpha(y[y_seg_pos]) y_comp = y[y_pos, y_seg_pos - y_pos] end diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb index 529ae409d8..a903f83107 100644 --- a/lib/chef/provider/powershell_script.rb +++ b/lib/chef/provider/powershell_script.rb @@ -89,7 +89,7 @@ class Chef { #{new_resource.code} } -EOH + EOH user_script_file.puts user_code_wrapped_in_powershell_script_block # A .close or explicit .flush required to ensure the file is @@ -215,7 +215,7 @@ EOH # launched with -Command, it will be 0 if $exitstatus was 0, # 1 (i.e. failed) otherwise. exit $exitstatus -EOH + EOH end end diff --git a/lib/chef/provider/route.rb b/lib/chef/provider/route.rb index b8af9e55b8..e20102e2f3 100644 --- a/lib/chef/provider/route.rb +++ b/lib/chef/provider/route.rb @@ -28,39 +28,39 @@ class Chef 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" }.freeze + 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" }.freeze def hex2ip(hex_data) # Cleanup hex data diff --git a/lib/chef/provider/service/aixinit.rb b/lib/chef/provider/service/aixinit.rb index dd8514cf20..43e6b3ac1b 100644 --- a/lib/chef/provider/service/aixinit.rb +++ b/lib/chef/provider/service/aixinit.rb @@ -22,7 +22,7 @@ class Chef class Provider class Service class AixInit < Chef::Provider::Service::Init - RC_D_SCRIPT_NAME = /\/etc\/rc.d\/rc2.d\/([SK])(\d\d|)/i + RC_D_SCRIPT_NAME = /\/etc\/rc.d\/rc2.d\/([SK])(\d\d|)/i.freeze def initialize(new_resource, run_context) super diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb index 351075111b..b6a938a7e8 100644 --- a/lib/chef/provider/service/debian.rb +++ b/lib/chef/provider/service/debian.rb @@ -26,8 +26,8 @@ class Chef Chef::Platform::ServiceHelpers.service_resource_providers.include?(:debian) end - UPDATE_RC_D_ENABLED_MATCHES = /\/rc[\dS].d\/S|not installed/i - UPDATE_RC_D_PRIORITIES = /\/rc([\dS]).d\/([SK])(\d\d)/i + UPDATE_RC_D_ENABLED_MATCHES = /\/rc[\dS].d\/S|not installed/i.freeze + UPDATE_RC_D_PRIORITIES = /\/rc([\dS]).d\/([SK])(\d\d)/i.freeze def self.supports?(resource, action) Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:initd) diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb index 18ef245083..9e8ff30216 100644 --- a/lib/chef/provider/service/redhat.rb +++ b/lib/chef/provider/service/redhat.rb @@ -32,8 +32,8 @@ class Chef Chef::Platform::ServiceHelpers.service_resource_providers.include?(:redhat) end - CHKCONFIG_ON = /\d:on/ - CHKCONFIG_MISSING = /No such/ + CHKCONFIG_ON = /\d:on/.freeze + CHKCONFIG_MISSING = /No such/.freeze def self.supports?(resource, action) Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:initd) diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb index 68f97d1ff2..96ed16dc8f 100644 --- a/lib/chef/provider/service/upstart.rb +++ b/lib/chef/provider/service/upstart.rb @@ -32,7 +32,7 @@ class Chef Chef::Platform::ServiceHelpers.service_resource_providers.include?(:upstart) end - UPSTART_STATE_FORMAT = /\S+ \(?(start|stop)?\)? ?[\/ ](\w+)/ + UPSTART_STATE_FORMAT = /\S+ \(?(start|stop)?\)? ?[\/ ](\w+)/.freeze # Returns true if the configs for the service name has upstart variable def self.supports?(resource, action) diff --git a/lib/chef/provider/subversion.rb b/lib/chef/provider/subversion.rb index dec9e06f87..adea6a6428 100644 --- a/lib/chef/provider/subversion.rb +++ b/lib/chef/provider/subversion.rb @@ -29,7 +29,7 @@ class Chef provides :subversion - SVN_INFO_PATTERN = /^([\w\s]+): (.+)$/ + SVN_INFO_PATTERN = /^([\w\s]+): (.+)$/.freeze include ChefConfig::Mixin::FuzzyHostnameMatcher diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb index 1d77c6867b..c656506138 100644 --- a/lib/chef/provider/windows_task.rb +++ b/lib/chef/provider/windows_task.rb @@ -347,21 +347,21 @@ class Chef flag = true else flag = true if start_day_updated?(current_task_trigger, new_task_trigger) == true || - start_time_updated?(current_task_trigger, new_task_trigger) == true || - current_task_trigger[:trigger_type] != new_task_trigger[:trigger_type] || - current_task_trigger[:type] != new_task_trigger[:type] || - current_task_trigger[:random_minutes_interval].to_i != new_task_trigger[:random_minutes_interval].to_i || - current_task_trigger[:minutes_interval].to_i != new_task_trigger[:minutes_interval].to_i || - task.account_information.to_s.casecmp(new_resource.user.to_s) != 0 || - task.application_name != new_resource.command || - description_needs_update?(task) || - task.parameters != new_resource.command_arguments.to_s || - task.working_directory != new_resource.cwd.to_s || - task.principals[:logon_type] != logon_type || - task.principals[:run_level] != run_level || - PRIORITY[task.priority] != new_resource.priority || - task.settings[:disallow_start_if_on_batteries] != new_resource.disallow_start_if_on_batteries || - task.settings[:stop_if_going_on_batteries] != new_resource.stop_if_going_on_batteries + start_time_updated?(current_task_trigger, new_task_trigger) == true || + current_task_trigger[:trigger_type] != new_task_trigger[:trigger_type] || + current_task_trigger[:type] != new_task_trigger[:type] || + current_task_trigger[:random_minutes_interval].to_i != new_task_trigger[:random_minutes_interval].to_i || + current_task_trigger[:minutes_interval].to_i != new_task_trigger[:minutes_interval].to_i || + task.account_information.to_s.casecmp(new_resource.user.to_s) != 0 || + task.application_name != new_resource.command || + description_needs_update?(task) || + task.parameters != new_resource.command_arguments.to_s || + task.working_directory != new_resource.cwd.to_s || + task.principals[:logon_type] != logon_type || + task.principals[:run_level] != run_level || + PRIORITY[task.priority] != new_resource.priority || + task.settings[:disallow_start_if_on_batteries] != new_resource.disallow_start_if_on_batteries || + task.settings[:stop_if_going_on_batteries] != new_resource.stop_if_going_on_batteries if trigger_type == TaskScheduler::MONTHLYDATE flag = true if current_task_trigger[:run_on_last_day_of_month] != new_task_trigger[:run_on_last_day_of_month] end diff --git a/lib/chef/resource/build_essential.rb b/lib/chef/resource/build_essential.rb index d9d75fb83b..c10be4b6a1 100644 --- a/lib/chef/resource/build_essential.rb +++ b/lib/chef/resource/build_essential.rb @@ -112,7 +112,7 @@ class Chef Chef::Log.warn <<-EOH The build_essential resource does not currently support the '#{node['platform_family']}' platform family. Skipping... - EOH + EOH end end diff --git a/lib/chef/resource/windows_certificate.rb b/lib/chef/resource/windows_certificate.rb index 9a2f4bda26..2057855b2c 100644 --- a/lib/chef/resource/windows_certificate.rb +++ b/lib/chef/resource/windows_certificate.rb @@ -200,7 +200,7 @@ class Chef <<-EOH $hash = #{hash} Test-Path "Cert:\\#{cert_location}\\#{new_resource.store_name}\\$hash" - EOH + EOH end def within_store_script @@ -210,7 +210,7 @@ class Chef $store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite) #{inner_script} $store.Close() - EOH + EOH end def acl_script(hash) @@ -233,7 +233,7 @@ class Chef $userSID = $currentUser.Translate([System.Security.Principal.SecurityIdentifier]).Value $fullpath = "$Env:ProgramData\\Microsoft\\Crypto\\RSA\\$userSID\\$keyname" } - EOH + EOH new_resource.private_key_acl.each do |name| set_acl_script << "$uname='#{name}'; icacls $fullpath /grant $uname`:RX\n" end diff --git a/lib/chef/resource_collection/resource_set.rb b/lib/chef/resource_collection/resource_set.rb index 6ff29247a0..637ba48030 100644 --- a/lib/chef/resource_collection/resource_set.rb +++ b/lib/chef/resource_collection/resource_set.rb @@ -26,14 +26,14 @@ class Chef # Matches a multiple resource lookup specification, # e.g., "service[nginx,unicorn]" - MULTIPLE_RESOURCE_MATCH = /^(.+)\[(.+?),(.+)\]$/ + MULTIPLE_RESOURCE_MATCH = /^(.+)\[(.+?),(.+)\]$/.freeze # Matches a single resource lookup specification, # e.g., "service[nginx]" - SINGLE_RESOURCE_MATCH = /^(.+)\[(.*)\]$/ + SINGLE_RESOURCE_MATCH = /^(.+)\[(.*)\]$/.freeze # Matches e.g. "apt_update" with no name - NAMELESS_RESOURCE_MATCH = /^([^\[\]\s]+)$/ + NAMELESS_RESOURCE_MATCH = /^([^\[\]\s]+)$/.freeze def initialize @resources_by_key = Hash.new diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb index 657caf0f81..b940bfecbd 100644 --- a/lib/chef/run_context.rb +++ b/lib/chef/run_context.rb @@ -337,7 +337,7 @@ class Chef is not a dependency of any cookbook in the run_list. To load this recipe, first add a dependency on cookbook '#{cookbook_name}' in the cookbook you're including it from in that cookbook's metadata. -ERROR_MESSAGE + ERROR_MESSAGE end if loaded_fully_qualified_recipe?(cookbook_name, recipe_short_name) diff --git a/lib/chef/run_list/run_list_item.rb b/lib/chef/run_list/run_list_item.rb index 74b4741eba..f5aec6de5e 100644 --- a/lib/chef/run_list/run_list_item.rb +++ b/lib/chef/run_list/run_list_item.rb @@ -18,10 +18,10 @@ class Chef class RunList class RunListItem - QUALIFIED_RECIPE = %r{^recipe\[([^\]@]+)(@([0-9]+(\.[0-9]+){1,2}))?\]$} - QUALIFIED_ROLE = %r{^role\[([^\]]+)\]$} - VERSIONED_UNQUALIFIED_RECIPE = %r{^([^@]+)(@([0-9]+(\.[0-9]+){1,2}))$} - FALSE_FRIEND = %r{[\[\]]} + QUALIFIED_RECIPE = %r{^recipe\[([^\]@]+)(@([0-9]+(\.[0-9]+){1,2}))?\]$}.freeze + QUALIFIED_ROLE = %r{^role\[([^\]]+)\]$}.freeze + VERSIONED_UNQUALIFIED_RECIPE = %r{^([^@]+)(@([0-9]+(\.[0-9]+){1,2}))$}.freeze + FALSE_FRIEND = %r{[\[\]]}.freeze attr_reader :name, :type, :version diff --git a/lib/chef/shell.rb b/lib/chef/shell.rb index 6c5f70edcc..e717c3705e 100644 --- a/lib/chef/shell.rb +++ b/lib/chef/shell.rb @@ -215,7 +215,7 @@ module Shell /etc/chef/client.rb if -z option is given. /etc/chef/solo.rb if --solo-legacy-mode option is given. .chef/knife.rb if -s option is given. -FOOTER + FOOTER option :config_file, short: "-c CONFIG", diff --git a/lib/chef/version_constraint.rb b/lib/chef/version_constraint.rb index 6b57cfefe1..bce2a29887 100644 --- a/lib/chef/version_constraint.rb +++ b/lib/chef/version_constraint.rb @@ -21,7 +21,7 @@ class Chef DEFAULT_CONSTRAINT = ">= 0.0.0".freeze STANDARD_OPS = %w{< > <= >=}.freeze OPS = %w{< > = <= >= ~>}.freeze - PATTERN = /^(#{OPS.join('|')}) *([0-9].*)$/ + PATTERN = /^(#{OPS.join('|')}) *([0-9].*)$/.freeze VERSION_CLASS = Chef::Version attr_reader :op, :version diff --git a/spec/functional/resource/apt_package_spec.rb b/spec/functional/resource/apt_package_spec.rb index c1ac51c4b1..ad4378b83a 100644 --- a/spec/functional/resource/apt_package_spec.rb +++ b/spec/functional/resource/apt_package_spec.rb @@ -89,7 +89,7 @@ end metadata = { unix_only: true, requires_root: true, provider: { package: Chef::Provider::Package::Apt }, - arch: "x86_64" # test packages are 64bit + arch: "x86_64", # test packages are 64bit } describe Chef::Resource::AptPackage, metadata do diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb index 1caa07d105..04a65acae7 100644 --- a/spec/functional/resource/dsc_script_spec.rb +++ b/spec/functional/resource/dsc_script_spec.rb @@ -103,7 +103,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do ValueData = '#{test_registry_data}' Ensure = 'Present' } -EOH + EOH end let(:dsc_code) { dsc_reg_code } @@ -111,7 +111,7 @@ EOH <<-EOH param($testregkeyname, $testregvaluename) #{dsc_reg_code} -EOH + EOH end let(:dsc_user_prefix) { "dsc" } @@ -138,7 +138,7 @@ EOH $#{dsc_user_prefix_param_name}, $#{dsc_user_suffix_param_name} ) -EOH + EOH end let(:config_param_section) { "" } @@ -166,7 +166,7 @@ EOH PasswordChangeRequired = $false } } -EOH + EOH end let(:dsc_user_config_data) do @@ -180,7 +180,7 @@ EOH ) } -EOH + EOH end let(:dsc_environment_env_var_name) { "dsc_test_cwd" } @@ -199,7 +199,7 @@ EOH Value = $pwd.path Ensure = 'Present' } -EOH + EOH end let(:dsc_config_name) do @@ -249,7 +249,7 @@ EOH Name = '#{dsc_environment_env_var_name}' Ensure = 'Absent' } -EOH + EOH removal_resource.run_action(:run) end @@ -448,7 +448,7 @@ EOH } "@ $ConfigurationData | out-file '#{configuration_data_path}' -force - MYCODE + MYCODE end let(:powershell_script_resource) do @@ -467,7 +467,7 @@ EOH Password = #{r.ps_credential('jf9a8m49jrajf4#')} Ensure = "Present" } -EOF + EOF r.configuration_data_script(configuration_data_path) end end diff --git a/spec/functional/resource/execute_spec.rb b/spec/functional/resource/execute_spec.rb index 3ad8762169..3e57795f73 100644 --- a/spec/functional/resource/execute_spec.rb +++ b/spec/functional/resource/execute_spec.rb @@ -87,8 +87,8 @@ describe Chef::Resource::Execute do describe "when parent resource sets :environment" do before do resource.environment({ - "SAWS_SECRET" => "supersecret", - "SAWS_KEY" => "qwerty", + "SAWS_SECRET" => "supersecret", + "SAWS_KEY" => "qwerty", }) end diff --git a/spec/functional/resource/git_spec.rb b/spec/functional/resource/git_spec.rb index 16cde6351a..67021f6901 100644 --- a/spec/functional/resource/git_spec.rb +++ b/spec/functional/resource/git_spec.rb @@ -69,7 +69,7 @@ describe Chef::Resource::Git, requires_git: true do [user] name = frodoTbaggins email = frodo@shire.org -E + E end before(:each) do diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb index 7800cf653d..d15a7d2afa 100644 --- a/spec/integration/client/client_spec.rb +++ b/spec/integration/client/client_spec.rb @@ -57,7 +57,7 @@ describe "chef-client" do file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) end @@ -66,7 +66,7 @@ EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM begin result = shell_out("env -i #{critical_env_vars} #{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) @@ -82,7 +82,7 @@ EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM result = shell_out("#{chef_client} --no-listen -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) result.error! @@ -126,7 +126,7 @@ EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) result.error! @@ -162,7 +162,7 @@ EOM syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T +vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= -----END RSA PRIVATE KEY----- -EOM + EOM end it "should complete with success even with a client key" do @@ -170,7 +170,7 @@ EOM local_mode true client_key #{path_to('mykey.pem').inspect} cookbook_path #{path_to('cookbooks').inspect} -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default'", cwd: chef_dir) result.error! @@ -181,19 +181,19 @@ EOM local_mode true client_key #{path_to('mykey.pem').inspect} cookbook_path #{path_to('cookbooks').inspect} -EOM + EOM file "arbitrary.rb", <<~EOM file #{path_to('tempfile.txt').inspect} do content '1' end -EOM + EOM file "arbitrary2.rb", <<~EOM file #{path_to('tempfile2.txt').inspect} do content '2' end -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" #{path_to('arbitrary.rb')} #{path_to('arbitrary2.rb')}", cwd: chef_dir) result.error! @@ -207,13 +207,13 @@ EOM local_mode true client_key #{path_to('mykey.pem').inspect} cookbook_path #{path_to('cookbooks').inspect} -EOM + EOM file "arbitrary.rb", <<~EOM file #{path_to('tempfile.txt').inspect} do content '1' end -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" arbitrary.rb", cwd: path_to("")) result.error! @@ -226,18 +226,18 @@ EOM local_mode true client_key #{path_to('mykey.pem').inspect} cookbook_path #{path_to('cookbooks').inspect} -EOM + EOM file "cookbooks/x/recipes/constant_definition.rb", <<~EOM class ::Blah THECONSTANT = '1' end -EOM + EOM file "arbitrary.rb", <<~EOM file #{path_to('tempfile.txt').inspect} do content ::Blah::THECONSTANT end -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o x::constant_definition arbitrary.rb", cwd: path_to("")) result.error! @@ -251,7 +251,7 @@ EOM file "config/client.rb", <<~EOM chef_server_url 'http://omg.com/blah' cookbook_path "#{path_to('cookbooks')}" -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir) result.error! @@ -261,7 +261,7 @@ EOM file "config/client.rb", <<~EOM chef_server_url 'http://omg.com/blah' cookbook_path "#{path_to('cookbooks')}" -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", cwd: chef_dir) result.error! @@ -271,7 +271,7 @@ EOM file "config/client.rb", <<~EOM chef_server_url 'http://omg.com/blah' cookbook_path "#{path_to('cookbooks')}" -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --local-mode", cwd: chef_dir) expect(result.stdout).not_to include("SSL validation of HTTPS requests is disabled.") @@ -282,7 +282,7 @@ EOM file "config/client.rb", <<~EOM chef_server_url 'http://omg.com/blah' cookbook_path "#{path_to('cookbooks')}" -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir) result.error! @@ -292,7 +292,7 @@ EOM file "config/client.rb", <<~EOM chef_server_url 'http://omg.com/blah' cookbook_path "#{path_to('cookbooks')}" -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -r 'x::default' -z -l info", cwd: chef_dir) expect(result.stdout).not_to include("Overridden Run List") @@ -304,7 +304,7 @@ EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z --profile-ruby", cwd: chef_dir) result.error! expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be true @@ -314,7 +314,7 @@ EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM result = shell_out!("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' -z", cwd: chef_dir) result.error! expect(File.exist?(path_to("config/local-mode-cache/cache/graph_profile.out"))).to be false @@ -328,11 +328,11 @@ EOM name 'x' version '0.0.1' chef_version '~> 999.99' -EOM + EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM end it "should fail the chef client run" do command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) @@ -391,7 +391,7 @@ EOM # Mimick what happens when you are on the console formatters << :doc log_level :warn -EOM + EOM ENV.delete("CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS") @@ -414,7 +414,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" audit_mode :enabled -EOM + EOM end it "should exit with a zero code when there is not an audit failure" do @@ -466,7 +466,7 @@ EOM no_lazy_load #{lazy} local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM result = shell_out("#{chef_client} -l debug -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", cwd: chef_dir) result.error! @@ -498,7 +498,7 @@ EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM end it "should run the ohai plugin" do @@ -524,7 +524,7 @@ EOM it "should complete with success when passed -z and --recipe-url" do file "config/client.rb", <<~EOM chef_repo_path "#{tmp_dir}" -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --recipe-url=http://localhost:9000/recipes.tgz -o 'x::default' -z", cwd: tmp_dir) result.error! end @@ -548,18 +548,18 @@ EOM name 'x' version '0.0.1' raise "TEH SADNESS" -EOM + EOM file "cookbooks/x/metadata.json", <<~EOM { "name": "x", "version": "0.0.1" } -EOM + EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM end it "the chef client run should succeed" do @@ -583,7 +583,7 @@ EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM end it "a chef client run should not log to info by default" do @@ -615,11 +615,11 @@ EOM before do file "cookbooks/x/recipes/default.rb", <<~EOM puts Chef::Config[:client_fork] ? "WITHFORK" : "NOFORK" -EOM + EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM end it "chef-client runs by default with no supervisor" do @@ -663,12 +663,12 @@ EOM before do file "cookbooks/x/recipes/default.rb", <<~EOM puts Chef::Config[:client_fork] ? "WITHFORK" : "NOFORK" -EOM + EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" client_fork true -EOM + EOM end it "chef-client uses a supervisor" do @@ -688,12 +688,12 @@ EOM before do file "cookbooks/x/recipes/default.rb", <<~EOM puts Chef::Config[:client_fork] ? "WITHFORK" : "NOFORK" -EOM + EOM file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" client_fork false -EOM + EOM end it "chef-client uses a supervisor" do diff --git a/spec/integration/client/exit_code_spec.rb b/spec/integration/client/exit_code_spec.rb index 7352863dbf..a6e070f9a5 100644 --- a/spec/integration/client/exit_code_spec.rb +++ b/spec/integration/client/exit_code_spec.rb @@ -31,7 +31,7 @@ describe "chef-client" do file "config/client.rb", <<~EOM local_mode true cookbook_path "#{path_to('cookbooks')}" -EOM + EOM end def setup_client_rb_with_audit_mode @@ -39,7 +39,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" audit_mode :audit_only -EOM + EOM end def run_chef_client_and_expect_exit_code(exit_code) @@ -72,7 +72,7 @@ EOM expect(4 - 4).to eq(1) end end -RECIPE + RECIPE end it "exits with AUDIT_MODE_FAILURE, 42" do @@ -114,7 +114,7 @@ RECIPE before do file "cookbooks/x/recipes/default.rb", <<~EOM raise Chef::Exceptions::Reboot.new -EOM + EOM end it "exits with REBOOT_SCHEDULED, 35" do @@ -127,7 +127,7 @@ EOM before do file "cookbooks/x/recipes/default.rb", <<~EOM raise Chef::Exceptions::RebootFailed.new -EOM + EOM end it "exits with REBOOT_FAILED, 41" do diff --git a/spec/integration/client/ipv6_spec.rb b/spec/integration/client/ipv6_spec.rb index c3cb73e4fa..04154c296f 100644 --- a/spec/integration/client/ipv6_spec.rb +++ b/spec/integration/client/ipv6_spec.rb @@ -53,7 +53,7 @@ describe "chef-client" do syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T +vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= -----END RSA PRIVATE KEY----- -END_VALIDATION_PEM + END_VALIDATION_PEM end let(:cache_path) do @@ -66,7 +66,7 @@ END_VALIDATION_PEM validation_key '#{path_to('config/validator.pem')}' cache_path '#{cache_path}' client_key '#{cache_path}/client.pem' -END_CLIENT_RB + END_CLIENT_RB end let(:client_rb_content) do diff --git a/spec/integration/knife/chef_fs_data_store_spec.rb b/spec/integration/knife/chef_fs_data_store_spec.rb index 79b0307e0d..231f2c6f9a 100644 --- a/spec/integration/knife/chef_fs_data_store_spec.rb +++ b/spec/integration/knife/chef_fs_data_store_spec.rb @@ -107,7 +107,7 @@ describe "ChefFSDataStore tests", :workstation do /policy_groups/x.json /roles/ /roles/x.json -EOM + EOM end end @@ -193,7 +193,7 @@ EOM knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} x").should_succeed stderr: <<~EOM Uploading x [1.0.0] Uploaded 1 cookbook. -EOM + EOM knife("list --local -Rfp /cookbooks").should_succeed "/cookbooks/x/\n/cookbooks/x/metadata.rb\n" end @@ -225,7 +225,7 @@ EOM "name": "x", "description": "hi there" } -EOM + EOM end end end @@ -250,7 +250,7 @@ EOM knife("cookbook upload -z --cookbook-path #{path_to('cookbooks_to_upload')} z").should_succeed stderr: <<~EOM Uploading z [1.0.0] Uploaded 1 cookbook. -EOM + EOM knife("list --local -Rfp /cookbooks").should_succeed "/cookbooks/z/\n/cookbooks/z/metadata.rb\n" end @@ -288,7 +288,7 @@ EOM "name": "x", "description": "hi there" } -EOM + EOM end end @@ -321,7 +321,7 @@ EOM /policies/ /policy_groups/ /roles/ -EOM + EOM end context "DELETE /TYPE/NAME" do @@ -459,7 +459,7 @@ EOM /roles/x.json /users/ /users/x.json -EOM + EOM end end @@ -496,7 +496,7 @@ EOM "name": "x", "description": "hi there" } -EOM + EOM end end end @@ -527,7 +527,7 @@ EOM /nodes/ /roles/ /users/ -EOM + EOM end context "DELETE /TYPE/NAME" do diff --git a/spec/integration/knife/chef_repo_path_spec.rb b/spec/integration/knife/chef_repo_path_spec.rb index 9df0b9def9..4a133b0181 100644 --- a/spec/integration/knife/chef_repo_path_spec.rb +++ b/spec/integration/knife/chef_repo_path_spec.rb @@ -76,7 +76,7 @@ describe "chef_repo_path tests", :workstation do /roles/role3.json /users/ /users/user3.json -EOM + EOM end it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only do @@ -98,7 +98,7 @@ EOM /roles/role3.json /users/ /users/user3.json -EOM + EOM end it "knife list --local -Rfp --chef-repo-path chef_r~1 / grabs chef_repo2 stuff", :windows_only do @@ -145,7 +145,7 @@ EOM /policy_groups/ /roles/ /roles/role3.json -EOM + EOM end context "when all _paths are set to alternates" do @@ -174,7 +174,7 @@ EOM /roles/role3.json /users/ /users/user3.json -EOM + EOM end context "when cwd is at the top level" do @@ -211,7 +211,7 @@ EOM roles/role2.json users/ users/user2.json -EOM + EOM end end @@ -221,7 +221,7 @@ EOM knife("list --local -Rfp").should_succeed <<~EOM bag2/ bag2/item2.json -EOM + EOM end it "knife list --local -Rfp ../roles lists roles" do knife("list --local -Rfp ../roles").should_succeed "/roles/role2.json\n" @@ -256,7 +256,7 @@ EOM roles/role2.json users/ users/user2.json -EOM + EOM end end @@ -280,7 +280,7 @@ EOM knife("list --local -Rfp").should_succeed <<~EOM bag2/ bag2/item2.json -EOM + EOM end end end @@ -327,7 +327,7 @@ EOM roles/role3.json users/ users/user3.json -EOM + EOM end end @@ -337,7 +337,7 @@ EOM knife("list --local -Rfp").should_succeed <<~EOM bag3/ bag3/item3.json -EOM + EOM end end end @@ -364,7 +364,7 @@ EOM { } -EOM + EOM end end @@ -381,7 +381,7 @@ EOM /cookbooks/cookbook1/metadata.rb /cookbooks/cookbook2/ /cookbooks/cookbook2/metadata.rb -EOM + EOM end end @@ -398,7 +398,7 @@ EOM /cookbooks/cookbook1/metadata.rb /cookbooks/cookbook2/ /cookbooks/cookbook2/metadata.rb -EOM + EOM end end @@ -415,7 +415,7 @@ EOM /cookbooks/cookbook1/metadata.rb /cookbooks/cookbook2/ /cookbooks/cookbook2/metadata.rb -EOM + EOM end end @@ -432,7 +432,7 @@ EOM /data_bags/bag2/item2.json /data_bags/blah/ /data_bags/blah/item.json -EOM + EOM end end @@ -449,7 +449,7 @@ EOM /data_bags/bag2/item2.json /data_bags/blah/ /data_bags/blah/item1.json -EOM + EOM end end @@ -464,7 +464,7 @@ EOM { } -EOM + EOM end end @@ -479,7 +479,7 @@ EOM { } -EOM + EOM end end @@ -494,7 +494,7 @@ EOM { } -EOM + EOM end end @@ -509,7 +509,7 @@ EOM { } -EOM + EOM end end @@ -528,7 +528,7 @@ EOM bag/item.json bag2/ bag2/item2.json -EOM + EOM end end @@ -561,7 +561,7 @@ EOM users/ users/user1.json users/user2.json -EOM + EOM end end @@ -573,7 +573,7 @@ EOM bag/item.json bag2/ bag2/item2.json -EOM + EOM end end end @@ -618,7 +618,7 @@ EOM users/ users/user1.json users/user3.json -EOM + EOM end end @@ -630,7 +630,7 @@ EOM bag/item.json bag3/ bag3/item3.json -EOM + EOM end end @@ -663,7 +663,7 @@ EOM users/ users/user1.json users/user3.json -EOM + EOM end end @@ -675,7 +675,7 @@ EOM bag/item.json bag3/ bag3/item3.json -EOM + EOM end end end @@ -723,7 +723,7 @@ EOM roles/role3.json users/ users/user3.json -EOM + EOM end end @@ -733,7 +733,7 @@ EOM knife("list --local -Rfp").should_succeed <<~EOM bag3/ bag3/item3.json -EOM + EOM end end end @@ -779,7 +779,7 @@ EOM users/ users/user1.json users/user3.json -EOM + EOM end end @@ -791,7 +791,7 @@ EOM bag/item.json bag3/ bag3/item3.json -EOM + EOM end end @@ -824,7 +824,7 @@ EOM users/ users/user1.json users/user3.json -EOM + EOM end end @@ -836,7 +836,7 @@ EOM bag/item.json bag3/ bag3/item3.json -EOM + EOM end end end @@ -863,7 +863,7 @@ EOM knife("list --local -Rfp").should_succeed <<~EOM bag/ bag/item.json -EOM + EOM end end @@ -887,7 +887,7 @@ EOM roles/role3.json users/ users/user3.json -EOM + EOM end end @@ -915,14 +915,14 @@ EOM /data_bags/ /data_bags/bag/ /data_bags/bag/item.json -EOM + EOM end it "knife list --local -Rfp /data_bags lists data bags" do knife("list --local -Rfp /data_bags").should_succeed <<~EOM /data_bags/bag/ /data_bags/bag/item.json -EOM + EOM end context "when cwd is inside the data_bags directory" do @@ -931,7 +931,7 @@ EOM knife("list --local -Rfp").should_succeed <<~EOM bag/ bag/item.json -EOM + EOM end end end diff --git a/spec/integration/knife/chef_repository_file_system_spec.rb b/spec/integration/knife/chef_repository_file_system_spec.rb index 538d6c5a63..6e9c4611e2 100644 --- a/spec/integration/knife/chef_repository_file_system_spec.rb +++ b/spec/integration/knife/chef_repository_file_system_spec.rb @@ -37,7 +37,7 @@ describe "General chef_repo file system checks", :workstation do /data_bags/bag1/ /environments/ /roles/ -EOM + EOM end end @@ -55,7 +55,7 @@ EOM it "knife list --local -Rfp / does not return it" do knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") /cookbooks/ -EOM + EOM end end @@ -65,7 +65,7 @@ EOM it "knife list --local -Rfp / does not return it" do knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") /cookbooks/ -EOM + EOM end end @@ -82,7 +82,7 @@ EOM /cookbooks/cookbook1/templates/ /cookbooks/cookbook1/templates/default/ /cookbooks/cookbook1/templates/default/x.txt -EOM + EOM end end @@ -92,7 +92,7 @@ EOM it "knife list --local -Rfp / does not return it" do knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") /cookbooks/ -EOM + EOM end end @@ -110,7 +110,7 @@ EOM /cookbooks/cookbook1/templates/ /cookbooks/cookbook1/templates/default/ /cookbooks/cookbook1/templates/default/x.txt -EOM + EOM end end @@ -154,7 +154,7 @@ EOM /environments/environment1.json /roles/ /roles/role1.json -EOM + EOM end end @@ -163,7 +163,7 @@ EOM it "does not show up in list -Rfp" do knife("list --local -Rfp /").should_succeed <<~EOM /cookbooks/ -EOM + EOM end end @@ -172,7 +172,7 @@ EOM it "does not show up in list -Rfp" do knife("list --local -Rfp /").should_succeed <<~EOM /data_bags/ -EOM + EOM end end end diff --git a/spec/integration/knife/chefignore_spec.rb b/spec/integration/knife/chefignore_spec.rb index eb36f4675f..b92fb1f485 100644 --- a/spec/integration/knife/chefignore_spec.rb +++ b/spec/integration/knife/chefignore_spec.rb @@ -56,7 +56,7 @@ describe "chefignore tests", :workstation do /environments/x.json /roles/ /roles/x.json -EOM + EOM end end end @@ -71,7 +71,7 @@ EOM it "the cookbook is not listed" do knife("list --local -Rfp /").should_succeed(<<~EOM, stderr: "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n") /cookbooks/ -EOM + EOM end end @@ -93,7 +93,7 @@ EOM /cookbooks/cookbook1/y.json /cookbooks/cookbook2/ /cookbooks/cookbook2/y.json -EOM + EOM end end @@ -110,7 +110,7 @@ EOM /cookbooks/cookbook1/y.json /cookbooks/cookbook2/ /cookbooks/cookbook2/y.json -EOM + EOM end end @@ -132,7 +132,7 @@ EOM /cookbooks/cookbook2/recipes/y.rb /cookbooks/cookbook2/x.json /cookbooks/cookbook2/y.json -EOM + EOM end end @@ -153,7 +153,7 @@ EOM /cookbooks/cookbook2/ /cookbooks/cookbook2/x.json /cookbooks/cookbook2/y.json -EOM + EOM end end @@ -173,7 +173,7 @@ EOM /cookbooks/cookbook2/ /cookbooks/cookbook2/x.json /cookbooks/cookbook2/y.json -EOM + EOM end end @@ -191,7 +191,7 @@ EOM /cookbooks/cookbook2/ /cookbooks/cookbook2/x.json /cookbooks/cookbook2/y.json -EOM + EOM end end @@ -207,7 +207,7 @@ EOM /cookbooks/cookbook1/y.json /cookbooks/cookbook2/ /cookbooks/cookbook2/y.json -EOM + EOM end end end @@ -239,7 +239,7 @@ EOM /cookbooks/mycookbook/x.json /cookbooks/yourcookbook/ /cookbooks/yourcookbook/metadata.rb -EOM + EOM end context "and conflicting cookbooks" do @@ -258,7 +258,7 @@ EOM /cookbooks/yourcookbook/ /cookbooks/yourcookbook/onlyincookbooks1.rb /cookbooks/yourcookbook/x.json -EOM + EOM end end end @@ -272,7 +272,7 @@ EOM knife("list --local -Rfp /cookbooks").should_succeed <<~EOM /cookbooks/chefignore/ /cookbooks/chefignore/metadata.rb -EOM + EOM end end @@ -294,7 +294,7 @@ EOM /cookbooks/blah/metadata.rb /cookbooks/chefignore/ /cookbooks/chefignore/metadata.rb -EOM + EOM end end end diff --git a/spec/integration/knife/client_bulk_delete_spec.rb b/spec/integration/knife/client_bulk_delete_spec.rb index 42bfe0396a..73dd1680b2 100644 --- a/spec/integration/knife/client_bulk_delete_spec.rb +++ b/spec/integration/knife/client_bulk_delete_spec.rb @@ -40,7 +40,7 @@ describe "knife client bulk delete", :workstation do Are you sure you want to delete these clients? (Y/N) Deleted client car Deleted client cat -EOM + EOM knife("client list").should_succeed <<~EOM cdr @@ -48,7 +48,7 @@ EOM chef-webui concat cons -EOM + EOM end it "deletes all matching clients when unanchored" do @@ -60,14 +60,14 @@ EOM Are you sure you want to delete these clients? (Y/N) Deleted client car Deleted client cat Deleted client concat -EOM + EOM knife("client list").should_succeed <<~EOM cdr chef-validator chef-webui cons -EOM + EOM end end @@ -93,7 +93,7 @@ EOM Are you sure you want to delete these clients? (Y/N) Deleted client car Deleted client cat -EOM + EOM knife("client list").should_succeed <<~EOM car-validator @@ -101,7 +101,7 @@ EOM chef-validator chef-webui cons -EOM + EOM end it "deletes a validator when told to" do @@ -117,14 +117,14 @@ EOM Are you sure you want to delete these clients? (Y/N) Deleted client car Deleted client cat -EOM + EOM knife("client list").should_succeed <<~EOM cdr chef-validator chef-webui cons -EOM + EOM end end end diff --git a/spec/integration/knife/client_create_spec.rb b/spec/integration/knife/client_create_spec.rb index 86609a63cd..505358923b 100644 --- a/spec/integration/knife/client_create_spec.rb +++ b/spec/integration/knife/client_create_spec.rb @@ -38,7 +38,7 @@ describe "knife client create", :workstation do chef_type: client name: bah validator: true -EOM + EOM end it "refuses to add an existing client" do diff --git a/spec/integration/knife/client_delete_spec.rb b/spec/integration/knife/client_delete_spec.rb index 914827cb46..3ba51fca96 100644 --- a/spec/integration/knife/client_delete_spec.rb +++ b/spec/integration/knife/client_delete_spec.rb @@ -35,7 +35,7 @@ describe "knife client delete", :workstation do it "deletes a client" do knife("client delete car", input: "Y").should_succeed <<~EOM Do you really want to delete car? (Y/N) Deleted client[car] -EOM + EOM knife("client list").should_succeed <<~EOM car-validator @@ -44,19 +44,19 @@ EOM chef-validator chef-webui cons -EOM + EOM end it "refuses to delete a validator normally" do knife("client delete car-validator", input: "Y").should_fail exit_code: 2, stdout: "Do you really want to delete car-validator? (Y/N) ", stderr: <<~EOM FATAL: You must specify --delete-validators to delete the validator client car-validator -EOM + EOM end it "deletes a validator correctly" do knife("client delete car-validator -D", input: "Y").should_succeed <<~EOM Do you really want to delete car-validator? (Y/N) Deleted client[car-validator] -EOM + EOM end end diff --git a/spec/integration/knife/client_key_delete_spec.rb b/spec/integration/knife/client_key_delete_spec.rb index 061a3fea76..04826bb0b8 100644 --- a/spec/integration/knife/client_key_delete_spec.rb +++ b/spec/integration/knife/client_key_delete_spec.rb @@ -33,7 +33,7 @@ describe "knife client key delete", :workstation do knife("client key create -k new car") knife("client key delete car new", input: "Y").should_succeed stdout: out, stderr: <<~EOM Deleted key named new for the client named car -EOM + EOM knife("client key list car").should_succeed "" end diff --git a/spec/integration/knife/client_key_list_spec.rb b/spec/integration/knife/client_key_list_spec.rb index 0969d5fb98..4fd18a6cd5 100644 --- a/spec/integration/knife/client_key_list_spec.rb +++ b/spec/integration/knife/client_key_list_spec.rb @@ -45,7 +45,7 @@ describe "knife client key list", :workstation do expired: http://127.0.0.1:8900/clients/cons/keys/expired (expired) new: http://127.0.0.1:8900/clients/cons/keys/new next_month: http://127.0.0.1:8900/clients/cons/keys/next_month -EOM + EOM end it "lists the expired keys for a client" do diff --git a/spec/integration/knife/client_list_spec.rb b/spec/integration/knife/client_list_spec.rb index 41cf8dcbb6..27ceecf7de 100644 --- a/spec/integration/knife/client_list_spec.rb +++ b/spec/integration/knife/client_list_spec.rb @@ -41,7 +41,7 @@ describe "knife client list", :workstation do chef-validator chef-webui cons -EOM + EOM end end diff --git a/spec/integration/knife/common_options_spec.rb b/spec/integration/knife/common_options_spec.rb index e0622eb801..5eac571a85 100644 --- a/spec/integration/knife/common_options_spec.rb +++ b/spec/integration/knife/common_options_spec.rb @@ -95,7 +95,7 @@ describe "knife common options", :workstation do syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T +vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= -----END RSA PRIVATE KEY----- -EOM + EOM end it "knife raw /nodes/x should retrieve the node" do diff --git a/spec/integration/knife/cookbook_api_ipv6_spec.rb b/spec/integration/knife/cookbook_api_ipv6_spec.rb index 8c2b0208ae..a7e3709276 100644 --- a/spec/integration/knife/cookbook_api_ipv6_spec.rb +++ b/spec/integration/knife/cookbook_api_ipv6_spec.rb @@ -54,7 +54,7 @@ describe "Knife cookbook API integration with IPv6", :workstation, :not_supporte syHLXYFNy0OxMtH/bBAXBGNHd9gf5uOnqh0pYcbe/uRAxumC7Rl0cL509eURiA2T +vFmf54y9YdnLXaqv+FhJT6B6V7WX7IpU9BMqJY1cJYXHuHG2KA= -----END RSA PRIVATE KEY----- -END_VALIDATION_PEM + END_VALIDATION_PEM end let(:cache_path) do @@ -80,7 +80,7 @@ END_VALIDATION_PEM client_key '#{path_to('config/knifeuser.pem')}' node_name 'whoisthisis' cookbook_path '#{CHEF_SPEC_DATA}/cookbooks' -END_CLIENT_RB + END_CLIENT_RB end before do diff --git a/spec/integration/knife/cookbook_bulk_delete_spec.rb b/spec/integration/knife/cookbook_bulk_delete_spec.rb index d3180c788f..5b8dc3a952 100644 --- a/spec/integration/knife/cookbook_bulk_delete_spec.rb +++ b/spec/integration/knife/cookbook_bulk_delete_spec.rb @@ -42,21 +42,21 @@ describe "knife cookbook bulk delete", :workstation do foo fox Do you really want to delete these cookbooks? (Y/N) -EOM + EOM stderr = <<~EOM Deleted cookbook foo [1.0.0] Deleted cookbook foo [0.6.5] Deleted cookbook fox [0.6.5] Deleted cookbook fox [0.6.0] -EOM + EOM knife("cookbook bulk delete ^fo.*", input: "Y").should_succeed(stderr: stderr, stdout: stdout) knife("cookbook list -a").should_succeed <<~EOM fax 0.6.0 zfa 0.6.5 -EOM + EOM end # rubocop:enable Layout/TrailingWhitespace diff --git a/spec/integration/knife/cookbook_download_spec.rb b/spec/integration/knife/cookbook_download_spec.rb index 2dbf9e5ae5..3fe801b64c 100644 --- a/spec/integration/knife/cookbook_download_spec.rb +++ b/spec/integration/knife/cookbook_download_spec.rb @@ -37,7 +37,7 @@ describe "knife cookbook download", :workstation do Downloading x cookbook version 1.0.1 Downloading root_files Cookbook downloaded to #{tmpdir}/x-1.0.1 -EOM + EOM end it "knife cookbook download with a version downloads the specified version" do @@ -45,7 +45,7 @@ EOM Downloading x cookbook version 1.0.1 Downloading root_files Cookbook downloaded to #{tmpdir}/x-1.0.1 -EOM + EOM end it "knife cookbook download with an unknown version raises an error" do @@ -64,7 +64,7 @@ EOM Downloading x cookbook version 1.0.1 Downloading root_files Cookbook downloaded to #{tmpdir}/x-1.0.1 -EOM + EOM ) end end diff --git a/spec/integration/knife/cookbook_list_spec.rb b/spec/integration/knife/cookbook_list_spec.rb index afea745bce..c9e4069a44 100644 --- a/spec/integration/knife/cookbook_list_spec.rb +++ b/spec/integration/knife/cookbook_list_spec.rb @@ -39,7 +39,7 @@ describe "knife cookbook list", :workstation do x 1.0.0 y 0.6.5 z 0.6.5 -EOM + EOM end it "knife cookbook list -a shows all the versions of all the cookbooks" do @@ -47,7 +47,7 @@ EOM x 1.0.0 0.6.5 0.6.0 y 0.6.5 0.6.0 z 0.6.5 -EOM + EOM end end diff --git a/spec/integration/knife/cookbook_show_spec.rb b/spec/integration/knife/cookbook_show_spec.rb index a8e87204e4..7b894efe30 100644 --- a/spec/integration/knife/cookbook_show_spec.rb +++ b/spec/integration/knife/cookbook_show_spec.rb @@ -82,7 +82,7 @@ describe "knife cookbook show", :workstation do specificity: default url: http://127.0.0.1:8900/file_store/checksums/8226671f751ba102dea6a6b6bd32fa8d version: 1.0.0 -EOM + EOM end it "knife cookbook show x 1.0.0 metadata shows the metadata" do @@ -109,7 +109,7 @@ EOM x::x: source_url: version: 1.0.0 -EOM + EOM end it "knife cookbook show x 1.0.0 recipes shows all the recipes" do @@ -125,7 +125,7 @@ EOM path: recipes/x.rb specificity: default url: http://127.0.0.1:8900/file_store/checksums/d41d8cd98f00b204e9800998ecf8427e -EOM + EOM end # rubocop:enable Layout/TrailingWhitespace diff --git a/spec/integration/knife/cookbook_upload_spec.rb b/spec/integration/knife/cookbook_upload_spec.rb index e96884e786..7e98b6ea64 100644 --- a/spec/integration/knife/cookbook_upload_spec.rb +++ b/spec/integration/knife/cookbook_upload_spec.rb @@ -36,14 +36,14 @@ describe "knife cookbook upload", :workstation do knife("cookbook upload x -o #{cb_dir}").should_succeed stderr: <<~EOM Uploading x [1.0.0] Uploaded 1 cookbook. -EOM + EOM end it "knife cookbook upload --freeze uploads and freezes the cookbook" do knife("cookbook upload x -o #{cb_dir} --freeze").should_succeed stderr: <<~EOM Uploading x [1.0.0] Uploaded 1 cookbook. -EOM + EOM # Modify the file, attempt to reupload file "cookbooks/x/metadata.rb", 'name "x"; version "1.0.0"#different' knife("cookbook upload x -o #{cb_dir} --freeze").should_fail stderr: <<~EOM @@ -51,7 +51,7 @@ EOM ERROR: Version 1.0.0 of cookbook x is frozen. Use --force to override. WARNING: Not updating version constraints for x in the environment as the cookbook is frozen. ERROR: Failed to upload 1 cookbook. -EOM + EOM end end @@ -66,7 +66,7 @@ EOM Uploading x [1.0.0] Uploading y [1.0.0] Uploaded 2 cookbooks. -EOM + EOM end it "knife cookbook upload fails due to missing dependencies" do @@ -75,7 +75,7 @@ EOM ERROR: Cookbook x depends on cookbooks which are not currently ERROR: being uploaded and cannot be found on the server. ERROR: The missing cookbook(s) are: 'y' version '>= 0.0.0' -EOM + EOM end it "knife cookbook upload -a uploads both cookbooks" do @@ -83,7 +83,7 @@ EOM Uploading x [1.0.0] Uploading y [1.0.0] Uploaded all cookbooks. -EOM + EOM end end end diff --git a/spec/integration/knife/data_bag_delete_spec.rb b/spec/integration/knife/data_bag_delete_spec.rb index f0ca05a3e4..b5ee1b0422 100644 --- a/spec/integration/knife/data_bag_delete_spec.rb +++ b/spec/integration/knife/data_bag_delete_spec.rb @@ -34,25 +34,25 @@ describe "knife data bag delete", :workstation do it "with an empty data bag" do knife("data bag delete canteloupe", input: "y").should_succeed <<~EOM Do you really want to delete canteloupe? (Y/N) Deleted data_bag[canteloupe] -EOM + EOM end it "with a bag with some items" do knife("data bag delete rocket", input: "y").should_succeed <<~EOM Do you really want to delete rocket? (Y/N) Deleted data_bag[rocket] -EOM + EOM end it "with a single item" do knife("data bag delete rocket falcon9", input: "y").should_succeed <<~EOM Do you really want to delete falcon9? (Y/N) Deleted data_bag_item[falcon9] -EOM + EOM end it "choosing not to delete" do knife("data bag delete rocket falcon9", input: "n").should_succeed <<~EOM, exit_code: 3 Do you really want to delete falcon9? (Y/N) You said no, so I'm done here. -EOM + EOM end end end diff --git a/spec/integration/knife/data_bag_from_file_spec.rb b/spec/integration/knife/data_bag_from_file_spec.rb index afaafc1e6b..5083153e91 100644 --- a/spec/integration/knife/data_bag_from_file_spec.rb +++ b/spec/integration/knife/data_bag_from_file_spec.rb @@ -47,7 +47,7 @@ describe "knife data bag from file", :workstation do "cipher": "aes-256-cbc" } } -EOM + EOM file "data_bags/bar/round_trip.json", <<~EOM { "name": "data_bag_item_bar_round_trip", @@ -70,33 +70,33 @@ EOM } } } -EOM + EOM end it "uploads a single file" do knife("data bag from file foo #{db_dir}/foo/bar.json").should_succeed stderr: <<~EOM Updated data_bag_item[foo::bar] -EOM + EOM end it "uploads a single encrypted file" do knife("data bag from file foo #{db_dir}/foo/encrypted.json").should_succeed stderr: <<~EOM Updated data_bag_item[foo::encrypted] -EOM + EOM end it "uploads a file in chef's internal format" do pending "chef/chef#4815" knife("data bag from file bar #{db_dir}/bar/round_trip.json").should_succeed stderr: <<~EOM Updated data_bag_item[bar::round_trip] -EOM + EOM end it "uploads many files" do knife("data bag from file foo #{db_dir}/foo/bar.json #{db_dir}/foo/bzr.json").should_succeed stderr: <<~EOM Updated data_bag_item[foo::bar] Updated data_bag_item[foo::bzr] -EOM + EOM end it "uploads a whole directory" do @@ -107,7 +107,7 @@ EOM cat dog encrypted -EOM + EOM end end diff --git a/spec/integration/knife/data_bag_list_spec.rb b/spec/integration/knife/data_bag_list_spec.rb index 4a2b740937..2e57cc7cca 100644 --- a/spec/integration/knife/data_bag_list_spec.rb +++ b/spec/integration/knife/data_bag_list_spec.rb @@ -36,7 +36,7 @@ describe "knife data bag list", :workstation do canteloupe rocket x -EOM + EOM end end diff --git a/spec/integration/knife/data_bag_show_spec.rb b/spec/integration/knife/data_bag_show_spec.rb index 5fefec5266..7e1a6b6e32 100644 --- a/spec/integration/knife/data_bag_show_spec.rb +++ b/spec/integration/knife/data_bag_show_spec.rb @@ -40,14 +40,14 @@ describe "knife data bag show", :workstation do ariane atlas falcon9 -EOM + EOM end it "with a single item" do knife("data bag show rocket falcon9").should_succeed <<~EOM heavy: true id: falcon9 -EOM + EOM end end end diff --git a/spec/integration/knife/delete_spec.rb b/spec/integration/knife/delete_spec.rb index 2e3efcf693..fd5853dfef 100644 --- a/spec/integration/knife/delete_spec.rb +++ b/spec/integration/knife/delete_spec.rb @@ -43,7 +43,7 @@ describe "knife delete", :workstation do /roles/x.json /users /users/x.json -EOM + EOM end let :server_everything do @@ -68,7 +68,7 @@ EOM /users /users/admin.json /users/x.json -EOM + EOM end let :server_nothing do <<~EOM @@ -83,7 +83,7 @@ EOM /roles /users /users/admin.json -EOM + EOM end let :nothing do @@ -95,7 +95,7 @@ EOM /nodes /roles /users -EOM + EOM end when_the_chef_server "has one of each thing" do @@ -125,7 +125,7 @@ EOM knife("delete --both /cookbooks/x").should_fail <<~EOM ERROR: /cookbooks/x (remote) must be deleted recursively! Pass -r to knife delete. ERROR: /cookbooks/x (local) must be deleted recursively! Pass -r to knife delete. -EOM + EOM knife("list -Rf /").should_succeed server_everything knife("list -Rf --local /").should_succeed everything end @@ -151,7 +151,7 @@ EOM /users /users/admin.json /users/x.json -EOM + EOM knife("list -Rf --local /").should_succeed <<~EOM /clients /clients/x.json @@ -168,7 +168,7 @@ EOM /roles/x.json /users /users/x.json -EOM + EOM end it "knife delete -r --local /cookbooks/x deletes x locally but not remotely" do @@ -190,7 +190,7 @@ EOM /roles/x.json /users /users/x.json -EOM + EOM end it "knife delete -r /cookbooks/x deletes x remotely but not locally" do @@ -214,7 +214,7 @@ EOM /users /users/admin.json /users/x.json -EOM + EOM knife("list -Rf --local /").should_succeed everything end @@ -229,7 +229,7 @@ EOM knife("delete --both /data_bags/empty").should_fail <<~EOM ERROR: /data_bags/empty (remote) must be deleted recursively! Pass -r to knife delete. ERROR: /data_bags/empty (local) must be deleted recursively! Pass -r to knife delete. -EOM + EOM knife("list -Rf /").should_succeed <<~EOM /clients /clients/chef-validator.json @@ -252,7 +252,7 @@ EOM /users /users/admin.json /users/x.json -EOM + EOM knife("list -Rf --local /").should_succeed <<~EOM /clients /clients/x.json @@ -272,7 +272,7 @@ EOM /roles/x.json /users /users/x.json -EOM + EOM end end @@ -280,7 +280,7 @@ EOM knife("delete --both /data_bags/x").should_fail <<~EOM ERROR: /data_bags/x (remote) must be deleted recursively! Pass -r to knife delete. ERROR: /data_bags/x (local) must be deleted recursively! Pass -r to knife delete. -EOM + EOM knife("list -Rf /").should_succeed server_everything knife("list -Rf --local /").should_succeed everything end @@ -306,7 +306,7 @@ EOM /users /users/admin.json /users/x.json -EOM + EOM knife("list -Rf --local /").should_succeed <<~EOM /clients /clients/x.json @@ -323,7 +323,7 @@ EOM /roles/x.json /users /users/x.json -EOM + EOM end it "knife delete --both /environments/x.json deletes x" do @@ -348,7 +348,7 @@ EOM /users /users/admin.json /users/x.json -EOM + EOM knife("list -Rf --local /").should_succeed <<~EOM /clients /clients/x.json @@ -366,7 +366,7 @@ EOM /roles/x.json /users /users/x.json -EOM + EOM end it "knife delete --both /roles/x.json deletes x" do @@ -391,7 +391,7 @@ EOM /users /users/admin.json /users/x.json -EOM + EOM knife("list -Rf --local /").should_succeed <<~EOM /clients /clients/x.json @@ -409,7 +409,7 @@ EOM /roles /users /users/x.json -EOM + EOM end it "knife delete --both /environments/_default.json fails but still deletes the local copy" do @@ -432,7 +432,7 @@ EOM /roles/x.json /users /users/x.json -EOM + EOM end it "knife delete --both /environments/nonexistent.json fails" do @@ -445,7 +445,7 @@ EOM knife("delete --both /").should_fail <<~EOM ERROR: / (remote) cannot be deleted. ERROR: / (local) cannot be deleted. -EOM + EOM knife("list -Rf /").should_succeed server_everything knife("list -Rf --local /").should_succeed everything end @@ -468,7 +468,7 @@ EOM ERROR: /roles (local) cannot be deleted. ERROR: /users (remote) cannot be deleted. ERROR: /users (local) cannot be deleted. -EOM + EOM knife("list -Rf /").should_succeed server_everything knife("list -Rf --local /").should_succeed everything end @@ -512,7 +512,7 @@ EOM /users /users/admin.json /users/x.json -EOM + EOM knife("list -Rf --local /").should_succeed nothing end @@ -543,7 +543,7 @@ EOM /users /users/admin.json /users/x.json -EOM + EOM knife("list -Rf --local /").should_succeed nothing end @@ -569,7 +569,7 @@ EOM /users /users/admin.json /users/x.json -EOM + EOM knife("list -Rf --local /").should_succeed nothing end @@ -595,7 +595,7 @@ EOM /users /users/admin.json /users/x.json -EOM + EOM knife("list -Rf --local /").should_succeed nothing end @@ -629,7 +629,7 @@ EOM ERROR: /roles (local) cannot be deleted. ERROR: /users (remote) cannot be deleted. ERROR: /users (local) cannot be deleted. -EOM + EOM knife("list -Rf /").should_succeed server_everything knife("list -Rf --local /").should_succeed nothing end @@ -665,7 +665,7 @@ EOM users users/admin.json users/x.json -EOM + EOM knife("list -Rf --local /").should_succeed <<~EOM clients cookbooks @@ -674,7 +674,7 @@ EOM nodes roles users -EOM + EOM end end end @@ -718,7 +718,7 @@ EOM /roles/x.json /users /users/x.json -EOM + EOM end it "knife delete --both /data_bags/x fails" do @@ -746,7 +746,7 @@ EOM /roles/x.json /users /users/x.json -EOM + EOM end it "knife delete --both /environments/x.json deletes x" do @@ -769,7 +769,7 @@ EOM /roles/x.json /users /users/x.json -EOM + EOM end it "knife delete --both /roles/x.json deletes x" do @@ -792,7 +792,7 @@ EOM /roles /users /users/x.json -EOM + EOM end it "knife delete --both /environments/_default.json fails but still deletes the local copy" do @@ -815,7 +815,7 @@ EOM /roles/x.json /users /users/x.json -EOM + EOM end it "knife delete --both / fails" do @@ -842,7 +842,7 @@ EOM ERROR: /roles (local) cannot be deleted. ERROR: /users (remote) cannot be deleted. ERROR: /users (local) cannot be deleted. -EOM + EOM knife("list -Rf /").should_succeed server_nothing knife("list -Rf --local /").should_succeed everything end @@ -869,7 +869,7 @@ EOM roles users users/admin.json -EOM + EOM knife("list -Rf --local /").should_succeed <<~EOM clients clients/x.json @@ -888,7 +888,7 @@ EOM roles/x.json users users/x.json -EOM + EOM end end end diff --git a/spec/integration/knife/deps_spec.rb b/spec/integration/knife/deps_spec.rb index b7eafcbd1c..4dfccf38de 100644 --- a/spec/integration/knife/deps_spec.rb +++ b/spec/integration/knife/deps_spec.rb @@ -46,7 +46,7 @@ describe "knife deps", :workstation do /cookbooks/quiche /cookbooks/soup /roles/starring.json -EOM + EOM end end @@ -65,7 +65,7 @@ EOM /cookbooks/quiche /cookbooks/soup /roles/starring.json -EOM + EOM end end @@ -99,7 +99,7 @@ EOM /cookbooks/quiche /cookbooks/soup /nodes/mort.json -EOM + EOM end end when_the_repository "has a cookbook with no dependencies" do @@ -155,7 +155,7 @@ depends "kettle"' /cookbooks/soup /roles/starring.json /nodes/mort.json -EOM + EOM end it "knife deps * reports all dependencies of all things" do knife("deps /nodes/*").should_succeed <<~EOM @@ -166,7 +166,7 @@ EOM /cookbooks/soup /roles/starring.json /nodes/mort.json -EOM + EOM end it "knife deps a b reports all dependencies of a and b" do knife("deps /nodes/bart.json /nodes/mort.json").should_succeed <<~EOM @@ -177,7 +177,7 @@ EOM /cookbooks/soup /roles/starring.json /nodes/mort.json -EOM + EOM end it "knife deps --tree /* shows dependencies in a tree" do knife("deps --tree /nodes/*").should_succeed <<~EOM @@ -189,7 +189,7 @@ EOM /roles/minor.json /cookbooks/quiche /cookbooks/soup -EOM + EOM end it "knife deps --tree --no-recurse shows only the first level of dependencies" do knife("deps --tree --no-recurse /nodes/*").should_succeed <<~EOM @@ -198,7 +198,7 @@ EOM /nodes/mort.json /environments/desert.json /roles/starring.json -EOM + EOM end end @@ -237,7 +237,7 @@ depends "foo"' /roles/bar.json /roles/foo.json /roles/self.json -EOM + EOM end it "knife deps --tree prints each once" do knife("deps --tree /roles/foo.json /roles/self.json") do @@ -383,7 +383,7 @@ EOM /cookbooks/quiche /cookbooks/soup /roles/starring.json -EOM + EOM end end @@ -400,7 +400,7 @@ EOM /cookbooks/quiche /cookbooks/soup /roles/starring.json -EOM + EOM end end @@ -432,7 +432,7 @@ EOM /cookbooks/quiche /cookbooks/soup /nodes/mort.json -EOM + EOM end end when_the_chef_server "has a cookbook with no dependencies" do @@ -484,7 +484,7 @@ depends "kettle"', "recipes" => { "default.rb" => "" } } /cookbooks/soup /roles/starring.json /nodes/mort.json -EOM + EOM end it "knife deps * reports all dependencies of all things" do knife("deps --remote /nodes/*").should_succeed <<~EOM @@ -495,7 +495,7 @@ EOM /cookbooks/soup /roles/starring.json /nodes/mort.json -EOM + EOM end it "knife deps a b reports all dependencies of a and b" do knife("deps --remote /nodes/bart.json /nodes/mort.json").should_succeed <<~EOM @@ -506,7 +506,7 @@ EOM /cookbooks/soup /roles/starring.json /nodes/mort.json -EOM + EOM end it "knife deps --tree /* shows dependencies in a tree" do knife("deps --remote --tree /nodes/*").should_succeed <<~EOM @@ -518,7 +518,7 @@ EOM /roles/minor.json /cookbooks/quiche /cookbooks/soup -EOM + EOM end it "knife deps --tree --no-recurse shows only the first level of dependencies" do knife("deps --remote --tree --no-recurse /nodes/*").should_succeed <<~EOM @@ -527,18 +527,18 @@ EOM /nodes/mort.json /environments/desert.json /roles/starring.json -EOM + EOM end end context "circular dependencies" do when_the_chef_server "has cookbooks with circular dependencies" do before do - cookbook "foo", "1.0.0", { "metadata.rb" => 'name "foo" + cookbook "foo", "1.0.0", { "metadata.rb" => 'name "foo" depends "bar"' } - cookbook "bar", "1.0.0", { "metadata.rb" => 'name "bar" + cookbook "bar", "1.0.0", { "metadata.rb" => 'name "bar" depends "baz"' } - cookbook "baz", "1.0.0", { "metadata.rb" => 'name "baz" + cookbook "baz", "1.0.0", { "metadata.rb" => 'name "baz" depends "foo"' } cookbook "self", "1.0.0", { "metadata.rb" => 'name "self" depends "self"' } @@ -549,7 +549,7 @@ depends "self"' } /cookbooks/bar /cookbooks/foo /cookbooks/self -EOM + EOM end it "knife deps --tree prints each once" do knife("deps --remote --tree /cookbooks/foo /cookbooks/self").should_succeed <<~EOM @@ -559,7 +559,7 @@ EOM /cookbooks/foo /cookbooks/self /cookbooks/self -EOM + EOM end end when_the_chef_server "has roles with circular dependencies" do @@ -575,7 +575,7 @@ EOM /roles/bar.json /roles/foo.json /roles/self.json -EOM + EOM end it "knife deps --tree prints each once" do knife("deps --remote --tree /roles/foo.json /roles/self.json") do diff --git a/spec/integration/knife/diff_spec.rb b/spec/integration/knife/diff_spec.rb index 9e54558300..719e9f59e6 100644 --- a/spec/integration/knife/diff_spec.rb +++ b/spec/integration/knife/diff_spec.rb @@ -58,7 +58,7 @@ describe "knife diff", :workstation do D\t/roles/x.json D\t/users/admin.json D\t/users/x.json -EOM + EOM end end @@ -96,13 +96,13 @@ EOM { "foo": "bar" } -EOM + EOM end it "knife diff reports the role as different" do knife("diff --name-status /").should_succeed <<~EOM M\t/roles/x.json -EOM + EOM end end @@ -130,7 +130,7 @@ EOM A\t/nodes/y.json A\t/roles/y.json A\t/users/y.json -EOM + EOM end context "when cwd is the data_bags directory" do @@ -139,13 +139,13 @@ EOM knife("diff --name-status").should_succeed <<~EOM A\tx/z.json A\ty -EOM + EOM end it "knife diff * reports different data bags" do knife("diff --name-status *").should_succeed <<~EOM A\tx/z.json A\ty -EOM + EOM end end end @@ -161,7 +161,7 @@ EOM D\t/nodes D\t/roles D\t/users -EOM + EOM end end end @@ -183,14 +183,14 @@ EOM M\t/cookbooks/x/metadata.rb D\t/cookbooks/x/onlyin1.0.1.rb A\t/cookbooks/x/onlyin1.0.0.rb -EOM + EOM end it "knife diff --diff-filter=MAT does not show deleted files" do knife("diff --diff-filter=MAT --name-status /cookbooks/x").should_succeed <<~EOM M\t/cookbooks/x/metadata.rb A\t/cookbooks/x/onlyin1.0.0.rb -EOM + EOM end end @@ -214,7 +214,7 @@ EOM M\t/cookbooks/x/metadata.rb D\t/cookbooks/x/onlyin1.0.1.rb A\t/cookbooks/x/onlyin1.0.0.rb -EOM + EOM end end @@ -228,7 +228,7 @@ EOM M\t/cookbooks/x/metadata.rb D\t/cookbooks/x/onlyin0.9.9.rb A\t/cookbooks/x/onlyin1.0.0.rb -EOM + EOM end end end @@ -353,7 +353,7 @@ EOM D\t/roles/x.json D\t/users/admin.json D\t/users/x.json -EOM + EOM end end @@ -390,13 +390,13 @@ EOM { "foo": "bar" } -EOM + EOM end it "knife diff reports the role as different" do knife("diff --name-status /").should_succeed <<~EOM M\t/roles/x.json -EOM + EOM end end @@ -426,7 +426,7 @@ EOM A\t/nodes/y.json A\t/roles/y.json A\t/users/y.json -EOM + EOM end context "when cwd is the data_bags directory" do @@ -435,13 +435,13 @@ EOM knife("diff --name-status").should_succeed <<~EOM A\tx/z.json A\ty -EOM + EOM end it "knife diff * reports different data bags" do knife("diff --name-status *").should_succeed <<~EOM A\tx/z.json A\ty -EOM + EOM end end end @@ -457,7 +457,7 @@ EOM D\t/nodes D\t/roles D\t/users -EOM + EOM end end end @@ -477,7 +477,7 @@ EOM it "knife diff /cookbooks shows differences" do knife("diff --name-status /cookbooks").should_succeed <<~EOM D\t/cookbooks/x-1.0.1 -EOM + EOM end it "knife diff --diff-filter=MAT does not show deleted files" do @@ -504,7 +504,7 @@ EOM knife("diff --name-status /cookbooks").should_succeed <<~EOM D\t/cookbooks/x-1.0.1 A\t/cookbooks/x-1.0.0 -EOM + EOM end end @@ -517,7 +517,7 @@ EOM knife("diff --name-status /cookbooks").should_succeed <<~EOM D\t/cookbooks/x-0.9.9 A\t/cookbooks/x-1.0.0 -EOM + EOM end end end diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb index 04610ba4e7..93d804b749 100644 --- a/spec/integration/knife/download_spec.rb +++ b/spec/integration/knife/download_spec.rb @@ -62,7 +62,7 @@ describe "knife download", :workstation do Created /roles/x.json Created /users/admin.json Created /users/x.json -EOM + EOM knife("diff --name-status /").should_succeed "" end end @@ -110,7 +110,7 @@ EOM ] } -EOM + EOM end it "knife download changes the role" do @@ -142,7 +142,7 @@ EOM ] } -EOM + EOM end it "knife download / does not change anything" do @@ -176,7 +176,7 @@ EOM A\t/nodes/y.json A\t/roles/y.json A\t/users/y.json -EOM + EOM end it "knife download --purge deletes the extra files" do @@ -190,7 +190,7 @@ EOM Deleted extra entry /nodes/y.json (purge is on) Deleted extra entry /roles/y.json (purge is on) Deleted extra entry /users/y.json (purge is on) -EOM + EOM knife("diff --name-status /").should_succeed "" end end @@ -219,7 +219,7 @@ EOM Created /users Created /users/admin.json Created /users/x.json -EOM + EOM knife("diff --name-status /").should_succeed "" end @@ -245,7 +245,7 @@ EOM Created /users Created /users/admin.json Created /users/x.json -EOM + EOM knife("diff --name-status /").should_succeed "" end @@ -273,10 +273,10 @@ EOM Created /data_bags Created /data_bags/x Created /data_bags/x/y.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/z.json -EOM + EOM end it "knife download /data_bags/x /data_bags/x/y.json downloads x once" do @@ -285,7 +285,7 @@ EOM Created /data_bags/x Created /data_bags/x/y.json Created /data_bags/x/z.json -EOM + EOM end end end @@ -296,17 +296,17 @@ EOM { "id": "deleted" } -EOM + EOM file "data_bags/x/modified.json", <<~EOM { "id": "modified" } -EOM + EOM file "data_bags/x/unmodified.json", <<~EOM { "id": "unmodified" } -EOM + EOM end when_the_chef_server "has a modified, unmodified, added and deleted data bag item" do @@ -321,11 +321,11 @@ EOM it "knife download of the modified file succeeds" do knife("download /data_bags/x/modified.json").should_succeed <<~EOM Updated /data_bags/x/modified.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/added.json A\t/data_bags/x/deleted.json -EOM + EOM end it "knife download of the unmodified file does nothing" do knife("download /data_bags/x/unmodified.json").should_succeed "" @@ -333,16 +333,16 @@ EOM D\t/data_bags/x/added.json M\t/data_bags/x/modified.json A\t/data_bags/x/deleted.json -EOM + EOM end it "knife download of the added file succeeds" do knife("download /data_bags/x/added.json").should_succeed <<~EOM Created /data_bags/x/added.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM M\t/data_bags/x/modified.json A\t/data_bags/x/deleted.json -EOM + EOM end it "knife download of the deleted file does nothing" do knife("download /data_bags/x/deleted.json").should_succeed "" @@ -350,32 +350,32 @@ EOM D\t/data_bags/x/added.json M\t/data_bags/x/modified.json A\t/data_bags/x/deleted.json -EOM + EOM end it "knife download --purge of the deleted file deletes it" do knife("download --purge /data_bags/x/deleted.json").should_succeed <<~EOM Deleted extra entry /data_bags/x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/added.json M\t/data_bags/x/modified.json -EOM + EOM end it "knife download of the entire data bag downloads everything" do knife("download /data_bags/x").should_succeed <<~EOM Created /data_bags/x/added.json Updated /data_bags/x/modified.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM A\t/data_bags/x/deleted.json -EOM + EOM end it "knife download --purge of the entire data bag downloads everything" do knife("download --purge /data_bags/x").should_succeed <<~EOM Created /data_bags/x/added.json Updated /data_bags/x/modified.json Deleted extra entry /data_bags/x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end context "when cwd is the /data_bags directory" do @@ -390,7 +390,7 @@ EOM Created x/added.json Updated x/modified.json Deleted extra entry x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end it "knife download --purge * downloads everything" do @@ -398,7 +398,7 @@ EOM Created x/added.json Updated x/modified.json Deleted extra entry x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end end @@ -421,7 +421,7 @@ EOM knife("diff --name-status /cookbooks").should_succeed <<~EOM D\t/cookbooks/x/y.rb A\t/cookbooks/x/z.rb -EOM + EOM end it "knife download of a deleted file does nothing" do knife("download /cookbooks/x/z.rb").should_succeed "" @@ -429,37 +429,37 @@ EOM M\t/cookbooks/x/metadata.rb D\t/cookbooks/x/y.rb A\t/cookbooks/x/z.rb -EOM + EOM end it "knife download --purge of a deleted file succeeds" do knife("download --purge /cookbooks/x/z.rb").should_succeed "Deleted extra entry /cookbooks/x/z.rb (purge is on)\n" knife("diff --name-status /cookbooks").should_succeed <<~EOM M\t/cookbooks/x/metadata.rb D\t/cookbooks/x/y.rb -EOM + EOM end it "knife download of an added file succeeds" do knife("download /cookbooks/x/y.rb").should_succeed "Created /cookbooks/x/y.rb\n" knife("diff --name-status /cookbooks").should_succeed <<~EOM M\t/cookbooks/x/metadata.rb A\t/cookbooks/x/z.rb -EOM + EOM end it "knife download of the cookbook itself succeeds" do knife("download /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x/metadata.rb Created /cookbooks/x/y.rb -EOM + EOM knife("diff --name-status /cookbooks").should_succeed <<~EOM A\t/cookbooks/x/z.rb -EOM + EOM end it "knife download --purge of the cookbook itself succeeds" do knife("download --purge /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x/metadata.rb Created /cookbooks/x/y.rb Deleted extra entry /cookbooks/x/z.rb (purge is on) -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -482,7 +482,7 @@ EOM Updated /cookbooks/x/metadata.rb Created /cookbooks/x/onlyin1.0.1.rb Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -496,7 +496,7 @@ EOM it "knife download /cookbooks/x downloads the updated file" do knife("download --purge /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x/onlyin1.0.0.rb -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -511,7 +511,7 @@ EOM Updated /cookbooks/x/metadata.rb Created /cookbooks/x/onlyin1.0.1.rb Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -526,7 +526,7 @@ EOM Updated /cookbooks/x/metadata.rb Created /cookbooks/x/onlyin0.9.9.rb Deleted extra entry /cookbooks/x/onlyin1.0.0.rb (purge is on) -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -541,7 +541,7 @@ EOM file "roles/x.rb", <<~EOM name "x" description "x" -EOM + EOM end it "knife download refuses to change the role" do @@ -565,7 +565,7 @@ EOM { (right here) ------^ -EOH + EOH knife("download /environments/x.json").should_succeed "Updated /environments/x.json\n", stderr: warning knife("diff --name-status /environments/x.json").should_succeed "" end @@ -631,7 +631,7 @@ EOH Created /roles/x.json Created /users/admin.json Created /users/x.json -EOM + EOM knife("diff --name-status /").should_succeed "" end end @@ -690,7 +690,7 @@ EOM ] } -EOM + EOM end it "knife download / does not change anything" do @@ -726,7 +726,7 @@ EOM A\t/nodes/y.json A\t/roles/y.json A\t/users/y.json -EOM + EOM end it "knife download --purge deletes the extra files" do @@ -741,7 +741,7 @@ EOM Deleted extra entry /nodes/y.json (purge is on) Deleted extra entry /roles/y.json (purge is on) Deleted extra entry /users/y.json (purge is on) -EOM + EOM knife("diff --name-status /").should_succeed "" end end @@ -770,7 +770,7 @@ EOM Created /users Created /users/admin.json Created /users/x.json -EOM + EOM knife("diff --name-status /").should_succeed "" end @@ -797,10 +797,10 @@ EOM Created /data_bags Created /data_bags/x Created /data_bags/x/y.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/z.json -EOM + EOM end end end @@ -811,17 +811,17 @@ EOM { "id": "deleted" } -EOM + EOM file "data_bags/x/modified.json", <<~EOM { "id": "modified" } -EOM + EOM file "data_bags/x/unmodified.json", <<~EOM { "id": "unmodified" } -EOM + EOM end when_the_chef_server "has a modified, unmodified, added and deleted data bag item" do @@ -836,11 +836,11 @@ EOM it "knife download of the modified file succeeds" do knife("download /data_bags/x/modified.json").should_succeed <<~EOM Updated /data_bags/x/modified.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/added.json A\t/data_bags/x/deleted.json -EOM + EOM end it "knife download of the unmodified file does nothing" do knife("download /data_bags/x/unmodified.json").should_succeed "" @@ -848,16 +848,16 @@ EOM D\t/data_bags/x/added.json M\t/data_bags/x/modified.json A\t/data_bags/x/deleted.json -EOM + EOM end it "knife download of the added file succeeds" do knife("download /data_bags/x/added.json").should_succeed <<~EOM Created /data_bags/x/added.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM M\t/data_bags/x/modified.json A\t/data_bags/x/deleted.json -EOM + EOM end it "knife download of the deleted file does nothing" do knife("download /data_bags/x/deleted.json").should_succeed "" @@ -865,32 +865,32 @@ EOM D\t/data_bags/x/added.json M\t/data_bags/x/modified.json A\t/data_bags/x/deleted.json -EOM + EOM end it "knife download --purge of the deleted file deletes it" do knife("download --purge /data_bags/x/deleted.json").should_succeed <<~EOM Deleted extra entry /data_bags/x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/added.json M\t/data_bags/x/modified.json -EOM + EOM end it "knife download of the entire data bag downloads everything" do knife("download /data_bags/x").should_succeed <<~EOM Created /data_bags/x/added.json Updated /data_bags/x/modified.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM A\t/data_bags/x/deleted.json -EOM + EOM end it "knife download --purge of the entire data bag downloads everything" do knife("download --purge /data_bags/x").should_succeed <<~EOM Created /data_bags/x/added.json Updated /data_bags/x/modified.json Deleted extra entry /data_bags/x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end context "when cwd is the /data_bags directory" do @@ -905,7 +905,7 @@ EOM Created x/added.json Updated x/modified.json Deleted extra entry x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end it "knife download --purge * downloads everything" do @@ -913,7 +913,7 @@ EOM Created x/added.json Updated x/modified.json Deleted extra entry x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end end @@ -936,7 +936,7 @@ EOM knife("diff --name-status /cookbooks").should_succeed <<~EOM D\t/cookbooks/x-1.0.0/y.rb A\t/cookbooks/x-1.0.0/z.rb -EOM + EOM end it "knife download of a deleted file does nothing" do knife("download /cookbooks/x-1.0.0/z.rb").should_succeed "" @@ -944,37 +944,37 @@ EOM M\t/cookbooks/x-1.0.0/metadata.rb D\t/cookbooks/x-1.0.0/y.rb A\t/cookbooks/x-1.0.0/z.rb -EOM + EOM end it "knife download --purge of a deleted file succeeds" do knife("download --purge /cookbooks/x-1.0.0/z.rb").should_succeed "Deleted extra entry /cookbooks/x-1.0.0/z.rb (purge is on)\n" knife("diff --name-status /cookbooks").should_succeed <<~EOM M\t/cookbooks/x-1.0.0/metadata.rb D\t/cookbooks/x-1.0.0/y.rb -EOM + EOM end it "knife download of an added file succeeds" do knife("download /cookbooks/x-1.0.0/y.rb").should_succeed "Created /cookbooks/x-1.0.0/y.rb\n" knife("diff --name-status /cookbooks").should_succeed <<~EOM M\t/cookbooks/x-1.0.0/metadata.rb A\t/cookbooks/x-1.0.0/z.rb -EOM + EOM end it "knife download of the cookbook itself succeeds" do knife("download /cookbooks/x-1.0.0").should_succeed <<~EOM Updated /cookbooks/x-1.0.0/metadata.rb Created /cookbooks/x-1.0.0/y.rb -EOM + EOM knife("diff --name-status /cookbooks").should_succeed <<~EOM A\t/cookbooks/x-1.0.0/z.rb -EOM + EOM end it "knife download --purge of the cookbook itself succeeds" do knife("download --purge /cookbooks/x-1.0.0").should_succeed <<~EOM Updated /cookbooks/x-1.0.0/metadata.rb Created /cookbooks/x-1.0.0/y.rb Deleted extra entry /cookbooks/x-1.0.0/z.rb (purge is on) -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -998,7 +998,7 @@ EOM Created /cookbooks/x-1.0.1 Created /cookbooks/x-1.0.1/metadata.rb Created /cookbooks/x-1.0.1/onlyin1.0.1.rb -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1015,7 +1015,7 @@ EOM Created /cookbooks/x-0.9.9/metadata.rb Created /cookbooks/x-0.9.9/onlyin0.9.9.rb Updated /cookbooks/x-1.0.0/onlyin1.0.0.rb -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1031,7 +1031,7 @@ EOM Created /cookbooks/x-1.0.1/metadata.rb Created /cookbooks/x-1.0.1/onlyin1.0.1.rb Deleted extra entry /cookbooks/x-1.0.0 (purge is on) -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1047,7 +1047,7 @@ EOM Created /cookbooks/x-0.9.9/metadata.rb Created /cookbooks/x-0.9.9/onlyin0.9.9.rb Deleted extra entry /cookbooks/x-1.0.0 (purge is on) -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1106,7 +1106,7 @@ EOM Created /cookbooks Created /cookbooks/x Created /cookbooks/x/metadata.rb -EOM + EOM end end end @@ -1189,7 +1189,7 @@ EOM Created /policies Created /policy_groups Created /roles -EOM + EOM end context "and the server has one of each thing" do @@ -1232,7 +1232,7 @@ EOM Created /acls/roles/x.json Updated /groups/clients.json Updated /groups/users.json -EOM + EOM end it "knife download / downloads everything" do @@ -1254,7 +1254,7 @@ EOM Created /policies/x-1.0.0.json Created /policy_groups/x.json Created /roles/x.json -EOM + EOM knife("diff --name-status /").should_succeed "" end @@ -1323,7 +1323,7 @@ EOM Updated /policies/x-1.0.0.json Updated /policy_groups/x.json Updated /roles/x.json -EOM + EOM knife("diff --name-status /").should_succeed "" end end diff --git a/spec/integration/knife/environment_compare_spec.rb b/spec/integration/knife/environment_compare_spec.rb index d3999fffa3..713c1efe12 100644 --- a/spec/integration/knife/environment_compare_spec.rb +++ b/spec/integration/knife/environment_compare_spec.rb @@ -49,7 +49,7 @@ describe "knife environment compare", :workstation do blah = 1.0.0 krad >= 1.0.0 -EOM + EOM end it "compares the cookbooks for two environments" do @@ -58,7 +58,7 @@ EOM blah = 1.0.0 = 1.1.0 krad >= 1.0.0 >= 1.0.0 -EOM + EOM end it "compares the cookbooks for all environments" do @@ -67,7 +67,7 @@ EOM blah = 1.0.0 = 1.1.0 krad >= 1.0.0 >= 1.0.0 -EOM + EOM end # rubocop:enable Layout/TrailingWhitespace end diff --git a/spec/integration/knife/environment_from_file_spec.rb b/spec/integration/knife/environment_from_file_spec.rb index 8948a3772c..8b33e254d8 100644 --- a/spec/integration/knife/environment_from_file_spec.rb +++ b/spec/integration/knife/environment_from_file_spec.rb @@ -45,7 +45,7 @@ describe "knife environment from file", :workstation do } } -EOM + EOM file "environments/car.json", <<~EOM { @@ -63,7 +63,7 @@ EOM } } -EOM + EOM file "environments/cdr.json", <<~EOM { @@ -81,14 +81,14 @@ EOM } } -EOM + EOM end it "uploads a single file" do knife("environment from file #{env_dir}/cons.json").should_succeed stderr: <<~EOM Updated Environment cons -EOM + EOM end it "uploads many files" do @@ -96,7 +96,7 @@ EOM Updated Environment cons Updated Environment car Updated Environment cdr -EOM + EOM end it "uploads all environments in the repository" do @@ -107,7 +107,7 @@ EOM car cdr cons -EOM + EOM end end diff --git a/spec/integration/knife/environment_list_spec.rb b/spec/integration/knife/environment_list_spec.rb index 0ac2df6300..b6b25e8661 100644 --- a/spec/integration/knife/environment_list_spec.rb +++ b/spec/integration/knife/environment_list_spec.rb @@ -34,7 +34,7 @@ describe "knife environment list", :workstation do _default b y -EOM + EOM end end diff --git a/spec/integration/knife/environment_show_spec.rb b/spec/integration/knife/environment_show_spec.rb index fdf41e70ce..c0334ecbf3 100644 --- a/spec/integration/knife/environment_show_spec.rb +++ b/spec/integration/knife/environment_show_spec.rb @@ -43,7 +43,7 @@ describe "knife environment show", :workstation do json_class: Chef::Environment name: b override_attributes: -EOM + EOM end # rubocop:enable Layout/TrailingWhitespace @@ -54,7 +54,7 @@ EOM baz: raz.my: mataz foo: bar -EOM + EOM end it "shows the requested nested attribute of an environment" do @@ -62,7 +62,7 @@ EOM b: default_attributes.baz: raz.my: mataz -EON + EON end it "shows the requested attribute of an environment with custom field separator" do @@ -70,7 +70,7 @@ EON b: default_attributes:baz: raz.my: mataz -EOT + EOT end end end diff --git a/spec/integration/knife/list_spec.rb b/spec/integration/knife/list_spec.rb index 39a3f77fc5..830dd0e428 100644 --- a/spec/integration/knife/list_spec.rb +++ b/spec/integration/knife/list_spec.rb @@ -35,7 +35,7 @@ describe "knife list", :workstation do /nodes /roles /users -EOM + EOM end it "knife list -R / returns everything" do @@ -66,7 +66,7 @@ EOM /users: admin.json -EOM + EOM end end @@ -100,7 +100,7 @@ EOM /nodes /roles /users -EOM + EOM end it "knife list -R / returns everything" do @@ -163,7 +163,7 @@ EOM admin.json user1.json user2.json -EOM + EOM end it "knife list -R --flat / returns everything" do @@ -201,7 +201,7 @@ EOM /users/admin.json /users/user1.json /users/user2.json -EOM + EOM end it "knife list -Rfp / returns everything" do @@ -239,14 +239,14 @@ EOM /users/admin.json /users/user1.json /users/user2.json -EOM + EOM end it "knife list /cookbooks returns the list of cookbooks" do knife("list /cookbooks").should_succeed <<~EOM /cookbooks/cookbook1 /cookbooks/cookbook2 -EOM + EOM end it "knife list /cookbooks/*2/*/*.rb returns the one file" do @@ -258,7 +258,7 @@ EOM /cookbooks/cookbook1/metadata.rb /cookbooks/cookbook2/metadata.rb /cookbooks/cookbook2/recipes/default.rb -EOM + EOM end it "knife list /cookbooks/**.rb returns all ruby files" do @@ -266,7 +266,7 @@ EOM /cookbooks/cookbook1/metadata.rb /cookbooks/cookbook2/metadata.rb /cookbooks/cookbook2/recipes/default.rb -EOM + EOM end it "knife list /**.json returns all json files" do @@ -289,7 +289,7 @@ EOM /users/admin.json /users/user1.json /users/user2.json -EOM + EOM end it "knife list /data**.json returns all data bag json files" do @@ -298,7 +298,7 @@ EOM /data_bags/bag1/item2.json /data_bags/bag2/item1.json /data_bags/bag2/item2.json -EOM + EOM end it "knife list /environments/missing_file.json reports missing file" do @@ -351,7 +351,7 @@ EOM users/admin.json users/user1.json users/user2.json -EOM + EOM end end end @@ -396,7 +396,7 @@ EOM /users/admin.json /users/user1.json /users/user2.json -EOM + EOM end it "knife list -Rfp .. returns everything" do @@ -434,7 +434,7 @@ EOM /users/admin.json /users/user1.json /users/user2.json -EOM + EOM end it "knife list -Rfp returns cookbooks" do @@ -445,7 +445,7 @@ EOM cookbook2/metadata.rb cookbook2/recipes/ cookbook2/recipes/default.rb -EOM + EOM end end end @@ -461,7 +461,7 @@ EOM metadata.rb recipes/ recipes/default.rb -EOM + EOM end end end @@ -483,7 +483,7 @@ EOM cookbook2/metadata.rb cookbook2/recipes/ cookbook2/recipes/default.rb -EOM + EOM end end @@ -498,7 +498,7 @@ EOM cookbook2/metadata.rb cookbook2/recipes/ cookbook2/recipes/default.rb -EOM + EOM end end end @@ -520,7 +520,7 @@ EOM cookbook2/metadata.rb cookbook2/recipes/ cookbook2/recipes/default.rb -EOM + EOM end end @@ -535,7 +535,7 @@ EOM cookbook2/metadata.rb cookbook2/recipes/ cookbook2/recipes/default.rb -EOM + EOM end end end @@ -619,7 +619,7 @@ EOM /users/ /users/user1.json /users/user2.json -EOM + EOM end context "missing file/directory tests" do @@ -665,7 +665,7 @@ EOM /policies /policy_groups /roles -EOM + EOM end it "knife list -R / returns everything" do @@ -780,7 +780,7 @@ EOM /policy_groups: /roles: -EOM + EOM end end @@ -896,7 +896,7 @@ EOM /policy_groups: /roles: -EOM + EOM end context "has plenty of stuff in it" do @@ -1052,7 +1052,7 @@ EOM /roles/ /roles/role1.json /roles/role2.json -EOM + EOM end end end diff --git a/spec/integration/knife/node_bulk_delete_spec.rb b/spec/integration/knife/node_bulk_delete_spec.rb index 501091c0e7..4dce471150 100644 --- a/spec/integration/knife/node_bulk_delete_spec.rb +++ b/spec/integration/knife/node_bulk_delete_spec.rb @@ -39,12 +39,12 @@ describe "knife node bulk delete", :workstation do Are you sure you want to delete these nodes? (Y/N) Deleted node car Deleted node cat -EOM + EOM knife("node list").should_succeed <<~EOM cdr cons -EOM + EOM end end diff --git a/spec/integration/knife/node_delete_spec.rb b/spec/integration/knife/node_delete_spec.rb index 9d8f382690..a578ae912e 100644 --- a/spec/integration/knife/node_delete_spec.rb +++ b/spec/integration/knife/node_delete_spec.rb @@ -34,13 +34,13 @@ describe "knife node delete", :workstation do it "deletes a node" do knife("node delete car", input: "Y").should_succeed <<~EOM Do you really want to delete car? (Y/N) Deleted node[car] -EOM + EOM knife("node list").should_succeed <<~EOM cat cdr cons -EOM + EOM end end diff --git a/spec/integration/knife/node_environment_set_spec.rb b/spec/integration/knife/node_environment_set_spec.rb index 09d1828130..96251f6351 100644 --- a/spec/integration/knife/node_environment_set_spec.rb +++ b/spec/integration/knife/node_environment_set_spec.rb @@ -34,7 +34,7 @@ describe "knife node environment set", :workstation do knife("node show cons -a chef_environment").should_succeed <<~EOM cons: chef_environment: lisp -EOM + EOM end it "with no environment" do diff --git a/spec/integration/knife/node_from_file_spec.rb b/spec/integration/knife/node_from_file_spec.rb index f7a4717e7c..8a2dddb76e 100644 --- a/spec/integration/knife/node_from_file_spec.rb +++ b/spec/integration/knife/node_from_file_spec.rb @@ -43,14 +43,14 @@ describe "knife node from file", :workstation do ] } } -EOM + EOM end it "uploads a single file" do knife("node from file #{node_dir}/cons.json").should_succeed stderr: <<~EOM Updated Node cons -EOM + EOM end end diff --git a/spec/integration/knife/node_list_spec.rb b/spec/integration/knife/node_list_spec.rb index fd7394f00b..9e5378f121 100644 --- a/spec/integration/knife/node_list_spec.rb +++ b/spec/integration/knife/node_list_spec.rb @@ -37,7 +37,7 @@ describe "knife node list", :workstation do cat cdr cons -EOM + EOM end end diff --git a/spec/integration/knife/raw_spec.rb b/spec/integration/knife/raw_spec.rb index 04f14be335..8875654bc8 100644 --- a/spec/integration/knife/raw_spec.rb +++ b/spec/integration/knife/raw_spec.rb @@ -63,7 +63,7 @@ describe "knife raw", :workstation do ] } -EOM + EOM end it "knife raw /blarghle returns 404" do @@ -90,7 +90,7 @@ EOM } } -EOM + EOM knife("show /roles/x.json").should_fail "ERROR: /roles/x.json: No such file or directory\n" end @@ -115,7 +115,7 @@ EOM } } -EOM + EOM file.close knife("raw -m PUT -i #{file.path} /roles/x").should_succeed <<~EOM @@ -137,14 +137,14 @@ EOM } } -EOM + EOM knife("show /roles/x.json").should_succeed <<~EOM /roles/x.json: { "name": "x", "description": "eek" } -EOM + EOM end end @@ -166,21 +166,21 @@ EOM "env_run_lists": { } } -EOM + EOM file.close knife("raw -m POST -i #{file.path} /roles").should_succeed <<~EOM { "uri": "#{Chef::Config.chef_server_url}/roles/y" } -EOM + EOM knife("show /roles/y.json").should_succeed <<~EOM /roles/y.json: { "name": "y", "description": "eek" } -EOM + EOM end end @@ -206,13 +206,13 @@ EOM "x": "y", "a": "b" } -EOM + EOM end it "knife raw --no-pretty /blah returns the raw json" do knife("raw --no-pretty /blah").should_succeed <<~EOM { "x": "y", "a": "b" } -EOM + EOM end end @@ -235,13 +235,13 @@ EOM it "knife raw /blah returns the raw text" do knife("raw /blah").should_succeed(<<~EOM) { "x": "y", "a": "b" } -EOM + EOM end it "knife raw --no-pretty /blah returns the raw text" do knife("raw --no-pretty /blah").should_succeed(<<~EOM) { "x": "y", "a": "b" } -EOM + EOM end end end diff --git a/spec/integration/knife/role_bulk_delete_spec.rb b/spec/integration/knife/role_bulk_delete_spec.rb index 5a88ef282e..36d1cb2041 100644 --- a/spec/integration/knife/role_bulk_delete_spec.rb +++ b/spec/integration/knife/role_bulk_delete_spec.rb @@ -39,12 +39,12 @@ describe "knife role bulk delete", :workstation do Are you sure you want to delete these roles? (Y/N) Deleted role car Deleted role cat -EOM + EOM knife("role list").should_succeed <<~EOM cdr cons -EOM + EOM end end diff --git a/spec/integration/knife/role_delete_spec.rb b/spec/integration/knife/role_delete_spec.rb index 875f80cede..aa12de57e8 100644 --- a/spec/integration/knife/role_delete_spec.rb +++ b/spec/integration/knife/role_delete_spec.rb @@ -34,13 +34,13 @@ describe "knife role delete", :workstation do it "deletes a role" do knife("role delete car", input: "Y").should_succeed <<~EOM Do you really want to delete car? (Y/N) Deleted role[car] -EOM + EOM knife("role list").should_succeed <<~EOM cat cdr cons -EOM + EOM end end diff --git a/spec/integration/knife/role_from_file_spec.rb b/spec/integration/knife/role_from_file_spec.rb index bc93d0f6e0..69f58e8c36 100644 --- a/spec/integration/knife/role_from_file_spec.rb +++ b/spec/integration/knife/role_from_file_spec.rb @@ -42,7 +42,7 @@ describe "knife role from file", :workstation do } } -EOM + EOM file "roles/car.json", <<~EOM { @@ -57,7 +57,7 @@ EOM } } -EOM + EOM file "roles/cdr.json", <<~EOM { @@ -72,14 +72,14 @@ EOM } } -EOM + EOM end it "uploads a single file" do knife("role from file #{role_dir}/cons.json").should_succeed stderr: <<~EOM Updated Role cons -EOM + EOM end it "uploads many files" do @@ -87,7 +87,7 @@ EOM Updated Role cons Updated Role car Updated Role cdr -EOM + EOM end end diff --git a/spec/integration/knife/role_list_spec.rb b/spec/integration/knife/role_list_spec.rb index db13e521b5..e718425cee 100644 --- a/spec/integration/knife/role_list_spec.rb +++ b/spec/integration/knife/role_list_spec.rb @@ -37,7 +37,7 @@ describe "knife role list", :workstation do cat cdr cons -EOM + EOM end end diff --git a/spec/integration/knife/role_show_spec.rb b/spec/integration/knife/role_show_spec.rb index c2f5efedaf..07afd19440 100644 --- a/spec/integration/knife/role_show_spec.rb +++ b/spec/integration/knife/role_show_spec.rb @@ -42,7 +42,7 @@ describe "knife role show", :workstation do name: cons override_attributes: run_list: -EOM + EOM end # rubocop:enable Layout/TrailingWhitespace diff --git a/spec/integration/knife/show_spec.rb b/spec/integration/knife/show_spec.rb index df9f55fbf2..a4013802c5 100644 --- a/spec/integration/knife/show_spec.rb +++ b/spec/integration/knife/show_spec.rb @@ -52,13 +52,13 @@ describe "knife show", :workstation do knife("show /cookbooks/x/metadata.rb").should_succeed <<~EOM /cookbooks/x/metadata.rb: name "x"; version "1.0.0" -EOM + EOM end it "knife show --local /cookbooks/x/metadata.rb shows the local version" do knife("show --local /cookbooks/x/metadata.rb").should_succeed <<~EOM /cookbooks/x/metadata.rb: name "x"; version "1.0.0" -EOM + EOM end it "knife show /data_bags/x/y.json shows the remote version" do knife("show /data_bags/x/y.json").should_succeed <<~EOM @@ -66,7 +66,7 @@ EOM { "id": "y" } -EOM + EOM end it "knife show --local /data_bags/x/y.json shows the local version" do knife("show --local /data_bags/x/y.json").should_succeed <<~EOM @@ -74,7 +74,7 @@ EOM { "foo": "bar" } -EOM + EOM end it "knife show /environments/x.json shows the remote version", skip: (RUBY_VERSION < "1.9") do knife("show /environments/x.json").should_succeed <<~EOM @@ -82,7 +82,7 @@ EOM { "name": "x" } -EOM + EOM end it "knife show --local /environments/x.json shows the local version" do knife("show --local /environments/x.json").should_succeed <<~EOM @@ -90,7 +90,7 @@ EOM { "foo": "bar" } -EOM + EOM end it "knife show /roles/x.json shows the remote version", skip: (RUBY_VERSION < "1.9") do knife("show /roles/x.json").should_succeed <<~EOM @@ -98,7 +98,7 @@ EOM { "name": "x" } -EOM + EOM end it "knife show --local /roles/x.json shows the local version" do knife("show --local /roles/x.json").should_succeed <<~EOM @@ -106,7 +106,7 @@ EOM { "foo": "bar" } -EOM + EOM end # show directory it "knife show /data_bags/x fails" do @@ -151,7 +151,7 @@ EOM "x": "y" } } -EOM + EOM end end @@ -161,7 +161,7 @@ EOM knife("show --local /environments/x.json").should_succeed <<~EOM /environments/x.json: { -EOM + EOM end end end diff --git a/spec/integration/knife/upload_spec.rb b/spec/integration/knife/upload_spec.rb index 647c7773f9..3f42b08f21 100644 --- a/spec/integration/knife/upload_spec.rb +++ b/spec/integration/knife/upload_spec.rb @@ -64,7 +64,7 @@ describe "knife upload", :workstation do D\t/roles/x.json D\t/users/admin.json D\t/users/x.json -EOM + EOM end it "knife upload --purge deletes everything" do @@ -79,10 +79,10 @@ EOM Deleted extra entry /roles/x.json (purge is on) Deleted extra entry /users/admin.json (purge is on) Deleted extra entry /users/x.json (purge is on) -EOM + EOM knife("diff --name-status /").should_succeed <<~EOM D\t/environments/_default.json -EOM + EOM end end @@ -145,7 +145,7 @@ EOM ] } -EOM + EOM end it "knife upload / does not change anything" do @@ -159,7 +159,7 @@ EOM file "roles/x.rb", <<~EOM name "x" description "blargle" -EOM + EOM end it "knife upload changes the role" do @@ -208,7 +208,7 @@ EOM Created /nodes/y.json Created /roles/y.json Created /users/y.json -EOM + EOM knife("diff /").should_succeed "" end @@ -224,7 +224,7 @@ EOM Created /nodes/y.json Created /roles/y.json Created /users/y.json -EOM + EOM knife("diff --name-status /").should_succeed "" end end @@ -241,7 +241,7 @@ EOM D\t/nodes D\t/roles D\t/users -EOM + EOM end it "knife upload --purge deletes nothing" do @@ -253,7 +253,7 @@ EOM ERROR: /nodes cannot be deleted. ERROR: /roles cannot be deleted. ERROR: /users cannot be deleted. -EOM + EOM knife("diff --name-status /").should_succeed <<~EOM D\t/clients D\t/cookbooks @@ -262,7 +262,7 @@ EOM D\t/nodes D\t/roles D\t/users -EOM + EOM end context "when current directory is top level" do @@ -288,7 +288,7 @@ EOM knife("upload /data_bags/x/y.json").should_succeed <<~EOM Created /data_bags/x Created /data_bags/x/y.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<EOM EOM expect(Chef::JSONCompat.parse(knife("raw /data/x/y").stdout, create_additions: false).keys.sort).to eq(%w{foo id}) @@ -298,7 +298,7 @@ EOM knife("upload /data_bags/x /data_bags/x/y.json").should_succeed <<~EOM Created /data_bags/x Created /data_bags/x/y.json -EOM + EOM end end @@ -312,7 +312,7 @@ EOM knife("upload /data_bags/x/y.json").should_succeed <<~EOM Created /data_bags/x Created /data_bags/x/y.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" result = Chef::JSONCompat.parse(knife("raw /data/x/y").stdout, create_additions: false) expect(result.keys.sort).to eq(%w{chef_type data_bag id}) @@ -331,10 +331,10 @@ EOM knife("upload /data_bags/x/y.json").should_succeed <<~EOM Created /data_bags/x Created /data_bags/x/y.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM A\t/data_bags/x/z.json -EOM + EOM end end end @@ -355,11 +355,11 @@ EOM it "knife upload of the modified file succeeds" do knife("upload /data_bags/x/modified.json").should_succeed <<~EOM Updated /data_bags/x/modified.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/deleted.json A\t/data_bags/x/added.json -EOM + EOM end it "knife upload of the unmodified file does nothing" do knife("upload /data_bags/x/unmodified.json").should_succeed "" @@ -367,16 +367,16 @@ EOM D\t/data_bags/x/deleted.json M\t/data_bags/x/modified.json A\t/data_bags/x/added.json -EOM + EOM end it "knife upload of the added file succeeds" do knife("upload /data_bags/x/added.json").should_succeed <<~EOM Created /data_bags/x/added.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/deleted.json M\t/data_bags/x/modified.json -EOM + EOM end it "knife upload of the deleted file does nothing" do knife("upload /data_bags/x/deleted.json").should_succeed "" @@ -384,32 +384,32 @@ EOM D\t/data_bags/x/deleted.json M\t/data_bags/x/modified.json A\t/data_bags/x/added.json -EOM + EOM end it "knife upload --purge of the deleted file deletes it" do knife("upload --purge /data_bags/x/deleted.json").should_succeed <<~EOM Deleted extra entry /data_bags/x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM M\t/data_bags/x/modified.json A\t/data_bags/x/added.json -EOM + EOM end it "knife upload of the entire data bag uploads everything" do knife("upload /data_bags/x").should_succeed <<~EOM Created /data_bags/x/added.json Updated /data_bags/x/modified.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/deleted.json -EOM + EOM end it "knife upload --purge of the entire data bag uploads everything" do knife("upload --purge /data_bags/x").should_succeed <<~EOM Created /data_bags/x/added.json Updated /data_bags/x/modified.json Deleted extra entry /data_bags/x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end context "when cwd is the /data_bags directory" do @@ -427,7 +427,7 @@ EOM Created x/added.json Updated x/modified.json Deleted extra entry x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end it "knife upload --purge * uploads everything" do @@ -435,7 +435,7 @@ EOM Created x/added.json Updated x/modified.json Deleted extra entry x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end end @@ -468,13 +468,13 @@ EOM it "knife upload of the cookbook itself succeeds" do knife("upload /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end it "knife upload --purge of the cookbook itself succeeds" do knife("upload /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -487,7 +487,7 @@ EOM it "knife upload of the cookbook succeeds" do knife("upload /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -502,7 +502,7 @@ EOM it "knife upload of the cookbook succeeds" do knife("upload /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -515,7 +515,7 @@ EOM it "knife upload --freeze freezes the cookbook" do knife("upload --freeze /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x -EOM + EOM # Modify a file and attempt to upload file "cookbooks/x/metadata.rb", 'name "x"; version "1.0.0"#different' knife("upload /cookbooks/x").should_fail "ERROR: /cookbooks failed to write: Cookbook x is frozen\n" @@ -540,7 +540,7 @@ EOM it "knife upload --force uploads the frozen cookbook" do knife("upload --force /cookbooks/frozencook").should_succeed <<~EOM Updated /cookbooks/frozencook -EOM + EOM end end end @@ -562,15 +562,15 @@ EOM M\t/cookbooks/x/metadata.rb D\t/cookbooks/x/onlyin1.0.1.rb A\t/cookbooks/x/onlyin1.0.0.rb -EOM + EOM knife("upload --purge /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x -EOM + EOM knife("diff --name-status /cookbooks").should_succeed <<~EOM M\t/cookbooks/x/metadata.rb D\t/cookbooks/x/onlyin1.0.1.rb A\t/cookbooks/x/onlyin1.0.0.rb -EOM + EOM end end @@ -583,7 +583,7 @@ EOM it "knife upload /cookbooks/x uploads the local version" do knife("upload --purge /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -598,27 +598,27 @@ EOM M\t/cookbooks/x/metadata.rb D\t/cookbooks/x/onlyin1.0.1.rb A\t/cookbooks/x/onlyin1.0.0.rb -EOM + EOM knife("upload --purge /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x -EOM + EOM knife("diff --name-status /cookbooks").should_succeed <<~EOM M\t/cookbooks/x/metadata.rb D\t/cookbooks/x/onlyin1.0.1.rb A\t/cookbooks/x/onlyin1.0.0.rb -EOM + EOM end end when_the_chef_server "has an earlier version for the cookbook, and no current version" do before do - cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" } + cookbook "x", "0.9.9", { "onlyin0.9.9.rb" => "hi" } end it "knife upload /cookbooks/x uploads the new version" do knife("upload --purge /cookbooks/x").should_succeed <<~EOM Updated /cookbooks/x -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -718,7 +718,7 @@ EOM it "knife upload succeeds" do knife("upload /cookbooks/x").should_succeed <<~EOM Created /cookbooks/x -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -763,7 +763,7 @@ EOM D\t/roles/x.json D\t/users/admin.json D\t/users/x.json -EOM + EOM end it "knife upload --purge deletes everything" do @@ -778,10 +778,10 @@ EOM Deleted extra entry /roles/x.json (purge is on) Deleted extra entry /users/admin.json (purge is on) Deleted extra entry /users/x.json (purge is on) -EOM + EOM knife("diff --name-status /").should_succeed <<~EOM D\t/environments/_default.json -EOM + EOM end end @@ -840,7 +840,7 @@ EOM ] } -EOM + EOM end it "knife upload / does not change anything" do @@ -876,7 +876,7 @@ EOM Created /nodes/y.json Created /roles/y.json Created /users/y.json -EOM + EOM knife("diff --name-status /").should_succeed "" end end @@ -893,7 +893,7 @@ EOM D\t/nodes D\t/roles D\t/users -EOM + EOM end it "knife upload --purge deletes nothing" do @@ -905,7 +905,7 @@ EOM ERROR: /nodes cannot be deleted. ERROR: /roles cannot be deleted. ERROR: /users cannot be deleted. -EOM + EOM knife("diff --name-status /").should_succeed <<~EOM D\t/clients D\t/cookbooks @@ -914,7 +914,7 @@ EOM D\t/nodes D\t/roles D\t/users -EOM + EOM end context "when current directory is top level" do @@ -940,10 +940,10 @@ EOM knife("upload /data_bags/x/y.json").should_succeed <<~EOM Created /data_bags/x Created /data_bags/x/y.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM A\t/data_bags/x/z.json -EOM + EOM end end end @@ -962,11 +962,11 @@ EOM it "knife upload of the modified file succeeds" do knife("upload /data_bags/x/modified.json").should_succeed <<~EOM Updated /data_bags/x/modified.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/deleted.json A\t/data_bags/x/added.json -EOM + EOM end it "knife upload of the unmodified file does nothing" do knife("upload /data_bags/x/unmodified.json").should_succeed "" @@ -974,16 +974,16 @@ EOM D\t/data_bags/x/deleted.json M\t/data_bags/x/modified.json A\t/data_bags/x/added.json -EOM + EOM end it "knife upload of the added file succeeds" do knife("upload /data_bags/x/added.json").should_succeed <<~EOM Created /data_bags/x/added.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/deleted.json M\t/data_bags/x/modified.json -EOM + EOM end it "knife upload of the deleted file does nothing" do knife("upload /data_bags/x/deleted.json").should_succeed "" @@ -991,32 +991,32 @@ EOM D\t/data_bags/x/deleted.json M\t/data_bags/x/modified.json A\t/data_bags/x/added.json -EOM + EOM end it "knife upload --purge of the deleted file deletes it" do knife("upload --purge /data_bags/x/deleted.json").should_succeed <<~EOM Deleted extra entry /data_bags/x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM M\t/data_bags/x/modified.json A\t/data_bags/x/added.json -EOM + EOM end it "knife upload of the entire data bag uploads everything" do knife("upload /data_bags/x").should_succeed <<~EOM Created /data_bags/x/added.json Updated /data_bags/x/modified.json -EOM + EOM knife("diff --name-status /data_bags").should_succeed <<~EOM D\t/data_bags/x/deleted.json -EOM + EOM end it "knife upload --purge of the entire data bag uploads everything" do knife("upload --purge /data_bags/x").should_succeed <<~EOM Created /data_bags/x/added.json Updated /data_bags/x/modified.json Deleted extra entry /data_bags/x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end context "when cwd is the /data_bags directory" do @@ -1031,7 +1031,7 @@ EOM Created x/added.json Updated x/modified.json Deleted extra entry x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end it "knife upload --purge * uploads everything" do @@ -1039,7 +1039,7 @@ EOM Created x/added.json Updated x/modified.json Deleted extra entry x/deleted.json (purge is on) -EOM + EOM knife("diff --name-status /data_bags").should_succeed "" end end @@ -1072,14 +1072,14 @@ EOM it "knife upload of the cookbook itself succeeds" do knife("upload /cookbooks/x-1.0.0").should_succeed <<~EOM Updated /cookbooks/x-1.0.0 -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end it "knife upload --purge of the cookbook itself succeeds" do knife("upload /cookbooks/x-1.0.0").should_succeed <<~EOM Updated /cookbooks/x-1.0.0 -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1092,7 +1092,7 @@ EOM it "knife upload of the cookbook succeeds" do knife("upload /cookbooks/x-1.0.0").should_succeed <<~EOM Updated /cookbooks/x-1.0.0 -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1107,7 +1107,7 @@ EOM it "knife upload of the cookbook succeeds" do knife("upload /cookbooks/x-1.0.0").should_succeed <<~EOM Updated /cookbooks/x-1.0.0 -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1129,11 +1129,11 @@ EOM knife("diff --name-status /cookbooks").should_succeed <<~EOM M\t/cookbooks/x-1.0.0/onlyin1.0.0.rb D\t/cookbooks/x-1.0.1 -EOM + EOM knife("upload --purge /cookbooks").should_succeed <<~EOM Updated /cookbooks/x-1.0.0 Deleted extra entry /cookbooks/x-1.0.1 (purge is on) -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1147,7 +1147,7 @@ EOM knife("upload --purge /cookbooks").should_succeed <<~EOM Updated /cookbooks/x-1.0.0 Deleted extra entry /cookbooks/x-0.9.9 (purge is on) -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1161,11 +1161,11 @@ EOM knife("diff --name-status /cookbooks").should_succeed <<~EOM D\t/cookbooks/x-1.0.1 A\t/cookbooks/x-1.0.0 -EOM + EOM knife("upload --purge /cookbooks").should_succeed <<~EOM Created /cookbooks/x-1.0.0 Deleted extra entry /cookbooks/x-1.0.1 (purge is on) -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1179,7 +1179,7 @@ EOM knife("upload --purge /cookbooks").should_succeed <<~EOM Created /cookbooks/x-1.0.0 Deleted extra entry /cookbooks/x-0.9.9 (purge is on) -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1252,7 +1252,7 @@ EOM it "knife upload succeeds" do knife("upload /cookbooks/x-1.0.0").should_succeed <<~EOM Created /cookbooks/x-1.0.0 -EOM + EOM knife("diff --name-status /cookbooks").should_succeed "" end end @@ -1331,7 +1331,7 @@ EOM Created /policies/x-1.0.0.json Created /policy_groups/x.json Created /roles/x.json -EOM + EOM expect(api.get("association_requests").map { |a| a["username"] }).to eq([ "foo" ]) expect(api.get("users").map { |a| a["user"]["username"] }).to eq([ "bar" ]) knife("diff --name-status --diff-filter=AMT /").should_succeed "" @@ -1368,7 +1368,7 @@ EOM it "knife upload makes no changes" do knife("upload /").should_succeed <<~EOM Updated /acls/groups/blah.json -EOM + EOM end end @@ -1380,7 +1380,7 @@ EOM it "should fail because policies are not updateable" do knife("upload /policies/x-1.0.0.json").should_fail <<~EOM ERROR: /policies/x-1.0.0.json cannot be updated: policy revisions are immutable once uploaded. If you want to change the policy, create a new revision with your changes. -EOM + EOM end end @@ -1392,7 +1392,7 @@ EOM it "should fail because cookbook_artifacts cannot be updated" do knife("upload /cookbook_artifacts/x-1x1").should_fail <<~EOM ERROR: /cookbook_artifacts/x-1x1 cannot be updated: cookbook artifacts are immutable once uploaded. -EOM + EOM end end @@ -1434,7 +1434,7 @@ EOM Created /policies/blah-1.0.0.json Updated /policy_groups/x.json Updated /roles/x.json -EOM + EOM knife("diff --name-status --diff-filter=AMT /").should_succeed "" end end diff --git a/spec/integration/recipes/lwrp_inline_resources_spec.rb b/spec/integration/recipes/lwrp_inline_resources_spec.rb index bda4728449..2f4ef92f31 100644 --- a/spec/integration/recipes/lwrp_inline_resources_spec.rb +++ b/spec/integration/recipes/lwrp_inline_resources_spec.rb @@ -149,7 +149,7 @@ describe "LWRPs with inline resources" do local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) actual = result.stdout.lines.map { |l| l.chomp }.join("\n") diff --git a/spec/integration/recipes/lwrp_spec.rb b/spec/integration/recipes/lwrp_spec.rb index 3f591d4cfc..b5af6978ac 100644 --- a/spec/integration/recipes/lwrp_spec.rb +++ b/spec/integration/recipes/lwrp_spec.rb @@ -24,15 +24,15 @@ describe "LWRPs" do file "resources/foo.rb", <<~EOM default_action :create -EOM + EOM file "providers/foo.rb", <<~EOM action :create do end -EOM + EOM file "recipes/default.rb", <<~EOM l_w_r_p_foo "me" -EOM + EOM end # directory 'cookbooks/x' end @@ -42,7 +42,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'l-w-r-p::default'", cwd: chef_dir) expect(result.stdout).to match(/\* l_w_r_p_foo\[me\] action create \(up to date\)/) diff --git a/spec/integration/recipes/notifies_spec.rb b/spec/integration/recipes/notifies_spec.rb index d9e89e7f1e..0df7aa311f 100644 --- a/spec/integration/recipes/notifies_spec.rb +++ b/spec/integration/recipes/notifies_spec.rb @@ -30,7 +30,7 @@ describe "notifications" do local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) # our delayed notification should run at the end of the parent run_context after the baz resource @@ -53,7 +53,7 @@ EOM notifies :write, 'log[foo]', :delayed end end -EOM + EOM file "recipes/default.rb", <<~EOM log "foo" do @@ -61,7 +61,7 @@ EOM end notifying_test "whatever" log "baz" -EOM + EOM end end @@ -71,7 +71,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) # our delayed notification should run at the end of the parent run_context after the baz resource @@ -94,7 +94,7 @@ EOM notifies :write, 'log[foo]', :delayed end end -EOM + EOM file "recipes/default.rb", <<~EOM log "foo" do @@ -104,7 +104,7 @@ EOM log "baz" do notifies :write, 'log[foo]', :delayed end -EOM + EOM end end @@ -114,7 +114,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) # our delayed notification should run at the end of the parent run_context after the baz resource @@ -139,7 +139,7 @@ EOM notifies :write, 'log[foo]', :delayed end end -EOM + EOM file "recipes/default.rb", <<~EOM log "foo" do @@ -151,7 +151,7 @@ EOM end notifying_test "whatever" log "baz" -EOM + EOM end end @@ -161,7 +161,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) # the delayed notification from the sub-resource is de-duplicated by the notification already in the parent run_context @@ -185,7 +185,7 @@ EOM log "baz" do notifies :write, 'log[foo]', :delayed end -EOM + EOM end end @@ -195,7 +195,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) # the delayed notification from the sub-resource is de-duplicated by the notification already in the parent run_context @@ -220,7 +220,7 @@ EOM notifies :write, 'log[foo]', :immediately end end -EOM + EOM file "recipes/default.rb", <<~EOM log "foo" do @@ -228,7 +228,7 @@ EOM end notifying_test "whatever" log "baz" -EOM + EOM end end @@ -238,7 +238,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[foo\] action write\s+\* log\[baz\] action write/) @@ -260,7 +260,7 @@ EOM notifies :write, resources(log: "foo"), :immediately end end -EOM + EOM file "recipes/default.rb", <<~EOM log "foo" do @@ -268,7 +268,7 @@ EOM end notifying_test "whatever" log "baz" -EOM + EOM end end @@ -278,7 +278,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).to match(/\* log\[bar\] action write\s+\* log\[foo\] action write\s+\* log\[baz\] action write/) @@ -300,12 +300,12 @@ EOM notifies :write, "log[foo]" end end -EOM + EOM file "recipes/default.rb", <<~EOM notifying_test "whatever" log "baz" -EOM + EOM end end @@ -315,7 +315,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).to match(/Chef::Exceptions::ResourceNotFound/) @@ -337,7 +337,7 @@ EOM level :info end end -EOM + EOM file "recipes/default.rb", <<~EOM log "bar" do @@ -345,7 +345,7 @@ EOM end cloning_test "whatever" -EOM + EOM end end @@ -355,7 +355,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).not_to match(/CHEF-3694/) @@ -383,7 +383,7 @@ EOM local_mode true cookbook_path "#{path_to('cookbooks')}" log_level :warn -EOM + EOM result = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" --no-color -F doc -o 'x::default'", cwd: chef_dir) expect(result.stdout).to match /\* log\[a, b\] action write/ diff --git a/spec/integration/recipes/resource_action_spec.rb b/spec/integration/recipes/resource_action_spec.rb index 149b17fcad..c8da9196ca 100644 --- a/spec/integration/recipes/resource_action_spec.rb +++ b/spec/integration/recipes/resource_action_spec.rb @@ -154,7 +154,7 @@ module ResourceActionSpec ResourceActionSpec::ActionJackson.ruby_block_converged = ResourceActionSpec::ActionJackson.succeeded end end - EOM + EOM expect(ActionJackson.ran_action).to eq :access_attribute expect(ActionJackson.succeeded).to eq "foo!" expect(ActionJackson.ruby_block_converged).to eq "foo!" diff --git a/spec/integration/recipes/resource_converge_if_changed_spec.rb b/spec/integration/recipes/resource_converge_if_changed_spec.rb index e1def5e191..605cb2c941 100644 --- a/spec/integration/recipes/resource_converge_if_changed_spec.rb +++ b/spec/integration/recipes/resource_converge_if_changed_spec.rb @@ -87,7 +87,7 @@ describe "Resource::ActionClass#converge_if_changed" do * #{resource_name}[blah] action create - update default_identity1 - set state1 to "new_state1" (was "current_state1") - EOM + EOM end end @@ -109,7 +109,7 @@ describe "Resource::ActionClass#converge_if_changed" do - update default_identity1 - set state1 to "new_state1" (was "current_state1") - set state2 to "new_state2" (was "current_state2") -EOM + EOM end end @@ -132,7 +132,7 @@ EOM - update default_identity1 - set state1 to (suppressed sensitive property) - set state2 to (suppressed sensitive property) -EOM + EOM end end @@ -152,7 +152,7 @@ EOM * #{resource_name}[blah] action create - update default_identity1 - set sensitive1 to (suppressed sensitive property) -EOM + EOM end end @@ -173,7 +173,7 @@ EOM * #{resource_name}[blah] action create - update default_identity1 - set state2 to "new_state2" (was "current_state2") -EOM + EOM end end @@ -192,7 +192,7 @@ EOM expect(resource.updated?).to be_falsey expect(converged_recipe.stdout).to eq <<~EOM * #{resource_name}[blah] action create (up to date) -EOM + EOM end end @@ -213,7 +213,7 @@ EOM expect(resource.updated?).to be_falsey expect(converged_recipe.stdout).to eq <<~EOM * #{resource_name}[blah] action create (up to date) -EOM + EOM end end end @@ -270,7 +270,7 @@ EOM - set state1 to "default_state1" (default value) - set state2 to "default_state2" (default value) - set sensitive1 to (suppressed sensitive property) (default value) -EOM + EOM end end @@ -295,7 +295,7 @@ EOM - set state1 to "new_state1" - set state2 to "new_state2" - set sensitive1 to (suppressed sensitive property) -EOM + EOM end end @@ -320,7 +320,7 @@ EOM - set state1 to (suppressed sensitive property) - set state2 to (suppressed sensitive property) - set sensitive1 to (suppressed sensitive property) (default value) -EOM + EOM end end end @@ -357,7 +357,7 @@ EOM expect(resource.updated?).to be_falsey expect(converged_recipe.stdout).to eq <<~EOM * #{resource_name}[blah] action create (up to date) -EOM + EOM end end @@ -378,7 +378,7 @@ EOM * #{resource_name}[blah] action create - update default_identity1 - set state1 to "new_state1" (was "current_state1") -EOM + EOM end end @@ -401,7 +401,7 @@ EOM - set state1 to "new_state1" (was "current_state1") - update default_identity1 - set state2 to "new_state2" (was "current_state2") -EOM + EOM end end @@ -422,7 +422,7 @@ EOM * #{resource_name}[blah] action create - update default_identity1 - set state2 to "new_state2" (was "current_state2") -EOM + EOM end end @@ -441,7 +441,7 @@ EOM expect(resource.updated?).to be_falsey expect(converged_recipe.stdout).to eq <<~EOM * #{resource_name}[blah] action create (up to date) -EOM + EOM end end @@ -461,7 +461,7 @@ EOM * #{resource_name}[blah] action create - update default_identity1 - set sensitive1 to (suppressed sensitive property) -EOM + EOM end end end @@ -489,7 +489,7 @@ EOM - set state2 to "default_state2" (default value) - create default_identity1 - set sensitive1 to (suppressed sensitive property) (default value) -EOM + EOM end end @@ -515,7 +515,7 @@ EOM - set state2 to "new_state2" - create default_identity1 - set sensitive1 to (suppressed sensitive property) -EOM + EOM end end @@ -541,7 +541,7 @@ EOM - set state2 to (suppressed sensitive property) - create default_identity1 - set sensitive1 to (suppressed sensitive property) (default value) -EOM + EOM end end diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb index 58314473e7..12826eb586 100644 --- a/spec/integration/solo/solo_spec.rb +++ b/spec/integration/solo/solo_spec.rb @@ -25,7 +25,7 @@ describe "chef-solo" do before do file "config/solo.rb", <<~EOM chef_repo_path "#{@repository_dir}" -EOM + EOM result = shell_out("ruby bin/chef-solo -c \"#{path_to('config/solo.rb')}\" -l debug", cwd: chef_dir) result.error! end @@ -77,7 +77,7 @@ EOM file "config/solo.rb", <<~EOM cookbook_path "#{path_to('cookbooks')}" file_cache_path "#{path_to('config/cache')}" -EOM + EOM result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir) result.error! expect(result.stdout).to include("ITWORKS") @@ -87,11 +87,11 @@ EOM file "config/solo.rb", <<~EOM cookbook_path "#{path_to('cookbooks')}" file_cache_path "#{path_to('config/cache')}" -EOM + EOM file "config/node.json", <<~E {"run_list":["x::default"]} -E + E result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -j '#{path_to('config/node.json')}' -l debug", cwd: chef_dir) result.error! @@ -113,7 +113,7 @@ E file "config/solo.rb", <<~EOM cookbook_path "#{path_to('cookbooks')}" file_cache_path "#{path_to('config/cache')}" -EOM + EOM result = shell_out("#{chef_solo} -c \"#{path_to('config/solo.rb')}\" -o 'x::default' -l debug", cwd: chef_dir) expect(result.exitstatus).to eq(0) # For CHEF-5120 this becomes 1 expect(result.stdout).to include("WARN: MissingCookbookDependency") @@ -127,7 +127,7 @@ EOM file "config/solo.rb", <<~EOM cookbook_path "#{path_to('cookbooks')}" file_cache_path "#{path_to('config/cache')}" -EOM + EOM end it "should exit with an error" do @@ -144,7 +144,7 @@ EOM file "config/solo.rb", <<~EOM cookbook_path "#{path_to('cookbooks')}" file_cache_path "#{path_to('config/cache')}" -EOM + EOM end it "should exit with an error" do @@ -169,14 +169,14 @@ EOM end end end -EOM + EOM end it "while running solo concurrently" do file "config/solo.rb", <<~EOM cookbook_path "#{path_to('cookbooks')}" file_cache_path "#{path_to('config/cache')}" -EOM + EOM # We have a timeout protection here so that if due to some bug # run_lock gets stuck we can discover it. expect do diff --git a/spec/scripts/ssl-serve.rb b/spec/scripts/ssl-serve.rb index 66e400b6d0..e9f645416c 100644 --- a/spec/scripts/ssl-serve.rb +++ b/spec/scripts/ssl-serve.rb @@ -34,7 +34,7 @@ DEFAULT_OPTIONS = { Host: "localhost", environment: :none, Logger: LOGGER, - DocumentRoot: File.expand_path("#{Dir.tmpdir}/chef-118-sampledata") + DocumentRoot: File.expand_path("#{Dir.tmpdir}/chef-118-sampledata"), #:AccessLog => [] # Remove this option to enable the access log when debugging. }.freeze diff --git a/spec/support/platforms/prof/gc.rb b/spec/support/platforms/prof/gc.rb index b494ff9646..9690e76032 100644 --- a/spec/support/platforms/prof/gc.rb +++ b/spec/support/platforms/prof/gc.rb @@ -24,7 +24,7 @@ module RSpec # GC 1 invokes. # Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC time(ms) # 1 0.012 159240 212940 10647 0.00000000000001530000 - LINE_PATTERN = /^\s+([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)$/ + LINE_PATTERN = /^\s+([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)\s+([\d\.]*)$/.freeze def start ::GC::Profiler.enable unless ::GC::Profiler.enabled? diff --git a/spec/support/shared/functional/http.rb b/spec/support/shared/functional/http.rb index 76faaaed47..7450f28e35 100644 --- a/spec/support/shared/functional/http.rb +++ b/spec/support/shared/functional/http.rb @@ -92,8 +92,8 @@ module ChefHTTPShared # (expected_content should be uncompressed) @api.get("/nyan_cat_content_length_compressed.png", 200, nil, { - "Content-Length" => nyan_compressed_size.to_s, - "Content-Type" => "application/gzip", + "Content-Length" => nyan_compressed_size.to_s, + "Content-Type" => "application/gzip", "Content-Encoding" => "gzip", } ) do @@ -120,8 +120,8 @@ module ChefHTTPShared # (expected_content should be uncompressed) @api.get("/nyan_cat_truncated_compressed.png", 200, nil, { - "Content-Length" => (nyan_compressed_size + 1).to_s, - "Content-Type" => "application/gzip", + "Content-Length" => (nyan_compressed_size + 1).to_s, + "Content-Type" => "application/gzip", "Content-Encoding" => "gzip", } ) do @@ -137,7 +137,7 @@ module ChefHTTPShared # (expected_content should be uncompressed) @api.get("/nyan_cat_transfer_encoding.png", 200, nil, { - "Content-Length" => (nyan_uncompressed_size + 1).to_s, + "Content-Length" => (nyan_uncompressed_size + 1).to_s, "Transfer-Encoding" => "anything", } ) do diff --git a/spec/unit/audit/audit_reporter_spec.rb b/spec/unit/audit/audit_reporter_spec.rb index 60e93a9331..0a023babd0 100644 --- a/spec/unit/audit/audit_reporter_spec.rb +++ b/spec/unit/audit/audit_reporter_spec.rb @@ -103,7 +103,7 @@ describe Chef::Audit::AuditReporter do Chef::Exceptions::AuditError: Audit phase failed with error message: derpderpderp /path/recipe.rb:57 /path/library.rb:106 -EOM + EOM end end @@ -273,7 +273,7 @@ EOM Chef::Exceptions::AuditError: Audit phase failed with error message: derpderpderp /path/recipe.rb:57 /path/library.rb:106 -EOM + EOM end end end diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb index 1d9dd54290..54bd7eab55 100644 --- a/spec/unit/client_spec.rb +++ b/spec/unit/client_spec.rb @@ -412,7 +412,7 @@ describe Chef::Client do let(:required_recipe) do <<~EOM fake_recipe_variable = "for reals" -EOM + EOM end context "when required_recipe is configured" do @@ -431,7 +431,7 @@ EOM let(:required_recipe) do <<~EOM this is not a recipe -EOM + EOM end it "should not raise an error" do expect { client.load_required_recipe(rest, run_context) }.not_to raise_error() diff --git a/spec/unit/cookbook/synchronizer_spec.rb b/spec/unit/cookbook/synchronizer_spec.rb index 8421b1ffd1..1291b230c1 100644 --- a/spec/unit/cookbook/synchronizer_spec.rb +++ b/spec/unit/cookbook/synchronizer_spec.rb @@ -63,7 +63,7 @@ describe Chef::CookbookSynchronizer do { "path" => "recipes/default.rb", "name" => "recipes/default.rb", - "url" => "http://chef.example.com/abc123", + "url" => "http://chef.example.com/abc123", "checksum" => "abc123", } end @@ -72,7 +72,7 @@ describe Chef::CookbookSynchronizer do { "path" => "attributes/default.rb", "name" => "attributes/default.rb", - "url" => "http://chef.example.com/abc456", + "url" => "http://chef.example.com/abc456", "checksum" => "abc456", } end diff --git a/spec/unit/cookbook_manifest_spec.rb b/spec/unit/cookbook_manifest_spec.rb index 417a067451..b28ab573c5 100644 --- a/spec/unit/cookbook_manifest_spec.rb +++ b/spec/unit/cookbook_manifest_spec.rb @@ -89,10 +89,10 @@ describe Chef::CookbookManifest do { "chef_type" => "cookbook_version", - "name" => "tatft-1.2.3", - "version" => "1.2.3", + "name" => "tatft-1.2.3", + "version" => "1.2.3", "cookbook_name" => "tatft", - "metadata" => metadata, + "metadata" => metadata, "frozen?" => false, @@ -129,9 +129,9 @@ describe Chef::CookbookManifest do end { - "name" => name, - "path" => relative_path, - "checksum" => Chef::Digester.generate_md5_checksum_for_file(path), + "name" => name, + "path" => relative_path, + "checksum" => Chef::Digester.generate_md5_checksum_for_file(path), "specificity" => "default", }.tap do |fp| if full @@ -145,10 +145,10 @@ describe Chef::CookbookManifest do { "chef_type" => "cookbook_version", - "name" => "tatft-1.2.3", - "version" => "1.2.3", + "name" => "tatft-1.2.3", + "version" => "1.2.3", "cookbook_name" => "tatft", - "metadata" => metadata, + "metadata" => metadata, "frozen?" => false, diff --git a/spec/unit/cookbook_uploader_spec.rb b/spec/unit/cookbook_uploader_spec.rb index 26e8d28454..2adecfaa82 100644 --- a/spec/unit/cookbook_uploader_spec.rb +++ b/spec/unit/cookbook_uploader_spec.rb @@ -96,8 +96,8 @@ describe Chef::CookbookUploader do upload_headers = { "content-type" => "application/x-binary", - "content-md5" => an_instance_of(String), - "accept" => "application/json", + "content-md5" => an_instance_of(String), + "accept" => "application/json", } expect(http_client).to receive(:put) diff --git a/spec/unit/cookbook_version_spec.rb b/spec/unit/cookbook_version_spec.rb index 83fb3f578f..3dff9e94d8 100644 --- a/spec/unit/cookbook_version_spec.rb +++ b/spec/unit/cookbook_version_spec.rb @@ -45,12 +45,12 @@ describe Chef::CookbookVersion do end describe "with a cookbook directory named tatft" do - MD5 = /[0-9a-f]{32}/ + MD5 = /[0-9a-f]{32}/.freeze let(:cookbook_paths_by_type) do { # Dunno if the paths here are representitive of what is set by CookbookLoader... - all_files: Dir[File.join(cookbook_root, "**", "**")], + all_files: Dir[File.join(cookbook_root, "**", "**")], } end @@ -117,7 +117,7 @@ describe Chef::CookbookVersion do let(:cookbook_paths_by_type) do { - all_files: Dir[File.join(cookbook_root, "**", "**")], + all_files: Dir[File.join(cookbook_root, "**", "**")], } end diff --git a/spec/unit/environment_spec.rb b/spec/unit/environment_spec.rb index 483ee615a2..1841707c2d 100644 --- a/spec/unit/environment_spec.rb +++ b/spec/unit/environment_spec.rb @@ -104,8 +104,8 @@ describe Chef::Environment do describe "cookbook_versions" do before(:each) do @cookbook_versions = { - "apt" => "= 1.0.0", - "god" => "= 2.0.0", + "apt" => "= 1.0.0", + "god" => "= 2.0.0", "apache2" => "= 4.2.0", } end @@ -243,8 +243,8 @@ describe Chef::Environment do describe "self.validate_cookbook_versions" do before(:each) do @cookbook_versions = { - "apt" => "= 1.0.0", - "god" => "= 2.0.0", + "apt" => "= 1.0.0", + "god" => "= 2.0.0", "apache2" => "= 4.2.0", } end diff --git a/spec/unit/http/authenticator_spec.rb b/spec/unit/http/authenticator_spec.rb index 4a919ad492..a2d4cb4815 100644 --- a/spec/unit/http/authenticator_spec.rb +++ b/spec/unit/http/authenticator_spec.rb @@ -108,7 +108,7 @@ describe Chef::HTTP::Authenticator do wxpGV4dGtdcahwXNE4601aXPra+xPcRd2puCNoEDBzgVuTSsLYeKBDMSfs173W1Q YwIDAQAB -----END PUBLIC KEY----- -EOH + EOH let(:class_instance) { Chef::HTTP::Authenticator.new(client_name: "test", raw_key: public_key, ssh_agent_signing: true) } diff --git a/spec/unit/http/socketless_chef_zero_client_spec.rb b/spec/unit/http/socketless_chef_zero_client_spec.rb index 4f3aed13c5..4bbc4f6768 100644 --- a/spec/unit/http/socketless_chef_zero_client_spec.rb +++ b/spec/unit/http/socketless_chef_zero_client_spec.rb @@ -38,13 +38,13 @@ describe Chef::HTTP::SocketlessChefZeroClient do let(:expected_rack_req) do { - "SCRIPT_NAME" => "", - "SERVER_NAME" => "localhost", - "REQUEST_METHOD" => method.to_s.upcase, - "PATH_INFO" => uri.path, - "QUERY_STRING" => uri.query, - "SERVER_PORT" => uri.port, - "HTTP_HOST" => "localhost:#{uri.port}", + "SCRIPT_NAME" => "", + "SERVER_NAME" => "localhost", + "REQUEST_METHOD" => method.to_s.upcase, + "PATH_INFO" => uri.path, + "QUERY_STRING" => uri.query, + "SERVER_PORT" => uri.port, + "HTTP_HOST" => "localhost:#{uri.port}", "rack.url_scheme" => "chefzero", } end @@ -137,16 +137,16 @@ describe Chef::HTTP::SocketlessChefZeroClient do let(:expected_rack_req) do { - "SCRIPT_NAME" => "", - "SERVER_NAME" => "localhost", - "REQUEST_METHOD" => method.to_s.upcase, - "PATH_INFO" => uri.path, - "QUERY_STRING" => uri.query, - "SERVER_PORT" => uri.port, - "HTTP_HOST" => "localhost:#{uri.port}", + "SCRIPT_NAME" => "", + "SERVER_NAME" => "localhost", + "REQUEST_METHOD" => method.to_s.upcase, + "PATH_INFO" => uri.path, + "QUERY_STRING" => uri.query, + "SERVER_PORT" => uri.port, + "HTTP_HOST" => "localhost:#{uri.port}", "HTTP_X_OPS_SERVER_API_VERSION" => "2", "rack.url_scheme" => "chefzero", - "rack.input" => an_instance_of(StringIO), + "rack.input" => an_instance_of(StringIO), } end diff --git a/spec/unit/key_spec.rb b/spec/unit/key_spec.rb index ea2eae3df7..63c5982137 100644 --- a/spec/unit/key_spec.rb +++ b/spec/unit/key_spec.rb @@ -34,7 +34,7 @@ describe Chef::Key do Tfuc9dUYsFjptWYrV6pfEQ+bgo1OGBXORBFcFL+2D7u9JYquKrMgosznHoEkQNLo 0wIDAQAB -----END PUBLIC KEY----- -EOS + EOS end shared_examples_for "fields with username type validation" do diff --git a/spec/unit/knife/cookbook_upload_spec.rb b/spec/unit/knife/cookbook_upload_spec.rb index ba0d57c5d6..8bff31197c 100644 --- a/spec/unit/knife/cookbook_upload_spec.rb +++ b/spec/unit/knife/cookbook_upload_spec.rb @@ -172,7 +172,7 @@ describe Chef::Knife::CookbookUpload do before(:each) do cookbook.metadata.depends("dependency") allow(cookbook_loader).to receive(:[]) do |ckbk| - { "test_cookbook" => cookbook, + { "test_cookbook" => cookbook, "dependency" => cookbook_dependency }[ckbk] end allow(knife).to receive(:cookbook_names).and_return(%w{cookbook_dependency test_cookbook}) @@ -198,7 +198,7 @@ describe Chef::Knife::CookbookUpload do cookbook_dependency2 = Chef::CookbookVersion.new("dependency2") cookbook.metadata.depends("dependency2") allow(cookbook_loader).to receive(:[]) do |ckbk| - { "test_cookbook" => cookbook, + { "test_cookbook" => cookbook, "dependency" => cookbook_dependency, "dependency2" => cookbook_dependency2 }[ckbk] end diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb index bd48709a93..5aa176557f 100644 --- a/spec/unit/knife/core/bootstrap_context_spec.rb +++ b/spec/unit/knife/core/bootstrap_context_spec.rb @@ -75,7 +75,7 @@ describe Chef::Knife::Core::BootstrapContext do log_level :info log_location "/tmp/log" # Using default node name (fqdn) -EXPECTED + EXPECTED expect(bootstrap_context.config_content).to eq expected end diff --git a/spec/unit/knife/core/cookbook_scm_repo_spec.rb b/spec/unit/knife/core/cookbook_scm_repo_spec.rb index a530dbcdaa..a72c184f19 100644 --- a/spec/unit/knife/core/cookbook_scm_repo_spec.rb +++ b/spec/unit/knife/core/cookbook_scm_repo_spec.rb @@ -35,7 +35,7 @@ describe Chef::Knife::CookbookSCMRepo do chef-vendor-graphite chef-vendor-python chef-vendor-absent-new -BRANCHES + BRANCHES end it "has a path to the cookbook repo" do @@ -84,7 +84,7 @@ BRANCHES @dirty_status = Mixlib::ShellOut.new @dirty_status.stdout.replace(<<-DIRTY) M chef/lib/chef/knife/cookbook_site_install.rb -DIRTY + DIRTY expect(@cookbook_repo).to receive(:shell_out!).with("git status --porcelain", cwd: @repo_path).and_return(@dirty_status) expect { @cookbook_repo.sanity_check }.to raise_error(SystemExit) end diff --git a/spec/unit/knife/core/node_editor_spec.rb b/spec/unit/knife/core/node_editor_spec.rb index a3dd63177d..ccf6776593 100644 --- a/spec/unit/knife/core/node_editor_spec.rb +++ b/spec/unit/knife/core/node_editor_spec.rb @@ -24,10 +24,10 @@ describe Chef::Knife::NodeEditor do { "name" => "test_node", "chef_environment" => "production", "automatic" => { "foo" => "bar" }, - "default" => { "alpha" => { "bravo" => "charlie", "delta" => "echo" } }, - "normal" => { "alpha" => { "bravo" => "hotel" }, "tags" => [] }, - "override" => { "alpha" => { "bravo" => "foxtrot", "delta" => "golf" } }, - "policy_name" => nil, + "default" => { "alpha" => { "bravo" => "charlie", "delta" => "echo" } }, + "normal" => { "alpha" => { "bravo" => "hotel" }, "tags" => [] }, + "override" => { "alpha" => { "bravo" => "foxtrot", "delta" => "golf" } }, + "policy_name" => nil, "policy_group" => nil, "run_list" => %w{role[comedy] role[drama] recipe[mystery]}, } diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb index 025c1ecd91..e5f19a4837 100644 --- a/spec/unit/knife/core/ui_spec.rb +++ b/spec/unit/knife/core/ui_spec.rb @@ -214,7 +214,7 @@ describe Chef::Knife::UI do expect(@out.string).to eq <<~EOM hi: a lo: b -EOM + EOM end it "formats empty hashes appropriately" do @@ -227,7 +227,7 @@ EOM expect(@out.string).to eq <<~EOM a b -EOM + EOM end it "formats empty arrays appropriately" do @@ -253,7 +253,7 @@ EOM c d -EOM + EOM end it "formats nested arrays with single- and empty subarrays appropriately" do @@ -267,7 +267,7 @@ EOM d e -EOM + EOM end it "formats arrays of hashes with extra lines in between for readability" do @@ -280,7 +280,7 @@ EOM m: n o: p -EOM + EOM end it "formats hashes with empty array members appropriately" do @@ -288,7 +288,7 @@ EOM expect(@out.string).to eq <<~EOM a: b: c -EOM + EOM end it "formats hashes with single-member array values appropriately" do @@ -296,7 +296,7 @@ EOM expect(@out.string).to eq <<~EOM a: foo b: c -EOM + EOM end it "formats hashes with array members appropriately" do @@ -306,7 +306,7 @@ EOM foo bar b: c -EOM + EOM end it "formats hashes with single-member nested array values appropriately" do @@ -315,7 +315,7 @@ EOM a: foo b: c -EOM + EOM end it "formats hashes with nested array values appropriately" do @@ -332,7 +332,7 @@ EOM aa: bb cc: dd b: c -EOM + EOM end it "formats hashes with empty hash values appropriately" do @@ -340,7 +340,7 @@ EOM expect(@out.string).to eq <<~EOM a: b: c -EOM + EOM end end diff --git a/spec/unit/knife/ssl_check_spec.rb b/spec/unit/knife/ssl_check_spec.rb index 9092110b95..58eae312f6 100644 --- a/spec/unit/knife/ssl_check_spec.rb +++ b/spec/unit/knife/ssl_check_spec.rb @@ -69,10 +69,10 @@ describe Chef::Knife::SslCheck do expect { ssl_check.run }.to raise_error(SystemExit) expected_stdout = <<~E USAGE: knife ssl check [URL] (options) -E + E expected_stderr = <<~E ERROR: Given URI: `foo.test' is invalid -E + E expect(stdout_io.string).to eq(expected_stdout) expect(stderr_io.string).to eq(expected_stderr) end @@ -85,10 +85,10 @@ E expect { ssl_check.run }.to raise_error(SystemExit) expected_stdout = <<~E USAGE: knife ssl check [URL] (options) -E + E expected_stderr = <<~E ERROR: Given URI: `#{name_args[0]}' is invalid -E + E expect(stdout_io.string).to eq(expected_stdout) expect(stderr_io.string).to eq(expected_stderr) end diff --git a/spec/unit/knife/ssl_fetch_spec.rb b/spec/unit/knife/ssl_fetch_spec.rb index 45dd27ceec..fb904074b3 100644 --- a/spec/unit/knife/ssl_fetch_spec.rb +++ b/spec/unit/knife/ssl_fetch_spec.rb @@ -70,10 +70,10 @@ describe Chef::Knife::SslFetch do expect { ssl_fetch.run }.to raise_error(SystemExit) expected_stdout = <<~E USAGE: knife ssl fetch [URL] (options) -E + E expected_stderr = <<~E ERROR: Given URI: `foo.test' is invalid -E + E expect(stdout_io.string).to eq(expected_stdout) expect(stderr_io.string).to eq(expected_stderr) end @@ -86,10 +86,10 @@ E expect { ssl_fetch.run }.to raise_error(SystemExit) expected_stdout = <<~E USAGE: knife ssl fetch [URL] (options) -E + E expected_stderr = <<~E ERROR: Given URI: `#{name_args[0]}' is invalid -E + E expect(stdout_io.string).to eq(expected_stdout) expect(stderr_io.string).to eq(expected_stderr) end @@ -190,7 +190,7 @@ E expected_error_text = <<~ERROR_TEXT ERROR: The service at the given URI (http://foo.example.com) does not accept SSL connections ERROR: Perhaps you meant to connect to 'https://foo.example.com'? -ERROR_TEXT + ERROR_TEXT run expect(stderr).to include(expected_error_text) diff --git a/spec/unit/knife/supermarket_download_spec.rb b/spec/unit/knife/supermarket_download_spec.rb index 0332bd4390..71120007e3 100644 --- a/spec/unit/knife/supermarket_download_spec.rb +++ b/spec/unit/knife/supermarket_download_spec.rb @@ -31,8 +31,8 @@ describe Chef::Knife::SupermarketDownload do @cookbook_api_url = "https://supermarket.chef.io/api/v1/cookbooks" @version = "1.0.2" @version_us = @version.tr ".", "_" - @current_data = { "deprecated" => false, - "latest_version" => "#{@cookbook_api_url}/apache2/versions/#{@version_us}", + @current_data = { "deprecated" => false, + "latest_version" => "#{@cookbook_api_url}/apache2/versions/#{@version_us}", "replacement" => "other_apache2" } allow(@knife.ui).to receive(:stderr).and_return(@stderr) @@ -60,7 +60,7 @@ describe Chef::Knife::SupermarketDownload do context "when" do before do @cookbook_data = { "version" => @version, - "file" => "http://example.com/apache2_#{@version_us}.tgz" } + "file" => "http://example.com/apache2_#{@version_us}.tgz" } @temp_file = double( path: "/tmp/apache2_#{@version_us}.tgz" ) @file = File.join(Dir.pwd, "apache2-#{@version}.tar.gz") end @@ -125,7 +125,7 @@ describe Chef::Knife::SupermarketDownload do @version = "1.0.1" @version_us = @version.tr ".", "_" @cookbook_data = { "version" => @version, - "file" => "http://example.com/apache2_#{@version_us}.tgz" } + "file" => "http://example.com/apache2_#{@version_us}.tgz" } @temp_file = double(path: "/tmp/apache2_#{@version_us}.tgz") @file = File.join(Dir.pwd, "apache2-#{@version}.tar.gz") @knife.name_args << @version diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb index 67251b2cd9..d727501b60 100644 --- a/spec/unit/knife_spec.rb +++ b/spec/unit/knife_spec.rb @@ -576,7 +576,7 @@ describe Chef::Knife do Use `knife ssl check` to troubleshoot your SSL configuration. If your Chef Server uses a self-signed certificate, you can use `knife ssl fetch` to make knife trust the server's certificates. -MSG + MSG expect(stderr.string).to include(expected_message) end diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb index a22060b25f..4f8e4dafac 100644 --- a/spec/unit/mixin/shell_out_spec.rb +++ b/spec/unit/mixin/shell_out_spec.rb @@ -72,11 +72,11 @@ describe Chef::Mixin::ShellOut do options = { environment: { "HOME" => "/Users/morty" } } expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, { environment: { - "HOME" => "/Users/morty", - "LC_ALL" => Chef::Config[:internal_locale], - "LANG" => Chef::Config[:internal_locale], + "HOME" => "/Users/morty", + "LC_ALL" => Chef::Config[:internal_locale], + "LANG" => Chef::Config[:internal_locale], "LANGUAGE" => Chef::Config[:internal_locale], - env_path => sanitized_path, + env_path => sanitized_path, }, }).and_return(retobj) shell_out_obj.send(method, cmd, options) @@ -86,11 +86,11 @@ describe Chef::Mixin::ShellOut do options = { environment: { "HOME" => "/Users/morty" } } expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, { environment: { - "HOME" => "/Users/morty", - "LC_ALL" => Chef::Config[:internal_locale], - "LANG" => Chef::Config[:internal_locale], + "HOME" => "/Users/morty", + "LC_ALL" => Chef::Config[:internal_locale], + "LANG" => Chef::Config[:internal_locale], "LANGUAGE" => Chef::Config[:internal_locale], - env_path => sanitized_path, + env_path => sanitized_path, }, }).and_return(retobj) shell_out_obj.send(method, cmd, options) @@ -115,11 +115,11 @@ describe Chef::Mixin::ShellOut do options = { env: { "HOME" => "/Users/morty" } } expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, { env: { - "HOME" => "/Users/morty", - "LC_ALL" => Chef::Config[:internal_locale], - "LANG" => Chef::Config[:internal_locale], + "HOME" => "/Users/morty", + "LC_ALL" => Chef::Config[:internal_locale], + "LANG" => Chef::Config[:internal_locale], "LANGUAGE" => Chef::Config[:internal_locale], - env_path => sanitized_path, + env_path => sanitized_path, }, }).and_return(retobj) shell_out_obj.send(method, cmd, options) @@ -129,11 +129,11 @@ describe Chef::Mixin::ShellOut do options = { env: { "HOME" => "/Users/morty" } } expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, { env: { - "HOME" => "/Users/morty", - "LC_ALL" => Chef::Config[:internal_locale], - "LANG" => Chef::Config[:internal_locale], + "HOME" => "/Users/morty", + "LC_ALL" => Chef::Config[:internal_locale], + "LANG" => Chef::Config[:internal_locale], "LANGUAGE" => Chef::Config[:internal_locale], - env_path => sanitized_path, + env_path => sanitized_path, }, }).and_return(retobj) shell_out_obj.send(method, cmd, options) @@ -147,10 +147,10 @@ describe Chef::Mixin::ShellOut do expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, { user: "morty", environment: { - "LC_ALL" => Chef::Config[:internal_locale], - "LANG" => Chef::Config[:internal_locale], + "LC_ALL" => Chef::Config[:internal_locale], + "LANG" => Chef::Config[:internal_locale], "LANGUAGE" => Chef::Config[:internal_locale], - env_path => sanitized_path, + env_path => sanitized_path, }, }).and_return(retobj) shell_out_obj.send(method, cmd, options) @@ -162,10 +162,10 @@ describe Chef::Mixin::ShellOut do it "should set environment language settings to the configured internal locale" do expect(Chef::Mixin::ShellOut).to receive(:shell_out_command).with(cmd, { environment: { - "LC_ALL" => Chef::Config[:internal_locale], - "LANG" => Chef::Config[:internal_locale], + "LC_ALL" => Chef::Config[:internal_locale], + "LANG" => Chef::Config[:internal_locale], "LANGUAGE" => Chef::Config[:internal_locale], - env_path => sanitized_path, + env_path => sanitized_path, }, }).and_return(retobj) shell_out_obj.send(method, cmd) diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb index c6fdf1e1c2..0f97a23ced 100644 --- a/spec/unit/node/attribute_spec.rb +++ b/spec/unit/node/attribute_spec.rb @@ -63,16 +63,16 @@ describe Chef::Node::Attribute do "mtu" => "1280", "type" => "gif", "encapsulation" => "IPIP" }, - "vmnet8" => { "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, - "number" => "8", - "addresses" => { "192.168.4.1" => { "broadcast" => "192.168.4.255", - "netmask" => "255.255.255.0", - "family" => "inet" }, - "00:50:56:c0:00:08" => { "family" => "lladdr" } }, - "mtu" => "1500", - "type" => "vmnet", - "arp" => { "192.168.4.255" => "ff:ff:ff:ff:ff:ff" }, - "encapsulation" => "Ethernet" }, + "vmnet8" => { "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, + "number" => "8", + "addresses" => { "192.168.4.1" => { "broadcast" => "192.168.4.255", + "netmask" => "255.255.255.0", + "family" => "inet" }, + "00:50:56:c0:00:08" => { "family" => "lladdr" } }, + "mtu" => "1500", + "type" => "vmnet", + "arp" => { "192.168.4.255" => "ff:ff:ff:ff:ff:ff" }, + "encapsulation" => "Ethernet" }, "en0" => { "status" => "inactive", "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, "number" => "0", @@ -81,8 +81,8 @@ describe Chef::Node::Attribute do "media" => { "supported" => { "autoselect" => { "options" => [] }, "none" => { "options" => [] }, "1000baseT" => { "options" => ["full-duplex", "flow-control", "hw-loopback"] }, - "10baseT/UTP" => { "options" => ["half-duplex", "full-duplex", "flow-control", "hw-loopback"] }, - "100baseTX" => { "options" => ["half-duplex", "full-duplex", "flow-control", "hw-loopback"] } }, + "10baseT/UTP" => { "options" => ["half-duplex", "full-duplex", "flow-control", "hw-loopback"] }, + "100baseTX" => { "options" => ["half-duplex", "full-duplex", "flow-control", "hw-loopback"] } }, "selected" => { "autoselect" => { "options" => [] } } }, "type" => "en", "encapsulation" => "Ethernet" }, @@ -118,28 +118,28 @@ describe Chef::Node::Attribute do "selected" => { "autoselect" => { "options" => [] } } }, "type" => "en", "encapsulation" => "Ethernet" }, - "fw0" => { "status" => "inactive", - "flags" => %w{BROADCAST SIMPLEX MULTICAST}, - "number" => "0", - "addresses" => { "00:23:32:ff:fe:b0:32:f2" => { "family" => "lladdr" } }, - "mtu" => "4078", - "media" => { "supported" => { "autoselect" => { "options" => ["full-duplex"] } }, - "selected" => { "autoselect" => { "options" => ["full-duplex"] } } }, - "type" => "fw", - "encapsulation" => "1394" }, - "en3" => { "status" => "active", - "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, - "number" => "3", - "addresses" => { "169.254.206.152" => { "broadcast" => "169.254.255.255", - "netmask" => "255.255.0.0", - "family" => "inet" }, - "00:1c:42:00:00:00" => { "family" => "lladdr" }, - "fe80::21c:42ff:fe00:0" => { "scope" => "Link", "prefixlen" => "64", "family" => "inet6" } }, - "mtu" => "1500", - "media" => { "supported" => { "autoselect" => { "options" => [] } }, - "selected" => { "autoselect" => { "options" => [] } } }, - "type" => "en", - "encapsulation" => "Ethernet" } } }, + "fw0" => { "status" => "inactive", + "flags" => %w{BROADCAST SIMPLEX MULTICAST}, + "number" => "0", + "addresses" => { "00:23:32:ff:fe:b0:32:f2" => { "family" => "lladdr" } }, + "mtu" => "4078", + "media" => { "supported" => { "autoselect" => { "options" => ["full-duplex"] } }, + "selected" => { "autoselect" => { "options" => ["full-duplex"] } } }, + "type" => "fw", + "encapsulation" => "1394" }, + "en3" => { "status" => "active", + "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, + "number" => "3", + "addresses" => { "169.254.206.152" => { "broadcast" => "169.254.255.255", + "netmask" => "255.255.0.0", + "family" => "inet" }, + "00:1c:42:00:00:00" => { "family" => "lladdr" }, + "fe80::21c:42ff:fe00:0" => { "scope" => "Link", "prefixlen" => "64", "family" => "inet6" } }, + "mtu" => "1500", + "media" => { "supported" => { "autoselect" => { "options" => [] } }, + "selected" => { "autoselect" => { "options" => [] } } }, + "type" => "en", + "encapsulation" => "Ethernet" } } }, "fqdn" => "latte.local", "ohai_time" => 1249065590.90391, "domain" => "local", @@ -572,8 +572,8 @@ describe Chef::Node::Attribute do before(:each) do @attributes = Chef::Node::Attribute.new( { - "one" => { "two" => "three" }, - "hut" => { "two" => "three" }, + "one" => { "two" => "three" }, + "hut" => { "two" => "three" }, "place" => {}, }, { @@ -621,11 +621,11 @@ describe Chef::Node::Attribute do before(:each) do @attributes = Chef::Node::Attribute.new( { - "one" => "two", - "hut" => "three", + "one" => "two", + "hut" => "three", }, { - "one" => "four", + "one" => "four", "snakes" => "on a plane", }, { @@ -659,11 +659,11 @@ describe Chef::Node::Attribute do before do @attributes = Chef::Node::Attribute.new( { - "one" => "two", - "hut" => "three", + "one" => "two", + "hut" => "three", }, { - "one" => "four", + "one" => "four", "snakes" => "on a plane", }, { @@ -695,11 +695,11 @@ describe Chef::Node::Attribute do before do @attributes = Chef::Node::Attribute.new( { - "one" => "two", - "hut" => "three", + "one" => "two", + "hut" => "three", }, { - "one" => "four", + "one" => "four", "snakes" => "on a plane", }, { @@ -731,11 +731,11 @@ describe Chef::Node::Attribute do before do @attributes = Chef::Node::Attribute.new( { - "one" => "two", - "hut" => "three", + "one" => "two", + "hut" => "three", }, { - "one" => "four", + "one" => "four", "snakes" => "on a plane", }, { @@ -775,11 +775,11 @@ describe Chef::Node::Attribute do before do @attributes = Chef::Node::Attribute.new( { - "one" => "two", - "hut" => "three", + "one" => "two", + "hut" => "three", }, { - "one" => "four", + "one" => "four", "snakes" => "on a plane", }, { @@ -809,11 +809,11 @@ describe Chef::Node::Attribute do before do @attributes = Chef::Node::Attribute.new( { - "one" => "two", - "hut" => "three", + "one" => "two", + "hut" => "three", }, { - "one" => "four", + "one" => "four", "snakes" => "on a plane", }, { @@ -866,11 +866,11 @@ describe Chef::Node::Attribute do before do @attributes = Chef::Node::Attribute.new( { - "one" => "two", - "hut" => "three", + "one" => "two", + "hut" => "three", }, { - "one" => "four", + "one" => "four", "snakes" => "on a plane", }, { @@ -911,11 +911,11 @@ describe Chef::Node::Attribute do before do @attributes = Chef::Node::Attribute.new( { - "one" => "two", - "hut" => "three", + "one" => "two", + "hut" => "three", }, { - "one" => "four", + "one" => "four", "snakes" => "on a plane", }, { @@ -952,11 +952,11 @@ describe Chef::Node::Attribute do before do @attributes = Chef::Node::Attribute.new( { - "one" => "two", - "hut" => "three", + "one" => "two", + "hut" => "three", }, { - "one" => "four", + "one" => "four", "snakes" => "on a plane", }, { @@ -988,11 +988,11 @@ describe Chef::Node::Attribute do before do @attributes = Chef::Node::Attribute.new( { - "one" => "two", - "hut" => "three", + "one" => "two", + "hut" => "three", }, { - "one" => "four", + "one" => "four", "snakes" => "on a plane", }, { @@ -1038,11 +1038,11 @@ describe Chef::Node::Attribute do before do @attributes = Chef::Node::Attribute.new( { - "one" => "two", - "hut" => "three", + "one" => "two", + "hut" => "three", }, { - "one" => "four", + "one" => "four", "snakes" => "on a plane", }, { diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index 4c056ca349..37dc27ec0f 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -1477,7 +1477,7 @@ describe Chef::Node do data = { "automatic" => { "filesystem" => { - "/dev/disk0s2" => { "size" => "10mb" }, + "/dev/disk0s2" => { "size" => "10mb" }, "map - autohome" => { "size" => "10mb" }, }, "network" => { @@ -1550,7 +1550,7 @@ describe Chef::Node do data = { "automatic" => { "filesystem" => { - "/dev/disk0s2" => { "size" => "10mb" }, + "/dev/disk0s2" => { "size" => "10mb" }, "map - autohome" => { "size" => "10mb" }, }, }, @@ -1578,7 +1578,7 @@ describe Chef::Node do data = { "automatic" => { "filesystem" => { - "/dev/disk0s2" => { "size" => "10mb" }, + "/dev/disk0s2" => { "size" => "10mb" }, "map - autohome" => { "size" => "10mb" }, }, "network" => { @@ -1616,7 +1616,7 @@ describe Chef::Node do data = { "automatic" => { "filesystem" => { - "/dev/disk0s2" => { "size" => "10mb" }, + "/dev/disk0s2" => { "size" => "10mb" }, "map - autohome" => { "size" => "10mb" }, }, }, @@ -1626,7 +1626,7 @@ describe Chef::Node do selected_data = { "automatic" => { "filesystem" => { - "/dev/disk0s2" => { "size" => "10mb" }, + "/dev/disk0s2" => { "size" => "10mb" }, "map - autohome" => { "size" => "10mb" }, }, }, diff --git a/spec/unit/provider/cron_spec.rb b/spec/unit/provider/cron_spec.rb index 03e3599b35..98c525762b 100644 --- a/spec/unit/provider/cron_spec.rb +++ b/spec/unit/provider/cron_spec.rb @@ -51,7 +51,7 @@ describe Chef::Provider::Cron do 2 * 1 * * /bin/false # Another comment -CRONTAB + CRONTAB end it "should set cron_exists" do @@ -80,7 +80,7 @@ CRONTAB 2 * 1 * * /bin/false # Another comment -CRONTAB + CRONTAB cron = @provider.load_current_resource expect(cron.mailto).to eq("foo@example.com") expect(cron.shell).to eq("/bin/foosh") @@ -97,7 +97,7 @@ CRONTAB TEST=lol FLAG=1 @reboot /bin/true -CRONTAB + CRONTAB cron = @provider.load_current_resource expect(cron.mailto).to eq("warn@example.com") @@ -112,7 +112,7 @@ CRONTAB TEST=lol ENVIRONMENT=production @reboot /bin/true -CRONTAB + CRONTAB cron = @provider.load_current_resource expect(cron.time).to eq(:reboot) @@ -175,7 +175,7 @@ CRONTAB * 5 * * * /bin/true # Another comment -CRONTAB + CRONTAB end it "should not set cron_exists or cron_empty" do @@ -193,7 +193,7 @@ CRONTAB allow(@provider).to receive(:read_crontab).and_return(<<~CRONTAB) # Chef Name: foo[bar] (baz) 21 */4 * * * some_prog 1234567 -CRONTAB + CRONTAB expect do @provider.load_current_resource end.not_to raise_error @@ -211,7 +211,7 @@ CRONTAB 2 * 1 * * /bin/false # Another comment -CRONTAB + CRONTAB end it "should set cron_exists" do @@ -245,7 +245,7 @@ CRONTAB 2 * 1 * * /bin/false # Another comment -CRONTAB + CRONTAB cron = @provider.load_current_resource expect(cron.mailto).to eq("foo@example.com") expect(cron.shell).to eq("/bin/foosh") @@ -267,7 +267,7 @@ CRONTAB TEST=lol FLAG=1 * 5 * * * /bin/true -CRONTAB + CRONTAB cron = @provider.load_current_resource expect(cron.mailto).to eq("warn@example.com") @@ -282,7 +282,7 @@ CRONTAB TEST=lol ENVIRONMENT=production * 5 * * * /bin/true -CRONTAB + CRONTAB cron = @provider.load_current_resource expect(cron.minute).to eq("*") @@ -307,7 +307,7 @@ CRONTAB 2 * 1 * * /bin/false # Another comment -CRONTAB + CRONTAB end it "should set cron_exists" do @@ -338,7 +338,7 @@ CRONTAB 0 2 * * * /some/other/command # Chef Name: cronhole some stuff -CRONTAB + CRONTAB cron = @provider.load_current_resource expect(@provider.cron_exists).to eq(true) expect(cron.minute).to eq("*") @@ -356,7 +356,7 @@ CRONTAB # Chef Name: cronhole some stuff #* 5 * 1 * /bin/true param1 param2 -CRONTAB + CRONTAB cron = @provider.load_current_resource expect(@provider.cron_exists).to eq(true) expect(cron.minute).to eq("*") @@ -378,7 +378,7 @@ CRONTAB 2 * 1 * * /bin/false # Another comment -CRONTAB + CRONTAB cron = @provider.load_current_resource expect(@provider.cron_exists).to eq(true) expect(cron.minute).to eq("*") @@ -700,7 +700,7 @@ CRONTAB * 5 * * * /bin/true # Another comment -CRONTAB + CRONTAB end it "should not update the crontab" do diff --git a/spec/unit/provider/execute_spec.rb b/spec/unit/provider/execute_spec.rb index 9718a012da..11eb70e396 100644 --- a/spec/unit/provider/execute_spec.rb +++ b/spec/unit/provider/execute_spec.rb @@ -30,11 +30,11 @@ describe Chef::Provider::Execute do let(:opts) do { - timeout: 3600, - returns: 0, - log_level: :info, - default_env: false, - log_tag: new_resource.to_s, + timeout: 3600, + returns: 0, + log_level: :info, + default_env: false, + log_tag: new_resource.to_s, } end diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb index 4a6266b58a..b1409ee1f4 100644 --- a/spec/unit/provider/git_spec.rb +++ b/spec/unit/provider/git_spec.rb @@ -259,7 +259,7 @@ describe Chef::Provider::Git do d7b9957f67236fa54e660cc3ab45ffecd6e0ba38\trefs/tags/0.7.8 b7d19519a1c15f1c1a324e2683bd728b6198ce5a\trefs/tags/0.7.8^{} ebc1b392fe7e8f0fbabc305c299b4d365d2b4d9b\trefs/tags/chef-server-package -SHAS + SHAS @resource.revision "" expect(@provider).to receive(:shell_out!).with(@git_ls_remote + "\"HEAD\"", { log_tag: "git[web2.0 app]" }).and_return(double("ShellOut result", stdout: @stdout)) expect(@provider.target_revision).to eql("28af684d8460ba4793eda3e7ac238c864a5d029a") diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb index 8bd6485740..94322a89f9 100644 --- a/spec/unit/provider/group/dscl_spec.rb +++ b/spec/unit/provider/group/dscl_spec.rb @@ -120,7 +120,7 @@ describe Chef::Provider::Group::Dscl do someprogram somethingElse:gid = ( 500 ) - EOS + EOS ) end @@ -322,7 +322,7 @@ describe "Test DSCL loading" do RecordName: com.apple.aj RecordType: dsRecTypeStandard:Groups GroupMembership: waka bar -EOF + EOF allow(@provider).to receive(:safe_dscl).with(*"read /Groups/aj".split(" ")).and_return(@output) @current_resource = @provider.load_current_resource diff --git a/spec/unit/provider/ifconfig/aix_spec.rb b/spec/unit/provider/ifconfig/aix_spec.rb index 6acfddbedb..8baf3e437d 100644 --- a/spec/unit/provider/ifconfig/aix_spec.rb +++ b/spec/unit/provider/ifconfig/aix_spec.rb @@ -32,7 +32,7 @@ describe Chef::Provider::Ifconfig::Aix do lo0: flags=e08084b,c0<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,LARGESEND,CHAIN> inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255 inet6 ::1%1/0 -IFCONFIG + IFCONFIG end before(:each) do diff --git a/spec/unit/provider/ifconfig/debian_spec.rb b/spec/unit/provider/ifconfig/debian_spec.rb index 93b0008e8b..308435dea2 100644 --- a/spec/unit/provider/ifconfig/debian_spec.rb +++ b/spec/unit/provider/ifconfig/debian_spec.rb @@ -123,7 +123,7 @@ describe Chef::Provider::Ifconfig::Debian do a line source #{tempdir_path}/* another line -EOF + EOF end before do @@ -146,7 +146,7 @@ EOF a line another line source #{tempdir_path}/* -EOF + EOF end before do diff --git a/spec/unit/provider/ifconfig_spec.rb b/spec/unit/provider/ifconfig_spec.rb index 8c63a3e46e..5b1256300e 100644 --- a/spec/unit/provider/ifconfig_spec.rb +++ b/spec/unit/provider/ifconfig_spec.rb @@ -44,7 +44,7 @@ describe Chef::Provider::Ifconfig do let(:net_tools_version) { StringIO.new <<~EOS } net-tools 1.60 ifconfig 1.42 (2001-04-13) -EOS + EOS before do ifconfig = double(stdout: "", exitstatus: 1) diff --git a/spec/unit/provider/launchd_spec.rb b/spec/unit/provider/launchd_spec.rb index 3031ea36c3..8b5edc68b5 100644 --- a/spec/unit/provider/launchd_spec.rb +++ b/spec/unit/provider/launchd_spec.rb @@ -49,7 +49,7 @@ describe Chef::Provider::Launchd do \t<integer>300</integer> </dict> </plist> -XML + XML let(:test_plist_multiple_intervals) { String.new <<~XML } <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> @@ -78,7 +78,7 @@ XML \t<integer>300</integer> </dict> </plist> -XML + XML let(:test_hash) do { @@ -139,7 +139,7 @@ XML it "should allow array of Hashes" do allowed = (1..2).collect do |num| { - "Hour" => 10 + num, + "Hour" => 10 + num, "Weekday" => num, } end @@ -152,11 +152,11 @@ XML it "should allow all StartCalendarInterval keys" do allowed = { - "Minute" => 1, - "Hour" => 1, - "Day" => 1, + "Minute" => 1, + "Hour" => 1, + "Day" => 1, "Weekday" => 1, - "Month" => 1, + "Month" => 1, } new_resource.program "/Library/scripts/call_mom.sh" new_resource.time_out 300 diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb index b472e60710..e1cc140855 100644 --- a/spec/unit/provider/mount/aix_spec.rb +++ b/spec/unit/provider/mount/aix_spec.rb @@ -26,29 +26,29 @@ describe Chef::Provider::Mount::Aix do node mounted mounted over vfs date options -------- --------------- --------------- ------ ------------ --------------- /dev/sdz1 /tmp/foo jfs2 Jul 17 13:22 rw,log=/dev/hd8 -MOUNT + MOUNT @unmounted_output = <<~UNMOUNTED node mounted mounted over vfs date options -------- --------------- --------------- ------ ------------ --------------- /dev/sdz2 / jfs2 Jul 17 13:22 rw,log=/dev/hd8 -UNMOUNTED + UNMOUNTED @conflict_mounted_output = <<~MOUNT node mounted mounted over vfs date options -------- --------------- --------------- ------ ------------ --------------- /dev/sdz3 /tmp/foo jfs2 Jul 17 13:22 rw,log=/dev/hd8 -MOUNT + MOUNT @enabled_output = <<~ENABLED #MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct /tmp/foo:/dev/sdz1:jfs2::bootfs:10485760:rw:yes:no -ENABLED + ENABLED @test_wrong_output = <<~WRONG #MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct /tmp/foo::/dev/sdz1:jfs2:bootfs:10485760:rw:yes:no -WRONG + WRONG end before(:each) do @@ -248,7 +248,7 @@ WRONG vfs = jfs2 mount = true options = rw -ETCFILESYSTEMS + ETCFILESYSTEMS filesystems = StringIO.new allow(::File).to receive(:open).with("/etc/filesystems", "w").and_yield(filesystems) diff --git a/spec/unit/provider/package/ips_spec.rb b/spec/unit/provider/package/ips_spec.rb index 70e1c3fe32..fc249729d1 100644 --- a/spec/unit/provider/package/ips_spec.rb +++ b/spec/unit/provider/package/ips_spec.rb @@ -40,7 +40,7 @@ describe Chef::Provider::Package::Ips do installed on the system. Try specifying -r to query remotely: crypto/gnupg -PKG_STATUS + PKG_STATUS OpenStruct.new(stdout: stdout, stdin: stdin, stderr: stderr, status: @status, exitstatus: 1) end @@ -56,7 +56,7 @@ PKG_STATUS Packaging Date: April 1, 2012 05:55:52 PM Size: 2.57 MB FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z -PKG_STATUS + PKG_STATUS stdin = StringIO.new stderr = "" OpenStruct.new(stdout: stdout, stdin: stdin, stderr: stderr, status: @status, exitstatus: 0) @@ -106,7 +106,7 @@ PKG_STATUS Packaging Date: October 19, 2011 09:14:50 AM Size: 8.07 MB FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z -INSTALLED + INSTALLED expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local) expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "-r", @new_resource.package_name, timeout: 900).and_return(remote_output) @provider.load_current_resource @@ -151,7 +151,7 @@ INSTALLED Packaging Date: April 1, 2012 05:55:52 PM Size: 2.57 MB FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z -PKG_STATUS + PKG_STATUS expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local_output) expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "-r", @new_resource.package_name, timeout: 900).and_return(remote) @provider.load_current_resource @@ -175,7 +175,7 @@ PKG_STATUS Packaging Date: October 19, 2011 09:14:50 AM Size: 8.07 MB FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z -INSTALLED + INSTALLED remote = remote_output remote.stdout = <<~REMOTE Name: crypto/gnupg @@ -191,7 +191,7 @@ INSTALLED Packaging Date: October 19, 2011 09:14:50 AM Size: 8.07 MB FMRI: pkg://solaris/crypto/gnupg@2.0.18,5.11-0.175.0.0.0.2.537:20111019T091450Z -REMOTE + REMOTE expect(@provider).to receive(:shell_out_compacted).with("pkg", "info", @new_resource.package_name, timeout: 900).and_return(local) expect(@provider).to receive(:shell_out_compacted!).with("pkg", "info", "-r", @new_resource.package_name, timeout: 900).and_return(remote) diff --git a/spec/unit/provider/package/macports_spec.rb b/spec/unit/provider/package/macports_spec.rb index 8b75e40d72..e2769fe71d 100644 --- a/spec/unit/provider/package/macports_spec.rb +++ b/spec/unit/provider/package/macports_spec.rb @@ -73,7 +73,7 @@ describe Chef::Provider::Package::Macports do stdout = <<~EOF The following ports are currently installed: openssl @0.9.8k_0 (active) -EOF + EOF status = double(stdout: stdout, exitstatus: 0) expect(@provider).to receive(:shell_out_compacted).and_return(status) diff --git a/spec/unit/provider/package/pacman_spec.rb b/spec/unit/provider/package/pacman_spec.rb index 10bb3492b2..c869992a0f 100644 --- a/spec/unit/provider/package/pacman_spec.rb +++ b/spec/unit/provider/package/pacman_spec.rb @@ -34,7 +34,7 @@ describe Chef::Provider::Package::Pacman do @stdin = StringIO.new @stdout = StringIO.new(<<~ERR) error: package "nano" not found -ERR + ERR @stderr = StringIO.new @pid = 2342 end @@ -86,7 +86,7 @@ ERR Install Reason : Explicitly installed Install Script : Yes Description : Pico editor clone with enhancements -PACMAN + PACMAN status = double(stdout: stdout, exitstatus: 0) allow(@provider).to receive(:shell_out_compacted).and_return(status) @@ -118,7 +118,7 @@ PACMAN [community] Include = /etc/pacman.d/mirrorlist -PACMAN_CONF + PACMAN_CONF status = double(stdout: "customrepo nano 1.2.3-4", exitstatus: 0) allow(::File).to receive(:exist?).with("/etc/pacman.conf").and_return(true) diff --git a/spec/unit/provider/package/paludis_spec.rb b/spec/unit/provider/package/paludis_spec.rb index 10c0d0f7e8..678e2e6301 100644 --- a/spec/unit/provider/package/paludis_spec.rb +++ b/spec/unit/provider/package/paludis_spec.rb @@ -40,7 +40,7 @@ describe Chef::Provider::Package::Paludis do user/ntp 0 accounts user/ntp 0 installed-accounts net/ntp 4.2.6_p5-r1 installed -PKG_STATUS + PKG_STATUS @pid = 12345 @shell_out = OpenStruct.new(stdout: @stdout, stdin: @stdin, stderr: @stderr, status: @status, exitstatus: 0) end @@ -71,7 +71,7 @@ PKG_STATUS user/ntp 0 accounts user/ntp 0 installed-accounts net/ntp 4.2.6_p5-r1 installed -INSTALLED + INSTALLED expect(@provider).to receive(:shell_out_compacted!).and_return(@shell_out) @provider.load_current_resource expect(@current_resource.version).to eq("4.2.6_p5-r1") @@ -100,7 +100,7 @@ INSTALLED @stdout.replace(<<~PKG_STATUS) sys-process/lsof 4.87 arbor sys-process/lsof 4.87 x86_64 -PKG_STATUS + PKG_STATUS expect(@provider).to receive(:shell_out_compacted!).with("cave", "-L", "warning", "resolve", "-x", "=sys-process/lsof-4.87", { timeout: @new_resource.timeout || 900 }) @provider.install_package("sys-process/lsof", "4.87") end @@ -109,7 +109,7 @@ PKG_STATUS @stdout.replace(<<~PKG_STATUS) sys-process/lsof 4.87 arbor sys-process/lsof 4.87 x86_64 -PKG_STATUS + PKG_STATUS expect(@provider).to receive(:shell_out_compacted!).and_return(@shell_out) @provider.load_current_resource expect(@current_resource.version).to be_nil diff --git a/spec/unit/provider/package/portage_spec.rb b/spec/unit/provider/package/portage_spec.rb index e1036bea74..4bfef864ff 100644 --- a/spec/unit/provider/package/portage_spec.rb +++ b/spec/unit/provider/package/portage_spec.rb @@ -138,7 +138,7 @@ describe Chef::Provider::Package::Portage, "load_current_resource" do * dev-python/sphinx Please use a more specific atom. -EOF + EOF status = double(stdout: "", stderr: stderr_output, exitstatus: 1) @provider = Chef::Provider::Package::Portage.new(@new_resource_without_category, @run_context) expect(@provider).to receive(:shell_out_compacted).and_return(status) diff --git a/spec/unit/provider/package/solaris_spec.rb b/spec/unit/provider/package/solaris_spec.rb index 2aa37fe8b3..5fc2d89a81 100644 --- a/spec/unit/provider/package/solaris_spec.rb +++ b/spec/unit/provider/package/solaris_spec.rb @@ -44,7 +44,7 @@ describe Chef::Provider::Package::Solaris do PSTAMP: sfw10-patch20070430084444 INSTDATE: Nov 04 2009 01:02 HOTLINE: Please contact your local service provider -PKGINFO + PKGINFO @status = double("Status", stdout: "", exitstatus: 0) end diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb index a7a9602750..faec7ff645 100644 --- a/spec/unit/provider/service/arch_service_spec.rb +++ b/spec/unit/provider/service/arch_service_spec.rb @@ -121,7 +121,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb -DEFAULT_PS + DEFAULT_PS @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @@ -132,7 +132,7 @@ DEFAULT_PS @stdout = StringIO.new(<<~RUNNING_PS) aj 7842 5057 0 21:26 pts/2 00:00:06 chef aj 7842 5057 0 21:26 pts/2 00:00:06 poos -RUNNING_PS + RUNNING_PS allow(@status).to receive(:stdout).and_return(@stdout) @provider.load_current_resource expect(@provider.current_resource.running).to be_truthy diff --git a/spec/unit/provider/service/freebsd_service_spec.rb b/spec/unit/provider/service/freebsd_service_spec.rb index b4330b976c..d33b97d63d 100644 --- a/spec/unit/provider/service/freebsd_service_spec.rb +++ b/spec/unit/provider/service/freebsd_service_spec.rb @@ -142,7 +142,7 @@ describe Chef::Provider::Service::Freebsd do 413 ?? Ss 0:02.51 /usr/sbin/syslogd -s 539 ?? Is 0:00.14 /usr/sbin/sshd 545 ?? Ss 0:17.53 sendmail: accepting connections (sendmail) -PS_SAMPLE + PS_SAMPLE end let(:status) { double(stdout: stdout, exitstatus: 0) } @@ -344,7 +344,7 @@ PS_SAMPLE StringIO.new(<<~EOF) name="#{new_resource.service_name}" rcvar=`set_rcvar` -EOF + EOF end it "should not raise an exception if the rcscript have a name variable" do @@ -365,7 +365,7 @@ EOF let(:rcscript) do StringIO.new <<~EOF rcvar=`set_rcvar` -EOF + EOF end before do @@ -380,7 +380,7 @@ EOF # # #{new_resource.service_name}_enable="YES" # (default: "") -EOF + EOF end it "should get the service name from rcvar if the rcscript does not have a name variable" do @@ -397,7 +397,7 @@ EOF rcvar_stdout = <<~EOF # service_with_noname # -EOF + EOF end it "should return nil" do diff --git a/spec/unit/provider/service/init_service_spec.rb b/spec/unit/provider/service/init_service_spec.rb index 07668ef8ab..38e9ad37de 100644 --- a/spec/unit/provider/service/init_service_spec.rb +++ b/spec/unit/provider/service/init_service_spec.rb @@ -36,7 +36,7 @@ describe Chef::Provider::Service::Init, "load_current_resource" do aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb -PS + PS @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) end @@ -136,7 +136,7 @@ PS @stdout = StringIO.new(<<~RUNNING_PS) aj 7842 5057 0 21:26 pts/2 00:00:06 chef aj 7842 5057 0 21:26 pts/2 00:00:06 poos -RUNNING_PS + RUNNING_PS allow(@status).to receive(:stdout).and_return(@stdout) @provider.load_current_resource expect(@current_resource.running).to be_truthy diff --git a/spec/unit/provider/service/invokercd_service_spec.rb b/spec/unit/provider/service/invokercd_service_spec.rb index 822062a82b..fb1a29fa43 100644 --- a/spec/unit/provider/service/invokercd_service_spec.rb +++ b/spec/unit/provider/service/invokercd_service_spec.rb @@ -36,7 +36,7 @@ describe Chef::Provider::Service::Invokercd, "load_current_resource" do aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb -PS + PS @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) end @@ -121,7 +121,7 @@ PS @stdout = StringIO.new(<<~RUNNING_PS) aj 7842 5057 0 21:26 pts/2 00:00:06 chef aj 7842 5057 0 21:26 pts/2 00:00:06 poos -RUNNING_PS + RUNNING_PS @status = double("Status", exitstatus: 0, stdout: @stdout) expect(@provider).to receive(:shell_out!).and_return(@status) @provider.load_current_resource diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb index 9864fb0185..e11cf6154e 100644 --- a/spec/unit/provider/service/macosx_spec.rb +++ b/spec/unit/provider/service/macosx_spec.rb @@ -57,7 +57,7 @@ describe Chef::Provider::Service::Macosx do <string>io.redis.redis-server</string> </dict> </plist> -XML + XML %w{Daemon Agent}.each do |service_type| ["redis-server", "io.redis.redis-server"].each do |service_name| @@ -150,7 +150,7 @@ XML "-f"; ); }; -SVC_LIST + SVC_LIST before do provider.load_current_resource @@ -188,7 +188,7 @@ SVC_LIST "-f"; ); }; -SVC_LIST + SVC_LIST before do provider.load_current_resource @@ -206,7 +206,7 @@ SVC_LIST context "when launchctl doesn't return service entry at all" do let(:launchctl_stdout) { StringIO.new <<~SVC_LIST } Could not find service "io.redis.redis-server" in domain for system -SVC_LIST + SVC_LIST it "sets service running state to false" do provider.load_current_resource diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb index 4ea1d520b7..2a0ebea1dc 100644 --- a/spec/unit/provider/service/simple_service_spec.rb +++ b/spec/unit/provider/service/simple_service_spec.rb @@ -35,7 +35,7 @@ describe Chef::Provider::Service::Simple, "load_current_resource" do aj 7842 5057 0 21:26 pts/2 00:00:06 vi init.rb aj 7903 5016 0 21:26 pts/5 00:00:00 /bin/bash aj 8119 6041 0 21:34 pts/3 00:00:03 vi simple_service_spec.rb -NOMOCKINGSTRINGSPLZ + NOMOCKINGSTRINGSPLZ @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) end @@ -78,7 +78,7 @@ NOMOCKINGSTRINGSPLZ @stdout = StringIO.new(<<~NOMOCKINGSTRINGSPLZ) aj 7842 5057 0 21:26 pts/2 00:00:06 chef aj 7842 5057 0 21:26 pts/2 00:00:06 poos -NOMOCKINGSTRINGSPLZ + NOMOCKINGSTRINGSPLZ @status = double("Status", exitstatus: 0, stdout: @stdout) allow(@provider).to receive(:shell_out!).and_return(@status) @provider.load_current_resource diff --git a/spec/unit/provider/template/content_spec.rb b/spec/unit/provider/template/content_spec.rb index 67d4eba138..572cf23181 100644 --- a/spec/unit/provider/template/content_spec.rb +++ b/spec/unit/provider/template/content_spec.rb @@ -162,7 +162,7 @@ describe Chef::Provider::Template::Content do 2 helpers.erb #{CHEF_SPEC_DATA}/cookbooks/openldap/templates/default/helpers.erb -EOF + EOF end end diff --git a/spec/unit/provider_resolver_spec.rb b/spec/unit/provider_resolver_spec.rb index 5066135b90..9b3839163d 100644 --- a/spec/unit/provider_resolver_spec.rb +++ b/spec/unit/provider_resolver_spec.rb @@ -553,61 +553,61 @@ describe Chef::ProviderResolver do PROVIDERS = { - aix_user: [ Chef::Resource::User::AixUser, Chef::Provider::User::Aix ], - apt_package: [ Chef::Resource::AptPackage, Chef::Provider::Package::Apt ], - bash: [ Chef::Resource::Bash, Chef::Provider::Script ], - bff_package: [ Chef::Resource::BffPackage, Chef::Provider::Package::Bff ], - breakpoint: [ Chef::Resource::Breakpoint, Chef::Resource::Breakpoint.action_class ], - chef_gem: [ Chef::Resource::ChefGem, Chef::Provider::Package::Rubygems ], - cookbook_file: [ Chef::Resource::CookbookFile, Chef::Provider::CookbookFile ], - csh: [ Chef::Resource::Csh, Chef::Provider::Script ], - directory: [ Chef::Resource::Directory, Chef::Provider::Directory ], - dpkg_package: [ Chef::Resource::DpkgPackage, Chef::Provider::Package::Dpkg ], - dsc_script: [ Chef::Resource::DscScript, Chef::Provider::DscScript ], - dscl_user: [ Chef::Resource::User::DsclUser, Chef::Provider::User::Dscl ], - execute: [ Chef::Resource::Execute, Chef::Provider::Execute ], - file: [ Chef::Resource::File, Chef::Provider::File ], - gem_package: [ Chef::Resource::GemPackage, Chef::Provider::Package::Rubygems ], - git: [ Chef::Resource::Git, Chef::Provider::Git ], - group: [ Chef::Resource::Group, Chef::Provider::Group::Gpasswd ], - homebrew_package: [ Chef::Resource::HomebrewPackage, Chef::Provider::Package::Homebrew ], - http_request: [ Chef::Resource::HttpRequest, Chef::Provider::HttpRequest ], - ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig ], - ips_package: [ Chef::Resource::IpsPackage, Chef::Provider::Package::Ips ], - link: [ Chef::Resource::Link, Chef::Provider::Link ], - linux_user: [ Chef::Resource::User::LinuxUser, Chef::Provider::User::Linux ], - log: [ Chef::Resource::Log, Chef::Provider::Log::ChefLog ], - macports_package: [ Chef::Resource::MacportsPackage, Chef::Provider::Package::Macports ], - mdadm: [ Chef::Resource::Mdadm, Chef::Provider::Mdadm ], - mount: [ Chef::Resource::Mount, Chef::Provider::Mount::Mount ], - pacman_package: [ Chef::Resource::PacmanPackage, Chef::Provider::Package::Pacman ], - paludis_package: [ Chef::Resource::PaludisPackage, Chef::Provider::Package::Paludis ], - perl: [ Chef::Resource::Perl, Chef::Provider::Script ], - portage_package: [ Chef::Resource::PortagePackage, Chef::Provider::Package::Portage ], - pw_user: [ Chef::Resource::User::PwUser, Chef::Provider::User::Pw ], - python: [ Chef::Resource::Python, Chef::Provider::Script ], - remote_directory: [ Chef::Resource::RemoteDirectory, Chef::Provider::RemoteDirectory ], - route: [ Chef::Resource::Route, Chef::Provider::Route ], - rpm_package: [ Chef::Resource::Package::RpmPackage, Chef::Provider::Package::Rpm ], - ruby_block: [ Chef::Resource::RubyBlock, Chef::Provider::RubyBlock ], - ruby: [ Chef::Resource::Ruby, Chef::Provider::Script ], - script: [ Chef::Resource::Script, Chef::Provider::Script ], - smartos_package: [ Chef::Resource::SmartosPackage, Chef::Provider::Package::SmartOS ], - snap_package: [ Chef::Resource::SnapPackage, Chef::Provider::Package::Snap ], - solaris_package: [ Chef::Resource::SolarisPackage, Chef::Provider::Package::Solaris ], - solaris_user: [ Chef::Resource::User::SolarisUser, Chef::Provider::User::Solaris ], - subversion: [ Chef::Resource::Subversion, Chef::Provider::Subversion ], - template: [ Chef::Resource::Template, Chef::Provider::Template ], + aix_user: [ Chef::Resource::User::AixUser, Chef::Provider::User::Aix ], + apt_package: [ Chef::Resource::AptPackage, Chef::Provider::Package::Apt ], + bash: [ Chef::Resource::Bash, Chef::Provider::Script ], + bff_package: [ Chef::Resource::BffPackage, Chef::Provider::Package::Bff ], + breakpoint: [ Chef::Resource::Breakpoint, Chef::Resource::Breakpoint.action_class ], + chef_gem: [ Chef::Resource::ChefGem, Chef::Provider::Package::Rubygems ], + cookbook_file: [ Chef::Resource::CookbookFile, Chef::Provider::CookbookFile ], + csh: [ Chef::Resource::Csh, Chef::Provider::Script ], + directory: [ Chef::Resource::Directory, Chef::Provider::Directory ], + dpkg_package: [ Chef::Resource::DpkgPackage, Chef::Provider::Package::Dpkg ], + dsc_script: [ Chef::Resource::DscScript, Chef::Provider::DscScript ], + dscl_user: [ Chef::Resource::User::DsclUser, Chef::Provider::User::Dscl ], + execute: [ Chef::Resource::Execute, Chef::Provider::Execute ], + file: [ Chef::Resource::File, Chef::Provider::File ], + gem_package: [ Chef::Resource::GemPackage, Chef::Provider::Package::Rubygems ], + git: [ Chef::Resource::Git, Chef::Provider::Git ], + group: [ Chef::Resource::Group, Chef::Provider::Group::Gpasswd ], + homebrew_package: [ Chef::Resource::HomebrewPackage, Chef::Provider::Package::Homebrew ], + http_request: [ Chef::Resource::HttpRequest, Chef::Provider::HttpRequest ], + ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig ], + ips_package: [ Chef::Resource::IpsPackage, Chef::Provider::Package::Ips ], + link: [ Chef::Resource::Link, Chef::Provider::Link ], + linux_user: [ Chef::Resource::User::LinuxUser, Chef::Provider::User::Linux ], + log: [ Chef::Resource::Log, Chef::Provider::Log::ChefLog ], + macports_package: [ Chef::Resource::MacportsPackage, Chef::Provider::Package::Macports ], + mdadm: [ Chef::Resource::Mdadm, Chef::Provider::Mdadm ], + mount: [ Chef::Resource::Mount, Chef::Provider::Mount::Mount ], + pacman_package: [ Chef::Resource::PacmanPackage, Chef::Provider::Package::Pacman ], + paludis_package: [ Chef::Resource::PaludisPackage, Chef::Provider::Package::Paludis ], + perl: [ Chef::Resource::Perl, Chef::Provider::Script ], + portage_package: [ Chef::Resource::PortagePackage, Chef::Provider::Package::Portage ], + pw_user: [ Chef::Resource::User::PwUser, Chef::Provider::User::Pw ], + python: [ Chef::Resource::Python, Chef::Provider::Script ], + remote_directory: [ Chef::Resource::RemoteDirectory, Chef::Provider::RemoteDirectory ], + route: [ Chef::Resource::Route, Chef::Provider::Route ], + rpm_package: [ Chef::Resource::Package::RpmPackage, Chef::Provider::Package::Rpm ], + ruby_block: [ Chef::Resource::RubyBlock, Chef::Provider::RubyBlock ], + ruby: [ Chef::Resource::Ruby, Chef::Provider::Script ], + script: [ Chef::Resource::Script, Chef::Provider::Script ], + smartos_package: [ Chef::Resource::SmartosPackage, Chef::Provider::Package::SmartOS ], + snap_package: [ Chef::Resource::SnapPackage, Chef::Provider::Package::Snap ], + solaris_package: [ Chef::Resource::SolarisPackage, Chef::Provider::Package::Solaris ], + solaris_user: [ Chef::Resource::User::SolarisUser, Chef::Provider::User::Solaris ], + subversion: [ Chef::Resource::Subversion, Chef::Provider::Subversion ], + template: [ Chef::Resource::Template, Chef::Provider::Template ], whyrun_safe_ruby_block: [ Chef::Resource::WhyrunSafeRubyBlock, Chef::Provider::WhyrunSafeRubyBlock ], - windows_package: [ Chef::Resource::WindowsPackage, Chef::Provider::Package::Windows ], - windows_service: [ Chef::Resource::WindowsService, Chef::Provider::Service::Windows ], - windows_user: [ Chef::Resource::User::WindowsUser, Chef::Provider::User::Windows ], - yum_package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ], + windows_package: [ Chef::Resource::WindowsPackage, Chef::Provider::Package::Windows ], + windows_service: [ Chef::Resource::WindowsService, Chef::Provider::Service::Windows ], + windows_user: [ Chef::Resource::User::WindowsUser, Chef::Provider::User::Windows ], + yum_package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ], "linux" => { "debian" => { ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig::Debian ], - package: [ Chef::Resource::AptPackage, Chef::Provider::Package::Apt ], + package: [ Chef::Resource::AptPackage, Chef::Provider::Package::Apt ], # service: [ Chef::Resource::DebianService, Chef::Provider::Service::Debian ], "debian" => { @@ -673,7 +673,7 @@ describe Chef::ProviderResolver do "opensuse" => { # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ], package: [ Chef::Resource::ZypperPackage, Chef::Provider::Package::Zypper ], - group: [ Chef::Resource::Group, Chef::Provider::Group::Usermod ], + group: [ Chef::Resource::Group, Chef::Provider::Group::Usermod ], "12.3" => { }, "12.2" => { @@ -684,7 +684,7 @@ describe Chef::ProviderResolver do "gentoo" => { # TODO should be Chef::Resource::PortagePackage - package: [ Chef::Resource::Package, Chef::Provider::Package::Portage ], + package: [ Chef::Resource::Package, Chef::Provider::Package::Portage ], portage_package: [ Chef::Resource::PortagePackage, Chef::Provider::Package::Portage ], # service: [ Chef::Resource::GentooService, Chef::Provider::Service::Gentoo ], @@ -696,21 +696,21 @@ describe Chef::ProviderResolver do "rhel" => { # service: [ Chef::Resource::SystemdService, Chef::Provider::Service::Systemd ], - package: [ Chef::Resource::DnfPackage, Chef::Provider::Package::Dnf ], + package: [ Chef::Resource::DnfPackage, Chef::Provider::Package::Dnf ], ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig::Redhat ], %w{amazon xcp xenserver ibm_powerkvm cloudlinux parallels} => { "3.1.4" => { - package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ], + package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ], # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ], }, }, %w{redhat centos scientific oracle} => { "7.0" => { - package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ], + package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ], }, "6.0" => { - package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ], + package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ], # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ], }, }, @@ -728,7 +728,7 @@ describe Chef::ProviderResolver do "freebsd" => { "freebsd" => { group: [ Chef::Resource::Group, Chef::Provider::Group::Pw ], - user: [ Chef::Resource::User::PwUser, Chef::Provider::User::Pw ], + user: [ Chef::Resource::User::PwUser, Chef::Provider::User::Pw ], "freebsd" => { "10.3" => { @@ -739,10 +739,10 @@ describe Chef::ProviderResolver do "darwin" => { %w{mac_os_x mac_os_x_server} => { - group: [ Chef::Resource::Group, Chef::Provider::Group::Dscl ], + group: [ Chef::Resource::Group, Chef::Provider::Group::Dscl ], package: [ Chef::Resource::HomebrewPackage, Chef::Provider::Package::Homebrew ], osx_profile: [ Chef::Resource::OsxProfile, Chef::Provider::OsxProfile], - user: [ Chef::Resource::User::DsclUser, Chef::Provider::User::Dscl ], + user: [ Chef::Resource::User::DsclUser, Chef::Provider::User::Dscl ], "mac_os_x" => { "10.9.2" => { @@ -752,17 +752,17 @@ describe Chef::ProviderResolver do }, "windows" => { - batch: [ Chef::Resource::Batch, Chef::Provider::Batch ], - dsc_script: [ Chef::Resource::DscScript, Chef::Provider::DscScript ], - windows_env: [ Chef::Resource::WindowsEnv, Chef::Provider::WindowsEnv ], - group: [ Chef::Resource::Group, Chef::Provider::Group::Windows ], - mount: [ Chef::Resource::Mount, Chef::Provider::Mount::Windows ], - package: [ Chef::Resource::WindowsPackage, Chef::Provider::Package::Windows ], + batch: [ Chef::Resource::Batch, Chef::Provider::Batch ], + dsc_script: [ Chef::Resource::DscScript, Chef::Provider::DscScript ], + windows_env: [ Chef::Resource::WindowsEnv, Chef::Provider::WindowsEnv ], + group: [ Chef::Resource::Group, Chef::Provider::Group::Windows ], + mount: [ Chef::Resource::Mount, Chef::Provider::Mount::Windows ], + package: [ Chef::Resource::WindowsPackage, Chef::Provider::Package::Windows ], powershell_script: [ Chef::Resource::PowershellScript, Chef::Provider::PowershellScript ], - service: [ Chef::Resource::WindowsService, Chef::Provider::Service::Windows ], - user: [ Chef::Resource::User::WindowsUser, Chef::Provider::User::Windows ], - windows_package: [ Chef::Resource::WindowsPackage, Chef::Provider::Package::Windows ], - windows_service: [ Chef::Resource::WindowsService, Chef::Provider::Service::Windows ], + service: [ Chef::Resource::WindowsService, Chef::Provider::Service::Windows ], + user: [ Chef::Resource::User::WindowsUser, Chef::Provider::User::Windows ], + windows_package: [ Chef::Resource::WindowsPackage, Chef::Provider::Package::Windows ], + windows_service: [ Chef::Resource::WindowsService, Chef::Provider::Service::Windows ], "windows" => { %w{mswin mingw32 windows} => { @@ -823,15 +823,15 @@ describe Chef::ProviderResolver do }, "solaris2" => { - group: [ Chef::Resource::Group, Chef::Provider::Group::Usermod ], - ips_package: [ Chef::Resource::IpsPackage, Chef::Provider::Package::Ips ], - package: [ Chef::Resource::SolarisPackage, Chef::Provider::Package::Solaris ], - mount: [ Chef::Resource::Mount, Chef::Provider::Mount::Solaris ], + group: [ Chef::Resource::Group, Chef::Provider::Group::Usermod ], + ips_package: [ Chef::Resource::IpsPackage, Chef::Provider::Package::Ips ], + package: [ Chef::Resource::SolarisPackage, Chef::Provider::Package::Solaris ], + mount: [ Chef::Resource::Mount, Chef::Provider::Mount::Solaris ], solaris_package: [ Chef::Resource::SolarisPackage, Chef::Provider::Package::Solaris ], "smartos" => { smartos_package: [ Chef::Resource::SmartosPackage, Chef::Provider::Package::SmartOS ], - package: [ Chef::Resource::SmartosPackage, Chef::Provider::Package::SmartOS ], + package: [ Chef::Resource::SmartosPackage, Chef::Provider::Package::SmartOS ], "smartos" => { "3.1.4" => { diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb index 3b16edaa4a..2d5bb81c95 100644 --- a/spec/unit/recipe_spec.rb +++ b/spec/unit/recipe_spec.rb @@ -390,7 +390,7 @@ describe Chef::Recipe do zen_master "gnome" do peace = true end - CODE + CODE expect { recipe.instance_eval(code) }.not_to raise_error expect(recipe.resources(zen_master: "gnome").name).to eql("gnome") end diff --git a/spec/unit/resource/chocolatey_config_spec.rb b/spec/unit/resource/chocolatey_config_spec.rb index b6f36026bd..f768197671 100644 --- a/spec/unit/resource/chocolatey_config_spec.rb +++ b/spec/unit/resource/chocolatey_config_spec.rb @@ -35,7 +35,7 @@ describe Chef::Resource::ChocolateyConfig do </features> <apiKeys /> </chocolatey> -CONFIG + CONFIG end # we save off the ENV and set ALLUSERSPROFILE so these specs will work on *nix and non-C drive Windows installs diff --git a/spec/unit/resource/chocolatey_source_spec.rb b/spec/unit/resource/chocolatey_source_spec.rb index bbead24e79..1463a448de 100644 --- a/spec/unit/resource/chocolatey_source_spec.rb +++ b/spec/unit/resource/chocolatey_source_spec.rb @@ -35,7 +35,7 @@ describe Chef::Resource::ChocolateySource do </features> <apiKeys /> </chocolatey> -CONFIG + CONFIG end # we save off the ENV and set ALLUSERSPROFILE so these specs will work on *nix and non-C drive Windows installs diff --git a/spec/unit/resource/rhsm_subscription_spec.rb b/spec/unit/resource/rhsm_subscription_spec.rb index 6de65a427f..00d61c9ff5 100644 --- a/spec/unit/resource/rhsm_subscription_spec.rb +++ b/spec/unit/resource/rhsm_subscription_spec.rb @@ -74,7 +74,7 @@ describe Chef::Resource::RhsmSubscription do Pool ID: pool2 Serial: serial2 Key2: value2 -EOL + EOL end it "parses the output correctly" do diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 7793b82034..3bd13b4c97 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -410,7 +410,7 @@ describe Chef::Resource do resource "foo" do foo foo end - EOH + EOH end end diff --git a/spec/unit/role_spec.rb b/spec/unit/role_spec.rb index 57f1d5c6ba..0e12f65e58 100644 --- a/spec/unit/role_spec.rb +++ b/spec/unit/role_spec.rb @@ -248,7 +248,7 @@ describe Chef::Role do ROLE_DSL = <<~EOR.freeze name "ceiling_cat" description "like Aliens, but furry" -EOR + EOR describe "when loading from disk" do before do diff --git a/spec/unit/util/dsc/lcm_output_parser_spec.rb b/spec/unit/util/dsc/lcm_output_parser_spec.rb index 32e5c0e07f..6ced178bf1 100644 --- a/spec/unit/util/dsc/lcm_output_parser_spec.rb +++ b/spec/unit/util/dsc/lcm_output_parser_spec.rb @@ -52,7 +52,7 @@ describe Chef::Util::DSC::LocalConfigurationManager::Parser do logtype: [machinename]: LCM: [ Start Resource ] [name] logtype: [machinename]: LCM: [ End Resource ] [name] logtype: [machinename]: LCM: [ End Set ] -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources.length).to eq(1) expect(resources[0].name).to eq("[name]") @@ -66,7 +66,7 @@ EOF logtype: [machinename]: LCM: [ End Set ] [name] logtype: [machinename]: LCM: [ End Resource ] [name] logtype: [machinename]: LCM: [ End Set ] -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].changes_state?).to be_truthy end @@ -80,7 +80,7 @@ EOF logtype: [machinename]: LCM: [ End Set ] [name] logtype: [machinename]: LCM: [ End Resource ] [name] logtype: [machinename]: LCM: [ End Set ] -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].change_log).to match_array(["[name]", "[message]", "[name]"]) end @@ -92,7 +92,7 @@ EOF logtype: [machinename]: LCM: [ Skip Set ] [name] logtype: [machinename]: LCM: [ End Resource ] [name] logtype: [machinename]: LCM: [ End Set ] -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].changes_state?).to be_falsey end @@ -104,7 +104,7 @@ EOF logtype: [machinename]: LCM: [ Skip Set ] [name] logtype: [machinename]: LCM: [ End Resource ] [name] logtype: [machinename]: LCM: [ End Set ] -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].change_log).to be_empty end @@ -118,7 +118,7 @@ EOF ResourcesNotInDesiredState: [name] ReturnValue : 0 PSComputerName : . -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, true) expect(resources.length).to eq(1) expect(resources[0].name).to eq("[name]") @@ -131,7 +131,7 @@ EOF ResourcesNotInDesiredState: [name] ReturnValue : 0 PSComputerName : . -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, true) expect(resources[0].changes_state?).to be_truthy end @@ -143,7 +143,7 @@ EOF ResourcesNotInDesiredState: ReturnValue : 0 PSComputerName : . -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, true) expect(resources[0].changes_state?).to be_falsey end @@ -155,7 +155,7 @@ EOF ResourcesNotInDesiredState: ReturnValue : 0 PSComputerName : . -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, true) expect(resources[0].change_log).to be_empty end @@ -176,7 +176,7 @@ EOF logtype: [machinename]: LCM: [ Start Set ] logtype: [machinename]: LCM: [ End Set ] logtype: [machinename]: LCM: [ End Set ] -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].changes_state?).to be_falsey @@ -197,7 +197,7 @@ EOF logtype: [machinename]: LCM: [ End Set ] logtype: [machinename]: LCM: [ End Resource ] logtype: [machinename]: LCM: [ End Set ] -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].changes_state?).to be_falsey @@ -217,7 +217,7 @@ EOF logtype: [machinename]: LCM: [ End Set ] logtype: [machinename]: LCM: [ End Resource ] logtype: [machinename]: LCM: [ End Set ] -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, false) expect(resources[0].changes_state?).to be_truthy expect(resources[0].name).to eql("[name]") @@ -239,7 +239,7 @@ EOF ResourcesNotInDesiredState: [name2] ReturnValue : 0 PSComputerName : . -EOF + EOF resources = Chef::Util::DSC::LocalConfigurationManager::Parser.parse(str, true) expect(resources[0].changes_state?).to be_falsey diff --git a/spec/unit/util/dsc/local_configuration_manager_spec.rb b/spec/unit/util/dsc/local_configuration_manager_spec.rb index cce5a39537..4ef6abdd59 100644 --- a/spec/unit/util/dsc/local_configuration_manager_spec.rb +++ b/spec/unit/util/dsc/local_configuration_manager_spec.rb @@ -29,7 +29,7 @@ describe Chef::Util::DSC::LocalConfigurationManager do logtype: [machinename]: LCM: [ Start Resource ] [name] logtype: [machinename]: LCM: [ End Resource ] [name] logtype: [machinename]: LCM: [ End Set ] -EOH + EOH end let(:no_whatif_lcm_output) do @@ -40,13 +40,13 @@ EOH + ~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Start-DscConfiguration], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,SomeCompany.SomeAssembly.Commands.RunSomeCommand -EOH + EOH end let(:dsc_resource_import_failure_output) do <<~EOH PowerShell provider MSFT_xWebsite failed to execute Test-TargetResource functionality with error message: Please ensure that WebAdministration module is installed. + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName : . PowerShell provider MSFT_xWebsite failed to execute Test-TargetResource functionality with error message: Please ensure that WebAdministration module is installed. + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName : . The SendConfigurationApply function did not succeed. + CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : MI RESULT 1 + PSComputerName : . -EOH + EOH end let(:lcm_status) do |