Skip to content

Commit 10cb814

Browse files
committed
Coding style fixes
1 parent aa1cd44 commit 10cb814

17 files changed

+106
-73
lines changed

Diff for: .project

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>postgresql</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.cloudsmith.geppetto.pp.dsl.ui.modulefileBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.cloudsmith.geppetto.pp.dsl.ui.puppetNature</nature>
21+
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
22+
</natures>
23+
</projectDescription>

Diff for: Modulefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author 'Inkling/Puppet Labs'
55
description 'PostgreSQL defined resource types'
66
summary 'PostgreSQL defined resource types'
77
license 'Apache'
8-
project_page 'https://github.com/puppetlabs/puppet-postgresql/issues'
8+
project_page 'https://github.com/puppetlabs/puppet-postgresql'
99

1010
dependency 'puppetlabs/stdlib', '>=3.2.0 <4.0.0'
1111
dependency 'puppetlabs/firewall', '>= 0.0.4'

Diff for: manifests/config/beforeservice.pp

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@
7373
# managing their own settings in a second conf file.
7474
file_line { 'postgresql.conf#include':
7575
path => $postgresql_conf_path,
76-
line => "include 'postgresql_puppet_extras.conf'",
76+
line => 'include \'postgresql_puppet_extras.conf\'',
7777
notify => Service['postgresqld'],
7878
}
7979

8080
# Since we're adding an "include" for this extras config file, we need
8181
# to make sure it exists.
82-
exec { "touch `dirname $postgresql_conf_path`/postgresql_puppet_extras.conf" :
83-
path => "/usr/bin:/bin",
84-
unless => "[ -f `dirname $postgresql_conf_path`/postgresql_puppet_extras.conf ]"
82+
exec { "touch `dirname ${postgresql_conf_path}`/postgresql_puppet_extras.conf" :
83+
path => '/usr/bin:/bin',
84+
unless => "[ -f `dirname ${postgresql_conf_path}`/postgresql_puppet_extras.conf ]"
8585
}
8686

8787
# TODO: is this a reasonable place for this firewall stuff?

Diff for: manifests/database.pp

+7-7
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
undef => '',
3535
default => "--locale=${locale}",
3636
}
37-
$public_revoke_privilege = "CONNECT"
37+
$public_revoke_privilege = 'CONNECT'
3838
} else {
39-
$locale_option = ""
40-
$public_revoke_privilege = "ALL"
39+
$locale_option = ''
40+
$public_revoke_privilege = 'ALL'
4141
}
4242

4343
$createdb_command_tmp = "${postgresql::params::createdb_path} --template=template0 --encoding '${charset}' ${locale_option} '${dbname}'"
@@ -49,9 +49,9 @@
4949
$createdb_command = "${createdb_command_tmp} --tablespace='${tablespace}'"
5050
}
5151

52-
postgresql_psql { "Check for existence of db '$dbname'":
53-
command => "SELECT 1",
54-
unless => "SELECT datname FROM pg_database WHERE datname='$dbname'",
52+
postgresql_psql { "Check for existence of db '${dbname}'":
53+
command => 'SELECT 1',
54+
unless => "SELECT datname FROM pg_database WHERE datname='${dbname}'",
5555
cwd => $postgresql::params::datadir,
5656
require => Class['postgresql::server']
5757
} ~>
@@ -65,7 +65,7 @@
6565

6666
# This will prevent users from connecting to the database unless they've been
6767
# granted privileges.
68-
postgresql_psql {"REVOKE ${public_revoke_privilege} ON DATABASE $dbname FROM public":
68+
postgresql_psql {"REVOKE ${public_revoke_privilege} ON DATABASE ${dbname} FROM public":
6969
db => 'postgres',
7070
refreshonly => true,
7171
cwd => $postgresql::params::datadir,

Diff for: manifests/database_grant.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
default => $privilege,
5151
}
5252

53-
postgresql_psql {"GRANT $privilege ON database $db TO $role":
53+
postgresql_psql {"GRANT ${privilege} ON database ${db} TO ${role}":
5454
db => $psql_db,
5555
psql_user => $psql_user,
56-
unless => "SELECT 1 WHERE has_database_privilege('$role', '$db', '$unless_privilege')",
56+
unless => "SELECT 1 WHERE has_database_privilege('${role}', '${db}', '${unless_privilege}')",
5757
cwd => $postgresql::params::datadir,
5858
}
5959
}

Diff for: manifests/init.pp

+44-34
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,46 @@
1-
# Class: postgresql
2-
#
3-
# This is a base class that can be used to modify catalog-wide settings relating
4-
# to the various types in class contained in the postgresql module.
5-
#
6-
# If you don't declare this class in your catalog, sensible defaults will
7-
# be used. However, if you choose to declare it, it needs to appear *before*
8-
# any other types or classes from the postgresql module.
9-
#
10-
# For examples, see the files in the `tests` directory; in particular,
11-
# `/server-yum-postgresql-org.pp`.
12-
#
13-
# Parameters:
14-
# [*version*] - The postgresql version to install. If not specified, the
15-
# module will use whatever version is the default for your
16-
# OS distro.
17-
# [*manage_package_repo*] - This determines whether or not the module should
18-
# attempt to manage the postgres package repository for your
19-
# distro. Defaults to `false`, but if set to `true`, it can
20-
# be used to set up the official postgres yum/apt package
21-
# repositories for you.
22-
# [*package_source*] - This setting is only used if `manage_package_repo` is
23-
# set to `true`. It determines which package repository should
24-
# be used to install the postgres packages. Currently supported
25-
# values include `yum.postgresql.org`.
26-
# [*locale*] - This setting defines the default locale for initdb and createdb
27-
# commands. This default to 'undef' which is effectively 'C'.
28-
# [*charset*] - Sets the default charset to be used for initdb and createdb.
29-
# Defaults to 'UTF8'.
30-
# Actions:
31-
#
32-
# Requires:
33-
#
34-
# Sample Usage:
1+
# == Class: postgresql
2+
#
3+
# This is a base class that can be used to modify catalog-wide settings relating
4+
# to the various types in class contained in the postgresql module.
5+
#
6+
# If you don't declare this class in your catalog, sensible defaults will
7+
# be used. However, if you choose to declare it, it needs to appear *before*
8+
# any other types or classes from the postgresql module.
9+
#
10+
# For examples, see the files in the `tests` directory; in particular,
11+
# `/server-yum-postgresql-org.pp`.
12+
#
13+
#
14+
# [*version*]
15+
# The postgresql version to install. If not specified, the
16+
# module will use whatever version is the default for your
17+
# OS distro.
18+
# [*manage_package_repo*]
19+
# This determines whether or not the module should
20+
# attempt to manage the postgres package repository for your
21+
# distro. Defaults to `false`, but if set to `true`, it can
22+
# be used to set up the official postgres yum/apt package
23+
# repositories for you.
24+
# [*package_source*]
25+
# This setting is only used if `manage_package_repo` is
26+
# set to `true`. It determines which package repository should
27+
# be used to install the postgres packages. Currently supported
28+
# values include `yum.postgresql.org`.
29+
#
30+
# [*locale*]
31+
# This setting defines the default locale for initdb and createdb
32+
# commands. This default to 'undef' which is effectively 'C'.
33+
# [*charset*]
34+
# Sets the default charset to be used for initdb and createdb.
35+
# Defaults to 'UTF8'.
36+
#
37+
# === Examples:
38+
#
39+
# class { 'postgresql':
40+
# version => '9.2',
41+
# manage_package_repo => true,
42+
# }
43+
#
3544
#
3645
class postgresql (
3746
$version = $::postgres_default_version,
@@ -41,6 +50,7 @@
4150
$charset = 'UTF8'
4251
) {
4352
class { 'postgresql::params':
53+
4454
version => $version,
4555
manage_package_repo => $manage_package_repo,
4656
package_source => $package_source,

Diff for: manifests/package_source/yum_postgresql_org.pp

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
$package_version = "${version_parts[0]}${version_parts[1]}"
77

88
file { "/etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-${package_version}":
9-
source => "puppet:///modules/postgresql/RPM-GPG-KEY-PGDG"
9+
source => 'puppet:///modules/postgresql/RPM-GPG-KEY-PGDG'
1010
} ->
1111

12-
yumrepo { "yum.postgresql.org":
12+
yumrepo { 'yum.postgresql.org':
1313
descr => "PostgreSQL ${version} \$releasever - \$basearch",
1414
baseurl => "http://yum.postgresql.org/${version}/redhat/rhel-\$releasever-\$basearch",
1515
enabled => 1,
1616
gpgcheck => 1,
1717
gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-${package_version}",
1818
}
1919

20-
Yumrepo["yum.postgresql.org"] -> Package<|tag == 'postgresql'|>
20+
Yumrepo['yum.postgresql.org'] -> Package<|tag == 'postgresql'|>
2121

2222
}

Diff for: manifests/params.pp

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
case $rh_pkg_source {
5454
'yum.postgresql.org': {
55-
class { "postgresql::package_source::yum_postgresql_org":
55+
class { 'postgresql::package_source::yum_postgresql_org':
5656
version => $version
5757
}
5858
}
@@ -64,7 +64,7 @@
6464
}
6565

6666
'Debian': {
67-
class { "postgresql::package_source::apt_postgresql_org": }
67+
class { 'postgresql::package_source::apt_postgresql_org': }
6868
}
6969

7070
default: {
@@ -81,7 +81,7 @@
8181
# that pluginsync might not be enabled. Ideally this would be handled directly
8282
# in puppet.
8383
if ($::postgres_default_version == undef) {
84-
fail "No value for postgres_default_version facter fact; it's possible that you don't have pluginsync enabled."
84+
fail 'No value for postgres_default_version facter fact; it\'s possible that you don\'t have pluginsync enabled.'
8585
}
8686

8787
case $::operatingsystem {

Diff for: manifests/psql.pp

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
$quoted_command = regsubst($command, '"', '\\"', 'G')
3939
$quoted_unless = regsubst($unless, '"', '\\"', 'G')
4040

41-
$final_cmd = "/bin/echo \"$quoted_command\" | $psql |egrep -v -q '^$'"
41+
$final_cmd = "/bin/echo \"${quoted_command}\" | ${psql} |egrep -v -q '^$'"
4242

43-
notify { "deprecation warning: $final_cmd":
44-
message => "postgresql::psql is deprecated ; please use postgresql_psql instead.",
43+
notify { "deprecation warning: ${final_cmd}":
44+
message => 'postgresql::psql is deprecated ; please use postgresql_psql instead.',
4545
} ->
4646

4747
exec { $final_cmd:

Diff for: manifests/role.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
$superuser_sql = $superuser ? { true => 'SUPERUSER' , default => 'NOSUPERUSER' }
3434

3535
# TODO: FIXME: Will not correct the superuser / createdb / createrole / login status of a role that already exists
36-
postgresql_psql {"CREATE ROLE ${username} ENCRYPTED PASSWORD '${password_hash}' $login_sql $createrole_sql $createdb_sql $superuser_sql":
36+
postgresql_psql {"CREATE ROLE ${username} ENCRYPTED PASSWORD '${password_hash}' ${login_sql} ${createrole_sql} ${createdb_sql} ${superuser_sql}":
3737
db => $db,
3838
psql_user => 'postgres',
39-
unless => "SELECT rolname FROM pg_roles WHERE rolname='$username'",
39+
unless => "SELECT rolname FROM pg_roles WHERE rolname='${username}'",
4040
cwd => $postgresql::params::datadir,
4141
}
4242
}

Diff for: manifests/tablespace.pp

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@
3838

3939
$create_tablespace_command = "CREATE TABLESPACE ${spcname} ${owner_section} LOCATION '${location}'"
4040

41-
file { "${location}":
41+
file { $location:
4242
ensure => directory,
4343
owner => 'postgres',
4444
group => 'postgres',
45-
mode => 700,
45+
mode => '0700',
4646
}
4747

4848
postgresql_psql { "Create tablespace '${spcname}'":
4949
command => $create_tablespace_command,
5050
unless => "SELECT spcname FROM pg_tablespace WHERE spcname='${spcname}'",
5151
cwd => $postgresql::params::datadir,
52-
require => [Class['postgresql::server'], File["${location}"]],
52+
require => [Class['postgresql::server'], File[$location]],
5353
}
5454
}

Diff for: spec/system/base.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
file {'/etc/sudoers.d/puppet_postgresql_tests':
2929
ensure => file,
3030
content => 'vagrant ALL=(ALL) ALL',
31-
mode => 0440,
31+
mode => '0440',
3232
owner => root,
3333
group => root,
3434
}

Diff for: spec/system/test_module/manifests/system_default/test_grant_create.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
require => Class['postgresql::server'],
3636
}
3737

38-
postgresql::database_grant { "grant create test":
38+
postgresql::database_grant { 'grant create test':
3939
privilege => 'CREATE',
4040
db => $db,
4141
role => $user,

Diff for: spec/system/test_module/manifests/system_default/test_tablespace.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
ensure => 'directory',
2828
owner => 'postgres',
2929
group => 'postgres',
30-
mode => 700,
30+
mode => '0700',
3131
require => File['/tmp'],
3232
}
3333

@@ -61,5 +61,5 @@
6161
tablespace => 'tablespace2',
6262
require => Postgresql::Tablespace['tablespace2'],
6363
}
64-
64+
6565
}

Diff for: tests/official-postgresql-repos.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# still need to use the 'postgresql' class to specify the postgres version
1313
# number, though, in order for the other classes to be able to find the
1414
# correct paths to the postgres dirs.
15-
class { "postgresql":
15+
class { 'postgresql':
1616
version => '9.2',
1717
manage_package_repo => true,
1818
}->
19-
class { "postgresql::server": }
19+
class { 'postgresql::server': }

Diff for: tests/postgresql_pgconf_extras.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
}
1010

11-
include "postgresql::params"
11+
include 'postgresql::params'
1212

1313
$pg_conf_include_file = "${postgresql::params::confdir}/postgresql_puppet_extras.conf"
1414

Diff for: tests/postgresql_tablespace.pp

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
ensure => 'directory',
1313
}
1414
file { '/tmp/pg_tablespaces':
15-
ensure => 'directory',
16-
owner => 'postgres',
17-
group => 'postgres',
18-
mode => 700,
15+
ensure => 'directory',
16+
owner => 'postgres',
17+
group => 'postgres',
18+
mode => '0700',
1919
require => File['/tmp'],
2020
}
2121

0 commit comments

Comments
 (0)