]> git.openstreetmap.org Git - chef.git/commitdiff
Fix some rubocop detected style issues
authorTom Hughes <tom@compton.nu>
Mon, 2 Feb 2015 22:44:23 +0000 (22:44 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 2 Feb 2015 23:00:35 +0000 (23:00 +0000)
53 files changed:
cookbooks/accounts/recipes/default.rb
cookbooks/bind/attributes/default.rb
cookbooks/chef/files/default/knife.rb
cookbooks/chef/libraries/compare_versions.rb
cookbooks/chef/libraries/subversion.rb
cookbooks/dev/recipes/default.rb
cookbooks/exim/attributes/default.rb
cookbooks/exim/metadata.rb
cookbooks/exim/recipes/default.rb
cookbooks/hardware/libraries/sensors.rb
cookbooks/hardware/recipes/default.rb
cookbooks/incron/recipes/default.rb
cookbooks/mediawiki/definitions/mediawiki_site.rb
cookbooks/munin/files/default/plugins/api_calls_
cookbooks/munin/files/default/plugins/api_calls_num
cookbooks/munin/files/default/plugins/api_waits_
cookbooks/munin/recipes/default.rb
cookbooks/mysql/libraries/mysql.rb
cookbooks/mysql/providers/database.rb
cookbooks/networking/attributes/default.rb
cookbooks/networking/libraries/ipaddresses.rb
cookbooks/networking/recipes/default.rb
cookbooks/nfs/recipes/default.rb
cookbooks/nominatim/recipes/default.rb
cookbooks/ntp/attributes/default.rb
cookbooks/openvpn/recipes/default.rb
cookbooks/planet/files/default/replication-bin/replicate-changesets
cookbooks/postgresql/libraries/postgresql.rb
cookbooks/postgresql/providers/table.rb
cookbooks/postgresql/recipes/default.rb
cookbooks/rsyncd/recipes/default.rb
cookbooks/sysctl/recipes/default.rb
cookbooks/sysfs/recipes/default.rb
cookbooks/tile/files/default/ruby/expire.rb
cookbooks/tile/recipes/default.rb
cookbooks/web/recipes/rails.rb
roles/errol.rb
roles/forum.rb
roles/ironbelly.rb
roles/katla.rb
roles/nominatim.rb
roles/owl.rb
roles/piwik.rb
roles/poldi.rb
roles/pummelzacken.rb
roles/ramoth.rb
roles/ridley.rb
roles/shenron.rb
roles/smaug.rb
roles/thinkup.rb
roles/tile.rb
roles/tyan-s7010.rb
roles/yournavigation.rb

index 9627d1d081ae9872b71168383bebdcc8a8196ad7..545ef7c9f5c81e08f4bca2676bb3f6b688703505 100644 (file)
@@ -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]
index 29b1d6ba2995e1b81a01d4d43d2ae25b16dc0c7c..9ebc9219eec4f44a96df014906d0f51039424043 100644 (file)
@@ -1 +1 @@
-default[:bind] = { }
+default[:bind] = {}
index 1827695e3b2610b794761f73747114ee5d1fcec0..1e191ce2c6d01d4aa8d9bf89bda336479036080e 100644 (file)
@@ -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'
index d2ccf8a0836e48470f0653ef195e9d23fdb67fc1..2f5d60baff82b5f435397c50b1efdce8065c4060 100644 (file)
@@ -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
index 952037f3fc965b37fe17a63b47e2a414ba89469d..50b207ff8286e93e3e57bd3d769c7a94910ae787 100644 (file)
@@ -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
 
index 1290e11f9bc31eeb1e7f8eaf238b0a74fe20c6f9..acea45e176c727c74f35da82789d94abcf820ef3 100644 (file)
@@ -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"
index bdd8be4ca6b97801bba30707ad36c62176579427..9575f5185c5994ceed21929fa8ad32e44ead2c83 100644 (file)
@@ -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] = [ ]
index d2d622c7c1ef5ea4b7ff0d14480def7642414664..98a7c73d9db9531ef9920aee605ef0016126dd6d 100644 (file)
@@ -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 => {}
index abf404303949f9efd9a9cf2cd51322e756a534c3..49568984183f31661b27a0e66c47190a367960b8 100644 (file)
@@ -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
index 512ba31ff4dedca1016965f75b38cede451c24ee..0a55eae39342d7cbca4f249e666e5900aa6127f4 100644 (file)
@@ -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
index 441dbd1e3ad8104ac9d6c7e319d4e01e2e8066b3..fec4b0c98a3d4c397263120fc6476e9fce8d9416 100644 (file)
@@ -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" ]
index 29ba1e80781c9672c41f0e3c0d4458bfec350ab9..ef44a693b782f2955825118898bdf64c7b75d04d 100644 (file)
@@ -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"
index 5ceccf69c1e7140996b20fe41788cc909adecc6f..5b08a34921838b3ef9ab7814ab1d66ded995c129 100644 (file)
@@ -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
 
index 8cf836d79b1fbaacba95e4883d4b09039af7fa5e..73e2615d0bf356a5f8a1f5617a589a6bc5801b61 100755 (executable)
@@ -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
index d2f7ea3720b29e562c6592d656dcd71c2639c4d4..c65ae0a7ad48c207e06df7f00046511b4a7699c6 100755 (executable)
@@ -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
index 741f190f0f38123e575af404764f5063032a692d..f74e3a5cdf2c7119ac02fbd562213c7fbf73a3d4 100755 (executable)
@@ -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
index e48c7806db5d962f2f9617b0107a68b13edfc3d2..302a601f79fd0618367f5426c53f11a1d1c5b6fa 100644 (file)
@@ -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_"
index c0da28f339129dde0adc85426cea5f88ba4de6e6..bc5dd33509491e32933baa5d8846abb257fdafd4 100644 (file)
@@ -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
index 556e40454673f27c1a6ebf8c2cf4c394198094ac..ab735cd7ee1cb9846a78ce11497ce66cc739e17c 100644 (file)
@@ -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)
 
index 9a03eb3fa6012edafe3cb392ac7922c82f2e4b9a..49bd27a57c27de1600a3e4983271a6e5bc72509a 100644 (file)
@@ -1,3 +1,3 @@
-default[:networking][:interfaces] = { }
+default[:networking][:interfaces] = {}
 default[:networking][:nameservers] = [ ]
 default[:networking][:search] = [ ]
index 811c81884387cbcd02cb7a5382bb123ccf35a93c..5eb54265e02ae8d57e79255a03041bd5bceeb743 100644 (file)
@@ -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
index 04df2495f43b1847314a65ffe9d37927f90fcaad..74fb0048365dda9a68e1ef398e9f4017264c521a 100644 (file)
@@ -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]
index 1719a967cb94cefcf9dd8a6e675c16b3f26f5a87..e5e88ba65cb8ac004c4a767f9348ddb446317a42 100644 (file)
@@ -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
index ab4e6e15ed2d270d85dd5663412f9eca4d09fda6..2259c9da79f5114f7142fe3d031c16656ec0d921 100644 (file)
@@ -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"
index 8eccde5fc19c2e93cc7cc497bbe05ca94e64148d..66088fb2e65a0a095660752c0f15729435259116 100644 (file)
@@ -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
 
index a1a52f13e455c42204f1a6720eddec6cb0f4449a..b1955aa8c633c2d42c4fa5c56a4edc52b289a41c 100644 (file)
@@ -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]
index 8cdc26e7aa2fe93475b2a61c904a5a34e807c385..daa7ab0b6319e48b93bd275af35e35a447ec8d95 100644 (file)
@@ -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
index 2f672960ccdfe25ad691340fbcb9fdd66f152ab0..316f8eca37f4f200de7b0e6af5ec8b5f1e516a29 100644 (file)
@@ -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] = {
index 1c56b63f1b6e0d828e0e14cece008d0460893b22..7bc8cfb020fd16af0d31f74914e45d3698a8a9fc 100644 (file)
@@ -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)
 
index 9dfde244856f3fbc2d2baccb0f9c650912e57d33..a8b37c59062b8fa7d8b4e81375e1845dd3d44bcc 100644 (file)
@@ -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
index 44fef331e032bfb95744cff19ea390e9905ca765..41eaee80a4549af1be7d6cd116337e2bb7826366 100644 (file)
@@ -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]
index 920402a6ebb0450ad5909811140c7f30288c3d34..7a0ed43573fbb6c6b369349d5c86dfaec506f649 100644 (file)
@@ -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
index a3de9b40dbb9f5e76570e9757f184d2250079cfd..0e59c1e1e75d6d27547b9a9b3e0f343ab7dded2c 100644 (file)
@@ -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
index 8bd448a887f03a2f05505de54f0933bda617fef8..4c9d1a31becd76967c0b2727ce403772699fbbc6 100755 (executable)
@@ -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)
index 767b4d3e1db7d3af6a69410f114bfa6ad205cdd3..fc4feb0b63fe19eeefffb68fbb6d5685f9d5b588 100644 (file)
@@ -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
 
index dd4260900c99c1cfe5319f1c845ec6a6b537f1c6..bc10fac3980a681730d1655a6a12b24cf84ee673 100644 (file)
@@ -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
 
index a74cf845272372c75ee583fee0eaaaa33ab439d7..69b0d8db479d49642c4a87d764a88de7885b34ed 100644 (file)
@@ -40,7 +40,7 @@ default_attributes(
       }
     }
   }
-);
+)
 
 run_list(
   "role[ucl-wolfson]",
index 3c355851e22b44e213712499fe03d46154d21195..37900137880ea1c05e188c33305fe1b74a62adbf 100644 (file)
@@ -21,7 +21,7 @@ default_attributes(
       :start_servers => 20,
       :min_spare_servers => 20,
       :max_spare_servers => 50,
-      :max_clients => 256,
+      :max_clients => 256
     }
   }
 )
index 06876abbb75c2698be29e6ad0696f54c833c5b21..21047885f2cf9215c94ad44d4d62422a64c979b7 100644 (file)
@@ -84,7 +84,7 @@ default_attributes(
       }
     }
   }
-);
+)
 
 run_list(
   "role[ic]",
index 417dc7e60cbc48e3bcc85ad3fe315f43fa89db46..674dd854efcc363d49273afa4212e05aa14a5440 100644 (file)
@@ -77,7 +77,7 @@ default_attributes(
       }
     }
   }
-);
+)
 
 run_list(
   "role[ic]",
index 6c7d972cf3569200d13b3a052ba134e2b4d65398..0aa56aaf40c74e8ed77089ddcad8dfd58bfb7af3 100644 (file)
@@ -9,7 +9,7 @@ default_attributes(
       :nominatim => {
         :status => :role,
         :members => [ :lonvia, :tomh, :twain ]
-      },
+      }
     }
   },
   :apache => {
index d905e3fb2a12b892f0199b886cc2396ab354fd08..74bddb68b04d8aa76f167d4ace6a730a2d69ec77 100644 (file)
@@ -9,7 +9,7 @@ default_attributes(
       :owl => {
         :status => :role,
         :members => [ :yellowbkpk, :ppawel ]
-      },
+      }
     },
     :groups => {
       :adm => {
index 7bf549ab0793cc36530cfeeaba9aac8ffc9a82b6..b15472dc8fd09eca9010147698775627bdedf1b2 100644 (file)
@@ -3,7 +3,7 @@ description "Role applied to all Piwik servers"
 
 default_attributes(
   :apache => {
-    :mpm => "prefork",
+    :mpm => "prefork"
   }
 )
 
index cc6a278e49e4af554f0a09a343ca7729c77cbb35..ad8988a579ed5a2a7cbc91fb8da3004ba07374a7 100644 (file)
@@ -93,7 +93,7 @@ default_attributes(
         "Search_Data" => "ssd1",
         "Search_Index" => "ssd1",
         "Aux_Data" => "aux",
-        "Aux_Index" => "aux",
+        "Aux_Index" => "aux"
     }
   }
 )
index cdc7e38fd9ae0c4f78fff0d672549e4e44ab99bf..0c03f3a1b4fffb17af7019858bc5d2d4fd9630f3 100644 (file)
@@ -61,7 +61,7 @@ default_attributes(
         "Search_Data" => "ssd",
         "Search_Index" => "ssd",
         "Aux_Data" => "data",
-        "Aux_Index" => "ssd",
+        "Aux_Index" => "ssd"
     }
   }
 )
index 7e3a89cc2106c28ff720d53d8646c4a00c0a8381..37a1074d2ddaeab160f6aa21bd83549ee172ad37 100644 (file)
@@ -60,7 +60,7 @@ default_attributes(
       }
     }
   }
-);
+)
 
 run_list(
   "role[ic]",
index eaaa8f8cb76a63fa5d44a2c80ec01eeb3749a663..9a1093fb2dcceeb9413800c7fad4d9a07767bdc7 100644 (file)
@@ -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 => {
index 191c6429ff7c4b8bcec17cb621fa82d7e297f71b..51d697e88960ddf007dea13e758c026c22bbc520 100644 (file)
@@ -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 => {
index 3538f09c74ba91d785c28920fec2a77aee05ca18..9937714f86d3790da17444a0e55d2a05fc43002d 100644 (file)
@@ -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]",
index d0df6286b1084f9f225047e78640014c63fa3478..565fc9ff92ccd27972dc10ae8d0cde54d557706d 100644 (file)
@@ -8,7 +8,7 @@ default_attributes(
     }
   },
   :apache => {
-    :mpm => "prefork",
+    :mpm => "prefork"
   }
 )
 
index 3f7afe9ea1fbeca86885f92bd058b7a674437722..66011b6e39925e87441d7578fd284533a9d1c14a 100644 (file)
@@ -7,8 +7,8 @@ default_attributes(
       :tile => {
         :status => :role,
         :members => [ :jburgess, :tomh ]
-      },
-    },
+      }
+    }
   },
   :apache => {
     :mpm => "event",
index 5d313b8c46e9724b2b632758ca716dbf9763cda5..6cd45ebb4536e8a95f996c00b664c3ad9f9699a3 100644 (file)
@@ -38,7 +38,7 @@ default_attributes(
           "temp6" => { :max => 78, :max_hyst => 73 }
         }
       }
-    },
+    }
   },
   :munin => {
     :plugins => {
index 56e2a61e750534ea8a3a9f753fa792d6943fa994..af79bde1d0620ed2cb32c98ffe8f6fee67f41029 100644 (file)
@@ -15,7 +15,7 @@ default_attributes(
       :start_servers => 20,
       :min_spare_servers => 20,
       :max_spare_servers => 50,
-      :max_clients => 256,
+      :max_clients => 256
     }
   }
 )