case dmi.system.product_name
when "ProLiant DL360 G6", "ProLiant DL360 G7"
- default[:hardware][:sensors][:"power_meter-*"][:power][:"power1"] = { :ignore => true }
+ default[:hardware][:sensors][:"power_meter-*"][:power][:power1] = { :ignore => true }
end
end
end
end
disks.each do |disk|
- if disk[:device] =~ /^cciss\/(.*)$/
+ if disk[:device] =~ %r{^cciss/(.*)$}
id = File.read("/sys/bus/cciss/devices/#{Regexp.last_match[1]}/unique_id").chomp
disk[:munin] = "cciss-3#{id.downcase}"
doc = Hpricot.parse(file)
tables = doc / "table"
rows = (tables[1] / "tr")[1..-1]
- data = rows.collect { |r| (r / "td").collect(&: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) }
# return only the URI part
doc = Hpricot.parse(file)
tables = doc / "table"
rows = (tables[1] / "tr")[1..-1]
- data = rows.collect { |r| (r / "td").collect(&: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) }
# return URI and number of seconds processing for each request
require "ipaddr"
node[:networking][:interfaces].each do |name, interface|
- if interface[:role] && role = node[:networking][:roles][interface[:role]]
+ if interface[:role] && (role = node[:networking][:roles][interface[:role]])
if role[interface[:family]]
node.set[:networking][:interfaces][name][:prefix] = role[interface[:family]][:prefix]
node.set[:networking][:interfaces][name][:gateway] = role[interface[:family]][:gateway]
email_errors = data_bag_item("accounts", "lonvia")["email"]
database_cluster = node[:nominatim][:database][:cluster]
-database_version = database_cluster.sub(/\/.*/, "")
+database_version = database_cluster.sub(%r{/.*}, "")
database_name = node[:nominatim][:database][:dbname]
postgis_version = node[:nominatim][:database][:postgis]
line.gsub!(/^ALLOWED_HOSTS = .*/, "ALLOWED_HOSTS = ('help.openstreetmap.org',)")
line.gsub!(/^CACHE_BACKEND = .*/, "CACHE_BACKEND = 'memcached://127.0.0.1:11211/'")
line.gsub!(%r{^APP_URL = 'http://'}, "APP_URL = 'http://#{name}'")
- line.gsub!(/^TIME_ZONE = 'America\/New_York'/, "TIME_ZONE = 'Europe/London'")
+ line.gsub!(%r{^TIME_ZONE = 'America/New_York'}, "TIME_ZONE = 'Europe/London'")
line.gsub!(/^DISABLED_MODULES = \[([^\]]+)\]/, "DISABLED_MODULES = [\\1, 'localauth', 'facebookauth', 'oauthauth']")
line
default[:passenger][:pool_idle_time] = 300
if node[:passenger][:version] == 4
- default[:apt][:sources] = node[:apt][:sources] | ["brightbox-ruby-ng", "passenger4"]
+ default[:apt][:sources] = node[:apt][:sources] | ["brightbox-ruby-ng", "passenger4"]
else
- default[:apt][:sources] = node[:apt][:sources] | ["brightbox-ruby-ng", "passenger"]
+ default[:apt][:sources] = node[:apt][:sources] | ["brightbox-ruby-ng", "passenger"]
end
def parse_acl(acl)
acl.sub(/^\{(.*)\}$/, "\\1").split(",").each_with_object({}) do |entry, permissions|
- entry = entry.sub(/^"(.*)"$/) { Regexp.last_match[1].gsub(/\\"/, '"') }.sub(/\/.*$/, "")
+ entry = entry.sub(/^"(.*)"$/) { Regexp.last_match[1].gsub(/\\"/, '"') }.sub(%r{/.*$}, "")
user, privileges = entry.split("=")
user = user.sub(/^"(.*)"$/, "\\1")