]> git.openstreetmap.org Git - chef.git/commitdiff
Fix new rubocop warnings
authorTom Hughes <tom@compton.nu>
Tue, 11 Jul 2017 19:33:05 +0000 (20:33 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 11 Jul 2017 19:33:05 +0000 (20:33 +0100)
48 files changed:
.rubocop.yml
cookbooks/apache/recipes/default.rb
cookbooks/dev/recipes/default.rb
cookbooks/hardware/attributes/default.rb
cookbooks/hardware/recipes/default.rb
cookbooks/imagery/recipes/gb_os_sv.rb
cookbooks/imagery/resources/site.rb
cookbooks/kibana/recipes/default.rb
cookbooks/memcached/recipes/default.rb
cookbooks/munin/files/default/plugins/api_calls_
cookbooks/munin/files/default/plugins/api_waits_
cookbooks/munin/files/default/plugins/passenger_memory
cookbooks/munin/files/default/plugins/passenger_processes
cookbooks/munin/files/default/plugins/passenger_queues
cookbooks/munin/files/default/plugins/passenger_requests
cookbooks/mysql/recipes/default.rb
cookbooks/networking/recipes/default.rb
cookbooks/nominatim/recipes/default.rb
cookbooks/ntp/metadata.rb
cookbooks/ntp/recipes/default.rb
cookbooks/piwik/attributes/default.rb
cookbooks/planet/files/default/replication-bin/replicate-changesets [changed mode: 0644->0755]
cookbooks/planet/recipes/dump.rb
cookbooks/postgresql/providers/munin.rb
cookbooks/squid/recipes/default.rb
cookbooks/ssl/recipes/default.rb
cookbooks/systemd/resources/service.rb
cookbooks/taginfo/recipes/default.rb
cookbooks/tile/recipes/default.rb
cookbooks/web/recipes/cgimap.rb
cookbooks/web/recipes/gpx.rb
cookbooks/web/recipes/rails.rb
hooks/pre-commit
roles/bytemark.rb
roles/dulcy.rb
roles/grisu.rb
roles/ic.rb
roles/katla.rb
roles/ladon.rb
roles/paulla.rb
roles/pummelzacken.rb
roles/spike-04.rb
roles/spike-05.rb
roles/teleservice.rb
roles/thorn-04.rb
roles/thorn-05.rb
roles/tyan-s7010.rb
roles/web.rb

index 23c3f82fc2644aadc8a36093d189c94859e0a541..07985407d1cf89d05b7de06242a8b9c020d7f26b 100644 (file)
@@ -1,12 +1,18 @@
 inherit_from: .rubocop_todo.yml
 
 inherit_from: .rubocop_todo.yml
 
-Style/AlignParameters:
+AllCops:
+  TargetRubyVersion: 2.3
+
+Layout/AlignParameters:
   Exclude:
     - '**/metadata.rb'
 
   Exclude:
     - '**/metadata.rb'
 
-Style/ExtraSpacing:
+Layout/ExtraSpacing:
   AllowForAlignment: true
 
   AllowForAlignment: true
 
+Layout/IndentHeredoc:
+  EnforcedStyle: squiggly
+
 Style/FileName:
   Exclude:
     - 'cookbooks/trac/files/default/trac-authenticate'
 Style/FileName:
   Exclude:
     - 'cookbooks/trac/files/default/trac-authenticate'
@@ -15,8 +21,14 @@ Style/FileName:
     - 'hooks/*'
     - 'roles/*.rb'
 
     - 'hooks/*'
     - 'roles/*.rb'
 
+Style/FrozenStringLiteralComment:
+  EnforcedStyle: never
+
 Style/HashSyntax:
   EnforcedStyle: hash_rockets
 
 Style/StringLiterals:
   EnforcedStyle: double_quotes
 Style/HashSyntax:
   EnforcedStyle: hash_rockets
 
 Style/StringLiterals:
   EnforcedStyle: double_quotes
+
+Style/SymbolArray:
+  EnforcedStyle: brackets
index 72af9140b9b64b6c8caa034ece4c0a69c1cbb23c..9b6c6ef5401bb2e8938b1202717b07a999b5b9ea 100644 (file)
@@ -22,7 +22,7 @@ include_recipe "ssl"
 package "apache2"
 package "libwww-perl"
 
 package "apache2"
 package "libwww-perl"
 
-%w(event itk prefork worker).each do |mpm|
+%w[event itk prefork worker].each do |mpm|
   if mpm == node[:apache][:mpm]
     apache_module "mpm_#{mpm}" do
       action [:enable]
   if mpm == node[:apache][:mpm]
     apache_module "mpm_#{mpm}" do
       action [:enable]
index 59fd78603d276e7850065ca5ea6b3ea07bd6fa68..80b80586b419a0c31be19ac6f1a662e8952c98d5 100644 (file)
@@ -113,7 +113,7 @@ search(:accounts, "*:*").each do |account|
   name = account["id"]
   details = node[:accounts][:users][name] || {}
 
   name = account["id"]
   details = node[:accounts][:users][name] || {}
 
-  next unless %w(user administrator).include?(details[:status])
+  next unless %w[user administrator].include?(details[:status])
 
   user_home = details[:home] || account["home"] || "#{node[:accounts][:home]}/#{name}"
 
 
   user_home = details[:home] || account["home"] || "#{node[:accounts][:home]}/#{name}"
 
index ce7aae86382f9ca162ff6f79381422dad01bbe37..393dd0317dbec45a23510bd8dc3924f4862a04b6 100644 (file)
@@ -1,10 +1,10 @@
 default[:hardware][:modules] = if node[:lsb][:release].to_f >= 16.04
 default[:hardware][:modules] = if node[:lsb][:release].to_f >= 16.04
-                                 %w(lp)
+                                 %w[lp]
                                else
                                else
-                                 %w(loop lp rtc)
+                                 %w[loop lp rtc]
                                end
 
                                end
 
-default[:hardware][:grub][:cmdline] = %w(nomodeset)
+default[:hardware][:grub][:cmdline] = %w[nomodeset]
 default[:hardware][:sensors] = {}
 
 if node[:dmi] && node[:dmi][:system]
 default[:hardware][:sensors] = {}
 
 if node[:dmi] && node[:dmi][:system]
@@ -19,7 +19,7 @@ if node[:dmi] && node[:dmi][:system]
   end
 end
 
   end
 end
 
-if Chef::Util.compare_versions(node[:kernel][:release], [3, 3]) < 0
+if Chef::Util.compare_versions(node[:kernel][:release], [3, 3]).negative?
   default[:hardware][:modules] |= ["microcode"]
 
   if node[:cpu][:"0"][:vendor_id] == "GenuineIntel"
   default[:hardware][:modules] |= ["microcode"]
 
   if node[:cpu][:"0"][:vendor_id] == "GenuineIntel"
@@ -28,7 +28,7 @@ if Chef::Util.compare_versions(node[:kernel][:release], [3, 3]) < 0
 end
 
 if node[:kernel] && node[:kernel][:modules]
 end
 
 if node[:kernel] && node[:kernel][:modules]
-  raidmods = node[:kernel][:modules].keys & %w(cciss hpsa mptsas mpt2sas mpt3sas megaraid_mm megaraid_sas aacraid)
+  raidmods = node[:kernel][:modules].keys & %w[cciss hpsa mptsas mpt2sas mpt3sas megaraid_mm megaraid_sas aacraid]
 
   default[:apt][:sources] |= ["hwraid"] unless raidmods.empty?
 end
 
   default[:apt][:sources] |= ["hwraid"] unless raidmods.empty?
 end
index 0120827893e94a4fca57a6660ce608abfbad86db..1d5be55cc3b9b304763cd6e283596aa2b51e13d9 100644 (file)
@@ -86,7 +86,7 @@ end
 
 # Remove legacy HP G4 support which breaks modern hp-health 10.4
 if manufacturer == "HP"
 
 # Remove legacy HP G4 support which breaks modern hp-health 10.4
 if manufacturer == "HP"
-  %w(/opt/hp/hp-health/bin/hpasmd /usr/lib/libhpasmintrfc.so.3.0 %/usr/lib/libhpasmintrfc.so.3 /usr/lib/libhpasmintrfc.so).each do |filename|
+  %w[/opt/hp/hp-health/bin/hpasmd /usr/lib/libhpasmintrfc.so.3.0 %/usr/lib/libhpasmintrfc.so.3 /usr/lib/libhpasmintrfc.so].each do |filename|
     file filename do
       action :delete
     end
     file filename do
       action :delete
     end
@@ -246,7 +246,7 @@ node[:block_device].each do |name, attributes|
   end
 end
 
   end
 end
 
-%w(hpssacli lsiutil sas2ircu megactl megacli arcconf).each do |tools_package|
+%w[hpssacli lsiutil sas2ircu megactl megacli arcconf].each do |tools_package|
   if tools_packages.include?(tools_package)
     package tools_package
   else
   if tools_packages.include?(tools_package)
     package tools_package
   else
@@ -384,7 +384,7 @@ smartd_service = if node[:lsb][:release].to_f >= 16.04
 
 disks = disks.compact
 
 
 disks = disks.compact
 
-if disks.count > 0
+if disks.count.positive?
   package "smartmontools"
 
   template "/usr/local/bin/smartd-mailer" do
   package "smartmontools"
 
   template "/usr/local/bin/smartd-mailer" do
@@ -434,7 +434,7 @@ else
   end
 end
 
   end
 end
 
-if disks.count > 0
+if disks.count.positive?
   munin_plugin "hddtemp_smartctl" do
     conf "munin.hddtemp.erb"
     conf_variables :disks => disks
   munin_plugin "hddtemp_smartctl" do
     conf "munin.hddtemp.erb"
     conf_variables :disks => disks
index 6dd2e98618fa9339d5c575624d21b518fe058a83..4dcf0bd0b39390e5609bda2dd92b16c548a0f9e6 100644 (file)
@@ -1,4 +1,5 @@
 # coding: utf-8
 # coding: utf-8
+
 #
 # Cookbook Name:: imagery
 # Recipe:: gb_os_sv
 #
 # Cookbook Name:: imagery
 # Recipe:: gb_os_sv
index 137153a72f1539eafbbdfd1d75345a4610543326..d6e2071ccfb1a07518a1ede888eaba2b78404663 100644 (file)
@@ -89,9 +89,10 @@ action :create do
   end
 
   base_domains = [name] + Array(aliases)
   end
 
   base_domains = [name] + Array(aliases)
+  tile_domains = base_domains.flat_map { |d| [d, "a.#{d}", "b.#{d}", "c.#{d}"] }
 
   ssl_certificate new_resource.name do
 
   ssl_certificate new_resource.name do
-    domains base_domains.flat_map { |d| [d, "a.#{d}", "b.#{d}", "c.#{d}"] }
+    domains tile_domains
   end
 
   resolvers = node[:networking][:nameservers].map do |resolver|
   end
 
   resolvers = node[:networking][:nameservers].map do |resolver|
index adc39270d253090723629e83c3af92f77dafe342..9f17df934666bc32c1da4f5af5cafb192514c72c 100644 (file)
@@ -1,4 +1,5 @@
 # coding: utf-8
 # coding: utf-8
+
 #
 # Cookbook Name:: kibana
 # Recipe:: default
 #
 # Cookbook Name:: kibana
 # Recipe:: default
index e96af7e35baafec9396ad890f489a9ce551d4ee5..7186626c01af5d65ba995f3315152d4414676c04 100644 (file)
@@ -36,7 +36,7 @@ munin_plugin_conf "memcached_multi" do
   template "munin.erb"
 end
 
   template "munin.erb"
 end
 
-%w(bytes commands conns evictions items memory).each do |stat|
+%w[bytes commands conns evictions items memory].each do |stat|
   munin_plugin "memcached_multi_#{stat}" do
     target "memcached_multi_"
   end
   munin_plugin "memcached_multi_#{stat}" do
     target "memcached_multi_"
   end
index 17bba1625aeb57b7b4e6823de1b423f89065f437..79c306635d319afacdbb47847ede2934b15b574d 100755 (executable)
@@ -12,7 +12,7 @@ def uris_from_status(server)
   rows = (tables[1] / "tr")[1..-1]
   data = rows.collect { |r| (r / "td").collect(&:inner_html) }
   # filter where the PID is numeric, status is 'W' and host matches the server
   rows = (tables[1] / "tr")[1..-1]
   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.positive? && r[3].match(/W/) && r[11].match(server) }
   # return only the URI part
   matching_data.collect { |r| r[12] }
 end
   # return only the URI part
   matching_data.collect { |r| r[12] }
 end
index 6be9fc6f553c49ca86e275c7b6de5d0000d69818..f5bbd1104560d499fbc24599736fbbbf19b8a6b7 100755 (executable)
@@ -12,7 +12,7 @@ def uri_and_times_from_status(server)
   rows = (tables[1] / "tr")[1..-1]
   data = rows.collect { |r| (r / "td").collect(&:inner_html) }
   # filter where the PID is numeric, status is 'W' and host matches the server
   rows = (tables[1] / "tr")[1..-1]
   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.positive? && 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] }
 end
   # return URI and number of seconds processing for each request
   matching_data.collect { |r| [r[12], r[5].to_i] }
 end
index 1aa9a77640fc6b7f1de49977bc0346aa379d67a0..7017c63e087131f715f04002f9a1789eb00cf723 100755 (executable)
@@ -6,13 +6,13 @@
 require "English"
 
 def output_config
 require "English"
 
 def output_config
-  puts <<-END
-graph_args --base 1024 -l 0 --vertical-label bytes --upper-limit 4056231936
-graph_category passenger
-graph_title Passenger memory
+  puts <<~END
+    graph_args --base 1024 -l 0 --vertical-label bytes --upper-limit 4056231936
+    graph_category passenger
+    graph_title Passenger memory
 
 
-memory.label memory
-END
+    memory.label memory
+  END
   exit 0
 end
 
   exit 0
 end
 
index 39842a04f7585ae1185bfd23ac3fab97d9cba313..b8a06cf3af9c3ce05aaeb9ab9b17721cb30ee017 100755 (executable)
@@ -3,18 +3,18 @@
 require "English"
 
 def output_config
 require "English"
 
 def output_config
-  puts <<-END
-graph_category passenger
-graph_title Passenger processes
-graph_order active inactive
-graph_vlabel processes
-graph_total total
+  puts <<~END
+    graph_category passenger
+    graph_title Passenger processes
+    graph_order active inactive
+    graph_vlabel processes
+    graph_total total
 
 
-active.label busy servers
-active.draw AREA
-inactive.label idle servers
-inactive.draw STACK
-END
+    active.label busy servers
+    active.draw AREA
+    inactive.label idle servers
+    inactive.draw STACK
+  END
   exit 0
 end
 
   exit 0
 end
 
index 60be63389f957160cc38ae9646ed7bf75e787b21..8d4159b463db107049ca604e37462502fb30c2e9 100755 (executable)
@@ -3,13 +3,13 @@
 require "English"
 
 def output_config
 require "English"
 
 def output_config
-  puts <<-END
-graph_category passenger
-graph_title Passenger queues
-graph_vlabel count
+  puts <<~END
+    graph_category passenger
+    graph_title Passenger queues
+    graph_vlabel count
 
 
-global.label global
-END
+    global.label global
+  END
   exit 0
 end
 
   exit 0
 end
 
index 1e34fc70f946c1e1d2218fd23a961c6f84661f12..3eeb776d6e0ecf83b2c542b1c9e38f106ae2c92f 100755 (executable)
@@ -3,17 +3,17 @@
 require "English"
 
 def output_config
 require "English"
 
 def output_config
-  puts <<-END
-graph_args --base 1000
-graph_category passenger
-graph_title Passenger requests
-graph_vlabel requests / ${graph_period}
+  puts <<~END
+    graph_args --base 1000
+    graph_category passenger
+    graph_title Passenger requests
+    graph_vlabel requests / ${graph_period}
 
 
-requests.label requests
-requests.type DERIVE
-requests.max 1000000
-requests.min 0
-END
+    requests.label requests
+    requests.type DERIVE
+    requests.max 1000000
+    requests.min 0
+  END
   exit 0
 end
 
   exit 0
 end
 
index 427081239daa786675442735ee1adbdc881ae64d..9c35682fd51c5b48970bde9d6f2f25aab71bef00 100644 (file)
@@ -42,7 +42,7 @@ end
 package "libdbd-mysql-perl"
 package "libcache-cache-perl"
 
 package "libdbd-mysql-perl"
 package "libcache-cache-perl"
 
-%w(
+%w[
   commands connections files handler_read handler_tmp handler_transaction
   handler_write innodb_bpool innodb_bpool_act innodb_history_list_length
   innodb_insert_buf innodb_io innodb_io_pend innodb_log innodb_queries
   commands connections files handler_read handler_tmp handler_transaction
   handler_write innodb_bpool innodb_bpool_act innodb_history_list_length
   innodb_insert_buf innodb_io innodb_io_pend innodb_log innodb_queries
@@ -50,15 +50,15 @@ package "libcache-cache-perl"
   innodb_tnx max_mem mrr myisam_indexes network_traffic performance
   qcache qcache_mem select_types slow sorts table_definitions table_locks
   tmp_tables
   innodb_tnx max_mem mrr myisam_indexes network_traffic performance
   qcache qcache_mem select_types slow sorts table_definitions table_locks
   tmp_tables
-).each do |stat|
+].each do |stat|
   munin_plugin "mysql_#{stat}" do
     target "mysql_"
   end
 end
 
   munin_plugin "mysql_#{stat}" do
     target "mysql_"
   end
 end
 
-%w(
+%w[
   bin_relay_log files_tables replication
   bin_relay_log files_tables replication
-).each do |stat|
+].each do |stat|
   munin_plugin "mysql_#{stat}" do
     action :delete
   end
   munin_plugin "mysql_#{stat}" do
     action :delete
   end
index 16dd48269c87b18b091abd3f43fb4a1ada5c2dda..697f2c34edf4ecea2aec60c3ffb68bf279d21c34 100644 (file)
@@ -216,7 +216,7 @@ firewall_rule "limit-icmp-echo" do
   rate_limit "s:1/sec:5"
 end
 
   rate_limit "s:1/sec:5"
 end
 
-%w(ucl ic bm aws).each do |zone|
+%w[ucl ic bm aws].each do |zone|
   firewall_rule "accept-openvpn-#{zone}" do
     action :accept
     family :inet
   firewall_rule "accept-openvpn-#{zone}" do
     action :accept
     family :inet
index e930ee47ce962b455a83fe4f74fdb134831a4246..e6d793afdf8314436a3fe797f2960b9e6ced931f 100644 (file)
@@ -274,7 +274,7 @@ template "/etc/init.d/nominatim-update" do
   variables :source_directory => source_directory
 end
 
   variables :source_directory => source_directory
 end
 
-%w(backup-nominatim vacuum-db-nominatim).each do |fname|
+%w[backup-nominatim vacuum-db-nominatim].each do |fname|
   template "/usr/local/bin/#{fname}" do
     source "#{fname}.erb"
     owner "root"
   template "/usr/local/bin/#{fname}" do
     source "#{fname}.erb"
     owner "root"
index d1906c34cc279f1bd423deb0c46d2a9a07804745..484d0d23d66f8e4c479a7b684dc45e2620616ef7 100644 (file)
@@ -8,7 +8,7 @@ version           "0.8.2"
 
 recipe "ntp", "Installs and configures ntp either as a server or client"
 
 
 recipe "ntp", "Installs and configures ntp either as a server or client"
 
-%w(ubuntu debian redhat centos fedora).each do |os|
+%w[ubuntu debian redhat centos fedora].each do |os|
   supports os
 end
 
   supports os
 end
 
index 29f79d6935b5b5d8a81261a12efaf72a72cae95a..cdf3b5a96ae4bafa892ddc19b1b772b026efe835 100644 (file)
@@ -51,7 +51,7 @@ template "/etc/ntp.conf" do
   notifies :restart, "service[ntp]"
 end
 
   notifies :restart, "service[ntp]"
 end
 
-munin_plugins = %w(ntp_kernel_err ntp_kernel_pll_freq ntp_kernel_pll_off ntp_offset)
+munin_plugins = %w[ntp_kernel_err ntp_kernel_pll_freq ntp_kernel_pll_off ntp_offset]
 
 munin_plugin "ntp_kernel_err"
 munin_plugin "ntp_kernel_pll_freq"
 
 munin_plugin "ntp_kernel_err"
 munin_plugin "ntp_kernel_pll_freq"
index ba7ade37790abe811058a33ba1364167cda0ae2e..16089ca7435c11256cafa339b0e5ac3ece067e64 100644 (file)
@@ -1,5 +1,5 @@
 default[:piwik][:version] = "3.0.4"
 default[:piwik][:version] = "3.0.4"
-default[:piwik][:plugins] = %w(
+default[:piwik][:plugins] = %w[
   Actions API BulkTracking Contents CoreAdminHome CoreConsole CoreHome
   CorePluginsAdmin CoreUpdater CoreVisualizations CustomVariables
   Dashboard DevicesDetection DevicePlugins DoNotTrack Events Feedback Goals
   Actions API BulkTracking Contents CoreAdminHome CoreConsole CoreHome
   CorePluginsAdmin CoreUpdater CoreVisualizations CustomVariables
   Dashboard DevicesDetection DevicePlugins DoNotTrack Events Feedback Goals
@@ -8,4 +8,4 @@ default[:piwik][:plugins] = %w(
   SegmentEditor SEO SitesManager Transitions UserCountry UserCountryMap
   UserLanguage UsersManager Widgetize VisitFrequency VisitorInterest
   VisitsSummary VisitTime
   SegmentEditor SEO SitesManager Transitions UserCountry UserCountryMap
   UserLanguage UsersManager Widgetize VisitFrequency VisitorInterest
   VisitsSummary VisitTime
-)
+]
old mode 100644 (file)
new mode 100755 (executable)
index a5312e1..3cf5429
@@ -100,7 +100,7 @@ class ChangesetBuilder
     xml["comments_count"] = res.num_tuples.to_s
 
     # early return if there aren't any comments
     xml["comments_count"] = res.num_tuples.to_s
 
     # early return if there aren't any comments
-    return unless res.num_tuples > 0
+    return unless res.num_tuples.positive?
 
     discussion = XML::Node.new("discussion")
     res.each do |row|
 
     discussion = XML::Node.new("discussion")
     res.each do |row|
@@ -167,7 +167,7 @@ class Replicator
     new_ids = @conn
               .exec("select distinct changeset_id from changeset_comments where created_at >= '#{last_run}' and created_at < '#{@now}' and visible")
               .map { |row| row["changeset_id"].to_i }
     new_ids = @conn
               .exec("select distinct changeset_id from changeset_comments where created_at >= '#{last_run}' and created_at < '#{@now}' and visible")
               .map { |row| row["changeset_id"].to_i }
-              .select { |c_id| !cs_ids.include?(c_id) }
+              .reject { |c_id| cs_ids.include?(c_id) }
 
     new_ids.each do |id|
       @conn
 
     new_ids.each do |id|
       @conn
@@ -277,7 +277,6 @@ class Replicator
         move_tmp_files_into_place!
 
         fl.flock(File::LOCK_UN)
         move_tmp_files_into_place!
 
         fl.flock(File::LOCK_UN)
-
       rescue
         STDERR.puts("Error! Couldn't update state.")
         fl.flock(File::LOCK_UN)
       rescue
         STDERR.puts("Error! Couldn't update state.")
         fl.flock(File::LOCK_UN)
index 44f1d6e59752be039b7f94876bd7386cbe542154..0eb5cef0d43e857ddef985d7e3e64ba2f6347187 100644 (file)
@@ -20,7 +20,7 @@
 node.default[:incron][:planetdump] = {
   :user => "www-data",
   :path => "/store/backup",
 node.default[:incron][:planetdump] = {
   :user => "www-data",
   :path => "/store/backup",
-  :events => %w(IN_CREATE IN_MOVED_TO),
+  :events => %w[IN_CREATE IN_MOVED_TO],
   :command => "/usr/local/bin/planetdump $#"
 }
 
   :command => "/usr/local/bin/planetdump $#"
 }
 
index 986c11f44a77d609f8bf0e103cf26d4294d14f01..efa0a8b4dccbfe9b304c770266cad25874ed2116 100644 (file)
@@ -28,7 +28,7 @@ action :create do
   database = new_resource.database
 
   if cluster
   database = new_resource.database
 
   if cluster
-    %w(cache connections locks querylength scans size transactions tuples).each do |plugin|
+    %w[cache connections locks querylength scans size transactions tuples].each do |plugin|
       munin_plugin "postgres_#{plugin}_#{database}:#{suffix}" do
         target "postgres_#{plugin}_"
         conf "munin.erb"
       munin_plugin "postgres_#{plugin}_#{database}:#{suffix}" do
         target "postgres_#{plugin}_"
         conf "munin.erb"
@@ -45,7 +45,7 @@ end
 action :delete do
   database = new_resource.database
 
 action :delete do
   database = new_resource.database
 
-  %w(cache connections locks querylength scans size transactions tuples).each do |plugin|
+  %w[cache connections locks querylength scans size transactions tuples].each do |plugin|
     munin_plugin "postgres_#{plugin}_#{database}:#{suffix}" do
       action :delete
       restart_munin false
     munin_plugin "postgres_#{plugin}_#{database}:#{suffix}" do
       action :delete
       restart_munin false
index 731cbdd83c0f408a7e8f973528ad7a23ad6031b4..54e6e4af4848d5a3056cf05c1d8dc7d397e7d3aa 100644 (file)
@@ -72,7 +72,7 @@ log "squid-restart" do
   notifies :restart, "service[squid]"
   only_if do
     IO.popen(["squidclient", "--host=127.0.0.1", "--port=80", "mgr:counters"]) do |io|
   notifies :restart, "service[squid]"
   only_if do
     IO.popen(["squidclient", "--host=127.0.0.1", "--port=80", "mgr:counters"]) do |io|
-      io.each.grep(/^[a-z][a-z_.]+ = -[0-9]+$/).count > 0
+      io.each.grep(/^[a-z][a-z_.]+ = -[0-9]+$/).count.positive?
     end
   end
 end
     end
   end
 end
index 328ba8bab324fc8446ce2be2d6878b0546b9445c..536110d3ecb5815248792d497c43f3c256419ec5 100644 (file)
@@ -20,7 +20,7 @@
 package "openssl"
 package "ssl-cert"
 
 package "openssl"
 package "ssl-cert"
 
-%w(letsencrypt dhparam).each do |certificate|
+%w[letsencrypt dhparam].each do |certificate|
   cookbook_file "/etc/ssl/certs/#{certificate}.pem" do
     owner "root"
     group "root"
   cookbook_file "/etc/ssl/certs/#{certificate}.pem" do
     owner "root"
     group "root"
index 664304da8d6e07c51fbac1ee1b01683f12936f94..e7779fae70ed72099b4b96b0f495a4b81d3186f2 100644 (file)
@@ -25,7 +25,7 @@ property :after, [String, Array]
 property :wants, [String, Array]
 property :type, String,
          :default => "simple",
 property :wants, [String, Array]
 property :type, String,
          :default => "simple",
-         :is => %w(simple forking oneshot dbus notify idle)
+         :is => %w[simple forking oneshot dbus notify idle]
 property :limit_nofile, Integer
 property :environment, Hash, :default => {}
 property :environment_file, [String, Hash]
 property :limit_nofile, Integer
 property :environment, Hash, :default => {}
 property :environment_file, [String, Hash]
@@ -40,14 +40,14 @@ property :exec_reload, String
 property :runtime_directory, String
 property :runtime_directory_mode, Integer
 property :standard_input, String,
 property :runtime_directory, String
 property :runtime_directory_mode, Integer
 property :standard_input, String,
-         :is => %w(null tty tty-force tty-fail socket)
+         :is => %w[null tty tty-force tty-fail socket]
 property :standard_output, String,
 property :standard_output, String,
-         :is => %w(inherit null tty journal syslog kmsg journal+console syslog+console kmsg+console socket)
+         :is => %w[inherit null tty journal syslog kmsg journal+console syslog+console kmsg+console socket]
 property :standard_error, String,
 property :standard_error, String,
-         :is => %w(inherit null tty journal syslog kmsg journal+console syslog+console kmsg+console socket)
+         :is => %w[inherit null tty journal syslog kmsg journal+console syslog+console kmsg+console socket]
 property :success_exit_status, [Integer, String, Array]
 property :restart, String,
 property :success_exit_status, [Integer, String, Array]
 property :restart, String,
-         :is => %w(on-success on-failure on-abnormal on-watchdog on-abort always)
+         :is => %w[on-success on-failure on-abnormal on-watchdog on-abort always]
 property :private_tmp, [TrueClass, FalseClass]
 property :private_devices, [TrueClass, FalseClass]
 property :private_network, [TrueClass, FalseClass]
 property :private_tmp, [TrueClass, FalseClass]
 property :private_devices, [TrueClass, FalseClass]
 property :private_network, [TrueClass, FalseClass]
index 57ccb3d40f058e400477c871bf1e0804d94847ea..cd3262c7ffe92b810fb2c095c807c5fa48b5e998 100644 (file)
@@ -45,7 +45,7 @@ ruby_version = node[:passenger][:ruby_version]
 
 package "ruby#{ruby_version}"
 
 
 package "ruby#{ruby_version}"
 
-%w(json sqlite3 sinatra sinatra-r18n rack-contrib).each do |gem|
+%w[json sqlite3 sinatra sinatra-r18n rack-contrib].each do |gem|
   gem_package gem do
     gem_binary "gem#{ruby_version}"
   end
   gem_package gem do
     gem_binary "gem#{ruby_version}"
   end
@@ -181,7 +181,7 @@ node[:taginfo][:sites].each do |site|
     subscribes :run, "git[#{directory}/osmium-tool]"
   end
 
     subscribes :run, "git[#{directory}/osmium-tool]"
   end
 
-  %w(taginfo/web/tmp bin data data/old download sources planet planet/log planet/replication).each do |dir|
+  %w[taginfo/web/tmp bin data data/old download sources planet planet/log planet/replication].each do |dir|
     directory "#{directory}/#{dir}" do
       owner "taginfo"
       group "taginfo"
     directory "#{directory}/#{dir}" do
       owner "taginfo"
       group "taginfo"
index 679d2a308cbc1ad2370b5b8c7ea7f44938fbc8fd..6cdf6190f33623bc8dde2b18cc42fed2f579375f 100644 (file)
@@ -376,7 +376,7 @@ postgresql_extension "hstore" do
   database "gis"
 end
 
   database "gis"
 end
 
-%w(geography_columns planet_osm_nodes planet_osm_rels planet_osm_ways raster_columns raster_overviews spatial_ref_sys).each do |table|
+%w[geography_columns planet_osm_nodes planet_osm_rels planet_osm_ways raster_columns raster_overviews spatial_ref_sys].each do |table|
   postgresql_table table do
     cluster node[:tile][:database][:cluster]
     database "gis"
   postgresql_table table do
     cluster node[:tile][:database][:cluster]
     database "gis"
@@ -385,7 +385,7 @@ end
   end
 end
 
   end
 end
 
-%w(geometry_columns planet_osm_line planet_osm_point planet_osm_polygon planet_osm_roads).each do |table|
+%w[geometry_columns planet_osm_line planet_osm_point planet_osm_polygon planet_osm_roads].each do |table|
   postgresql_table table do
     cluster node[:tile][:database][:cluster]
     database "gis"
   postgresql_table table do
     cluster node[:tile][:database][:cluster]
     database "gis"
index 0875804cd3cae4e153ae8ee08396ddd0e3502873..8303955c2f3e1b329be9bd3070910da8ad4f1b56 100644 (file)
@@ -63,7 +63,7 @@ systemd_service "cgimap" do
   pid_file "#{node[:web][:pid_directory]}/cgimap.pid"
 end
 
   pid_file "#{node[:web][:pid_directory]}/cgimap.pid"
 end
 
-if %w(database_offline api_offline).include?(node[:web][:status])
+if %w[database_offline api_offline].include?(node[:web][:status])
   service "cgimap" do
     action :stop
   end
   service "cgimap" do
     action :stop
   end
index f74ac50364bb014c3f3577c1555de045ee71b92d..59d5bc1de684cf3d65a56f870052ef34743fb9cf 100644 (file)
@@ -79,7 +79,7 @@ systemd_service "gpx-import" do
   pid_file "#{pid_directory}/gpx-import.pid"
 end
 
   pid_file "#{pid_directory}/gpx-import.pid"
 end
 
-if %w(database_offline database_readonly gpx_offline).include?(node[:web][:status])
+if %w[database_offline database_readonly gpx_offline].include?(node[:web][:status])
   service "gpx-import" do
     action :stop
   end
   service "gpx-import" do
     action :stop
   end
index 725f3b746533c41f1d31757079b682e6f1fe1799..14eacc50a43d3993d5eec39a2fb94c3e7b420955 100644 (file)
@@ -48,7 +48,7 @@ end
 rails_directory = "#{node[:web][:base_directory]}/rails"
 
 piwik_configuration = data_bag_item("web", "piwik").to_hash.reject do |k, _|
 rails_directory = "#{node[:web][:base_directory]}/rails"
 
 piwik_configuration = data_bag_item("web", "piwik").to_hash.reject do |k, _|
-  %w(chef_type data_bag id).include?(k)
+  %w[chef_type data_bag id].include?(k)
 end
 
 rails_port "www.openstreetmap.org" do
 end
 
 rails_port "www.openstreetmap.org" do
index 7c7655e5db50430912c67d267acc583bbcb1d86d..cb7bc82d55348a9c92229c160e2cdf512b5c1282 100755 (executable)
@@ -3,7 +3,7 @@
 ok = true
 
 if IO.popen(["git", "ls-files", "--unmerged"]).read.empty?
 ok = true
 
 if IO.popen(["git", "ls-files", "--unmerged"]).read.empty?
-  need_stash = !IO.popen(%w(git diff)).read.empty?
+  need_stash = !IO.popen(%w[git diff]).read.empty?
 
   system("git", "stash", "save", "--keep-index", "--quiet") if need_stash
 
 
   system("git", "stash", "save", "--keep-index", "--quiet") if need_stash
 
index 6d539ff5f65207391a46cbcd56e69a00bfb4b177..404d84764d301cfadc820d1212e65181ca4aed1a 100644 (file)
@@ -27,7 +27,7 @@ default_attributes(
     }
   },
   :web => {
     }
   },
   :web => {
-    :backends => %w(rails4 rails5),
+    :backends => %w[rails4 rails5],
     :fileserver => "grisu",
     :readonly_database_host => "katla.bm.openstreetmap.org"
   }
     :fileserver => "grisu",
     :readonly_database_host => "katla.bm.openstreetmap.org"
   }
index 29cf0bb3885893a9a7fe0ec012f570e302138cde..355f98cc6d0b905a34af64fd83432a568f564042 100644 (file)
@@ -42,7 +42,7 @@ default_attributes(
   :nominatim => {
     :state => "standalone",
     :enable_backup => false,
   :nominatim => {
     :state => "standalone",
     :enable_backup => false,
-    :dbadmins => %w(lonvia tomh),
+    :dbadmins => %w[lonvia tomh],
     :dbcluster => "9.6/main",
     :flatnode_file => "/ssd/nominatim/nodes.store",
     :logdir => "/ssd/nominatim/log",
     :dbcluster => "9.6/main",
     :flatnode_file => "/ssd/nominatim/nodes.store",
     :logdir => "/ssd/nominatim/log",
index 613f9f27ca9230761a1304391fc8e545ebcc7c0a..ebc62416bca997cf828ce410bcba875b36d22884 100644 (file)
@@ -10,7 +10,7 @@ default_attributes(
         :family => :inet,
         :address => "10.0.32.20",
         :bond => {
         :family => :inet,
         :address => "10.0.32.20",
         :bond => {
-          :slaves => %w(em1 em2)
+          :slaves => %w[em1 em2]
         }
       },
       :external_ipv4 => {
         }
       },
       :external_ipv4 => {
index 4041d2b36fb9bea7b0c7c877744a92de4bc25b42..33e99624b2f17f23fd99fd2538aa0ef19f885ec5 100644 (file)
@@ -30,7 +30,7 @@ default_attributes(
     }
   },
   :web => {
     }
   },
   :web => {
-    :backends => %w(rails1 rails2 rails3),
+    :backends => %w[rails1 rails2 rails3],
     :fileserver => "ironbelly",
     :readonly_database_host => "karm.ic.openstreetmap.org"
   }
     :fileserver => "ironbelly",
     :readonly_database_host => "karm.ic.openstreetmap.org"
   }
index 399c767b2bf961cbfb930efae0ced62a76765982..4753dd832ffb95ff8ef73071e08dc4a43549e049 100644 (file)
@@ -58,7 +58,7 @@ default_attributes(
         :family => :inet,
         :address => "10.0.32.40",
         :bond => {
         :family => :inet,
         :address => "10.0.32.40",
         :bond => {
-          :slaves => %w(eth0 eth1)
+          :slaves => %w[eth0 eth1]
         }
       }
     }
         }
       }
     }
index f70e0af2b7d694937b465cfadd9432c137c5955d..75da422c89adeb73a825be5fb7e526293791d84d 100644 (file)
@@ -15,7 +15,7 @@ default_attributes(
           :mode => "802.3ad",
           :miimon => "100",
           :xmithashpolicy => "layer3+4",
           :mode => "802.3ad",
           :miimon => "100",
           :xmithashpolicy => "layer3+4",
-          :slaves => %w(eth0 eth1)
+          :slaves => %w[eth0 eth1]
         }
       },
       :external_ipv6 => {
         }
       },
       :external_ipv6 => {
index db4252d5d6d0cbfaa5724447597824a9c1c8ecca..3d542df25c330af80ee49e8b2bffabae7dcbefad 100644 (file)
@@ -1,4 +1,5 @@
 # coding: utf-8
 # coding: utf-8
+
 name "paulla"
 description "Role applied to all servers at PauLLA"
 
 name "paulla"
 description "Role applied to all servers at PauLLA"
 
index f5a573d47d01e952b31893b7b511065c387d56f1..a7ccf2e5eca5291d054fd0180a2ea0fd02d992d5 100644 (file)
@@ -33,7 +33,7 @@ default_attributes(
   },
   :nominatim => {
     :state => "standalone",
   },
   :nominatim => {
     :state => "standalone",
-    :dbadmins => %w(lonvia tomh),
+    :dbadmins => %w[lonvia tomh],
     :dbcluster => "9.5/main",
     :flatnode_file => "/ssd/nominatim/nodes.store",
     :tablespaces => {
     :dbcluster => "9.5/main",
     :flatnode_file => "/ssd/nominatim/nodes.store",
     :tablespaces => {
index 343a5c59141bc277ba097a158d207d4a287404bd..4936947656672a5e9bed427e7b46ca794b474e06 100644 (file)
@@ -10,7 +10,7 @@ default_attributes(
         :family => :inet,
         :address => "10.0.32.21",
         :bond => {
         :family => :inet,
         :address => "10.0.32.21",
         :bond => {
-          :slaves => %w(em1 em2)
+          :slaves => %w[em1 em2]
         }
       },
       :external_ipv4 => {
         }
       },
       :external_ipv4 => {
index 6df29d9cbe063c0253839a8087e77774752caad5..7710900aa7b69ca5426aba3f6da104283043cdd0 100644 (file)
@@ -10,7 +10,7 @@ default_attributes(
         :family => :inet,
         :address => "10.0.32.22",
         :bond => {
         :family => :inet,
         :address => "10.0.32.22",
         :bond => {
-          :slaves => %w(em1 em2)
+          :slaves => %w[em1 em2]
         }
       },
       :external_ipv4 => {
         }
       },
       :external_ipv4 => {
index 70e0e5bde881a2779a8af726e491520b0465f42e..6bb0b45dad71f5c0a40554892a0dbfce53fd15fe 100644 (file)
@@ -1,4 +1,5 @@
 # coding: utf-8
 # coding: utf-8
+
 name "teleservice"
 description "Role applied to all servers at Teleservice"
 
 name "teleservice"
 description "Role applied to all servers at Teleservice"
 
index 1487ae3d2629a4130c59e1b51dc739950119b3d4..8954a8c348440f38991ea47be8496be61aff49a0 100644 (file)
@@ -10,7 +10,7 @@ default_attributes(
         :family => :inet,
         :address => "10.0.32.41",
         :bond => {
         :family => :inet,
         :address => "10.0.32.41",
         :bond => {
-          :slaves => %w(em1 em2)
+          :slaves => %w[em1 em2]
         }
       }
     }
         }
       }
     }
index e36e2201747807ddaacbeba8dde04e8010d46cc8..e0b20913d94c055e7784ac495dafa61042689dec 100644 (file)
@@ -10,7 +10,7 @@ default_attributes(
         :family => :inet,
         :address => "10.0.32.42",
         :bond => {
         :family => :inet,
         :address => "10.0.32.42",
         :bond => {
-          :slaves => %w(em1 em2)
+          :slaves => %w[em1 em2]
         }
       }
     }
         }
       }
     }
index 86ef45b0e94dbd73210b20a259f2b55517fc0e00..c6e21bd9afb13fa9ae23f21cf88aafafb996ce39 100644 (file)
@@ -3,7 +3,7 @@ description "Role applied to machines using the Tyan S7010 motherboard"
 
 default_attributes(
   :hardware => {
 
 default_attributes(
   :hardware => {
-    :modules => %w(i2c_i801 jc42 w83793),
+    :modules => %w[i2c_i801 jc42 w83793],
     :sensors => {
       "jc42-*" => {
         :temps => {
     :sensors => {
       "jc42-*" => {
         :temps => {
index dce003b3da9acf40909b1fce6c902aad16a1f05d..7427f0526f24765e6f73e602952d0efd84d50bca 100644 (file)
@@ -15,7 +15,7 @@ default_attributes(
   },
   :web => {
     :status => "online",
   },
   :web => {
     :status => "online",
-    :memcached_servers => %w(rails1.ic rails2.ic rails3.ic)
+    :memcached_servers => %w[rails1.ic rails2.ic rails3.ic]
   }
 )
 
   }
 )