From: Tom Hughes Date: Mon, 2 Feb 2015 22:44:23 +0000 (+0000) Subject: Fix some rubocop detected style issues X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/3a4b1c2078cd515e93a5f1bf8967f380fbd1646f?ds=sidebyside Fix some rubocop detected style issues --- diff --git a/cookbooks/accounts/recipes/default.rb b/cookbooks/accounts/recipes/default.rb index 9627d1d08..545ef7c9f 100644 --- a/cookbooks/accounts/recipes/default.rb +++ b/cookbooks/accounts/recipes/default.rb @@ -33,7 +33,7 @@ search(:accounts, "*:*").each do |account| user_home = details[:home] || account["home"] || "#{node[:accounts][:home]}/#{name}" manage_home = details[:manage_home] || account["manage_home"] || node[:accounts][:manage_home] - group_members = group_members.collect { |m| m.to_s }.sort + group_members = group_members.collect(&:to_s).sort case details[:status] when "role" @@ -92,7 +92,7 @@ search(:accounts, "*:*").each do |account| end end -node[:accounts][:groups].each do |name,details| +node[:accounts][:groups].each do |name, details| group name do action :modify members details[:members] diff --git a/cookbooks/bind/attributes/default.rb b/cookbooks/bind/attributes/default.rb index 29b1d6ba2..9ebc9219e 100644 --- a/cookbooks/bind/attributes/default.rb +++ b/cookbooks/bind/attributes/default.rb @@ -1 +1 @@ -default[:bind] = { } +default[:bind] = {} diff --git a/cookbooks/chef/files/default/knife.rb b/cookbooks/chef/files/default/knife.rb index 1827695e3..1e191ce2c 100644 --- a/cookbooks/chef/files/default/knife.rb +++ b/cookbooks/chef/files/default/knife.rb @@ -4,7 +4,7 @@ validation_client_name 'chef-validator' validation_key '/etc/chef/validation.pem' chef_server_url 'https://chef.openstreetmap.org' cache_type 'BasicFile' -cache_options( :path => '.chef/checksums' ) +cache_options :path => '.chef/checksums' cookbook_path [ 'cookbooks' ] cookbook_copyright 'OpenStreetMap Administrators' cookbook_email 'admins@openstreetmap.org' diff --git a/cookbooks/chef/libraries/compare_versions.rb b/cookbooks/chef/libraries/compare_versions.rb index d2ccf8a08..2f5d60baf 100644 --- a/cookbooks/chef/libraries/compare_versions.rb +++ b/cookbooks/chef/libraries/compare_versions.rb @@ -2,11 +2,11 @@ class Chef class Util def self.compare_versions(a, b) if a.kind_of?(String) - a = a.split(".").map { |c| c.to_i } + a = a.split(".").map(&:to_i) end if b.kind_of?(String) - b = b.split(".").map { |c| c.to_i } + b = b.split(".").map(&:to_i) end a <=> b diff --git a/cookbooks/chef/libraries/subversion.rb b/cookbooks/chef/libraries/subversion.rb index 952037f3f..50b207ff8 100644 --- a/cookbooks/chef/libraries/subversion.rb +++ b/cookbooks/chef/libraries/subversion.rb @@ -38,7 +38,7 @@ class Chef command = scm(:info) status, svn_info, error_message = output_of_command(command, run_options(:cwd => cwd)) - unless [0,1].include?(status.exitstatus) + unless [0, 1].include?(status.exitstatus) handle_command_failures(status, "STDOUT: #{svn_info}\nSTDERR: #{error_message}") end diff --git a/cookbooks/dev/recipes/default.rb b/cookbooks/dev/recipes/default.rb index 1290e11f9..acea45e17 100644 --- a/cookbooks/dev/recipes/default.rb +++ b/cookbooks/dev/recipes/default.rb @@ -105,7 +105,7 @@ search(:accounts, "*:*").each do |account| details = node[:accounts][:users][name] || {} port = 7000 + account["uid"].to_i - if ["user","administrator"].include?(details[:status]) + if ["user", "administrator"].include?(details[:status]) user_home = details[:home] || account["home"] || "#{node[:accounts][:home]}/#{name}" if File.directory?("#{user_home}/public_html") @@ -132,7 +132,7 @@ if node[:postgresql][:clusters][:"9.1/main"] cluster "9.3/main" end - node[:dev][:rails].each do |name,details| + node[:dev][:rails].each do |name, details| database_name = details[:database] || "apis_#{name}" site_name = "#{name}.apis.dev.openstreetmap.org" rails_directory = "/srv/#{name}.apis.dev.openstreetmap.org" diff --git a/cookbooks/exim/attributes/default.rb b/cookbooks/exim/attributes/default.rb index bdd8be4ca..9575f5185 100644 --- a/cookbooks/exim/attributes/default.rb +++ b/cookbooks/exim/attributes/default.rb @@ -5,6 +5,6 @@ default[:exim][:daemon_smtp_ports] = [ 25 ] default[:exim][:trusted_users] = [ ] default[:exim][:smarthost_name] = nil default[:exim][:smarthost_via] = "mail.openstreetmap.org:26" -default[:exim][:routes] = { } +default[:exim][:routes] = {} default[:exim][:aliases][:root] = "tomh" default[:exim][:rewrites] = [ ] diff --git a/cookbooks/exim/metadata.rb b/cookbooks/exim/metadata.rb index d2d622c7c..98a7c73d9 100644 --- a/cookbooks/exim/metadata.rb +++ b/cookbooks/exim/metadata.rb @@ -50,9 +50,9 @@ attribute "exim/smarthost_via", attribute "exim/routes", :display_name => "Custom Routes", :description => "Custom routes for handling local mail", - :default => { } + :default => {} attribute "exim/aliases", :display_name => "Mail Aliases", :description => "Mail aliases", - :default => { } + :default => {} diff --git a/cookbooks/exim/recipes/default.rb b/cookbooks/exim/recipes/default.rb index abf404303..495689841 100644 --- a/cookbooks/exim/recipes/default.rb +++ b/cookbooks/exim/recipes/default.rb @@ -94,7 +94,7 @@ end if node[:exim][:private_aliases] aliases = data_bag_item("exim", "aliases") - aliases[node[:exim][:private_aliases]].each do |name,address| + aliases[node[:exim][:private_aliases]].each do |name, address| node.default[:exim][:aliases][name] = address end end diff --git a/cookbooks/hardware/libraries/sensors.rb b/cookbooks/hardware/libraries/sensors.rb index 512ba31ff..0a55eae39 100644 --- a/cookbooks/hardware/libraries/sensors.rb +++ b/cookbooks/hardware/libraries/sensors.rb @@ -4,7 +4,7 @@ class Chef sensors ||= {} results = [] - sensors.sort.each do |sensor,attributes| + sensors.sort.each do |sensor, attributes| if attributes[:ignore] results << "ignore #{sensor}" else diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 441dbd1e3..fec4b0c98 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -203,7 +203,7 @@ node[:kernel][:modules].each_key do |modname| end end -node[:block_device].each do |name,attributes| +node[:block_device].each do |name, attributes| if attributes[:vendor] == "HP" and attributes[:model] == "LOGICAL VOLUME" if name =~ /^cciss!(c[0-9]+)d[0-9]+$/ status_packages["cciss-vol-status"] |= [ "cciss/#{$1}d0" ] diff --git a/cookbooks/incron/recipes/default.rb b/cookbooks/incron/recipes/default.rb index 29ba1e807..ef44a693b 100644 --- a/cookbooks/incron/recipes/default.rb +++ b/cookbooks/incron/recipes/default.rb @@ -37,7 +37,7 @@ node[:incron].each_value do |details| incrontabs[user].push("#{path} #{mask} #{command}") end -incrontabs.each do |user,lines| +incrontabs.each do |user, lines| file "/var/spool/incron/#{user}" do owner user group "incron" diff --git a/cookbooks/mediawiki/definitions/mediawiki_site.rb b/cookbooks/mediawiki/definitions/mediawiki_site.rb index 5ceccf69c..5b08a3492 100644 --- a/cookbooks/mediawiki/definitions/mediawiki_site.rb +++ b/cookbooks/mediawiki/definitions/mediawiki_site.rb @@ -57,7 +57,7 @@ define :mediawiki_site, :action => [ :create, :enable ] do :private_accounts => params[:private_accounts] || FALSE, :private => params[:private] || FALSE, :recaptcha_public => params[:recaptcha_public_key], - :recaptcha_private => params[:recaptcha_private_key], + :recaptcha_private => params[:recaptcha_private_key] } #---------------- @@ -81,7 +81,7 @@ define :mediawiki_site, :action => [ :create, :enable ] do ruby_block "rename-installer-localsettings" do action :nothing block do - ::File.rename("#{mediawiki[:directory]}/LocalSettings.php","#{mediawiki[:directory]}/LocalSettings-install.php") + ::File.rename("#{mediawiki[:directory]}/LocalSettings.php", "#{mediawiki[:directory]}/LocalSettings-install.php") end end diff --git a/cookbooks/munin/files/default/plugins/api_calls_ b/cookbooks/munin/files/default/plugins/api_calls_ index 8cf836d79..73e2615d0 100755 --- a/cookbooks/munin/files/default/plugins/api_calls_ +++ b/cookbooks/munin/files/default/plugins/api_calls_ @@ -10,11 +10,11 @@ def uris_from_status(server) doc = Hpricot.parse(file) tables = doc / 'table' rows = (tables[0] / 'tr')[1..-1] - data = rows.collect {|r| (r / 'td').collect {|x| x.inner_html} } + data = rows.collect { |r| (r / 'td').collect(&:inner_html) } # filter where the PID is numeric, status is 'W' and host matches the server - matching_data = data.select {|r| (r[1].to_i > 0) && r[3].match(/W/) && r[11].match(server)} + matching_data = data.select { |r| (r[1].to_i > 0) && r[3].match(/W/) && r[11].match(server) } # return only the URI part - matching_data.collect {|r| r[12]} + matching_data.collect { |r| r[12] } end CALL_TYPES = { @@ -53,7 +53,7 @@ if ARGV[0] == 'config' else counts = uris_from_status(server). - collect {|x| categorise_uri(x)}. + collect { |x| categorise_uri(x) }. inject(Hash.new) do |h, e| if h.has_key? e h[e] += 1 diff --git a/cookbooks/munin/files/default/plugins/api_calls_num b/cookbooks/munin/files/default/plugins/api_calls_num index d2f7ea372..c65ae0a7a 100755 --- a/cookbooks/munin/files/default/plugins/api_calls_num +++ b/cookbooks/munin/files/default/plugins/api_calls_num @@ -63,7 +63,7 @@ else min_time, max_time, lines = uris_from_logs delta_t = (max_time - min_time).to_f * 24 * 60 counts = lines. - collect {|x| categorise_uri(x)}. + collect { |x| categorise_uri(x) }. inject(Hash.new) do |h, e| if h.has_key? e h[e] += 1 diff --git a/cookbooks/munin/files/default/plugins/api_waits_ b/cookbooks/munin/files/default/plugins/api_waits_ index 741f190f0..f74e3a5cd 100755 --- a/cookbooks/munin/files/default/plugins/api_waits_ +++ b/cookbooks/munin/files/default/plugins/api_waits_ @@ -10,11 +10,11 @@ def uri_and_times_from_status(server) doc = Hpricot.parse(file) tables = doc / 'table' rows = (tables[0] / 'tr')[1..-1] - data = rows.collect {|r| (r / 'td').collect {|x| x.inner_html} } + data = rows.collect { |r| (r / 'td').collect(&:inner_html) } # filter where the PID is numeric, status is 'W' and host matches the server - matching_data = data.select {|r| (r[1].to_i > 0) && r[3].match(/W/) && r[11].match(server)} + matching_data = data.select { |r| (r[1].to_i > 0) && r[3].match(/W/) && r[11].match(server) } # return URI and number of seconds processing for each request - matching_data.collect {|r| [r[12], r[5].to_i]} + matching_data.collect { |r| [r[12], r[5].to_i] } end CALL_TYPES = { @@ -53,7 +53,7 @@ if ARGV[0] == 'config' else counts = uri_and_times_from_status(server). - collect {|x,y| [categorise_uri(x), y]}. + collect { |x, y| [categorise_uri(x), y] }. inject(Hash.new) do |h, e| category, time = e if h.has_key? category @@ -66,7 +66,7 @@ else CALL_TYPES.keys.each do |type| count = counts[type] || [0] - avg = count.inject(0){|x,y|x+y} / (1.0 * count.length) + avg = count.inject(0) { |x, y|x + y } / (1.0 * count.length) puts "#{type}.value #{avg}" end end diff --git a/cookbooks/munin/recipes/default.rb b/cookbooks/munin/recipes/default.rb index e48c7806d..302a601f7 100644 --- a/cookbooks/munin/recipes/default.rb +++ b/cookbooks/munin/recipes/default.rb @@ -127,7 +127,7 @@ else end end -disks = node[:block_device].select do |_,attributes| +disks = node[:block_device].select do |_, attributes| [ "ATA", "FUJITSU", "SEAGATE", "DELL", "COMPAQ", "IBM-ESXS" ].include?(attributes[:vendor]) end @@ -172,7 +172,7 @@ munin_plugin "http_loadtime" do action :delete end -node[:network][:interfaces].each do |ifname,ifattr| +node[:network][:interfaces].each do |ifname, ifattr| if ifattr[:encapsulation] == "Ethernet" and ifattr[:state] == "up" munin_plugin "if_err_#{ifname}" do target "if_err_" @@ -319,7 +319,7 @@ else end end -node[:block_device].each do |name,attributes| +node[:block_device].each do |name, attributes| if attributes[:vendor] == "ATA" munin_plugin "smart_#{name}" do target "smart_" diff --git a/cookbooks/mysql/libraries/mysql.rb b/cookbooks/mysql/libraries/mysql.rb index c0da28f33..bc5dd3350 100644 --- a/cookbooks/mysql/libraries/mysql.rb +++ b/cookbooks/mysql/libraries/mysql.rb @@ -87,10 +87,10 @@ class Chef end def users - @users ||= query("SELECT * FROM user").inject({}) do |users,user| + @users ||= query("SELECT * FROM user").inject({}) do |users, user| name = "'#{user[:user]}'@'#{user[:host]}'" - users[name] = USER_PRIVILEGES.inject({}) do |privileges,privilege| + users[name] = USER_PRIVILEGES.inject({}) do |privileges, privilege| privileges[privilege] = user["#{privilege}_priv".to_sym] == "Y" privileges end @@ -100,7 +100,7 @@ class Chef end def databases - @databases ||= query("SHOW databases").inject({}) do |databases,database| + @databases ||= query("SHOW databases").inject({}) do |databases, database| databases[database[:database]] = { :permissions => {} } @@ -111,7 +111,7 @@ class Chef if database = @databases[record[:db]] user = "'#{record[:user]}'@'#{record[:host]}'" - database[:permissions][user] = DATABASE_PRIVILEGES.inject([]) do |privileges,privilege| + database[:permissions][user] = DATABASE_PRIVILEGES.inject([]) do |privileges, privilege| privileges << privilege if record["#{privilege}_priv".to_sym] == "Y" privileges end diff --git a/cookbooks/mysql/providers/database.rb b/cookbooks/mysql/providers/database.rb index 556e40454..ab735cd7e 100644 --- a/cookbooks/mysql/providers/database.rb +++ b/cookbooks/mysql/providers/database.rb @@ -36,7 +36,7 @@ action :create do end end - new_permissions = Hash[new_resource.permissions.collect do |user,privileges| + new_permissions = Hash[new_resource.permissions.collect do |user, privileges| [@mysql.canonicalise_user(user), privileges] end] @@ -49,7 +49,7 @@ action :create do end end - new_permissions.each do |user,new_privileges| + new_permissions.each do |user, new_privileges| current_privileges = @current_resource.permissions[user] || {} new_privileges = Array(new_privileges) diff --git a/cookbooks/networking/attributes/default.rb b/cookbooks/networking/attributes/default.rb index 9a03eb3fa..49bd27a57 100644 --- a/cookbooks/networking/attributes/default.rb +++ b/cookbooks/networking/attributes/default.rb @@ -1,3 +1,3 @@ -default[:networking][:interfaces] = { } +default[:networking][:interfaces] = {} default[:networking][:nameservers] = [ ] default[:networking][:search] = [ ] diff --git a/cookbooks/networking/libraries/ipaddresses.rb b/cookbooks/networking/libraries/ipaddresses.rb index 811c81884..5eb54265e 100644 --- a/cookbooks/networking/libraries/ipaddresses.rb +++ b/cookbooks/networking/libraries/ipaddresses.rb @@ -15,11 +15,11 @@ class Chef end def internal_ipaddress - return ipaddresses(:role => :internal).first + ipaddresses(:role => :internal).first end def external_ipaddress - return ipaddresses(:role => :external).first + ipaddresses(:role => :external).first end end end diff --git a/cookbooks/networking/recipes/default.rb b/cookbooks/networking/recipes/default.rb index 04df2495f..74fb00483 100644 --- a/cookbooks/networking/recipes/default.rb +++ b/cookbooks/networking/recipes/default.rb @@ -22,7 +22,7 @@ require "ipaddr" -node[:networking][:interfaces].each do |name,interface| +node[:networking][:interfaces].each do |name, interface| if interface[:role] and role = node[:networking][:roles][interface[:role]] if role[interface[:family]] node.default[:networking][:interfaces][name][:prefix] = role[interface[:family]][:prefix] diff --git a/cookbooks/nfs/recipes/default.rb b/cookbooks/nfs/recipes/default.rb index 1719a967c..e5e88ba65 100644 --- a/cookbooks/nfs/recipes/default.rb +++ b/cookbooks/nfs/recipes/default.rb @@ -19,7 +19,7 @@ package "nfs-common" -node[:nfs].each do |mountpoint,details| +node[:nfs].each do |mountpoint, details| if details[:readonly] mount_options = "ro,bg,soft,udp,rsize=8192,wsize=8192,nfsvers=3" else diff --git a/cookbooks/nominatim/recipes/default.rb b/cookbooks/nominatim/recipes/default.rb index ab4e6e15e..2259c9da7 100644 --- a/cookbooks/nominatim/recipes/default.rb +++ b/cookbooks/nominatim/recipes/default.rb @@ -58,7 +58,7 @@ apache_site "default" do action [ :disable ] end -node[:nominatim][:fpm_pools].each do |name,data| +node[:nominatim][:fpm_pools].each do |name, data| template "/etc/php5/fpm/pool.d/#{name}.conf" do source "fpm.conf.erb" owner "root" diff --git a/cookbooks/ntp/attributes/default.rb b/cookbooks/ntp/attributes/default.rb index 8eccde5fc..66088fb2e 100644 --- a/cookbooks/ntp/attributes/default.rb +++ b/cookbooks/ntp/attributes/default.rb @@ -1,7 +1,7 @@ case platform -when "ubuntu","debian" +when "ubuntu", "debian" default[:ntp][:service] = "ntp" -when "redhat","centos","fedora" +when "redhat", "centos", "fedora" default[:ntp][:service] = "ntpd" end diff --git a/cookbooks/openvpn/recipes/default.rb b/cookbooks/openvpn/recipes/default.rb index a1a52f13e..b1955aa8c 100644 --- a/cookbooks/openvpn/recipes/default.rb +++ b/cookbooks/openvpn/recipes/default.rb @@ -25,7 +25,7 @@ service "openvpn" do ignore_failure true end -node[:openvpn][:tunnels].each do |name,details| +node[:openvpn][:tunnels].each do |name, details| if peer = search(:node, "fqdn:#{details[:peer][:host]}").first if peer[:openvpn] and not details[:peer][:address] node.default[:openvpn][:tunnels][name][:peer][:address] = peer[:openvpn][:address] diff --git a/cookbooks/planet/files/default/replication-bin/replicate-changesets b/cookbooks/planet/files/default/replication-bin/replicate-changesets index 8cdc26e7a..daa7ab0b6 100644 --- a/cookbooks/planet/files/default/replication-bin/replicate-changesets +++ b/cookbooks/planet/files/default/replication-bin/replicate-changesets @@ -9,10 +9,10 @@ require 'xml/libxml' require 'zlib' # after this many changes, a changeset will be closed -CHANGES_LIMIT=50000 +CHANGES_LIMIT = 50000 # this is the scale factor for lat/lon values stored as integers in the database -GEO_SCALE=10000000 +GEO_SCALE = 10000000 ## # changeset class keeps some information about changesets downloaded from the @@ -62,8 +62,8 @@ class Replicator # there. @conn. exec("select id, created_at, closed_at, num_changes from changesets where closed_at > ((now() at time zone 'utc') - '1 hour'::interval)"). - map {|row| Changeset.new(row) }. - select {|cs| cs.activity_between?(last_run, @now) } + map { |row| Changeset.new(row) }. + select { |cs| cs.activity_between?(last_run, @now) } end # creates an XML file containing the changeset information from the @@ -76,7 +76,7 @@ class Replicator 'copyright' => "OpenStreetMap and contributors", 'attribution' => "http://www.openstreetmap.org/copyright", 'license' => "http://opendatacommons.org/licenses/odbl/1-0/" }. - each { |k,v| doc.root[k] = v } + each { |k, v| doc.root[k] = v } changesets.each do |cs| xml = XML::Node.new("changeset") @@ -120,7 +120,7 @@ class Replicator fl.flock(File::LOCK_EX) sequence = (@state.has_key?('sequence') ? @state['sequence'] + 1 : 0) - data_file = @config['data_dir'] + sprintf("/%03d/%03d/%03d.osm.gz", sequence / 1000000, (sequence / 1000) % 1000, (sequence % 1000)); + data_file = @config['data_dir'] + sprintf("/%03d/%03d/%03d.osm.gz", sequence / 1000000, (sequence / 1000) % 1000, (sequence % 1000)) tmp_state = @config['state_file'] + ".tmp" tmp_data = "/tmp/changeset_data.osm.tmp" # try and write the files to tmp locations and then diff --git a/cookbooks/postgresql/libraries/postgresql.rb b/cookbooks/postgresql/libraries/postgresql.rb index 2f672960c..316f8eca3 100644 --- a/cookbooks/postgresql/libraries/postgresql.rb +++ b/cookbooks/postgresql/libraries/postgresql.rb @@ -57,13 +57,13 @@ class Chef # Extract the record data lines.collect do |line| record = {} - fields.zip(line.split("|")) { |name,value| record[name.to_sym] = value } + fields.zip(line.split("|")) { |name, value| record[name.to_sym] = value } record end end def users - @users ||= query("SELECT * FROM pg_user").inject({}) do |users,user| + @users ||= query("SELECT * FROM pg_user").inject({}) do |users, user| users[user[:usename]] = { :superuser => user[:usesuper] == "t", :createdb => user[:usercreatedb] == "t", @@ -75,7 +75,7 @@ class Chef end def databases - @databases ||= query("SELECT d.datname, u.usename, d.encoding, d.datcollate, d.datctype FROM pg_database AS d INNER JOIN pg_user AS u ON d.datdba = u.usesysid").inject({}) do |databases,database| + @databases ||= query("SELECT d.datname, u.usename, d.encoding, d.datcollate, d.datctype FROM pg_database AS d INNER JOIN pg_user AS u ON d.datdba = u.usesysid").inject({}) do |databases, database| databases[database[:datname]] = { :owner => database[:usename], :encoding => database[:encoding], @@ -88,7 +88,7 @@ class Chef def extensions(database) @extensions ||= {} - @extensions[database] ||= query("SELECT extname, extversion FROM pg_extension", :database => database).inject({}) do |extensions,extension| + @extensions[database] ||= query("SELECT extname, extversion FROM pg_extension", :database => database).inject({}) do |extensions, extension| extensions[extension[:extname]] = { :version => extension[:extversion] } @@ -98,7 +98,7 @@ class Chef def tables(database) @tables ||= {} - @tables[database] ||= query("SELECT n.nspname, c.relname, u.usename, c.relacl FROM pg_class AS c INNER JOIN pg_user AS u ON c.relowner = u.usesysid INNER JOIN pg_namespace AS n ON c.relnamespace = n.oid", :database => database).inject({}) do |tables,table| + @tables[database] ||= query("SELECT n.nspname, c.relname, u.usename, c.relacl FROM pg_class AS c INNER JOIN pg_user AS u ON c.relowner = u.usesysid INNER JOIN pg_namespace AS n ON c.relnamespace = n.oid", :database => database).inject({}) do |tables, table| name = "#{table[:nspname]}.#{table[:relname]}" tables[name] = { diff --git a/cookbooks/postgresql/providers/table.rb b/cookbooks/postgresql/providers/table.rb index 1c56b63f1..7bc8cfb02 100644 --- a/cookbooks/postgresql/providers/table.rb +++ b/cookbooks/postgresql/providers/table.rb @@ -51,7 +51,7 @@ action :create do end end - new_resource.permissions.each do |user,new_privileges| + new_resource.permissions.each do |user, new_privileges| current_privileges = @current_resource.permissions[user] || {} new_privileges = Array(new_privileges) diff --git a/cookbooks/postgresql/recipes/default.rb b/cookbooks/postgresql/recipes/default.rb index 9dfde2448..a8b37c590 100644 --- a/cookbooks/postgresql/recipes/default.rb +++ b/cookbooks/postgresql/recipes/default.rb @@ -98,7 +98,7 @@ package "libdbd-pg-perl" clusters = node[:postgresql][:clusters] || [] -clusters.each do |name,details| +clusters.each do |name, details| suffix = name.tr("/", ":") munin_plugin "postgres_bgwriter_#{suffix}" do diff --git a/cookbooks/rsyncd/recipes/default.rb b/cookbooks/rsyncd/recipes/default.rb index 44fef331e..41eaee80a 100644 --- a/cookbooks/rsyncd/recipes/default.rb +++ b/cookbooks/rsyncd/recipes/default.rb @@ -22,7 +22,7 @@ include_recipe "networking" hosts_allow = Hash.new hosts_deny = Hash.new -node[:rsyncd][:modules].each do |name,details| +node[:rsyncd][:modules].each do |name, details| hosts_allow[name] = details[:hosts_allow] || [] if details[:nodes_allow] diff --git a/cookbooks/sysctl/recipes/default.rb b/cookbooks/sysctl/recipes/default.rb index 920402a6e..7a0ed4357 100644 --- a/cookbooks/sysctl/recipes/default.rb +++ b/cookbooks/sysctl/recipes/default.rb @@ -41,7 +41,7 @@ template "/etc/sysctl.d/60-chef.conf" do end node[:sysctl].each_value do |group| - group[:parameters].each do |key,value| + group[:parameters].each do |key, value| sysctl_file = "/proc/sys/#{key.gsub('.', '/')}" file sysctl_file do diff --git a/cookbooks/sysfs/recipes/default.rb b/cookbooks/sysfs/recipes/default.rb index a3de9b40d..0e59c1e1e 100644 --- a/cookbooks/sysfs/recipes/default.rb +++ b/cookbooks/sysfs/recipes/default.rb @@ -33,7 +33,7 @@ template "/etc/sysfs.conf" do end node[:sysfs].each_value do |group| - group[:parameters].each do |key,value| + group[:parameters].each do |key, value| sysfs_file = "/sys/#{key}" file sysfs_file do diff --git a/cookbooks/tile/files/default/ruby/expire.rb b/cookbooks/tile/files/default/ruby/expire.rb index 8bd448a88..4c9d1a31b 100755 --- a/cookbooks/tile/files/default/ruby/expire.rb +++ b/cookbooks/tile/files/default/ruby/expire.rb @@ -15,13 +15,13 @@ module Expire "+nadgrids=@null", "+no_defs +over"]) # width/height of the spherical mercator projection - SIZE=40075016.6855784 + SIZE = 40075016.6855784 # the size of the meta tile blocks METATILE = 8 # the directory root for meta tiles HASH_ROOT = "/tiles/default/" # node cache file - NODE_CACHE_FILE="/store/database/nodes" + NODE_CACHE_FILE = "/store/database/nodes" # turns a spherical mercator coord into a tile coord def Expire.tile_from_merc(point, zoom) @@ -29,8 +29,8 @@ module Expire point.x = 0.5 + point.x / SIZE point.y = 0.5 - point.y / SIZE # transform into tile space - point.x = point.x * 2 ** zoom - point.y = point.y * 2 ** zoom + point.x = point.x * 2**zoom + point.y = point.y * 2**zoom # chop of the fractional parts [point.x.to_int, point.y.to_int, zoom] end @@ -49,7 +49,7 @@ module Expire y &= ~(METATILE - 1) # generate the path hash_path = (0..4).collect { |i| - (((x >> 4*i) & 0xf) << 4) | ((y >> 4*i) & 0xf) + (((x >> 4 * i) & 0xf) << 4) | ((y >> 4 * i) & 0xf) }.reverse.join('/') z.to_s + '/' + hash_path + ".meta" end @@ -176,7 +176,7 @@ module Expire if id <= @max_id offset = 16 + id * 8 - lon, lat = @cache[offset .. offset+7].unpack("ll") + lon, lat = @cache[offset..offset + 7].unpack("ll") if lon != -2147483648 && lat != -2147483648 node = Node.new(lon, lat) diff --git a/cookbooks/tile/recipes/default.rb b/cookbooks/tile/recipes/default.rb index 767b4d3e1..fc4feb0b6 100644 --- a/cookbooks/tile/recipes/default.rb +++ b/cookbooks/tile/recipes/default.rb @@ -235,7 +235,7 @@ directory "/srv/tile.openstreetmap.org/styles" do mode 0755 end -node[:tile][:styles].each do |name,details| +node[:tile][:styles].each do |name, details| style_directory = "/srv/tile.openstreetmap.org/styles/#{name}" tile_directory = "/srv/tile.openstreetmap.org/tiles/#{name}" @@ -513,7 +513,7 @@ template "/usr/local/bin/cleanup-tiles" do mode 0755 end -tile_directories = node[:tile][:styles].collect do |_,style| +tile_directories = node[:tile][:styles].collect do |_, style| style[:tile_directories].collect { |directory| directory[:name] } end.flatten.sort.uniq diff --git a/cookbooks/web/recipes/rails.rb b/cookbooks/web/recipes/rails.rb index dd4260900..bc10fac39 100644 --- a/cookbooks/web/recipes/rails.rb +++ b/cookbooks/web/recipes/rails.rb @@ -37,7 +37,7 @@ end rails_directory = "#{node[:web][:base_directory]}/rails" -piwik_configuration = data_bag_item("web", "piwik").to_hash.reject do |k,_| +piwik_configuration = data_bag_item("web", "piwik").to_hash.reject do |k, _| ["chef_type", "data_bag", "id"].include?(k) end diff --git a/roles/errol.rb b/roles/errol.rb index a74cf8452..69b0d8db4 100644 --- a/roles/errol.rb +++ b/roles/errol.rb @@ -40,7 +40,7 @@ default_attributes( } } } -); +) run_list( "role[ucl-wolfson]", diff --git a/roles/forum.rb b/roles/forum.rb index 3c355851e..379001378 100644 --- a/roles/forum.rb +++ b/roles/forum.rb @@ -21,7 +21,7 @@ default_attributes( :start_servers => 20, :min_spare_servers => 20, :max_spare_servers => 50, - :max_clients => 256, + :max_clients => 256 } } ) diff --git a/roles/ironbelly.rb b/roles/ironbelly.rb index 06876abbb..21047885f 100644 --- a/roles/ironbelly.rb +++ b/roles/ironbelly.rb @@ -84,7 +84,7 @@ default_attributes( } } } -); +) run_list( "role[ic]", diff --git a/roles/katla.rb b/roles/katla.rb index 417dc7e60..674dd854e 100644 --- a/roles/katla.rb +++ b/roles/katla.rb @@ -77,7 +77,7 @@ default_attributes( } } } -); +) run_list( "role[ic]", diff --git a/roles/nominatim.rb b/roles/nominatim.rb index 6c7d972cf..0aa56aaf4 100644 --- a/roles/nominatim.rb +++ b/roles/nominatim.rb @@ -9,7 +9,7 @@ default_attributes( :nominatim => { :status => :role, :members => [ :lonvia, :tomh, :twain ] - }, + } } }, :apache => { diff --git a/roles/owl.rb b/roles/owl.rb index d905e3fb2..74bddb68b 100644 --- a/roles/owl.rb +++ b/roles/owl.rb @@ -9,7 +9,7 @@ default_attributes( :owl => { :status => :role, :members => [ :yellowbkpk, :ppawel ] - }, + } }, :groups => { :adm => { diff --git a/roles/piwik.rb b/roles/piwik.rb index 7bf549ab0..b15472dc8 100644 --- a/roles/piwik.rb +++ b/roles/piwik.rb @@ -3,7 +3,7 @@ description "Role applied to all Piwik servers" default_attributes( :apache => { - :mpm => "prefork", + :mpm => "prefork" } ) diff --git a/roles/poldi.rb b/roles/poldi.rb index cc6a278e4..ad8988a57 100644 --- a/roles/poldi.rb +++ b/roles/poldi.rb @@ -93,7 +93,7 @@ default_attributes( "Search_Data" => "ssd1", "Search_Index" => "ssd1", "Aux_Data" => "aux", - "Aux_Index" => "aux", + "Aux_Index" => "aux" } } ) diff --git a/roles/pummelzacken.rb b/roles/pummelzacken.rb index cdc7e38fd..0c03f3a1b 100644 --- a/roles/pummelzacken.rb +++ b/roles/pummelzacken.rb @@ -61,7 +61,7 @@ default_attributes( "Search_Data" => "ssd", "Search_Index" => "ssd", "Aux_Data" => "data", - "Aux_Index" => "ssd", + "Aux_Index" => "ssd" } } ) diff --git a/roles/ramoth.rb b/roles/ramoth.rb index 7e3a89cc2..37a1074d2 100644 --- a/roles/ramoth.rb +++ b/roles/ramoth.rb @@ -60,7 +60,7 @@ default_attributes( } } } -); +) run_list( "role[ic]", diff --git a/roles/ridley.rb b/roles/ridley.rb index eaaa8f8cb..9a1093fb2 100644 --- a/roles/ridley.rb +++ b/roles/ridley.rb @@ -2,7 +2,7 @@ name "ridley" description "Master role applied to ridley" default_attributes( - :dhcpd =>{ + :dhcpd => { :first_address => "10.0.15.1", :last_address => "10.0.15.254" }, @@ -39,7 +39,7 @@ default_attributes( :role => :internal, :family => :inet, :address => "10.0.0.3" - }, + } } }, :openvpn => { diff --git a/roles/shenron.rb b/roles/shenron.rb index 191c6429f..51d697e88 100644 --- a/roles/shenron.rb +++ b/roles/shenron.rb @@ -7,7 +7,7 @@ default_attributes( :bretth => { :status => :user, :shell => "/usr/bin/git-shell" - }, + } } }, :apache => { @@ -19,7 +19,7 @@ default_attributes( :hardware => { :modules => [ "it87" - ], + ] }, :networking => { :interfaces => { @@ -38,7 +38,7 @@ default_attributes( :address => "2001:41c9:1:400::32", :prefix => "64", :gateway => "fe80::1" - }, + } } }, :openvpn => { diff --git a/roles/smaug.rb b/roles/smaug.rb index 3538f09c7..9937714f8 100644 --- a/roles/smaug.rb +++ b/roles/smaug.rb @@ -56,7 +56,7 @@ default_attributes( "kernel.shmmax" => 17 * 1024 * 1024 * 1024, "kernel.shmall" => 17 * 1024 * 1024 * 1024 / 4096 } - }, + } }, :sysfs => { :hdd_tune => { @@ -69,7 +69,7 @@ default_attributes( } } } -); +) run_list( "role[ic]", diff --git a/roles/thinkup.rb b/roles/thinkup.rb index d0df6286b..565fc9ff9 100644 --- a/roles/thinkup.rb +++ b/roles/thinkup.rb @@ -8,7 +8,7 @@ default_attributes( } }, :apache => { - :mpm => "prefork", + :mpm => "prefork" } ) diff --git a/roles/tile.rb b/roles/tile.rb index 3f7afe9ea..66011b6e3 100644 --- a/roles/tile.rb +++ b/roles/tile.rb @@ -7,8 +7,8 @@ default_attributes( :tile => { :status => :role, :members => [ :jburgess, :tomh ] - }, - }, + } + } }, :apache => { :mpm => "event", diff --git a/roles/tyan-s7010.rb b/roles/tyan-s7010.rb index 5d313b8c4..6cd45ebb4 100644 --- a/roles/tyan-s7010.rb +++ b/roles/tyan-s7010.rb @@ -38,7 +38,7 @@ default_attributes( "temp6" => { :max => 78, :max_hyst => 73 } } } - }, + } }, :munin => { :plugins => { diff --git a/roles/yournavigation.rb b/roles/yournavigation.rb index 56e2a61e7..af79bde1d 100644 --- a/roles/yournavigation.rb +++ b/roles/yournavigation.rb @@ -15,7 +15,7 @@ default_attributes( :start_servers => 20, :min_spare_servers => 20, :max_spare_servers => 50, - :max_clients => 256, + :max_clients => 256 } } )