diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-01-18 09:12:29 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-01-18 09:12:29 -0800 |
commit | 86643d99789002eca3f064f3450fe48dcd316753 (patch) | |
tree | 525ffeff996a1333a498d33821fe7257281a8337 /lib/chef | |
parent | ca084429991a141127c80e9d2a08cb1bb68585c4 (diff) | |
download | chef-86643d99789002eca3f064f3450fe48dcd316753.tar.gz |
Autofixing Style/PercentLiteralDelimeterslcg/percentliteraldelimeters
See chef/chefstyle#11 for analysis and discussion. We select '{}' since
audit of our source code shows that is the most common, and that used to
be the dominant learning paradigm (e.g. in ruby 1.9 pickaxe book.
Diffstat (limited to 'lib/chef')
45 files changed, 77 insertions, 77 deletions
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb index 37f30dde45..ab161c7fb2 100644 --- a/lib/chef/chef_fs/chef_fs_data_store.rb +++ b/lib/chef/chef_fs/chef_fs_data_store.rb @@ -288,7 +288,7 @@ class Chef end # GET /cookbooks/NAME/VERSION or /cookbook_artifacts/NAME/IDENTIFIER - elsif %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length == 3 + elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 3 with_entry(path) do |entry| cookbook_type = path[0] result = nil @@ -325,8 +325,8 @@ class Chef result['metadata'] = result['metadata'].to_hash result['metadata'].delete_if do |key,value| value == [] || - (value == {} && !%w(dependencies attributes recipes).include?(key)) || - (value == "" && %w(source_url issues_url).include?(key)) || + (value == {} && !%w{dependencies attributes recipes}.include?(key)) || + (value == "" && %w{source_url issues_url}.include?(key)) || (value == false && key == "privacy") end end @@ -354,7 +354,7 @@ class Chef end # Write out the files! - if %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length == 3 + if %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 3 write_cookbook(path, data, *options) # Handle /policy_groups/some_policy_group/policies/some_policy_name @@ -418,7 +418,7 @@ class Chef else with_entry(path) do |entry| begin - if %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length >= 3 + if %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length >= 3 entry.delete(true) else entry.delete(false) @@ -499,7 +499,7 @@ class Chef policies.keys end - elsif %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length == 1 + elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 1 with_entry(path) do |entry| begin if path[0] == "cookbook_artifacts" @@ -516,7 +516,7 @@ class Chef end end - elsif %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length == 2 + elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 2 if chef_fs.versioned_cookbooks || path[0] == "cookbook_artifacts" result = with_entry([ path[0] ]) do |entry| # list /cookbooks/name = filter /cookbooks/name-version down to name @@ -551,7 +551,7 @@ class Chef # Older versions of chef-zero do not understand policies and cookbook_artifacts, # don't give that stuff to them if path == [] && ChefZero::VERSION.to_f < 4.4 - result.reject! { |child| %w(policies policy_data cookbook_artifacts).include?(child) } + result.reject! { |child| %w{policies policy_data cookbook_artifacts}.include?(child) } end result end @@ -575,7 +575,7 @@ class Chef if use_memory_store?(path) @memory_store.exists_dir?(path) - elsif %w(cookbooks cookbook_artifacts).include?(path[0]) && path.length == 2 + elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) && path.length == 2 list([ path[0] ]).include?(path[1]) # /policies/NAME @@ -661,7 +661,7 @@ class Chef elsif path[0] == "policies" && path[2] == "revisions" && path.length >= 4 path = [ "policies", "#{path[1]}-#{path[3]}.json" ] - elsif %w(cookbooks cookbook_artifacts).include?(path[0]) + elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) if path.length == 2 raise ChefZero::DataStore::DataNotFoundError.new(path) elsif path.length >= 3 @@ -707,7 +707,7 @@ class Chef path[2] = path[2][0..-6] end - elsif %w(cookbooks cookbook_artifacts).include?(path[0]) + elsif %w{cookbooks cookbook_artifacts}.include?(path[0]) if chef_fs.versioned_cookbooks || path[0] == "cookbook_artifacts" # cookbooks/name-version/... -> cookbooks/name/version/... if path.length >= 2 @@ -741,7 +741,7 @@ class Chef end def path_always_exists?(path) - return path.length == 1 && %w(clients cookbooks data environments nodes roles users).include?(path[0]) + return path.length == 1 && %w{clients cookbooks data environments nodes roles users}.include?(path[0]) end def with_entry(path) diff --git a/lib/chef/chef_fs/config.rb b/lib/chef/chef_fs/config.rb index 5b9d34441b..07c014e2ab 100644 --- a/lib/chef/chef_fs/config.rb +++ b/lib/chef/chef_fs/config.rb @@ -234,11 +234,11 @@ class Chef result = {} case @chef_config[:repo_mode] when "static" - object_names = %w(cookbooks data_bags environments roles) + object_names = %w{cookbooks data_bags environments roles} when "hosted_everything" - object_names = %w(acls clients cookbooks cookbook_artifacts containers data_bags environments groups nodes roles policies policy_groups) + object_names = %w{acls clients cookbooks cookbook_artifacts containers data_bags environments groups nodes roles policies policy_groups} else - object_names = %w(clients cookbooks data_bags environments nodes roles users) + object_names = %w{clients cookbooks data_bags environments nodes roles users} end object_names.each do |object_name| # cookbooks -> cookbook_path diff --git a/lib/chef/chef_fs/data_handler/environment_data_handler.rb b/lib/chef/chef_fs/data_handler/environment_data_handler.rb index 2480415f85..3b9d5b4ec7 100644 --- a/lib/chef/chef_fs/data_handler/environment_data_handler.rb +++ b/lib/chef/chef_fs/data_handler/environment_data_handler.rb @@ -26,7 +26,7 @@ class Chef end def to_ruby(object) - result = to_ruby_keys(object, %w(name description default_attributes override_attributes)) + result = to_ruby_keys(object, %w{name description default_attributes override_attributes}) if object["cookbook_versions"] object["cookbook_versions"].each_pair do |name, version| result << "cookbook #{name.inspect}, #{version.inspect}" diff --git a/lib/chef/chef_fs/data_handler/role_data_handler.rb b/lib/chef/chef_fs/data_handler/role_data_handler.rb index a3a1a31dc7..eb10f7bb4a 100644 --- a/lib/chef/chef_fs/data_handler/role_data_handler.rb +++ b/lib/chef/chef_fs/data_handler/role_data_handler.rb @@ -32,7 +32,7 @@ class Chef end def to_ruby(object) - to_ruby_keys(object, %w(name description default_attributes override_attributes run_list env_run_lists)) + to_ruby_keys(object, %w{name description default_attributes override_attributes run_list env_run_lists}) end end end diff --git a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb index 4a602ba66d..4fec51a9b1 100644 --- a/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb +++ b/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb @@ -26,7 +26,7 @@ class Chef module FileSystem module ChefServer class AclEntry < RestListEntry - PERMISSIONS = %w(create read update delete grant) + PERMISSIONS = %w{create read update delete grant} def api_path "#{super}/_acl" diff --git a/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb b/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb index aa1ebf159e..4f8fff1bda 100644 --- a/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb +++ b/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb @@ -27,7 +27,7 @@ class Chef module FileSystem module ChefServer class AclsDir < BaseFSDir - ENTITY_TYPES = %w(clients containers cookbooks data_bags environments groups nodes roles) # we don't read sandboxes, so we don't read their acls + ENTITY_TYPES = %w{clients containers cookbooks data_bags environments groups nodes roles} # we don't read sandboxes, so we don't read their acls def data_handler @data_handler ||= Chef::ChefFS::DataHandler::AclDataHandler.new diff --git a/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb b/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb index 00c1c71b71..2e45b74450 100644 --- a/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb +++ b/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb @@ -42,7 +42,7 @@ class Chef begin rest.post(api_path, "username" => member) rescue Net::HTTPServerException => e - if %w(404 405).include?(e.response.code) + if %w{404 405}.include?(e.response.code) raise "Chef server at #{api_path} does not allow you to directly add members. Please either upgrade your Chef server or move the users you want into invitations.json instead of members.json." else raise diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb index a3a3dfc6b9..24017acc13 100644 --- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb @@ -73,7 +73,7 @@ class Chef attr_reader :child_paths attr_reader :versioned_cookbooks - CHILDREN = %w(org.json invitations.json members.json) + CHILDREN = %w{org.json invitations.json members.json} def children @children ||= begin diff --git a/lib/chef/chef_fs/knife.rb b/lib/chef/chef_fs/knife.rb index 83adf6a495..4501aeea0f 100644 --- a/lib/chef/chef_fs/knife.rb +++ b/lib/chef/chef_fs/knife.rb @@ -145,7 +145,7 @@ class Chef end def discover_repo_dir(dir) - %w(.chef cookbooks data_bags environments roles).each do |subdir| + %w{.chef cookbooks data_bags environments roles}.each do |subdir| return dir if File.directory?(File.join(dir, subdir)) end # If this isn't it, check the parent diff --git a/lib/chef/client.rb b/lib/chef/client.rb index 2362c14db1..a524a9cd54 100644 --- a/lib/chef/client.rb +++ b/lib/chef/client.rb @@ -536,7 +536,7 @@ class Chef # @api private # def run_ohai - filter = Chef::Config[:minimal_ohai] ? %w[fqdn machinename hostname platform platform_version os os_version] : nil + filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil ohai.all_plugins(filter) events.ohai_completed(node) end diff --git a/lib/chef/dsl/chef_provisioning.rb b/lib/chef/dsl/chef_provisioning.rb index 35f175296b..27458dc04a 100644 --- a/lib/chef/dsl/chef_provisioning.rb +++ b/lib/chef/dsl/chef_provisioning.rb @@ -23,7 +23,7 @@ class Chef # require 'chef-provisioning' (which will define the actual method) and then call the # method chef-provisioning defined. module ChefProvisioning - %w( + %w{ add_machine_options current_image_options current_machine_options @@ -36,7 +36,7 @@ class Chef with_driver with_image_options with_machine_options - ).each do |method_name| + }.each do |method_name| eval(<<-EOM, binding, __FILE__, __LINE__+1) def #{method_name}(*args, &block) Chef::DSL::ChefProvisioning.load_chef_provisioning diff --git a/lib/chef/dsl/cheffish.rb b/lib/chef/dsl/cheffish.rb index 736ad52add..019dadd3f2 100644 --- a/lib/chef/dsl/cheffish.rb +++ b/lib/chef/dsl/cheffish.rb @@ -23,7 +23,7 @@ class Chef # require 'cheffish' (which will define the actual method) and then call the # method cheffish defined. module Cheffish - %w( + %w{ chef_acl chef_client chef_container @@ -43,7 +43,7 @@ class Chef with_chef_server with_chef_local_server get_private_key - ).each do |method_name| + }.each do |method_name| eval(<<-EOM, binding, __FILE__, __LINE__+1) def #{method_name}(*args, &block) Chef::DSL::Cheffish.load_cheffish diff --git a/lib/chef/dsl/recipe.rb b/lib/chef/dsl/recipe.rb index 8a25328023..5e39919158 100644 --- a/lib/chef/dsl/recipe.rb +++ b/lib/chef/dsl/recipe.rb @@ -51,9 +51,9 @@ class Chef def describe_self_for_error if respond_to?(:name) - %Q[`#{self.class} "#{name}"'] + %Q{`#{self.class} "#{name}"'} elsif respond_to?(:recipe_name) - %Q[`#{self.class} "#{recipe_name}"'] + %Q{`#{self.class} "#{recipe_name}"'} else to_s end diff --git a/lib/chef/encrypted_data_bag_item/encryptor.rb b/lib/chef/encrypted_data_bag_item/encryptor.rb index 98c83f3201..5edf5b9530 100644 --- a/lib/chef/encrypted_data_bag_item/encryptor.rb +++ b/lib/chef/encrypted_data_bag_item/encryptor.rb @@ -127,7 +127,7 @@ class Chef::EncryptedDataBagItem end def self.encryptor_keys - %w( encrypted_data iv version cipher ) + %w{ encrypted_data iv version cipher } end end @@ -155,7 +155,7 @@ class Chef::EncryptedDataBagItem end def self.encryptor_keys - super + %w( hmac ) + super + %w{ hmac } end end @@ -216,7 +216,7 @@ class Chef::EncryptedDataBagItem end def self.encryptor_keys - super + %w( auth_tag ) + super + %w{ auth_tag } end end diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index 25f2735b7d..dfc5a6efbb 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -220,7 +220,7 @@ class Chef class ImmutableAttributeModification < NoMethodError def initialize super "Node attributes are read-only when you do not specify which precedence level to set. " + - %Q(To set an attribute use code like `node.default["key"] = "value"') + %Q{To set an attribute use code like `node.default["key"] = "value"'} end end diff --git a/lib/chef/http/http_request.rb b/lib/chef/http/http_request.rb index 891ffef05e..2dec4d8267 100644 --- a/lib/chef/http/http_request.rb +++ b/lib/chef/http/http_request.rb @@ -125,7 +125,7 @@ class Chef rescue NoMethodError => e # http://redmine.ruby-lang.org/issues/show/2708 # http://redmine.ruby-lang.org/issues/show/2758 - if e.to_s =~ /#{Regexp.escape(%q|undefined method `closed?' for nil:NilClass|)}/ + if e.to_s =~ /#{Regexp.escape(%q{undefined method `closed?' for nil:NilClass})}/ Chef::Log.debug("Rescued error in http connect, re-raising as Errno::ECONNREFUSED to hide bug in net/http") Chef::Log.debug("#{e.class.name}: #{e}") Chef::Log.debug(e.backtrace.join("\n")) diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index fdc34d1c49..a070c6c858 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -230,7 +230,7 @@ class Chef private - OFFICIAL_PLUGINS = %w[ec2 rackspace windows openstack terremark bluebox] + OFFICIAL_PLUGINS = %w{ec2 rackspace windows openstack terremark bluebox} def self.path_from_caller(caller_line) caller_line.split(/:\d+/).first diff --git a/lib/chef/knife/core/node_editor.rb b/lib/chef/knife/core/node_editor.rb index 9896195a97..897d00932e 100644 --- a/lib/chef/knife/core/node_editor.rb +++ b/lib/chef/knife/core/node_editor.rb @@ -57,7 +57,7 @@ class Chef pristine_copy = Chef::JSONCompat.parse(Chef::JSONCompat.to_json(node)) updated_copy = Chef::JSONCompat.parse(Chef::JSONCompat.to_json(@updated_node)) - updated_properties = %w[ + updated_properties = %w{ name chef_environment automatic @@ -67,7 +67,7 @@ class Chef policy_name policy_group run_list - ].reject do |key| + }.reject do |key| pristine_copy[key] == updated_copy[key] end diff --git a/lib/chef/knife/serve.rb b/lib/chef/knife/serve.rb index 4cb698c968..3f97962eae 100644 --- a/lib/chef/knife/serve.rb +++ b/lib/chef/knife/serve.rb @@ -27,7 +27,7 @@ class Chef # --chef-repo-path forcibly overrides all other paths if config[:chef_repo_path] Chef::Config.chef_repo_path = config[:chef_repo_path] - %w(acl client cookbook container data_bag environment group node role user).each do |variable_name| + %w{acl client cookbook container data_bag environment group node role user}.each do |variable_name| Chef::Config.delete("#{variable_name}_path".to_sym) end end diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index bf2f0d4bf0..2b2a367f18 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -463,7 +463,7 @@ class Chef def cssh cssh_cmd = nil - %w[csshX cssh].each do |cmd| + %w{csshX cssh}.each do |cmd| begin # Unix and Mac only cssh_cmd = shell_out!("which #{cmd}").stdout.strip diff --git a/lib/chef/mixin/path_sanity.rb b/lib/chef/mixin/path_sanity.rb index 00eba5876e..ef04bf288f 100644 --- a/lib/chef/mixin/path_sanity.rb +++ b/lib/chef/mixin/path_sanity.rb @@ -48,9 +48,9 @@ class Chef def sane_paths @sane_paths ||= begin if Chef::Platform.windows? - %w[] + %w{} else - %w[/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin] + %w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin} end end end diff --git a/lib/chef/platform/service_helpers.rb b/lib/chef/platform/service_helpers.rb index 09b6acb897..1a7e739169 100644 --- a/lib/chef/platform/service_helpers.rb +++ b/lib/chef/platform/service_helpers.rb @@ -103,7 +103,7 @@ class Chef end def has_systemd_service_unit?(svc_name) - %w( /etc /usr/lib /lib /run ).any? do |load_path| + %w{ /etc /usr/lib /lib /run }.any? do |load_path| ::File.exist?( Chef.path_to("#{load_path}/systemd/system/#{svc_name.gsub(/@.*$/, '@')}.service") ) @@ -112,7 +112,7 @@ class Chef def has_systemd_unit?(svc_name) # TODO: stop supporting non-service units with service resource - %w( /etc /usr/lib /lib /run ).any? do |load_path| + %w{ /etc /usr/lib /lib /run }.any? do |load_path| ::File.exist?(Chef.path_to("#{load_path}/systemd/system/#{svc_name}")) end end diff --git a/lib/chef/provider/cron.rb b/lib/chef/provider/cron.rb index fbd6510121..361691aa0a 100644 --- a/lib/chef/provider/cron.rb +++ b/lib/chef/provider/cron.rb @@ -199,7 +199,7 @@ class Chef private def set_environment_var(attr_name, attr_value) - if %w(MAILTO PATH SHELL HOME).include?(attr_name) + if %w{MAILTO PATH SHELL HOME}.include?(attr_name) @current_resource.send(attr_name.downcase.to_sym, attr_value) else @current_resource.environment(@current_resource.environment.merge(attr_name => attr_value)) diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb index 07008b98f6..a0f6d076df 100644 --- a/lib/chef/provider/git.rb +++ b/lib/chef/provider/git.rb @@ -283,7 +283,7 @@ class Chef end def git_ls_remote(rev_pattern) - command = git(%Q(ls-remote "#{@new_resource.repository}" "#{rev_pattern}")) + command = git(%Q{ls-remote "#{@new_resource.repository}" "#{rev_pattern}"}) shell_out!(command, run_options).stdout end diff --git a/lib/chef/provider/group/usermod.rb b/lib/chef/provider/group/usermod.rb index 51b14234ba..f4f3ac55ae 100644 --- a/lib/chef/provider/group/usermod.rb +++ b/lib/chef/provider/group/usermod.rb @@ -23,7 +23,7 @@ class Chef class Group class Usermod < Chef::Provider::Group::Groupadd - provides :group, os: %w(openbsd solaris2 hpux) + provides :group, os: %w{openbsd solaris2 hpux} provides :group, platform: "opensuse" def load_current_resource diff --git a/lib/chef/provider/ifconfig/aix.rb b/lib/chef/provider/ifconfig/aix.rb index 4ceb7866db..30e702fe10 100644 --- a/lib/chef/provider/ifconfig/aix.rb +++ b/lib/chef/provider/ifconfig/aix.rb @@ -22,7 +22,7 @@ class Chef class Provider class Ifconfig class Aix < Chef::Provider::Ifconfig - provides :ifconfig, platform: %w(aix) + provides :ifconfig, platform: %w{aix} def load_current_resource @current_resource = Chef::Resource::Ifconfig.new(@new_resource.name) diff --git a/lib/chef/provider/ifconfig/debian.rb b/lib/chef/provider/ifconfig/debian.rb index b7e4adc0a3..3885e55998 100644 --- a/lib/chef/provider/ifconfig/debian.rb +++ b/lib/chef/provider/ifconfig/debian.rb @@ -23,8 +23,8 @@ class Chef class Provider class Ifconfig class Debian < Chef::Provider::Ifconfig - provides :ifconfig, platform: %w(ubuntu), platform_version: ">= 11.10" - provides :ifconfig, platform: %w(debian), platform_version: ">= 7.0" + provides :ifconfig, platform: %w{ubuntu}, platform_version: ">= 11.10" + provides :ifconfig, platform: %w{debian}, platform_version: ">= 7.0" INTERFACES_FILE = "/etc/network/interfaces" INTERFACES_DOT_D_DIR = "/etc/network/interfaces.d" diff --git a/lib/chef/provider/ifconfig/redhat.rb b/lib/chef/provider/ifconfig/redhat.rb index b0131f8f5a..8c02c1be07 100644 --- a/lib/chef/provider/ifconfig/redhat.rb +++ b/lib/chef/provider/ifconfig/redhat.rb @@ -22,7 +22,7 @@ class Chef class Provider class Ifconfig class Redhat < Chef::Provider::Ifconfig - provides :ifconfig, platform_family: %w(fedora rhel) + provides :ifconfig, platform_family: %w{fedora rhel} def initialize(new_resource, run_context) super(new_resource, run_context) diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb index 577505ac69..a6fccfadf4 100644 --- a/lib/chef/provider/mount/aix.rb +++ b/lib/chef/provider/mount/aix.rb @@ -22,7 +22,7 @@ class Chef class Provider class Mount class Aix < Chef::Provider::Mount::Mount - provides :mount, platform: %w(aix) + provides :mount, platform: %w{aix} # Override for aix specific handling def initialize(new_resource, run_context) diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb index fe657659ad..e0bddb454a 100644 --- a/lib/chef/provider/mount/mount.rb +++ b/lib/chef/provider/mount/mount.rb @@ -193,7 +193,7 @@ class Chef def device_should_exist? ( @new_resource.device != "none" ) && ( not network_device? ) && - ( not %w[ cgroup tmpfs fuse ].include? @new_resource.fstype ) + ( not %w{ cgroup tmpfs fuse }.include? @new_resource.fstype ) end private diff --git a/lib/chef/provider/mount/solaris.rb b/lib/chef/provider/mount/solaris.rb index f61b9e673b..76f1ac0137 100644 --- a/lib/chef/provider/mount/solaris.rb +++ b/lib/chef/provider/mount/solaris.rb @@ -27,7 +27,7 @@ class Chef class Mount # Mount Solaris File systems class Solaris < Chef::Provider::Mount - provides :mount, platform: %w(openindiana opensolaris nexentacore omnios solaris2 smartos) + provides :mount, platform: %w{openindiana opensolaris nexentacore omnios solaris2 smartos} extend Forwardable @@ -202,7 +202,7 @@ class Chef end def device_should_exist? - !%w(tmpfs nfs ctfs proc mntfs objfs sharefs fd smbfs vxfs).include?(fstype) + !%w{tmpfs nfs ctfs proc mntfs objfs sharefs fd smbfs vxfs}.include?(fstype) end def mount_at_boot? diff --git a/lib/chef/provider/package/ips.rb b/lib/chef/provider/package/ips.rb index 84cb19486f..a69a2e24e0 100644 --- a/lib/chef/provider/package/ips.rb +++ b/lib/chef/provider/package/ips.rb @@ -27,7 +27,7 @@ class Chef class Package class Ips < Chef::Provider::Package - provides :package, platform: %w(openindiana opensolaris omnios solaris2) + provides :package, platform: %w{openindiana opensolaris omnios solaris2} provides :ips_package, os: "solaris2" attr_accessor :virtual diff --git a/lib/chef/provider/package/rpm.rb b/lib/chef/provider/package/rpm.rb index 019d26d92e..9ab10b062d 100644 --- a/lib/chef/provider/package/rpm.rb +++ b/lib/chef/provider/package/rpm.rb @@ -113,7 +113,7 @@ class Chef def uri_scheme?(str) scheme = URI.split(str).first return false unless scheme - %w(http https ftp file).include?(scheme.downcase) + %w{http https ftp file}.include?(scheme.downcase) rescue URI::InvalidURIError return false end diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index 034f526060..85796e8b9a 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -394,7 +394,7 @@ class Chef end def is_omnibus? - if RbConfig::CONFIG["bindir"] =~ %r!/(opscode|chef|chefdk)/embedded/bin! + if RbConfig::CONFIG["bindir"] =~ %r{/(opscode|chef|chefdk)/embedded/bin} Chef::Log.debug("#{@new_resource} detected omnibus installation in #{RbConfig::CONFIG['bindir']}") # Omnibus installs to a static path because of linking on unix, find it. true diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb index 7b291d5f00..c3fd3f69ec 100644 --- a/lib/chef/provider/package/yum.rb +++ b/lib/chef/provider/package/yum.rb @@ -28,7 +28,7 @@ class Chef class Package class Yum < Chef::Provider::Package - provides :package, platform_family: %w(rhel fedora) + provides :package, platform_family: %w{rhel fedora} provides :yum_package, os: "linux" class RPMUtils diff --git a/lib/chef/provider/service.rb b/lib/chef/provider/service.rb index 1c0738112a..6e1d0b4064 100644 --- a/lib/chef/provider/service.rb +++ b/lib/chef/provider/service.rb @@ -205,7 +205,7 @@ class Chef Chef.set_provider_priority_array :service, [ Systemd, Arch ], platform_family: "arch" Chef.set_provider_priority_array :service, [ Systemd, Gentoo ], platform_family: "gentoo" Chef.set_provider_priority_array :service, [ Systemd, Upstart, Insserv, Debian, Invokercd ], platform_family: "debian" - Chef.set_provider_priority_array :service, [ Systemd, Insserv, Redhat ], platform_family: %w(rhel fedora suse) + Chef.set_provider_priority_array :service, [ Systemd, Insserv, Redhat ], platform_family: %w{rhel fedora suse} end end end diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb index 9d80f5f924..559ad48418 100644 --- a/lib/chef/provider/service/debian.rb +++ b/lib/chef/provider/service/debian.rb @@ -109,7 +109,7 @@ class Chef priority.each { |runlevel, arguments| Chef::Log.debug("#{new_resource} runlevel #{runlevel}, action #{arguments[0]}, priority #{arguments[1]}") # if we are in a update-rc.d default startup runlevel && we start in this runlevel - if %w[ 1 2 3 4 5 S ].include?(runlevel) && arguments[0] == :start + if %w{ 1 2 3 4 5 S }.include?(runlevel) && arguments[0] == :start enabled = true end } diff --git a/lib/chef/provider/service/insserv.rb b/lib/chef/provider/service/insserv.rb index 87527599b0..1c4d294053 100644 --- a/lib/chef/provider/service/insserv.rb +++ b/lib/chef/provider/service/insserv.rb @@ -24,7 +24,7 @@ class Chef class Service class Insserv < Chef::Provider::Service::Init - provides :service, platform_family: %w(debian rhel fedora suse) do |node| + provides :service, platform_family: %w{debian rhel fedora suse} do |node| Chef::Platform::ServiceHelpers.service_resource_providers.include?(:insserv) end diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb index f93cd36348..9cc4258b70 100644 --- a/lib/chef/provider/service/redhat.rb +++ b/lib/chef/provider/service/redhat.rb @@ -28,7 +28,7 @@ class Chef # @api private attr_accessor :current_run_levels - provides :service, platform_family: %w(rhel fedora suse) do |node| + provides :service, platform_family: %w{rhel fedora suse} do |node| Chef::Platform::ServiceHelpers.service_resource_providers.include?(:redhat) end diff --git a/lib/chef/provider/user/aix.rb b/lib/chef/provider/user/aix.rb index a575a41e54..83bd900f79 100644 --- a/lib/chef/provider/user/aix.rb +++ b/lib/chef/provider/user/aix.rb @@ -18,7 +18,7 @@ class Chef class Provider class User class Aix < Chef::Provider::User::Useradd - provides :user, platform: %w(aix) + provides :user, platform: %w{aix} UNIVERSAL_OPTIONS = [[:comment, "-c"], [:gid, "-g"], [:shell, "-s"], [:uid, "-u"]] diff --git a/lib/chef/provider/user/pw.rb b/lib/chef/provider/user/pw.rb index 37890bdc1e..60df7d55f8 100644 --- a/lib/chef/provider/user/pw.rb +++ b/lib/chef/provider/user/pw.rb @@ -22,7 +22,7 @@ class Chef class Provider class User class Pw < Chef::Provider::User - provides :user, platform: %w(freebsd) + provides :user, platform: %w{freebsd} def load_current_resource super diff --git a/lib/chef/provider/user/solaris.rb b/lib/chef/provider/user/solaris.rb index d9108d4ca4..18f44523ff 100644 --- a/lib/chef/provider/user/solaris.rb +++ b/lib/chef/provider/user/solaris.rb @@ -24,7 +24,7 @@ class Chef class Provider class User class Solaris < Chef::Provider::User::Useradd - provides :user, platform: %w(omnios solaris2) + provides :user, platform: %w{omnios solaris2} UNIVERSAL_OPTIONS = [[:comment, "-c"], [:gid, "-g"], [:shell, "-s"], [:uid, "-u"]] attr_writer :password_file diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb index b5659c8a25..6d3f53c6d5 100644 --- a/lib/chef/run_context.rb +++ b/lib/chef/run_context.rb @@ -600,7 +600,7 @@ ERROR_MESSAGE # class ChildRunContext < RunContext extend Forwardable - def_delegators :parent_run_context, *%w( + def_delegators :parent_run_context, *%w{ cancel_reboot config cookbook_collection @@ -627,7 +627,7 @@ ERROR_MESSAGE request_reboot resolve_attribute unreachable_cookbook? - ) + } def initialize(parent_run_context) @parent_run_context = parent_run_context @@ -638,7 +638,7 @@ ERROR_MESSAGE initialize_child_state end - CHILD_STATE = %w( + CHILD_STATE = %w{ audits audits= create_child @@ -660,7 +660,7 @@ ERROR_MESSAGE parent_run_context resource_collection resource_collection= - ).map { |x| x.to_sym } + }.map { |x| x.to_sym } # Verify that we didn't miss any methods missing_methods = superclass.instance_methods(false) - instance_methods(false) - CHILD_STATE diff --git a/lib/chef/tasks/chef_repo.rake b/lib/chef/tasks/chef_repo.rake index 977f8eb67c..6dce0a5f70 100644 --- a/lib/chef/tasks/chef_repo.rake +++ b/lib/chef/tasks/chef_repo.rake @@ -172,23 +172,23 @@ namespace :databag do end def deprecation_notice - %Q[************************************************* + %Q{************************************************* NOTICE: Chef Repository Rake Tasks Are Deprecated ************************************************* -] +} end def deprecated_cookbook_upload - %Q[ + %Q{ The `upload_cookbook` and `upload_cookbooks` rake tasks are not recommended. These tasks are replaced by other, better workflow tools, such as `knife cookbook upload`, `knife upload`, or `berks` -] +} end def deprecated_data_bag_creation - %Q[ + %Q{ The `data_bags:create` and `data_bags:create_item` tasks are not recommended. You should create data bag items as JSON files in the data_bags directory, with a sub-directory for each bag, and use `knife upload` to @@ -197,5 +197,5 @@ upload them. For example, if you have a data bags named `users`, with ./data_bags/users/finn.json ./data-bags/users/jake.json -] +} end diff --git a/lib/chef/version_constraint.rb b/lib/chef/version_constraint.rb index f30512c3cf..ef0849a120 100644 --- a/lib/chef/version_constraint.rb +++ b/lib/chef/version_constraint.rb @@ -19,8 +19,8 @@ require "chef/version_class" class Chef class VersionConstraint DEFAULT_CONSTRAINT = ">= 0.0.0" - STANDARD_OPS = %w(< > <= >=) - OPS = %w(< > = <= >= ~>) + STANDARD_OPS = %w{< > <= >=} + OPS = %w{< > = <= >= ~>} PATTERN = /^(#{OPS.join('|')}) *([0-9].*)$/ VERSION_CLASS = Chef::Version |