Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(PDB-3587) Add puppetlabs-postgresql 5.x support and integrate rspec-puppetfacts #260

Merged
merged 18 commits into from Jun 29, 2017

Conversation

dhollinger
Copy link
Contributor

@dhollinger dhollinger commented Jun 26, 2017

Casts $database_port in postgresql.pp to an integer to make module compatible with puppetlabs-postgresql 5.x

Fix an issue where puppetlabs-puppetdb would pass true to managed_pg_repo by default for all supported OSes, however puppetlabs-postgresql can only manage the pg repo if the osfamily is RedHat or Debian.

Added rspec-puppet-facts to the unit tests and updated the beaker tests with beaker-puppet_install_helper and beaker-module_install_helper. These simplify test setup (it also happened to be the easiest way to get tests working consistently).

David Hollinger added 7 commits June 26, 2017 15:29
Converted $database_port into an integer for compatibility with
puppetlabs-postgresql 5.x
The manage_pg_repo defaulted to 'true' in all cases. This proved
to be a problem on supported OSes that weren't of the Redhat or
Debian families as puppetlabs-postgresql only supports managing
Debian or Redhat Postgresql repositories.

The parameter now defaults to true only when $osfamily is Redhat or
Debian
@@ -20,7 +20,7 @@
class { '::postgresql::server':
ip_mask_allow_all_users => '0.0.0.0/0',
listen_addresses => $listen_addresses,
port => $database_port,
port => 0 + $database_port,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the cheap way of casting $database_port to an integer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was trying to avoid breaking any functionality with this PR.

There is the scanf function as well, but required a minimum of Puppet 3.7.5, so that would also be a breaking change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're going to roll a major release soon and bring the minimum required version to Puppet 4, so scanf should be ok here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mullr Sounds good, I'll update that line of code

default_facts = {
puppetversion: Puppet.version,
facterversion: Facter.version
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vox Pupuli configs \o/

on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts.merge({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you want to move the selinux and iptables fact to default_module_facts.yml?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The selinux fact changes in different tests, but the iptables fact never changes.

let(:facts) do
facts.merge({
:puppetversion => Puppet.version,
:fqdn => 'puppetdb.example.com',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently mocking node for some reason doesn't carry over to fqdn in these tests

it { should contain_puppetdb_conn_validator('puppetdb_conn').with(
:puppetdb_server => 'puppetdb.example.com',
:puppetdb_port => '8081',
:use_ssl => 'true') }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you pull the } into the next line?

Updated the spec_helper_acceptance.rb file to utilize a few more
beaker helper gems to simplify agent and dependency installs.

Updated the puppetserver and puppetlabs release install logic to
use Puppet Collections and supported packages.
Updated base_spec.rb to utilize the newer, supported directory paths
and corrected the ntp panic attribute which is no longer a boolean
value.
@@ -17,7 +17,12 @@
$puppetdb_version = $puppetdb::globals::version
$database = $puppetdb::globals::database
$manage_dbserver = true
$manage_pg_repo = true

if $::osfamily =~ /RedHat|Debian/ {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this equal to $manage_pg_repo = $::osfamily =~ /RedHat|Debian/?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ekohl You're right, that does to the same thing.

Unless @mullr requests it for this PR, though, I'm going to keep this PR as is. We (or Puppet) could always submit that change as a part of a PR to bring the module in-line with Puppet 4.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use the new facts hash here? $facts['os']['family']

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bastelfreak I'll leave that for a Puppet 4 or Facts Hash PR. Wanted to keep the scope of this PR as close as possible to just making the module compatible with puppetlabs-postgresql 5.x for now.

@@ -87,6 +87,10 @@
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.2.2 <5.0.0"
},
{
"name": "puppetlabs/ntp",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only needed for acceptance testing. It feels wrong to add this as a regular dependency and should be fixed in the spec_helper_acceptance.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss this in #263

@mullr mullr merged commit 8a7f600 into puppetlabs:master Jun 29, 2017
@mullr
Copy link
Contributor

mullr commented Jun 29, 2017

@dhollinger THANK YOU THANK YOU THANK YOU for this PR.

@mmoll
Copy link
Contributor

mmoll commented Jun 29, 2017

I can haz release to the forge, pretty plz?

@mullr
Copy link
Contributor

mullr commented Jun 30, 2017

soon

@mullr
Copy link
Contributor

mullr commented Jun 30, 2017

@dhollinger I'd like to do in next wednesday, after US holidays.

@dhollinger
Copy link
Contributor Author

@mullr sounds good to me!

Sent from my Google Pixel using FastHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants