inherit_from: .rubocop_todo.yml
-Style/AlignParameters:
+AllCops:
+ TargetRubyVersion: 2.3
+
+Layout/AlignParameters:
Exclude:
- '**/metadata.rb'
-Style/ExtraSpacing:
+Layout/ExtraSpacing:
AllowForAlignment: true
+Layout/IndentHeredoc:
+ EnforcedStyle: squiggly
+
Style/FileName:
Exclude:
- 'cookbooks/trac/files/default/trac-authenticate'
- 'hooks/*'
- 'roles/*.rb'
+Style/FrozenStringLiteralComment:
+ EnforcedStyle: never
+
Style/HashSyntax:
EnforcedStyle: hash_rockets
Style/StringLiterals:
EnforcedStyle: double_quotes
+
+Style/SymbolArray:
+ EnforcedStyle: brackets
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]
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}"
default[:hardware][:modules] = if node[:lsb][:release].to_f >= 16.04
- %w(lp)
+ %w[lp]
else
- %w(loop lp rtc)
+ %w[loop lp rtc]
end
-default[:hardware][:grub][:cmdline] = %w(nomodeset)
+default[:hardware][:grub][:cmdline] = %w[nomodeset]
default[:hardware][:sensors] = {}
if node[:dmi] && node[:dmi][:system]
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"
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
# 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
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
disks = disks.compact
-if disks.count > 0
+if disks.count.positive?
package "smartmontools"
template "/usr/local/bin/smartd-mailer" do
end
end
-if disks.count > 0
+if disks.count.positive?
munin_plugin "hddtemp_smartctl" do
conf "munin.hddtemp.erb"
conf_variables :disks => disks
# coding: utf-8
+
#
# Cookbook Name:: imagery
# Recipe:: gb_os_sv
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
- domains base_domains.flat_map { |d| [d, "a.#{d}", "b.#{d}", "c.#{d}"] }
+ domains tile_domains
end
resolvers = node[:networking][:nameservers].map do |resolver|
# coding: utf-8
+
#
# Cookbook Name:: kibana
# Recipe:: default
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
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
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
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
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
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
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
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
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
-%w(
+%w[
bin_relay_log files_tables replication
-).each do |stat|
+].each do |stat|
munin_plugin "mysql_#{stat}" do
action :delete
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
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"
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
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"
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
SegmentEditor SEO SitesManager Transitions UserCountry UserCountryMap
UserLanguage UsersManager Widgetize VisitFrequency VisitorInterest
VisitsSummary VisitTime
-)
+]
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|
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
move_tmp_files_into_place!
fl.flock(File::LOCK_UN)
-
rescue
STDERR.puts("Error! Couldn't update state.")
fl.flock(File::LOCK_UN)
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 $#"
}
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"
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
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
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"
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 :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,
- :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,
- :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,
- :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]
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
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"
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"
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"
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
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
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
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
}
},
:web => {
- :backends => %w(rails4 rails5),
+ :backends => %w[rails4 rails5],
:fileserver => "grisu",
:readonly_database_host => "katla.bm.openstreetmap.org"
}
: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",
:family => :inet,
:address => "10.0.32.20",
:bond => {
- :slaves => %w(em1 em2)
+ :slaves => %w[em1 em2]
}
},
:external_ipv4 => {
}
},
:web => {
- :backends => %w(rails1 rails2 rails3),
+ :backends => %w[rails1 rails2 rails3],
:fileserver => "ironbelly",
:readonly_database_host => "karm.ic.openstreetmap.org"
}
:family => :inet,
:address => "10.0.32.40",
:bond => {
- :slaves => %w(eth0 eth1)
+ :slaves => %w[eth0 eth1]
}
}
}
:mode => "802.3ad",
:miimon => "100",
:xmithashpolicy => "layer3+4",
- :slaves => %w(eth0 eth1)
+ :slaves => %w[eth0 eth1]
}
},
:external_ipv6 => {
# coding: utf-8
+
name "paulla"
description "Role applied to all servers at PauLLA"
},
:nominatim => {
:state => "standalone",
- :dbadmins => %w(lonvia tomh),
+ :dbadmins => %w[lonvia tomh],
:dbcluster => "9.5/main",
:flatnode_file => "/ssd/nominatim/nodes.store",
:tablespaces => {
:family => :inet,
:address => "10.0.32.21",
:bond => {
- :slaves => %w(em1 em2)
+ :slaves => %w[em1 em2]
}
},
:external_ipv4 => {
:family => :inet,
:address => "10.0.32.22",
:bond => {
- :slaves => %w(em1 em2)
+ :slaves => %w[em1 em2]
}
},
:external_ipv4 => {
# coding: utf-8
+
name "teleservice"
description "Role applied to all servers at Teleservice"
:family => :inet,
:address => "10.0.32.41",
:bond => {
- :slaves => %w(em1 em2)
+ :slaves => %w[em1 em2]
}
}
}
:family => :inet,
:address => "10.0.32.42",
:bond => {
- :slaves => %w(em1 em2)
+ :slaves => %w[em1 em2]
}
}
}
default_attributes(
:hardware => {
- :modules => %w(i2c_i801 jc42 w83793),
+ :modules => %w[i2c_i801 jc42 w83793],
:sensors => {
"jc42-*" => {
:temps => {
},
:web => {
:status => "online",
- :memcached_servers => %w(rails1.ic rails2.ic rails3.ic)
+ :memcached_servers => %w[rails1.ic rails2.ic rails3.ic]
}
)