Layout/IndentHeredoc:
EnforcedStyle: squiggly
-Style/FileName:
+Naming/FileName:
Exclude:
- 'cookbooks/trac/files/default/trac-authenticate'
- 'cookbooks/planet/files/default/replication-bin/replicate-changesets'
-# -*- coding: utf-8 -*-
#
# Cookbook Name:: accounts
# Recipe:: default
mode 0o755
end
-node[:civicrm][:extensions].each do |_, details|
+node[:civicrm][:extensions].each_value do |details|
git "#{extensions_directory}/#{details[:name]}" do
action :sync
repository details[:repository]
# an Areca controller as they only allow one thing to
# talk to the controller at a time and smartd will
# throw errors if it clashes with munin
- disks = disks.reject { |disk| disk[:smart] && disk[:smart].start_with?("areca,") }
+ disks = disks.reject { |disk| disk[:smart]&.start_with?("areca,") }
disks.each do |disk|
munin_plugin "smart_#{disk[:munin]}" do
-# coding: utf-8
-
#
# Cookbook Name:: imagery
# Recipe:: gb_os_sv
-# coding: utf-8
-
#
# Cookbook Name:: kibana
# Recipe:: default
end
end
- CALL_TYPES.keys.each do |type|
+ CALL_TYPES.each_key do |type|
count = counts[type] || 0
puts "#{type}.value #{count}"
end
else
statistics = JSON.parse(File.read("/srv/www.openstreetmap.org/rails/tmp/statistics.json"))
- CALL_TYPES.keys.each do |type|
+ CALL_TYPES.each_key do |type|
count = statistics["uri"][type.to_s] || 0
puts "#{type}.value #{count}"
end
else
statistics = JSON.parse(File.read("/srv/www.openstreetmap.org/rails/tmp/statistics.json"))
- HTTP_STATUSES.keys.each do |code|
+ HTTP_STATUSES.each_key do |code|
count = statistics["status"][code] || 0
puts "http#{code}.value #{count}"
end
end
end
- CALL_TYPES.keys.each do |type|
+ CALL_TYPES.each_key do |type|
count = counts[type] || [0]
avg = count.inject(0) { |acc, elem| acc + elem } / (1.0 * count.length)
puts "#{type}.value #{avg}"
require "English"
def output_config
- puts <<~END
+ puts <<~CONFIG
graph_args --base 1024 -l 0 --vertical-label bytes --upper-limit 4056231936
graph_category passenger
graph_title Passenger memory
memory.label memory
- END
+ CONFIG
exit 0
end
def output_values
status = `/usr/sbin/passenger-memory-stats | tail -1`
unless $CHILD_STATUS.success?
- $stderr.puts "failed executing passenger-memory-stats"
+ warn "failed executing passenger-memory-stats"
exit 1
end
status =~ /(\d+\.\d+)/
require "English"
def output_config
- puts <<~END
+ puts <<~CONFIG
graph_category passenger
graph_title Passenger processes
graph_order active inactive
active.draw AREA
inactive.label idle servers
inactive.draw STACK
- END
+ CONFIG
exit 0
end
def output_values
status = `/usr/sbin/passenger-status`
unless $CHILD_STATUS.success?
- $stderr.puts "failed executing passenger-status"
+ warn "failed executing passenger-status"
exit 1
end
status =~ /active\s+=\s+(\d+)/
require "English"
def output_config
- puts <<~END
+ puts <<~CONFIG
graph_category passenger
graph_title Passenger queues
graph_vlabel count
global.label global
- END
+ CONFIG
exit 0
end
def output_values
status = `/usr/sbin/passenger-status`
unless $CHILD_STATUS.success?
- $stderr.puts "failed executing passenger-status"
+ warn "failed executing passenger-status"
exit 1
end
status =~ /Requests in top-level queue :\s+(\d+)/
require "English"
def output_config
- puts <<~END
+ puts <<~CONFIG
graph_args --base 1000
graph_category passenger
graph_title Passenger requests
requests.type DERIVE
requests.max 1000000
requests.min 0
- END
+ CONFIG
exit 0
end
def output_values
status = `/usr/sbin/passenger-status`
unless $CHILD_STATUS.success?
- $stderr.puts "failed executing passenger-status"
+ warn "failed executing passenger-status"
exit 1
end
total_requests = 0
def query(sql, options = {})
# Run the query
- result = execute(options.merge(:command => sql, :xml => :true))
+ result = execute(options.merge(:command => sql, :xml => true))
# Parse the output
document = REXML::Document.new(result.stdout)
def canonicalise_user(user)
local, host = user.split("@")
- host = "%" unless host
+ host ||= "%"
local = "'#{local}'" unless local =~ /^'.*'$/
host = "'#{host}'" unless host =~ /^'.*'$/
move_tmp_files_into_place!
fl.flock(File::LOCK_UN)
- rescue
+ rescue StandardError
STDERR.puts("Error! Couldn't update state.")
fl.flock(File::LOCK_UN)
raise
interpreter "php"
cwd site_directory
user "wordpress"
- code <<-EOS
+ code <<-WP_FAIL2BAN
<?php
@include "wp-config.php";
@include_once "wp-includes/functions.php";
@include_once "wp-admin/includes/plugin.php";
activate_plugin("wp-fail2ban/wp-fail2ban.php", '', false, false);
?>
- EOS
+ WP_FAIL2BAN
subscribes :run, "wordpress_plugin[wp-fail2ban]"
end
end
-# coding: utf-8
-
name "paulla"
description "Role applied to all servers at PauLLA"
-# coding: utf-8
-
name "teleservice"
description "Role applied to all servers at Teleservice"