From: Peter Palfrader Date: Sat, 28 Sep 2019 17:31:37 +0000 (+0200) Subject: modules/postgres/manifests: quoting, spacing, linting X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=4ea7519709997c63f04eec23234e8f1596748c22;p=mirror%2Fdsa-puppet.git modules/postgres/manifests: quoting, spacing, linting --- diff --git a/modules/postgres/manifests/backup_server.pp b/modules/postgres/manifests/backup_server.pp index 0da5594af..94eb01e9e 100644 --- a/modules/postgres/manifests/backup_server.pp +++ b/modules/postgres/manifests/backup_server.pp @@ -27,12 +27,12 @@ class postgres::backup_server { } file { '/var/lib/dsa/postgres-make-base-backups': ensure => directory, - owner => 'debbackup', - mode => '0755', + owner => 'debbackup', + mode => '0755', } concat::fragment { 'puppet-crontab--postgres-make_base_backups': - target => '/etc/cron.d/puppet-crontab', - content => @("EOF") + target => '/etc/cron.d/puppet-crontab', + content => @("EOF") */30 * * * * debbackup sleep $(( RANDOM \% 1200 )); chronic ${$postgres::backup_server::globals::make_base_backups} | EOF } @@ -47,11 +47,11 @@ class postgres::backup_server { } file { '/usr/local/bin/postgres-make-backup-sshauthkeys': content => template('postgres/backup_server/postgres-make-backup-sshauthkeys.erb'), - mode => '0555', + mode => '0555', notify => Exec['postgres-make-backup-sshauthkeys'], } file { '/usr/local/bin/postgres-make-one-base-backup': - source => 'puppet:///modules/postgres/backup_server/postgres-make-one-base-backup', + source => 'puppet:///modules/postgres/backup_server/postgres-make-one-base-backup', mode => '0555' } file { '/etc/dsa/postgresql-backup/sshkeys-manual': @@ -59,18 +59,18 @@ class postgres::backup_server { notify => Exec['postgres-make-backup-sshauthkeys'], } concat { $postgres::backup_server::globals::sshkeys_sources: - notify => Exec['postgres-make-backup-sshauthkeys'], + notify => Exec['postgres-make-backup-sshauthkeys'], } concat::fragment { 'postgresql-backup/source-sshkeys-header': - target => $postgres::backup_server::globals::sshkeys_sources , - content => @(EOF), + target => $postgres::backup_server::globals::sshkeys_sources , + content => @(EOF), # | EOF - order => '00', + order => '00', } Concat::Fragment <<| tag == $postgres::backup_server::globals::tag_source_sshkey |>> - exec { "postgres-make-backup-sshauthkeys": - command => "/usr/local/bin/postgres-make-backup-sshauthkeys", + exec { 'postgres-make-backup-sshauthkeys': + command => '/usr/local/bin/postgres-make-backup-sshauthkeys', refreshonly => true, } @@ -78,23 +78,22 @@ class postgres::backup_server { # Maintain /etc/nagios/dsa-check-backuppg.conf # file { '/etc/dsa/postgresql-backup/dsa-check-backuppg.conf.d': - ensure => 'directory', + ensure => 'directory', purge => true, force => true, recurse => true, - source => 'puppet:///files/empty/', - notify => Exec['update dsa-check-backuppg-manual.conf'], + notify => Exec['update dsa-check-backuppg-manual.conf'], } file { '/etc/dsa/postgresql-backup/dsa-check-backuppg.conf.d/manual.conf': content => template('postgres/backup_server/dsa-check-backuppg-manual.conf.erb'), - notify => Exec['update dsa-check-backuppg-manual.conf'] + notify => Exec['update dsa-check-backuppg-manual.conf'] } File<<| tag == $postgres::backup_server::globals::tag_dsa_check_backupp |>> - exec { "update dsa-check-backuppg-manual.conf": - command => @(EOF), + exec { 'update dsa-check-backuppg-manual.conf': + command => @(EOF), perl -MYAML=LoadFile,Dump -MHash::Merge::Simple=merge -E 'say Dump(merge(map{LoadFile($_)}@ARGV))' /etc/dsa/postgresql-backup/dsa-check-backuppg.conf.d/*.conf > /etc/nagios/dsa-check-backuppg.conf | EOF - provider => shell, + provider => shell, refreshonly => true, } diff --git a/modules/postgres/manifests/backup_server/globals.pp b/modules/postgres/manifests/backup_server/globals.pp index 0dd3d8cc5..e5509ba72 100644 --- a/modules/postgres/manifests/backup_server/globals.pp +++ b/modules/postgres/manifests/backup_server/globals.pp @@ -4,8 +4,8 @@ class postgres::backup_server::globals { $sshkeys_sources = '/etc/dsa/postgresql-backup/sshkeys-sources' $base_backup_clusters = '/etc/dsa/postgresql-backup/base-backup-clusters' - $tag_base_backup = "postgresql::server::backup-source-make-base-backup-entry" - $tag_source_sshkey = "postgresql::server::backup-source-sshkey" - $tag_source_pgpassline = "postgresql::server::backup-source-pgpassline" - $tag_dsa_check_backupp = "postgresql::server::backup-dsa-check-backuppg" + $tag_base_backup = 'postgresql::server::backup-source-make-base-backup-entry' + $tag_source_sshkey = 'postgresql::server::backup-source-sshkey' + $tag_source_pgpassline = 'postgresql::server::backup-source-pgpassline' + $tag_dsa_check_backupp = 'postgresql::server::backup-dsa-check-backuppg' } diff --git a/modules/postgres/manifests/backup_server/register_backup_cluster.pp b/modules/postgres/manifests/backup_server/register_backup_cluster.pp index 44a1e42d4..5fdabab33 100644 --- a/modules/postgres/manifests/backup_server/register_backup_cluster.pp +++ b/modules/postgres/manifests/backup_server/register_backup_cluster.pp @@ -11,19 +11,19 @@ # @param pg_cluster cluster name # @param pg_version pg version of the cluster define postgres::backup_server::register_backup_cluster ( - String $hostname = $::hostname, - String $fqdn = $::fqdn, Integer $pg_port, String $pg_role, String $pg_password, String $pg_cluster, String $pg_version, + String $hostname = $::hostname, + String $fqdn = $::fqdn, ) { include postgres::backup_server::globals # foobar.debian.org:5432:*:debian-backup:swordfish - @@concat::fragment { "postgresql::server::backup-source-pgpassline::$hostname::$pg_port::$pg_role": - target => $postgres::backup_server::globals::pgpassfile, + @@concat::fragment { "postgresql::server::backup-source-pgpassline::${hostname}::${pg_port}::${pg_role}": + target => $postgres::backup_server::globals::pgpassfile, content => @("EOF"), ${fqdn}:${pg_port}:*:${pg_role}:${pg_password} | EOF @@ -31,7 +31,7 @@ define postgres::backup_server::register_backup_cluster ( } # example entry: # vittoria.debian.org 5432 debian-backup main 9.6 - @@concat::fragment { "postgresql::server::backup-source-make-base-backup-entry::$hostname::$pg_port::$pg_role": + @@concat::fragment { "postgresql::server::backup-source-make-base-backup-entry::${hostname}::${pg_port}::${pg_role}": tag => $postgres::backup_server::globals::tag_base_backup, target => $postgres::backup_server::globals::base_backup_clusters, content => "${::fqdn} ${pg_port} ${pg_role} ${pg_cluster} ${pg_version}", @@ -44,7 +44,7 @@ define postgres::backup_server::register_backup_cluster ( ${hostname}: ${pg_cluster}: | EOF - tag => $postgres::backup_server::globals::tag_dsa_check_backupp, - notify => Exec['update dsa-check-backuppg-manual.conf'] + tag => $postgres::backup_server::globals::tag_dsa_check_backupp, + notify => Exec['update dsa-check-backuppg-manual.conf'] } }