diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-12 15:33:27 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-12 15:33:27 -0800 |
commit | a030711a57e126f58b2e897c915d430e67cb7d13 (patch) | |
tree | 4c92a61db73e69587747baefc2a63683e275dd29 | |
parent | a5afeecc19170cac9d430f7bee128d05e9bca5a9 (diff) | |
parent | f890cc4480c601b08c657cee2d24dd3ed472c054 (diff) | |
download | chef-a030711a57e126f58b2e897c915d430e67cb7d13.tar.gz |
Merge pull request #4573 from chef/lcg/bump-rubocop
pull rubocop 0.37.2 into chefstyle
47 files changed, 258 insertions, 258 deletions
diff --git a/chef-config/chef-config.gemspec b/chef-config/chef-config.gemspec index f59741629f..afbd69f188 100644 --- a/chef-config/chef-config.gemspec +++ b/chef-config/chef-config.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |spec| end spec.files = %w{Rakefile LICENSE README.md} + Dir.glob("*.gemspec") + - Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } + Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } spec.bindir = "bin" spec.executables = [] diff --git a/lib/chef/application/knife.rb b/lib/chef/application/knife.rb index 4a39ba5ba1..34598574dd 100644 --- a/lib/chef/application/knife.rb +++ b/lib/chef/application/knife.rb @@ -38,7 +38,7 @@ class Chef::Application::Knife < Chef::Application :short => "-V", :long => "--verbose", :description => "More verbose output. Use twice for max verbosity", - :proc => Proc.new { verbosity_level += 1 }, + :proc => Proc.new { verbosity_level += 1 }, :default => 0 option :color, @@ -63,7 +63,7 @@ class Chef::Application::Knife < Chef::Application :long => "--disable-editing", :description => "Do not open EDITOR, just accept the data as is", :boolean => true, - :default => false + :default => false option :help, :short => "-h", diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index 62e17d4f3b..7d14cea44f 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -828,7 +828,7 @@ INVALID def validate_calculated_default_rule(options) calculated_conflict = ((options[:default].is_a?(Array) && !options[:default].empty?) || (options[:default].is_a?(String) && !options[:default] != "")) && - options[:calculated] == true + options[:calculated] == true raise ArgumentError, "Default cannot be specified if calculated is true!" if calculated_conflict end diff --git a/lib/chef/encrypted_data_bag_item/assertions.rb b/lib/chef/encrypted_data_bag_item/assertions.rb index 8162a9aa54..bbdcf7a721 100644 --- a/lib/chef/encrypted_data_bag_item/assertions.rb +++ b/lib/chef/encrypted_data_bag_item/assertions.rb @@ -30,7 +30,7 @@ class Chef::EncryptedDataBagItem unless format_version.kind_of?(Integer) and format_version >= Chef::Config[:data_bag_decrypt_minimum_version] raise UnacceptableEncryptedDataBagItemFormat, "The encrypted data bag item has format version `#{format_version}', " + - "but the config setting 'data_bag_decrypt_minimum_version' requires version `#{Chef::Config[:data_bag_decrypt_minimum_version]}'" + "but the config setting 'data_bag_decrypt_minimum_version' requires version `#{Chef::Config[:data_bag_decrypt_minimum_version]}'" end end diff --git a/lib/chef/environment.rb b/lib/chef/environment.rb index b286dad4e2..9cdb8a8522 100644 --- a/lib/chef/environment.rb +++ b/lib/chef/environment.rb @@ -36,7 +36,7 @@ class Chef attr_accessor :chef_server_rest - COMBINED_COOKBOOK_CONSTRAINT = /(.+)(?:[\s]+)((?:#{Chef::VersionConstraint::OPS.join('|')})(?:[\s]+).+)$/.freeze + COMBINED_COOKBOOK_CONSTRAINT = /(.+)(?:[\s]+)((?:#{Chef::VersionConstraint::OPS.join('|')})(?:[\s]+).+)$/ def initialize(chef_server_rest: nil) @name = "" @@ -123,7 +123,7 @@ class Chef result = { "name" => @name, "description" => @description, - "cookbook_versions" => @cookbook_versions, + "cookbook_versions" => @cookbook_versions, "json_class" => self.class.name, "chef_type" => "environment", "default_attributes" => @default_attributes, diff --git a/lib/chef/http.rb b/lib/chef/http.rb index 0060fb08c7..9cd55f18dd 100644 --- a/lib/chef/http.rb +++ b/lib/chef/http.rb @@ -383,7 +383,7 @@ class Chef end def build_headers(method, url, headers = {}, json_body = false) - headers = @default_headers.merge(headers) + headers = @default_headers.merge(headers) headers["Content-Length"] = json_body.bytesize.to_s if json_body headers.merge!(Chef::Config[:custom_http_headers]) if Chef::Config[:custom_http_headers] headers diff --git a/lib/chef/http/basic_client.rb b/lib/chef/http/basic_client.rb index 9428858cdf..e0a02a05cf 100644 --- a/lib/chef/http/basic_client.rb +++ b/lib/chef/http/basic_client.rb @@ -98,7 +98,7 @@ class Chef #adapted from buildr/lib/buildr/core/transports.rb def proxy_uri proxy = Chef::Config["#{url.scheme}_proxy"] || - env["#{url.scheme.upcase}_PROXY"] || env["#{url.scheme}_proxy"] + env["#{url.scheme.upcase}_PROXY"] || env["#{url.scheme}_proxy"] # Check if the proxy string contains a scheme. If not, add the url's scheme to the # proxy before parsing. The regex /^.*:\/\// matches, for example, http://. Reusing proxy diff --git a/lib/chef/http/http_request.rb b/lib/chef/http/http_request.rb index 6cd7dda251..20c46aaa8d 100644 --- a/lib/chef/http/http_request.rb +++ b/lib/chef/http/http_request.rb @@ -60,7 +60,7 @@ class Chef HOST_LOWER = "host".freeze - URI_SCHEME_DEFAULT_PORT = { "http" => 80, "https" => 443 }.freeze + URI_SCHEME_DEFAULT_PORT = { "http" => 80, "https" => 443 }.freeze def self.user_agent=(ua) @user_agent = ua diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index 164a2cdeda..fb43f8721b 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -244,7 +244,7 @@ class Chef # Mention rehash when the subcommands cache(plugin_manifest.json) is used if subcommand_loader.is_a?(Chef::Knife::SubcommandLoader::HashedCommandLoader) || - subcommand_loader.is_a?(Chef::Knife::SubcommandLoader::CustomManifestLoader) + subcommand_loader.is_a?(Chef::Knife::SubcommandLoader::CustomManifestLoader) ui.info("If this is a recently installed plugin, please run 'knife rehash' to update the subcommands cache.") end diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index 971257bf9e..280960f3c6 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -368,7 +368,7 @@ class Chef # chef-vault integration must use the new client-side hawtness, otherwise to use the # new client-side hawtness, just delete your validation key. if chef_vault_handler.doing_chef_vault? || - (Chef::Config[:validation_key] && !File.exist?(File.expand_path(Chef::Config[:validation_key]))) + (Chef::Config[:validation_key] && !File.exist?(File.expand_path(Chef::Config[:validation_key]))) unless config[:chef_node_name] ui.error("You must pass a node name with -N when bootstrapping with user credentials") diff --git a/lib/chef/knife/client_create.rb b/lib/chef/knife/client_create.rb index ecacb36833..22c7ce907d 100644 --- a/lib/chef/knife/client_create.rb +++ b/lib/chef/knife/client_create.rb @@ -39,7 +39,7 @@ class Chef :boolean => true option :validator, - :long => "--validator", + :long => "--validator", :description => "Create the client as a validator.", :boolean => true diff --git a/lib/chef/knife/configure.rb b/lib/chef/knife/configure.rb index e62a9dd05c..df41aa7265 100644 --- a/lib/chef/knife/configure.rb +++ b/lib/chef/knife/configure.rb @@ -97,7 +97,7 @@ EOH user_create = Chef::Knife::UserCreate.new user_create.name_args = [ new_client_name ] user_create.config[:user_password] = config[:user_password] || - ui.ask("Please enter a password for the new user: ") { |q| q.echo = false } + ui.ask("Please enter a password for the new user: ") { |q| q.echo = false } user_create.config[:admin] = true user_create.config[:file] = new_client_key user_create.config[:yes] = true diff --git a/lib/chef/knife/cookbook_site_install.rb b/lib/chef/knife/cookbook_site_install.rb index 9a79cd076a..01374b9b36 100644 --- a/lib/chef/knife/cookbook_site_install.rb +++ b/lib/chef/knife/cookbook_site_install.rb @@ -53,7 +53,7 @@ class Chef :default => "master" option :use_current_branch, - :short => "-b", + :short => "-b", :long => "--use-current-branch", :description => "Use the current branch", :boolean => true, @@ -172,7 +172,7 @@ class Chef def preferred_metadata md = Chef::Cookbook::Metadata.new - rb = File.join(@install_path, @cookbook_name, "metadata.rb") + rb = File.join(@install_path, @cookbook_name, "metadata.rb") if File.exist?(rb) md.from_file(rb) return md diff --git a/lib/chef/knife/core/gem_glob_loader.rb b/lib/chef/knife/core/gem_glob_loader.rb index 6802be29ef..78726feee7 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]+}.freeze - MATCHES_THIS_CHEF_GEM = %r{/chef-#{Chef::VERSION}(-\w+)?(-\w+)?/}.freeze + MATCHES_CHEF_GEM = %r{/chef-[\d]+\.[\d]+\.[\d]+} + MATCHES_THIS_CHEF_GEM = %r{/chef-#{Chef::VERSION}(-\w+)?(-\w+)?/} def subcommand_files @subcommand_files ||= (gem_and_builtin_subcommands.values + site_subcommands).flatten.uniq diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index a1e54f784d..4184171a4e 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -186,8 +186,8 @@ class Chef Chef::Log.debug("Using node attribute #{Chef::Config[:knife][:ssh_attribute]}") attribute = Chef::Config[:knife][:ssh_attribute] elsif node[:cloud] && - node[:cloud][:public_hostname] && - !node[:cloud][:public_hostname].empty? + node[:cloud][:public_hostname] && + !node[:cloud][:public_hostname].empty? Chef::Log.debug("Using node attribute 'cloud[:public_hostname]' automatically as the ssh target") attribute = "cloud.public_hostname" else diff --git a/lib/chef/knife/user_create.rb b/lib/chef/knife/user_create.rb index 5a9589aad8..b1782a893b 100644 --- a/lib/chef/knife/user_create.rb +++ b/lib/chef/knife/user_create.rb @@ -38,7 +38,7 @@ class Chef option :user_key, :long => "--user-key FILENAME", - :description => "Set the initial default key for the user from a file on disk (cannot pass with --prevent-keygen)." + :description => "Set the initial default key for the user from a file on disk (cannot pass with --prevent-keygen)." option :prevent_keygen, :short => "-k", diff --git a/lib/chef/mixin/windows_architecture_helper.rb b/lib/chef/mixin/windows_architecture_helper.rb index c55f92b362..11e1b5559d 100644 --- a/lib/chef/mixin/windows_architecture_helper.rb +++ b/lib/chef/mixin/windows_architecture_helper.rb @@ -48,7 +48,7 @@ class Chef def with_os_architecture(node, architecture: nil) node ||= begin os_arch = ENV["PROCESSOR_ARCHITEW6432"] || - ENV["PROCESSOR_ARCHITECTURE"] + ENV["PROCESSOR_ARCHITECTURE"] Hash.new.tap do |n| n[:kernel] = Hash.new n[:kernel][:machine] = os_arch == "AMD64" ? :x86_64 : :i386 diff --git a/lib/chef/mixin/xml_escape.rb b/lib/chef/mixin/xml_escape.rb index afb0d09c2d..f9a41b9fd0 100644 --- a/lib/chef/mixin/xml_escape.rb +++ b/lib/chef/mixin/xml_escape.rb @@ -64,14 +64,14 @@ class Chef CP1252 = { 128 => 8364, # euro sign 130 => 8218, # single low-9 quotation mark - 131 => 402, # latin small letter f with hook + 131 => 402, # latin small letter f with hook 132 => 8222, # double low-9 quotation mark 133 => 8230, # horizontal ellipsis 134 => 8224, # dagger 135 => 8225, # double dagger - 136 => 710, # modifier letter circumflex accent + 136 => 710, # modifier letter circumflex accent 137 => 8240, # per mille sign - 138 => 352, # latin capital letter s with caron + 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 @@ -82,9 +82,9 @@ class Chef 149 => 8226, # bullet 150 => 8211, # en dash 151 => 8212, # em dash - 152 => 732, # small tilde + 152 => 732, # small tilde 153 => 8482, # trade mark sign - 154 => 353, # latin small letter s with caron + 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 diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb index 39d415e590..d24cd8c18c 100644 --- a/lib/chef/platform/provider_mapping.rb +++ b/lib/chef/platform/provider_mapping.rb @@ -173,8 +173,8 @@ class Chef def find_provider(platform, version, resource_type) provider_klass = explicit_provider(platform, version, resource_type) || - platform_provider(platform, version, resource_type) || - resource_matching_provider(platform, version, resource_type) + platform_provider(platform, version, resource_type) || + resource_matching_provider(platform, version, resource_type) raise Chef::Exceptions::ProviderNotFound, "Cannot find a provider for #{resource_type} on #{platform} version #{version}" if provider_klass.nil? diff --git a/lib/chef/policy_builder/dynamic.rb b/lib/chef/policy_builder/dynamic.rb index 22438a1e0f..c6c7deeee6 100644 --- a/lib/chef/policy_builder/dynamic.rb +++ b/lib/chef/policy_builder/dynamic.rb @@ -149,9 +149,9 @@ class Chef # testing purposes; production code should call #load_node instead. def select_implementation(node) if policyfile_set_in_config? || - policyfile_attribs_in_node_json? || - node_has_policyfile_attrs?(node) || - policyfile_compat_mode_config? + policyfile_attribs_in_node_json? || + node_has_policyfile_attrs?(node) || + policyfile_compat_mode_config? @implementation = Policyfile.new(node_name, ohai_data, json_attribs, override_runlist, events) else @implementation = ExpandNodeObject.new(node_name, ohai_data, json_attribs, override_runlist, events) diff --git a/lib/chef/property.rb b/lib/chef/property.rb index 8198dd6700..0230c8b23b 100644 --- a/lib/chef/property.rb +++ b/lib/chef/property.rb @@ -336,11 +336,11 @@ class Chef # It won't do what they expect. This checks whether you try to *read* # `content` while we are compiling the resource. if resource.respond_to?(:resource_initializing) && - resource.resource_initializing && - resource.respond_to?(:enclosing_provider) && - resource.enclosing_provider && - resource.enclosing_provider.new_resource && - resource.enclosing_provider.new_resource.respond_to?(name) + resource.resource_initializing && + resource.respond_to?(:enclosing_provider) && + resource.enclosing_provider && + resource.enclosing_provider.new_resource && + resource.enclosing_provider.new_resource.respond_to?(name) Chef::Log.warn("#{Chef::Log.caller_location}: property #{name} is declared in both #{resource} and #{resource.enclosing_provider}. Use new_resource.#{name} instead. At #{Chef::Log.caller_location}") end @@ -486,8 +486,8 @@ class Chef # the original options. options = self.options if modified_options.has_key?(:name_property) || - modified_options.has_key?(:name_attribute) || - modified_options.has_key?(:default) + modified_options.has_key?(:name_attribute) || + modified_options.has_key?(:default) options = options.reject { |k, v| k == :name_attribute || k == :name_property || k == :default } end self.class.new(options.merge(modified_options)) diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb index 600da540e5..4f17da0288 100644 --- a/lib/chef/provider/git.rb +++ b/lib/chef/provider/git.rb @@ -53,9 +53,9 @@ class Chef a.assertion { !(@new_resource.revision =~ /^origin\//) } a.failure_message Chef::Exceptions::InvalidRemoteGitReference, "Deploying remote branches is not supported. " + - "Specify the remote branch as a local branch for " + - "the git repository you're deploying from " + - "(ie: '#{@new_resource.revision.gsub('origin/', '')}' rather than '#{@new_resource.revision}')." + "Specify the remote branch as a local branch for " + + "the git repository you're deploying from " + + "(ie: '#{@new_resource.revision.gsub('origin/', '')}' rather than '#{@new_resource.revision}')." end requirements.assert(:all_actions) do |a| @@ -65,8 +65,8 @@ class Chef a.assertion { target_revision != nil } a.failure_message Chef::Exceptions::UnresolvableGitReference, "Unable to parse SHA reference for '#{@new_resource.revision}' in repository '#{@new_resource.repository}'. " + - "Verify your (case-sensitive) repository URL and revision.\n" + - "`git ls-remote '#{@new_resource.repository}' '#{rev_search_pattern}'` output: #{@resolved_reference}" + "Verify your (case-sensitive) repository URL and revision.\n" + + "`git ls-remote '#{@new_resource.repository}' '#{rev_search_pattern}'` output: #{@resolved_reference}" end end diff --git a/lib/chef/provider/link.rb b/lib/chef/provider/link.rb index 116efccaef..d184094bbb 100644 --- a/lib/chef/provider/link.rb +++ b/lib/chef/provider/link.rb @@ -58,8 +58,8 @@ class Chef @current_resource.link_type(:hard) if ::File.exists?(@current_resource.target_file) if ::File.exists?(@new_resource.to) && - file_class.stat(@current_resource.target_file).ino == - file_class.stat(@new_resource.to).ino + file_class.stat(@current_resource.target_file).ino == + file_class.stat(@new_resource.to).ino @current_resource.to(canonicalize(@new_resource.to)) else @current_resource.to("") @@ -96,7 +96,7 @@ class Chef # target_file - the name of the link if @current_resource.to != canonicalize(@new_resource.to) || - @current_resource.link_type != @new_resource.link_type + @current_resource.link_type != @new_resource.link_type # Handle the case where the symlink already exists and is pointing at a valid to_file if @current_resource.to # On Windows, to fix a symlink already pointing at a directory we must first @@ -106,7 +106,7 @@ class Chef # directory we want to throw an exception and calling ::File.unlink on the directory symlink # will throw the correct ones. if Chef::Platform.windows? && ::File.directory?(@new_resource.to) && - ::File.directory?(@current_resource.target_file) + ::File.directory?(@current_resource.target_file) converge_by("unlink existing windows symlink to dir at #{@new_resource.target_file}") do ::Dir.unlink(@new_resource.target_file) end diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb index 1bef30d53b..3747a917fa 100644 --- a/lib/chef/provider/osx_profile.rb +++ b/lib/chef/provider/osx_profile.rb @@ -51,7 +51,7 @@ class Chef @new_profile_identifier = @new_profile_hash["PayloadIdentifier"] else @new_profile_identifier = @new_resource.identifier || - @new_resource.profile_name + @new_resource.profile_name end if all_profiles.empty? diff --git a/lib/chef/resource/cron.rb b/lib/chef/resource/cron.rb index 26711fde16..74fa6685f1 100644 --- a/lib/chef/resource/cron.rb +++ b/lib/chef/resource/cron.rb @@ -126,8 +126,8 @@ class Chef error_message << Provider::Cron::WEEKDAY_SYMBOLS.map { |sym| ":#{sym}" }.join(", ") error_message << " and a string in crontab format" if (arg.is_a?(Symbol) && !Provider::Cron::WEEKDAY_SYMBOLS.include?(arg)) || - (!arg.is_a?(Symbol) && integerize(arg) > 7) || - (!arg.is_a?(Symbol) && integerize(arg) < 0) + (!arg.is_a?(Symbol) && integerize(arg) > 7) || + (!arg.is_a?(Symbol) && integerize(arg) < 0) raise RangeError, error_message end rescue ArgumentError diff --git a/lib/chef/resource/template.rb b/lib/chef/resource/template.rb index 1570af2812..0b9d86f242 100644 --- a/lib/chef/resource/template.rb +++ b/lib/chef/resource/template.rb @@ -171,8 +171,8 @@ class Chef elsif module_name.nil? raise Exceptions::ValidationFailed, "#helpers requires either a module name or inline module code as a block.\n" + - "e.g.: helpers do; helper_code; end;\n" + - "OR: helpers(MyHelpersModule)" + "e.g.: helpers do; helper_code; end;\n" + + "OR: helpers(MyHelpersModule)" else raise Exceptions::ValidationFailed, "Argument to #helpers must be a module. You gave #{module_name.inspect} (#{module_name.class})" diff --git a/lib/chef/resource_collection.rb b/lib/chef/resource_collection.rb index 293a99991e..6c5b4289d8 100644 --- a/lib/chef/resource_collection.rb +++ b/lib/chef/resource_collection.rb @@ -78,8 +78,8 @@ class Chef # Read-only methods are simple to delegate - doing that below resource_list_methods = Enumerable.instance_methods + - [:iterator, :all_resources, :[], :each, :execute_each_resource, :each_index, :empty?] - - [:find] # find needs to run on the set + [:iterator, :all_resources, :[], :each, :execute_each_resource, :each_index, :empty?] - + [:find] # find needs to run on the set resource_set_methods = [:lookup, :find, :resources, :keys, :validate_lookup_spec!] def_delegators :resource_list, *resource_list_methods diff --git a/lib/chef/resource_collection/resource_set.rb b/lib/chef/resource_collection/resource_set.rb index 2a653356dc..88354de31d 100644 --- a/lib/chef/resource_collection/resource_set.rb +++ b/lib/chef/resource_collection/resource_set.rb @@ -124,7 +124,7 @@ class Chef else raise Chef::Exceptions::InvalidResourceSpecification, "The object `#{query_object.inspect}' is not valid for resource collection lookup. " + - "Use a String like `resource_type[resource_name]' or a Chef::Resource object" + "Use a String like `resource_type[resource_name]' or a Chef::Resource object" end end diff --git a/lib/chef/search/query.rb b/lib/chef/search/query.rb index 8a205160fa..487a54f0df 100644 --- a/lib/chef/search/query.rb +++ b/lib/chef/search/query.rb @@ -116,8 +116,8 @@ WARNDEP def validate_type(t) unless t.kind_of?(String) || t.kind_of?(Symbol) msg = "Invalid search object type #{t.inspect} (#{t.class}), must be a String or Symbol." + - "Usage: search(:node, QUERY[, OPTIONAL_ARGS])" + - " `knife search environment QUERY (options)`" + "Usage: search(:node, QUERY[, OPTIONAL_ARGS])" + + " `knife search environment QUERY (options)`" raise Chef::Exceptions::InvalidSearchQuery, msg end end diff --git a/lib/chef/shell/ext.rb b/lib/chef/shell/ext.rb index 83863b16f7..40d7e10d2e 100644 --- a/lib/chef/shell/ext.rb +++ b/lib/chef/shell/ext.rb @@ -210,9 +210,9 @@ module Shell desc "prints information about chef" def version puts "This is the chef-shell.\n" + - " Chef Version: #{::Chef::VERSION}\n" + - " http://www.chef.io/\n" + - " http://docs.chef.io/" + " Chef Version: #{::Chef::VERSION}\n" + + " http://www.chef.io/\n" + + " http://docs.chef.io/" :ucanhaz_automation end alias :shell :version diff --git a/lib/chef/util/dsc/configuration_generator.rb b/lib/chef/util/dsc/configuration_generator.rb index af9a71b246..739a463ad5 100644 --- a/lib/chef/util/dsc/configuration_generator.rb +++ b/lib/chef/util/dsc/configuration_generator.rb @@ -68,7 +68,7 @@ class Chef::Util::DSC end def get_merged_configuration_flags!(configuration_flags, configuration_name) - merged_configuration_flags = { :outputpath => configuration_document_directory(configuration_name) } + merged_configuration_flags = { :outputpath => configuration_document_directory(configuration_name) } if configuration_flags configuration_flags.map do |switch, value| if merged_configuration_flags.key?(switch.to_s.downcase.to_sym) diff --git a/lib/chef/win32/api.rb b/lib/chef/win32/api.rb index ad65b087cc..64db9d2b63 100644 --- a/lib/chef/win32/api.rb +++ b/lib/chef/win32/api.rb @@ -67,7 +67,7 @@ class Chef # BaseTsd.h: #ifdef (_WIN64) host.typedef int HALF_PTR; #else host.typedef short HALF_PTR; host.typedef :ulong, :HACCEL # (L) Handle to an accelerator table. WinDef.h: #host.typedef HANDLE HACCEL; # See http://msdn.microsoft.com/en-us/library/ms645526%28VS.85%29.aspx - host.typedef :size_t, :HANDLE # (L) Handle to an object. WinNT.h: #host.typedef PVOID HANDLE; + host.typedef :size_t, :HANDLE # (L) Handle to an object. WinNT.h: #host.typedef PVOID HANDLE; # todo: Platform-dependent! Need to change to :uint64 for Win64 host.typedef :ulong, :HBITMAP # (L) Handle to a bitmap: http://msdn.microsoft.com/en-us/library/dd183377%28VS.85%29.aspx host.typedef :ulong, :HBRUSH # (L) Handle to a brush. http://msdn.microsoft.com/en-us/library/dd183394%28VS.85%29.aspx diff --git a/lib/chef/win32/api/security.rb b/lib/chef/win32/api/security.rb index 44968372b5..64df077686 100644 --- a/lib/chef/win32/api/security.rb +++ b/lib/chef/win32/api/security.rb @@ -133,11 +133,11 @@ class Chef FILE_READ_ATTRIBUTES = 0x0080 FILE_WRITE_ATTRIBUTES = 0x0100 FILE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | - SYNCHRONIZE | - 0x1FF + SYNCHRONIZE | + 0x1FF FILE_GENERIC_READ = STANDARD_RIGHTS_READ | - FILE_READ_DATA | FILE_READ_ATTRIBUTES | - FILE_READ_EA | SYNCHRONIZE + FILE_READ_DATA | FILE_READ_ATTRIBUTES | + FILE_READ_EA | SYNCHRONIZE FILE_GENERIC_WRITE = STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE FILE_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE # Access Token Rights (for OpenProcessToken) @@ -163,7 +163,7 @@ class Chef SE_PRIVILEGE_REMOVED = 0X00000004 SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000 SE_PRIVILEGE_VALID_ATTRIBUTES = SE_PRIVILEGE_ENABLED_BY_DEFAULT | - SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS + SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS # Minimum size of a SECURITY_DESCRIPTOR. TODO: this is probably platform dependent. # Make it work on 64 bit. diff --git a/lib/chef/win32/file.rb b/lib/chef/win32/file.rb index 94a771c3ba..2a8f453432 100644 --- a/lib/chef/win32/file.rb +++ b/lib/chef/win32/file.rb @@ -167,9 +167,9 @@ class Chef def self.file_access_check(path, desired_access) security_descriptor = Chef::ReservedNames::Win32::Security.get_file_security(path) token_rights = Chef::ReservedNames::Win32::Security::TOKEN_IMPERSONATE | - Chef::ReservedNames::Win32::Security::TOKEN_QUERY | - Chef::ReservedNames::Win32::Security::TOKEN_DUPLICATE | - Chef::ReservedNames::Win32::Security::STANDARD_RIGHTS_READ + Chef::ReservedNames::Win32::Security::TOKEN_QUERY | + Chef::ReservedNames::Win32::Security::TOKEN_DUPLICATE | + Chef::ReservedNames::Win32::Security::STANDARD_RIGHTS_READ token = Chef::ReservedNames::Win32::Security.open_process_token( Chef::ReservedNames::Win32::Process.get_current_process, token_rights) diff --git a/lib/chef/win32/registry.rb b/lib/chef/win32/registry.rb index 5f8d23b452..bccd2e3c72 100644 --- a/lib/chef/win32/registry.rb +++ b/lib/chef/win32/registry.rb @@ -211,8 +211,8 @@ class Chef hive.open(key, ::Win32::Registry::KEY_READ | registry_system_architecture) do |reg| reg.each do |val_name, val_type, val_data| if safely_downcase(val_name) == safely_downcase(value[:name]) && - val_type == get_type_from_name(value[:type]) && - val_data == value[:data] + val_type == get_type_from_name(value[:type]) && + val_data == value[:data] return true end end diff --git a/spec/functional/resource/powershell_script_spec.rb b/spec/functional/resource/powershell_script_spec.rb index 7a7f7a2ded..af345b0ea4 100644 --- a/spec/functional/resource/powershell_script_spec.rb +++ b/spec/functional/resource/powershell_script_spec.rb @@ -458,7 +458,7 @@ configuration LCM end it "evaluates a successful cmdlet exit status for not_if as true" do - resource.not_if "cd ." + resource.not_if "cd ." expect(resource.should_skip?(:run)).to be_truthy end diff --git a/spec/support/shared/functional/http.rb b/spec/support/shared/functional/http.rb index 8e6b5bfa89..d6ba709c77 100644 --- a/spec/support/shared/functional/http.rb +++ b/spec/support/shared/functional/http.rb @@ -81,7 +81,7 @@ module ChefHTTPShared # (expected_content should be uncompressed) @api.get("/nyan_cat_content_length.png", 200, nil, { - "Content-Length" => nyan_uncompressed_size.to_s + "Content-Length" => nyan_uncompressed_size.to_s } ) { File.open(nyan_uncompressed_filename, "rb") do |f| @@ -109,7 +109,7 @@ module ChefHTTPShared # (expected_content should be uncompressed) @api.get("/nyan_cat_truncated.png", 200, nil, { - "Content-Length" => (nyan_uncompressed_size + 1).to_s + "Content-Length" => (nyan_uncompressed_size + 1).to_s } ) { File.open(nyan_uncompressed_filename, "rb") do |f| diff --git a/spec/support/shared/unit/script_resource.rb b/spec/support/shared/unit/script_resource.rb index a80ab81fb9..ba33d69a59 100644 --- a/spec/support/shared/unit/script_resource.rb +++ b/spec/support/shared/unit/script_resource.rb @@ -74,7 +74,7 @@ shared_examples_for "a script resource" do it "inherits exactly the :cwd, :environment, :group, :path, :user, and :umask attributes from a parent resource class" do inherited_difference = Chef::Resource::Script.guard_inherited_attributes - - [:cwd, :environment, :group, :path, :user, :umask ] + [:cwd, :environment, :group, :path, :user, :umask ] expect(inherited_difference).to eq([]) end diff --git a/spec/unit/knife/core/node_editor_spec.rb b/spec/unit/knife/core/node_editor_spec.rb index 32ce402e19..770e2e84aa 100644 --- a/spec/unit/knife/core/node_editor_spec.rb +++ b/spec/unit/knife/core/node_editor_spec.rb @@ -74,7 +74,7 @@ describe Chef::Knife::NodeEditor do expect(ui).to have_received(:warn) .with "Changing the name of a node results in a new node being " + - "created, test_node will not be modified or removed." + "created, test_node will not be modified or removed." expect(ui).to have_received(:confirm) .with("Proceed with creation of new node") @@ -123,7 +123,7 @@ describe Chef::Knife::NodeEditor do "override" => { "alpha" => { "bravo" => "foxtrot2", "delta" => "golf2" } }, "policy_name" => "mypolicy", "policy_group" => "prod", - "run_list" => %w{role[drama] recipe[mystery]}, + "run_list" => %w{role[drama] recipe[mystery]}, ) end @@ -159,7 +159,7 @@ describe Chef::Knife::NodeEditor do "override" => { "alpha" => { "bravo" => "foxtrot2", "delta" => "golf2" } }, "policy_name" => "mypolicy", "policy_group" => "prod", - "run_list" => %w{role[drama] recipe[mystery]}, + "run_list" => %w{role[drama] recipe[mystery]}, ) end diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb index 37974821d7..eacca2af2e 100644 --- a/spec/unit/knife/core/ui_spec.rb +++ b/spec/unit/knife/core/ui_spec.rb @@ -352,19 +352,19 @@ EOM end it "should return multiple attributes" do - input = { "gi" => "go", "hi" => "ho", "id" => "sample-data-bag-item" } + input = { "gi" => "go", "hi" => "ho", "id" => "sample-data-bag-item" } @ui.config[:attribute] = %w{gi hi} expect(@ui.format_for_display(input)).to eq({ "sample-data-bag-item" => { "gi" => "go", "hi" => "ho" } }) end it "should handle attributes named the same as methods" do - input = { "keys" => "values", "hi" => "ho", "id" => "sample-data-bag-item" } + input = { "keys" => "values", "hi" => "ho", "id" => "sample-data-bag-item" } @ui.config[:attribute] = "keys" expect(@ui.format_for_display(input)).to eq({ "sample-data-bag-item" => { "keys" => "values" } }) end it "should handle nested attributes named the same as methods" do - input = { "keys" => { "keys" => "values" }, "hi" => "ho", "id" => "sample-data-bag-item" } + input = { "keys" => { "keys" => "values" }, "hi" => "ho", "id" => "sample-data-bag-item" } @ui.config[:attribute] = "keys.keys" expect(@ui.format_for_display(input)).to eq({ "sample-data-bag-item" => { "keys.keys" => "values" } }) end @@ -377,7 +377,7 @@ EOM end it "returns nil when given an attribute path that isn't a name or attribute" do - input = { "keys" => { "keys" => "values" }, "hi" => "ho", "id" => "sample-data-bag-item" } + input = { "keys" => { "keys" => "values" }, "hi" => "ho", "id" => "sample-data-bag-item" } non_existing_path = "nope.nada.nothingtoseehere" @ui.config[:attribute] = non_existing_path expect(@ui.format_for_display(input)).to eq({ "sample-data-bag-item" => { non_existing_path => nil } }) diff --git a/spec/unit/knife/node_show_spec.rb b/spec/unit/knife/node_show_spec.rb index b3fc78c954..2f684b27f4 100644 --- a/spec/unit/knife/node_show_spec.rb +++ b/spec/unit/knife/node_show_spec.rb @@ -34,7 +34,7 @@ describe Chef::Knife::NodeShow do end before(:each) do - Chef::Config[:node_name] = "webmonkey.example.com" + Chef::Config[:node_name] = "webmonkey.example.com" end describe "run" do diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb index 7170f62efb..aaca47d951 100644 --- a/spec/unit/node/attribute_spec.rb +++ b/spec/unit/node/attribute_spec.rb @@ -28,114 +28,114 @@ describe Chef::Node::Attribute do "platform_version" => "10.5.7", "platform" => "mac_os_x", "ipaddress" => "192.168.0.117", - "network" => { "default_interface" => "en1", - "interfaces" => { "vmnet1" => { "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, - "number" => "1", - "addresses" => { "00:50:56:c0:00:01" => { "family" => "lladdr" }, - "192.168.110.1" => { "broadcast" => "192.168.110.255", - "netmask" => "255.255.255.0", - "family" => "inet" } }, - "mtu" => "1500", - "type" => "vmnet", - "arp" => { "192.168.110.255" => "ff:ff:ff:ff:ff:ff" }, - "encapsulation" => "Ethernet" }, - "stf0" => { "flags" => [], - "number" => "0", - "addresses" => {}, - "mtu" => "1280", - "type" => "stf", - "encapsulation" => "6to4" }, - "lo0" => { "flags" => %w{UP LOOPBACK RUNNING MULTICAST}, - "number" => "0", - "addresses" => { "::1" => { "scope" => "Node", "prefixlen" => "128", "family" => "inet6" }, - "127.0.0.1" => { "netmask" => "255.0.0.0", "family" => "inet" }, - "fe80::1" => { "scope" => "Link", "prefixlen" => "64", "family" => "inet6" } }, - "mtu" => "16384", - "type" => "lo", - "encapsulation" => "Loopback" }, - "gif0" => { "flags" => %w{POINTOPOINT MULTICAST}, - "number" => "0", - "addresses" => {}, - "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" }, - "en0" => { "status" => "inactive", - "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, - "number" => "0", - "addresses" => { "00:23:32:b0:32:f2" => { "family" => "lladdr" } }, - "mtu" => "1500", - "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"] } }, - "selected" => { "autoselect" => { "options" => [] } } }, - "type" => "en", - "encapsulation" => "Ethernet" }, - "en1" => { "status" => "active", - "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, - "number" => "1", - "addresses" => { "fe80::223:6cff:fe7f:676c" => { "scope" => "Link", "prefixlen" => "64", "family" => "inet6" }, - "00:23:6c:7f:67:6c" => { "family" => "lladdr" }, - "192.168.0.117" => { "broadcast" => "192.168.0.255", - "netmask" => "255.255.255.0", - "family" => "inet" } }, - "mtu" => "1500", - "media" => { "supported" => { "autoselect" => { "options" => [] } }, - "selected" => { "autoselect" => { "options" => [] } } }, - "type" => "en", - "arp" => { "192.168.0.72" => "0:f:ea:39:fa:d5", - "192.168.0.1" => "0:1c:fb:fc:6f:20", - "192.168.0.255" => "ff:ff:ff:ff:ff:ff", - "192.168.0.3" => "0:1f:33:ea:26:9b", - "192.168.0.77" => "0:23:12:70:f8:cf", - "192.168.0.152" => "0:26:8:7d:2:4c" }, - "encapsulation" => "Ethernet" }, - "en2" => { "status" => "active", - "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, - "number" => "2", - "addresses" => { "169.254.206.152" => { "broadcast" => "169.254.255.255", - "netmask" => "255.255.0.0", - "family" => "inet" }, - "00:1c:42:00:00:01" => { "family" => "lladdr" }, - "fe80::21c:42ff:fe00:1" => { "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" } } }, + "network" => { "default_interface" => "en1", + "interfaces" => { "vmnet1" => { "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, + "number" => "1", + "addresses" => { "00:50:56:c0:00:01" => { "family" => "lladdr" }, + "192.168.110.1" => { "broadcast" => "192.168.110.255", + "netmask" => "255.255.255.0", + "family" => "inet" } }, + "mtu" => "1500", + "type" => "vmnet", + "arp" => { "192.168.110.255" => "ff:ff:ff:ff:ff:ff" }, + "encapsulation" => "Ethernet" }, + "stf0" => { "flags" => [], + "number" => "0", + "addresses" => {}, + "mtu" => "1280", + "type" => "stf", + "encapsulation" => "6to4" }, + "lo0" => { "flags" => %w{UP LOOPBACK RUNNING MULTICAST}, + "number" => "0", + "addresses" => { "::1" => { "scope" => "Node", "prefixlen" => "128", "family" => "inet6" }, + "127.0.0.1" => { "netmask" => "255.0.0.0", "family" => "inet" }, + "fe80::1" => { "scope" => "Link", "prefixlen" => "64", "family" => "inet6" } }, + "mtu" => "16384", + "type" => "lo", + "encapsulation" => "Loopback" }, + "gif0" => { "flags" => %w{POINTOPOINT MULTICAST}, + "number" => "0", + "addresses" => {}, + "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" }, + "en0" => { "status" => "inactive", + "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, + "number" => "0", + "addresses" => { "00:23:32:b0:32:f2" => { "family" => "lladdr" } }, + "mtu" => "1500", + "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"] } }, + "selected" => { "autoselect" => { "options" => [] } } }, + "type" => "en", + "encapsulation" => "Ethernet" }, + "en1" => { "status" => "active", + "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, + "number" => "1", + "addresses" => { "fe80::223:6cff:fe7f:676c" => { "scope" => "Link", "prefixlen" => "64", "family" => "inet6" }, + "00:23:6c:7f:67:6c" => { "family" => "lladdr" }, + "192.168.0.117" => { "broadcast" => "192.168.0.255", + "netmask" => "255.255.255.0", + "family" => "inet" } }, + "mtu" => "1500", + "media" => { "supported" => { "autoselect" => { "options" => [] } }, + "selected" => { "autoselect" => { "options" => [] } } }, + "type" => "en", + "arp" => { "192.168.0.72" => "0:f:ea:39:fa:d5", + "192.168.0.1" => "0:1c:fb:fc:6f:20", + "192.168.0.255" => "ff:ff:ff:ff:ff:ff", + "192.168.0.3" => "0:1f:33:ea:26:9b", + "192.168.0.77" => "0:23:12:70:f8:cf", + "192.168.0.152" => "0:26:8:7d:2:4c" }, + "encapsulation" => "Ethernet" }, + "en2" => { "status" => "active", + "flags" => %w{UP BROADCAST SMART RUNNING SIMPLEX MULTICAST}, + "number" => "2", + "addresses" => { "169.254.206.152" => { "broadcast" => "169.254.255.255", + "netmask" => "255.255.0.0", + "family" => "inet" }, + "00:1c:42:00:00:01" => { "family" => "lladdr" }, + "fe80::21c:42ff:fe00:1" => { "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", @@ -551,11 +551,11 @@ describe Chef::Node::Attribute do "place" => {}, }, { - "one" => { "four" => "five" }, + "one" => { "four" => "five" }, "snakes" => "on a plane", }, { - "one" => { "six" => "seven" }, + "one" => { "six" => "seven" }, "snack" => "cookies", }, {}, diff --git a/spec/unit/provider/osx_profile_spec.rb b/spec/unit/provider/osx_profile_spec.rb index 260204f98b..f11fce49db 100644 --- a/spec/unit/provider/osx_profile_spec.rb +++ b/spec/unit/provider/osx_profile_spec.rb @@ -29,30 +29,30 @@ describe Chef::Provider::OsxProfile do let(:new_resource) { Chef::Resource::OsxProfile.new("Profile Test", run_context) } let(:provider) { Chef::Provider::OsxProfile.new(new_resource, run_context) } let(:all_profiles) do - { "_computerlevel" => [{ "ProfileDisplayName" => "Finder Settings", - "ProfileIdentifier" => "com.apple.finder", - "ProfileInstallDate" => "2015-11-08 23:15:21 +0000", - "ProfileItems" => [{ "PayloadContent" => { "PayloadContentManagedPreferences" => { "com.apple.finder" => { "Forced" => [{ "mcx_preference_settings" => { "ShowExternalHardDrivesOnDesktop" => false } }] } } }, - "PayloadDisplayName" => "Custom: (com.apple.finder)", - "PayloadIdentifier" => "com.apple.finder", - "PayloadType" => "com.apple.ManagedClient.preferences", - "PayloadUUID" => "a017048f-684b-4e81-baa3-43afe316d739", - "PayloadVersion" => 1 }], - "ProfileOrganization" => "Chef", - "ProfileRemovalDisallowed" => "false", - "ProfileType" => "Configuration", - "ProfileUUID" => "e2e09bef-e673-44a6-bcbe-ecb5f1c1b740", - "ProfileVerificationState" => "unsigned", - "ProfileVersion" => 1 }, + { "_computerlevel" => [{ "ProfileDisplayName" => "Finder Settings", + "ProfileIdentifier" => "com.apple.finder", + "ProfileInstallDate" => "2015-11-08 23:15:21 +0000", + "ProfileItems" => [{ "PayloadContent" => { "PayloadContentManagedPreferences" => { "com.apple.finder" => { "Forced" => [{ "mcx_preference_settings" => { "ShowExternalHardDrivesOnDesktop" => false } }] } } }, + "PayloadDisplayName" => "Custom: (com.apple.finder)", + "PayloadIdentifier" => "com.apple.finder", + "PayloadType" => "com.apple.ManagedClient.preferences", + "PayloadUUID" => "a017048f-684b-4e81-baa3-43afe316d739", + "PayloadVersion" => 1 }], + "ProfileOrganization" => "Chef", + "ProfileRemovalDisallowed" => "false", + "ProfileType" => "Configuration", + "ProfileUUID" => "e2e09bef-e673-44a6-bcbe-ecb5f1c1b740", + "ProfileVerificationState" => "unsigned", + "ProfileVersion" => 1 }, { "ProfileDisplayName" => "ScreenSaver Settings", "ProfileIdentifier" => "com.testprofile.screensaver", "ProfileInstallDate" => "2015-10-05 23:15:21 +0000", - "ProfileItems" => [{ "PayloadContent" => { "PayloadContentManagedPreferences" => { "com.apple.screensaver" => { "Forced" => [{ "mcx_preference_settings" => { "idleTime" => 0 } }] } } }, - "PayloadDisplayName" => "Custom: (com.apple.screensaver)", - "PayloadIdentifier" => "com.apple.screensaver", - "PayloadType" => "com.apple.ManagedClient.preferences", - "PayloadUUID" => "73fc30e0-1e57-0131-c32d-000c2944c110", - "PayloadVersion" => 1 }], + "ProfileItems" => [{ "PayloadContent" => { "PayloadContentManagedPreferences" => { "com.apple.screensaver" => { "Forced" => [{ "mcx_preference_settings" => { "idleTime" => 0 } }] } } }, + "PayloadDisplayName" => "Custom: (com.apple.screensaver)", + "PayloadIdentifier" => "com.apple.screensaver", + "PayloadType" => "com.apple.ManagedClient.preferences", + "PayloadUUID" => "73fc30e0-1e57-0131-c32d-000c2944c110", + "PayloadVersion" => 1 }], "ProfileOrganization" => "Chef", "ProfileRemovalDisallowed" => "false", "ProfileType" => "Configuration", @@ -185,30 +185,30 @@ describe Chef::Provider::OsxProfile do let(:provider) { Chef::Provider::OsxProfile.new(new_resource, run_context) } let(:current_resource) { Chef::Resource::OsxProfile.new("Profile Test") } let(:all_profiles) do - { "_computerlevel" => [{ "ProfileDisplayName" => "ScreenSaver Settings", - "ProfileIdentifier" => "com.apple.screensaver", - "ProfileInstallDate" => "2015-10-05 23:15:21 +0000", - "ProfileItems" => [{ "PayloadContent" => { "PayloadContentManagedPreferences" => { "com.apple.screensaver" => { "Forced" => [{ "mcx_preference_settings" => { "idleTime" => 0 } }] } } }, - "PayloadDisplayName" => "Custom: (com.apple.screensaver)", - "PayloadIdentifier" => "com.apple.screensaver", - "PayloadType" => "com.apple.ManagedClient.preferences", - "PayloadUUID" => "73fc30e0-1e57-0131-c32d-000c2944c108", - "PayloadVersion" => 1 }], - "ProfileOrganization" => "Chef", - "ProfileRemovalDisallowed" => "false", - "ProfileType" => "Configuration", - "ProfileUUID" => "1781fbec-3325-565f-9022-8aa28135c3cc", - "ProfileVerificationState" => "unsigned", - "ProfileVersion" => 1 }, + { "_computerlevel" => [{ "ProfileDisplayName" => "ScreenSaver Settings", + "ProfileIdentifier" => "com.apple.screensaver", + "ProfileInstallDate" => "2015-10-05 23:15:21 +0000", + "ProfileItems" => [{ "PayloadContent" => { "PayloadContentManagedPreferences" => { "com.apple.screensaver" => { "Forced" => [{ "mcx_preference_settings" => { "idleTime" => 0 } }] } } }, + "PayloadDisplayName" => "Custom: (com.apple.screensaver)", + "PayloadIdentifier" => "com.apple.screensaver", + "PayloadType" => "com.apple.ManagedClient.preferences", + "PayloadUUID" => "73fc30e0-1e57-0131-c32d-000c2944c108", + "PayloadVersion" => 1 }], + "ProfileOrganization" => "Chef", + "ProfileRemovalDisallowed" => "false", + "ProfileType" => "Configuration", + "ProfileUUID" => "1781fbec-3325-565f-9022-8aa28135c3cc", + "ProfileVerificationState" => "unsigned", + "ProfileVersion" => 1 }, { "ProfileDisplayName" => "ScreenSaver Settings", "ProfileIdentifier" => "com.testprofile.screensaver", "ProfileInstallDate" => "2015-10-05 23:15:21 +0000", - "ProfileItems" => [{ "PayloadContent" => { "PayloadContentManagedPreferences" => { "com.apple.screensaver" => { "Forced" => [{ "mcx_preference_settings" => { "idleTime" => 0 } }] } } }, - "PayloadDisplayName" => "Custom: (com.apple.screensaver)", - "PayloadIdentifier" => "com.apple.screensaver", - "PayloadType" => "com.apple.ManagedClient.preferences", - "PayloadUUID" => "73fc30e0-1e57-0131-c32d-000c2944c110", - "PayloadVersion" => 1 }], + "ProfileItems" => [{ "PayloadContent" => { "PayloadContentManagedPreferences" => { "com.apple.screensaver" => { "Forced" => [{ "mcx_preference_settings" => { "idleTime" => 0 } }] } } }, + "PayloadDisplayName" => "Custom: (com.apple.screensaver)", + "PayloadIdentifier" => "com.apple.screensaver", + "PayloadType" => "com.apple.ManagedClient.preferences", + "PayloadUUID" => "73fc30e0-1e57-0131-c32d-000c2944c110", + "PayloadVersion" => 1 }], "ProfileOrganization" => "Chef", "ProfileRemovalDisallowed" => "false", "ProfileType" => "Configuration", diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb index bd1e637570..2e3f6e4e9e 100644 --- a/spec/unit/provider/route_spec.rb +++ b/spec/unit/provider/route_spec.rb @@ -52,7 +52,7 @@ describe Chef::Provider::Route do before do @node.automatic_attrs[:os] = "linux" routing_table = "Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT\n" + - "eth0 0064A8C0 0984A8C0 0003 0 0 0 00FFFFFF 0 0 0\n" + "eth0 0064A8C0 0984A8C0 0003 0 0 0 00FFFFFF 0 0 0\n" route_file = StringIO.new(routing_table) allow(File).to receive(:open).with("/proc/net/route", "r").and_return(route_file) end diff --git a/spec/unit/provider/subversion_spec.rb b/spec/unit/provider/subversion_spec.rb index 372f3499c4..2744fb9207 100644 --- a/spec/unit/provider/subversion_spec.rb +++ b/spec/unit/provider/subversion_spec.rb @@ -54,15 +54,15 @@ describe Chef::Provider::Subversion do end it "determines the current revision if there's a checkout with svn data available" do - example_svn_info = "Path: .\n" + - "URL: http://svn.example.org/trunk/myapp\n" + - "Repository Root: http://svn.example.org\n" + - "Repository UUID: d62ff500-7bbc-012c-85f1-0026b0e37c24\n" + - "Revision: 11739\nNode Kind: directory\n" + - "Schedule: normal\n" + - "Last Changed Author: codeninja\n" + - "Last Changed Rev: 11410\n" + # Last Changed Rev is preferred to Revision - "Last Changed Date: 2009-03-25 06:09:56 -0600 (Wed, 25 Mar 2009)\n\n" + example_svn_info = "Path: .\n" + + "URL: http://svn.example.org/trunk/myapp\n" + + "Repository Root: http://svn.example.org\n" + + "Repository UUID: d62ff500-7bbc-012c-85f1-0026b0e37c24\n" + + "Revision: 11739\nNode Kind: directory\n" + + "Schedule: normal\n" + + "Last Changed Author: codeninja\n" + + "Last Changed Rev: 11410\n" + # Last Changed Rev is preferred to Revision + "Last Changed Date: 2009-03-25 06:09:56 -0600 (Wed, 25 Mar 2009)\n\n" expect(::File).to receive(:exist?).at_least(1).times.with("/my/deploy/dir/.svn").and_return(true) expected_command = ["svn info", { :cwd => "/my/deploy/dir", :returns => [0, 1] }] expect(@provider).to receive(:shell_out!).with(*expected_command). @@ -109,15 +109,15 @@ describe Chef::Provider::Subversion do end it "queries the server and resolves the revision if it's not an integer (i.e. 'HEAD')" do - example_svn_info = "Path: .\n" + - "URL: http://svn.example.org/trunk/myapp\n" + - "Repository Root: http://svn.example.org\n" + - "Repository UUID: d62ff500-7bbc-012c-85f1-0026b0e37c24\n" + - "Revision: 11739\nNode Kind: directory\n" + - "Schedule: normal\n" + - "Last Changed Author: codeninja\n" + - "Last Changed Rev: 11410\n" + # Last Changed Rev is preferred to Revision - "Last Changed Date: 2009-03-25 06:09:56 -0600 (Wed, 25 Mar 2009)\n\n" + example_svn_info = "Path: .\n" + + "URL: http://svn.example.org/trunk/myapp\n" + + "Repository Root: http://svn.example.org\n" + + "Repository UUID: d62ff500-7bbc-012c-85f1-0026b0e37c24\n" + + "Revision: 11739\nNode Kind: directory\n" + + "Schedule: normal\n" + + "Last Changed Author: codeninja\n" + + "Last Changed Rev: 11410\n" + # Last Changed Rev is preferred to Revision + "Last Changed Date: 2009-03-25 06:09:56 -0600 (Wed, 25 Mar 2009)\n\n" @resource.revision "HEAD" expected_command = ["svn info http://svn.example.org/trunk/ --no-auth-cache -rHEAD", { :cwd => "/my/deploy/dir", :returns => [0, 1] }] expect(@provider).to receive(:shell_out!).with(*expected_command). diff --git a/spec/unit/resource/powershell_script_spec.rb b/spec/unit/resource/powershell_script_spec.rb index f1a9215caa..6457090608 100644 --- a/spec/unit/resource/powershell_script_spec.rb +++ b/spec/unit/resource/powershell_script_spec.rb @@ -61,7 +61,7 @@ describe Chef::Resource::PowershellScript do it "inherits exactly the :cwd, :environment, :group, :path, :user, :umask, and :architecture attributes from a parent resource class" do inherited_difference = Chef::Resource::PowershellScript.guard_inherited_attributes - - [:cwd, :environment, :group, :path, :user, :umask, :architecture ] + [:cwd, :environment, :group, :path, :user, :umask, :architecture ] expect(inherited_difference).to eq([]) end diff --git a/spec/unit/rest_spec.rb b/spec/unit/rest_spec.rb index 9e99a3e32f..ea3bd88023 100644 --- a/spec/unit/rest_spec.rb +++ b/spec/unit/rest_spec.rb @@ -327,7 +327,7 @@ describe Chef::REST do context "when configured to disable compression" do let(:rest) do allow(Net::HTTP).to receive(:new).and_return(http_client) - Chef::REST.new(base_url, nil, nil, :disable_gzip => true) + Chef::REST.new(base_url, nil, nil, :disable_gzip => true) end it "does not accept encoding gzip" do |