Skip to content

Commit 740c0b3

Browse files
committed
Update postgresql::globals::default_connect_settings and default to {}
- Add missing parameter `default_connect_settings` to class `postgresql::server` which was required by all of the classes and actually would have failed if the tests where not masking the issue - Remove test param that was masking the issue
1 parent 76321c7 commit 740c0b3

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ PostgreSQL is a high-performance, free, open-source relational database server.
4141

4242
### Getting started with postgresql
4343

44-
To configure a basic default PostgreSQL server, declare the `postgresql::server` class.
44+
To configure a basic default PostgreSQL server, declare the `postgresql::server` class.
4545

4646
```puppet
4747
class { 'postgresql::server': }
@@ -182,7 +182,7 @@ require => Postgresql::Server::Role['super2'],
182182

183183
### Create an access rule for pg_hba.conf
184184

185-
To create an access rule for `pg_hba.conf`:
185+
To create an access rule for `pg_hba.conf`:
186186

187187
```puppet
188188
postgresql::server::pg_hba_rule { 'allow application network to access app database':
@@ -242,7 +242,7 @@ sslrepli repli1.example.com replication
242242

243243
### Create recovery configuration
244244

245-
To create the recovery configuration file (`recovery.conf`):
245+
To create the recovery configuration file (`recovery.conf`):
246246

247247
```puppet
248248
postgresql::server::recovery{ 'Create a recovery.conf file with the following defined parameters':
@@ -535,7 +535,7 @@ Installs the packages containing the development libraries for PostgreSQL and sy
535535

536536
##### `link_pg_config`
537537

538-
If the bin directory used by the PostgreSQL page is not `/usr/bin` or `/usr/local/bin`, symlinks `pg_config` from the package's bin dir into `usr/bin` (not applicable to Debian systems). Set to false to disable this behavior. Valid values: true, false. Default: true.
538+
If the bin directory used by the PostgreSQL page is not `/usr/bin` or `/usr/local/bin`, symlinks `pg_config` from the package's bin dir into `usr/bin` (not applicable to Debian systems). Set to false to disable this behavior. Valid values: true, false. Default: true.
539539

540540
##### `package_ensure`
541541

@@ -585,7 +585,7 @@ Specifies whether the package is present. Valid values: 'present', 'absent'. Def
585585

586586
#### postgresql::lib::python
587587

588-
Installs PostgreSQL Python libraries.
588+
Installs PostgreSQL Python libraries.
589589

590590
##### `package_ensure`
591591

@@ -605,6 +605,10 @@ The name of the PostgreSQL Python package.
605605

606606
Specifies the name of the default database to connect with. On most systems this is "postgres".
607607

608+
##### `default_connect_settings`
609+
610+
Specifies a hash of environment variables used when connecting to a remote server. Becomes the default for other defined-types. i.e. `postgresql::server::role`
611+
608612
##### `encoding`
609613

610614
Sets the default encoding for all databases created with this module. On certain operating systems this is also used during the `template1` initialization, so it becomes a default outside of the module as well. Default: undef.
@@ -627,7 +631,7 @@ Lists strings for access control for connection method, users, databases, IPv6 a
627631

628632
##### `ip_mask_allow_all_users`
629633

630-
Overrides PostgreSQL defaults for remote connections. By default, PostgreSQL does not allow database user accounts to connect via TCP from remote machines. If you'd like to allow this, you can override this setting.
634+
Overrides PostgreSQL defaults for remote connections. By default, PostgreSQL does not allow database user accounts to connect via TCP from remote machines. If you'd like to allow this, you can override this setting.
631635

632636
Set to `0.0.0.0/0` to allow database users to connect from any remote machine, or `192.168.0.0/16` to allow connections from any machine on your local 192.168 subnet. Default: `127.0.0.1/32`.
633637

@@ -1035,7 +1039,7 @@ Provides the target for the rule and is generally an internal only property. **U
10351039

10361040
Allows you to create the content for `recovery.conf`. For more details see the [usage example](#create-recovery-configuration) and the [PostgreSQL documentation](http://www.postgresql.org/docs/current/static/recovery-config.html).
10371041

1038-
Every parameter value is a string set in the template except `recovery_target_inclusive`, `pause_at_recovery_target`, `standby_mode` and `recovery_min_apply_delay`.
1042+
Every parameter value is a string set in the template except `recovery_target_inclusive`, `pause_at_recovery_target`, `standby_mode` and `recovery_min_apply_delay`.
10391043

10401044
A detailed description of all listed parameters can be found in the [PostgreSQL documentation](http://www.postgresql.org/docs/current/static/recovery-config.html).
10411045

manifests/globals.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
$pg_ident_conf_path = undef,
2828
$postgresql_conf_path = undef,
2929
$recovery_conf_path = undef,
30-
$default_connect_settings = undef,
30+
$default_connect_settings = {},
3131

3232
$pg_hba_conf_defaults = undef,
3333

manifests/server.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
$service_reload = $postgresql::params::service_reload,
1919
$service_status = $postgresql::params::service_status,
2020
$default_database = $postgresql::params::default_database,
21-
21+
$default_connect_settings = $postgresql::globals::default_connect_settings,
2222
$listen_addresses = $postgresql::params::listen_addresses,
2323
$port = $postgresql::params::port,
2424
$ip_mask_deny_postgres_user = $postgresql::params::ip_mask_deny_postgres_user,

spec/unit/defines/server/database_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
it { is_expected.to contain_postgresql_psql("Create db 'test'") }
2525

2626
context "with comment set to 'test comment'" do
27-
let (:params) {{ :comment => 'test comment',
28-
:connect_settings => {} }}
27+
let (:params) {{ :comment => 'test comment' }}
2928

3029
it { is_expected.to contain_postgresql_psql("COMMENT ON DATABASE \"test\" IS 'test comment'").with_connect_settings( {} ) }
3130
end

spec/unit/defines/server/role_spec.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
let :params do
2121
{
2222
:password_hash => 'new-pa$s',
23-
:connect_settings => {},
2423
}
2524
end
2625

@@ -35,7 +34,6 @@
3534
'environment' => "NEWPGPASSWD=new-pa$s",
3635
'unless' => "SELECT rolname FROM pg_roles WHERE rolname='test'",
3736
'port' => "5432",
38-
'connect_settings' => {},
3937
})
4038
end
4139
it 'should have alter role for "test" user with password as ****' do
@@ -44,7 +42,6 @@
4442
'environment' => "NEWPGPASSWD=new-pa$s",
4543
'unless' => "SELECT usename FROM pg_shadow WHERE usename='test' and passwd='md5b6f7fcbbabb4befde4588a26c1cfd2fa'",
4644
'port' => "5432",
47-
'connect_settings' => {},
4845
})
4946
end
5047

0 commit comments

Comments
 (0)