Skip to content

Commit

Permalink
Merge pull request #743 from bmjen/4.7.1_prep
Browse files Browse the repository at this point in the history
4.7.1 Release Prep
  • Loading branch information
hunner committed Feb 18, 2016
2 parents cfdeee8 + 0d4e932 commit fea6aa8
Show file tree
Hide file tree
Showing 20 changed files with 139 additions and 71 deletions.
5 changes: 4 additions & 1 deletion .gitattributes
@@ -1,2 +1,5 @@
*.sh eol=lf
#This file is generated by ModuleSync, do not edit.
*.rb eol=lf
*.erb eol=lf
*.pp eol=lf
*.sh eol=lf
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
#This file is generated by ModuleSync, do not edit.
pkg/
Gemfile.lock
vendor/
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
@@ -1,3 +1,4 @@
#This file is generated by ModuleSync, do not edit.
---
sudo: false
language: ruby
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,19 @@
## Supported Release 4.7.1
### Summary
This release contains some bugfixes and documentation updates.

#### Bugfixes
- (MODULES-3024) Quote database objects when creating databases.
- Properly escape case where password ends with '$'.
- Fixes password change when postgres is configure to non-standard port.
- Unpins concat dependency to be able to use concat 2.x.
- Workaround to fix installing on Amazon Linux.
- Fixes proper defaulting of `$service_provider` parameter.
- Fixes postgres server init script naming on Amazon Linux.
- Fixes service reload parameter on Arch Linux.
- Adds missing onlyif_function to sequence grant code.
- Fixes to the markdown of the README.

## Supported Release 4.7.0
### Summary
A release with a considerable amount of new features, including remote db support and several platform support updates. Various bugfixes including several to address warnings and a sizable README update.
Expand Down
39 changes: 15 additions & 24 deletions Gemfile
@@ -1,12 +1,14 @@
#This file is generated by ModuleSync, do not edit.

source ENV['GEM_SOURCE'] || "https://rubygems.org"

def location_for(place, fake_version = nil)
def location_for(place, version = nil)
if place =~ /^(git[:@][^#]*)#(.*)/
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
[version, { :git => $1, :branch => $2, :require => false}].compact
elsif place =~ /^file:\/\/(.*)/
['>= 0', { :path => File.expand_path($1), :require => false }]
['>= 0', { :path => File.expand_path($1), :require => false}]
else
[place, { :require => false }]
[place, version, { :require => false}].compact
end
end

Expand All @@ -20,29 +22,18 @@ group :development, :unit_tests do
gem 'simplecov', :require => false
end
group :system_tests do
gem 'beaker-rspec', *location_for(ENV['BEAKER_RSPEC_VERSION'] || '>= 3.4')
gem 'beaker', *location_for(ENV['BEAKER_VERSION'])
gem 'serverspec', :require => false
gem 'beaker-puppet_install_helper', :require => false
if beaker_version = ENV['BEAKER_VERSION']
gem 'beaker', *location_for(beaker_version)
end
if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
gem 'beaker-rspec', *location_for(beaker_rspec_version)
else
gem 'beaker-rspec', :require => false
end
gem 'master_manipulator', :require => false
gem 'serverspec', :require => false
gem 'beaker-hostgenerator', *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'])
end

if facterversion = ENV['FACTER_GEM_VERSION']
gem 'facter', facterversion, :require => false
else
gem 'facter', :require => false
end
gem 'facter', *location_for(ENV['FACTER_GEM_VERSION'])
gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'])

if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
end

# vim:ft=ruby
if File.exists? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding)
end
2 changes: 1 addition & 1 deletion LICENSE
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2013 Puppet Labs
Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
23 changes: 19 additions & 4 deletions NOTICE
@@ -1,8 +1,8 @@
Puppetlabs postgresql module
postgresql puppet module

Copyright 2012 Inkling Systems Inc
Copyright 2012-2013 Puppet Labs Inc
Copyright 2012-2013 Camptocamp SA.
Copyright (C) 2012-2016 Puppet Labs, Inc.
Copyright (C) 2012 Inkling Systems Inc
Copyright (C) 2012-2013 Camptocamp SA.

This product includes software developed by:
The Puppet Labs Inc (http://www.puppetlabs.com/).
Expand All @@ -12,3 +12,18 @@ This product includes also software developed by:

This product includes also software developed by:
Inkling Systems Inc (https://www.inkling.com/)

Puppet Labs can be contacted at: info@puppetlabs.com


Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
36 changes: 18 additions & 18 deletions README.md
Expand Up @@ -229,13 +229,14 @@ postgresql::server::pg_ident_rule{ 'Map the SSL certificate of the backup server
system_username => 'repli1.example.com',
database_username => 'replication',
}
```

This would create a user name map in `pg_ident.conf` similar to:

```
# Rule Name: Map the SSL certificate of the backup server as a replication user
# Description: none
# Order: 150
#Rule Name: Map the SSL certificate of the backup server as a replication user
#Description: none
#Order: 150
sslrepli repli1.example.com replication
```

Expand Down Expand Up @@ -280,10 +281,9 @@ recovery_min_apply_delay = 0

Only the specified parameters are recognized in the template. The `recovery.conf` is only be created if at least one parameter is set **and** [manage_recovery_conf](#manage_recovery_conf) is set to true.


### Validate connectivity

To validate client connections to a remote PostgreSQL database before starting dependent tasks, use the `postgresql::validate_db_connection` resource. You can use this on any node where the PostgreSQL client software is installed. It is often chained to other tasks such as starting an application server or performing a database migration.
To validate client connections to a remote PostgreSQL database before starting dependent tasks, use the `postgresql::validate_db_connection` resource. You can use this on any node where the PostgreSQL client software is installed. It is often chained to other tasks such as starting an application server or performing a database migration.

Example usage:

Expand All @@ -299,11 +299,11 @@ exec { 'rake db:migrate':
}
```

## Reference
## Reference

The posgresql module comes with many options for configuring the server. While you are unlikely to use all of the settings below, they provide a decent amount of control over your security settings.

Classes:
**Classes:**

* [postgresql::client](#postgresqlclient)
* [postgresql::globals](#postgresqlglobals)
Expand All @@ -316,7 +316,7 @@ Classes:
* [postgresql::server::contrib](#postgresqlservercontrib)
* [postgresql::server::postgis](#postgresqlserverpostgis)

Defined Types:
**Defined Types:**

* [postgresql::server::config_entry](#postgresqlserverconfig_entry)
* [postgresql::server::database](#postgresqlserverdatabase)
Expand All @@ -332,13 +332,13 @@ Defined Types:
* [postgresql::server::tablespace](#postgresqlservertablespace)
* [postgresql::validate_db_connection](#postgresqlvalidate_db_connection)

Types:
**Types:**

* [postgresql_psql](#custom-resource-postgresql_psql)
* [postgresql_replication_slot](#custom-resource-postgresql_replication_slot)
* [postgresql_conf](#custom-resource-postgresql_conf)

Functions:
**Functions:**

* [postgresql_password](#function-postgresql_password)
* [postgresql_acls_to_resources_hash](#function-postgresql_acls_to_resources_hashacl_array-id-order_offset)
Expand Down Expand Up @@ -367,7 +367,7 @@ Specifies the path to validate the connection script. Default: '/usr/local/bin/v

Installs PostgreSQL bindings for Postgres-Docs. Set the following parameters if you have a custom version you would like to install.

>**Note:** Make sure to add any necessary yum or apt repositories if specifying a custom version.
**Note:** Make sure to add any necessary yum or apt repositories if specifying a custom version.

##### `package_name`

Expand All @@ -379,7 +379,7 @@ Whether the PostgreSQL docs package resource should be present. Valid values: 'p

#### postgresql::globals

>**Note:** Most server-specific defaults should be overriden in the `postgresql::server` class. This class should be used only if you are using a non-standard OS, or if you are changing elements that can only be changed here, such as `version` or `manage_package_repo`.
**Note:** Most server-specific defaults should be overriden in the `postgresql::server` class. This class should be used only if you are using a non-standard OS, or if you are changing elements that can only be changed here, such as `version` or `manage_package_repo`.

##### `bindir`

Expand All @@ -405,7 +405,7 @@ Overrides the default PostgreSQL contrib package name. Default: OS dependent.

Overrides the default PostgreSQL data directory for the target platform. Default: OS dependent.

>**Note:** Changing the datadir after installation causes the server to come to a full stop before making the change. For RedHat systems, the data directory must be labeled appropriately for SELinux. On Ubuntu, you must explicitly set `needs_initdb = true` to allow Puppet to initialize the database in the new datadir (`needs_initdb` defaults to true on other systems).
**Note:** Changing the datadir after installation causes the server to come to a full stop before making the change. For RedHat systems, the data directory must be labeled appropriately for SELinux. On Ubuntu, you must explicitly set `needs_initdb = true` to allow Puppet to initialize the database in the new datadir (`needs_initdb` defaults to true on other systems).

**Warning:** If datadir is changed from the default, Puppet does not manage purging of the original data directory, which causes it to fail if the data directory is changed back to the original.

Expand Down Expand Up @@ -545,11 +545,11 @@ Overrides the `ensure` parameter during package installation. Defaults to `prese

Overrides the default package name for the distribution you are installing to. Defaults to `postgresql-devel` or `postgresql<version>-devel` depending on your distro.

####postgresql::lib::java
#### postgresql::lib::java

Installs PostgreSQL bindings for Java (JDBC). Set the following parameters if you have a custom version you would like to install.

>**Note:** Make sure to add any necessary yum or apt repositories if specifying a custom version.
**Note:** Make sure to add any necessary yum or apt repositories if specifying a custom version.

##### `package_ensure`

Expand Down Expand Up @@ -583,7 +583,7 @@ Specifies the name of the postgresql PL/Python package.

Specifies whether the package is present. Valid values: 'present', 'absent'. Default: 'present'.

####postgresql::lib::python
#### postgresql::lib::python

Installs PostgreSQL Python libraries.

Expand All @@ -595,7 +595,7 @@ Specifies whether the package is present. Valid values: 'present', 'absent'. Def

The name of the PostgreSQL Python package.

####postgresql::server
#### postgresql::server

##### `createdb_path`

Expand Down Expand Up @@ -1094,6 +1094,7 @@ Sets the hash to use during password creation. If the password is not already pr
postgresql::server::role { "myusername":
password_hash => postgresql_password('myusername', 'mypassword'),
}
```

##### `replication`

Expand All @@ -1107,7 +1108,6 @@ Specifies whether to grant super user capability for the new role. Default: fals

Defines the username of the role to create. Defaults to the namevar.

#### postgresql::server::schema

Creates a schema.
Expand Down
31 changes: 31 additions & 0 deletions Rakefile
Expand Up @@ -9,3 +9,34 @@ PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_documentation')
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

desc 'Generate pooler nodesets'
task :gen_nodeset do
require 'beaker-hostgenerator'
require 'securerandom'
require 'fileutils'

agent_target = ENV['TEST_TARGET']
if ! agent_target
STDERR.puts 'TEST_TARGET environment variable is not set'
STDERR.puts 'setting to default value of "redhat-64default."'
agent_target = 'redhat-64default.'
end

master_target = ENV['MASTER_TEST_TARGET']
if ! master_target
STDERR.puts 'MASTER_TEST_TARGET environment variable is not set'
STDERR.puts 'setting to default value of "redhat7-64mdcl"'
master_target = 'redhat7-64mdcl'
end

targets = "#{master_target}-#{agent_target}"
cli = BeakerHostGenerator::CLI.new([targets])
nodeset_dir = "tmp/nodesets"
nodeset = "#{nodeset_dir}/#{targets}-#{SecureRandom.uuid}.yaml"
FileUtils.mkdir_p(nodeset_dir)
File.open(nodeset, 'w') do |fh|
fh.print(cli.execute)
end
puts nodeset
end
4 changes: 2 additions & 2 deletions lib/puppet/parser/functions/postgresql_escape.rb
Expand Up @@ -11,7 +11,7 @@ module Puppet::Parser::Functions

password = args[0]

if password !~ /\$\$/
if password !~ /\$\$/ and password[-1] != '$'
retval = "$$#{password}$$"
else
escape = Digest::MD5.hexdigest(password)[0..5].gsub(/\d/,'')
Expand All @@ -20,6 +20,6 @@ module Puppet::Parser::Functions
end
retval = "$#{escape}$#{password}$#{escape}$"
end
retval
retval
end
end
8 changes: 4 additions & 4 deletions manifests/params.pp
Expand Up @@ -14,7 +14,7 @@
$service_enable = true
$service_manage = true
$service_restart_on_change = true
$service_provider = $service_provider
$service_provider = $postgresql::globals::service_provider
$manage_pg_hba_conf = pick($manage_pg_hba_conf, true)
$manage_pg_ident_conf = pick($manage_pg_ident_conf, true)
$manage_recovery_conf = pick($manage_recovery_conf, false)
Expand All @@ -30,7 +30,7 @@
$version_parts = split($version, '[.]')
$package_version = "${version_parts[0]}${version_parts[1]}"

if $version == $postgresql::globals::default_version {
if $version == $postgresql::globals::default_version and $::operatingsystem != 'Amazon' {
$client_package_name = pick($client_package_name, 'postgresql')
$server_package_name = pick($server_package_name, 'postgresql-server')
$contrib_package_name = pick($contrib_package_name,'postgresql-contrib')
Expand All @@ -56,7 +56,7 @@
$plperl_package_name = pick($plperl_package_name, "postgresql${package_version}-plperl")
$plpython_package_name = pick($plpython_package_name, "postgresql${package_version}-plpython")
$service_name = $::operatingsystem ? {
'Amazon' => pick($service_name, "postgresql${version}"),
'Amazon' => pick($service_name, "postgresql${version_parts[0]}${version_parts[1]}"),
default => pick($service_name, "postgresql-${version}"),
}
$bindir = $::operatingsystem ? {
Expand Down Expand Up @@ -112,7 +112,7 @@
$psql_path = pick($psql_path, "${bindir}/psql")

$service_status = $service_status
$service_reload = "service ${service_name} reload"
$service_reload = "systemctl reload ${service_name}"
$python_package_name = pick($python_package_name, 'python-psycopg2')
# Archlinux does not have a perl::DBD::Pg package
$perl_package_name = pick($perl_package_name, 'undef')
Expand Down

0 comments on commit fea6aa8

Please sign in to comment.