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

Puppet 7 prep #797

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@
}
}
}
~> file { "${puppet_dir}/auth.conf":
content => template($auth_template),

if versioncmp($facts['puppetversion'], '7.0.0') >= 0 {
file { "${puppet_dir}/auth.conf":
ensure => absent,
}
} else {
file { "${puppet_dir}/auth.conf":
ensure => file,
content => template($auth_template),
}
}
}
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@
#
# $server_use_legacy_auth_conf:: Should the puppetserver use the legacy puppet auth.conf?
# Defaults to false (the puppetserver will use its own conf.d/auth.conf)
# Note that Puppetserver 7 has dropped this option.
#
# $server_check_for_updates:: Should the puppetserver phone home to check for available updates?
# Defaults to true
Expand Down
5 changes: 1 addition & 4 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,9 @@
if $facts['os']['family'] == 'Windows' {
$dir_owner = undef
$dir_group = undef
} elsif $aio_package or $facts['os']['family'] == 'Suse' {
} else {
$dir_owner = 'root'
$dir_group = $root_group
} else {
$dir_owner = $user
$dir_group = $group
}

$package_provider = $facts['os']['family'] ? {
Expand Down
13 changes: 11 additions & 2 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
#
# $use_legacy_auth_conf:: Should the puppetserver use the legacy puppet auth.conf?
# Defaults to false (the puppetserver will use its own conf.d/auth.conf)
# Note that Puppetserver 7 has dropped support for this.
#
# $check_for_updates:: Should the puppetserver phone home to check for available updates?
#
Expand Down Expand Up @@ -479,12 +480,20 @@
# assume a particular version here.
if $puppetserver_version {
$real_puppetserver_version = $puppetserver_version
} elsif versioncmp($::puppetversion, '6.0.0') >= 0 {
} elsif versioncmp($facts['puppetversion'], '7.0.0') >= 0 {
$real_puppetserver_version = '7.0.0'
} elsif versioncmp($facts['puppetversion'], '6.0.0') >= 0 {
$real_puppetserver_version = '6.0.0'
} else {
} else {
$real_puppetserver_version = '5.3.6'
}

if versioncmp($real_puppetserver_version, '7.0.0') >= 0 {
if $use_legacy_auth_conf {
fail('The jruby-puppet.use-legacy-auth-conf setting is removed in Puppetserver 7')
}
}

if $jvm_extra_args {
$real_jvm_extra_args = $jvm_extra_args
} else {
Expand Down
34 changes: 0 additions & 34 deletions spec/acceptance/puppetserver_config_spec.rb

This file was deleted.

47 changes: 39 additions & 8 deletions spec/acceptance/puppetserver_latest_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper_acceptance'

describe 'Scenario: install puppetserver (latest):', unless: unsupported_puppetserver do
before(:context) do
before(:all) do
if check_for_package(default, 'puppetserver')
on default, puppet('resource package puppetserver ensure=purged')
on default, 'rm -rf /etc/sysconfig/puppetserver /etc/puppetlabs/puppetserver'
Expand All @@ -13,13 +13,44 @@
raise 'At least 2048MB free memory required' if memoryfree_mb < 256
end

it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-EOS
class { 'puppet':
server => true,
}
EOS
context 'default options' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-EOS
class { 'puppet':
server => true,
}
EOS
end
end
end

describe 'server_max_open_files' do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-MANIFEST
class { 'puppet':
server => true,
server_max_open_files => 32143,
}

# Puppet 5 + puppet/systemd 3 workaround
if versioncmp($facts['puppetversion'], '6.1') < 0 and $puppet::server_max_open_files {
exec { 'puppetserver-systemctl-daemon-reload':
command => 'systemctl daemon-reload',
refreshonly => true,
path => $facts['path'],
subscribe => File['/etc/systemd/system/puppetserver.service.d/limits.conf'],
}
}
MANIFEST
end
end

# pgrep -f java.*puppetserver would be better. But i cannot get it to work. Shellwords.escape() seems to break something
describe command("grep '^Max open files' /proc/`cat /var/run/puppetlabs/puppetserver/puppetserver.pid`/limits"), :sudo => true do
its(:exit_status) { is_expected.to eq 0 }
its(:stdout) { is_expected.to match %r{^Max open files\s+32143\s+32143\s+files\s*$} }
end
end
end
76 changes: 0 additions & 76 deletions spec/acceptance/puppetserver_upgrade_6_7_0_to_6_7_2_spec.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper_acceptance'

describe 'Scenario: 5.3.6 to 5.3.7 upgrade:', if: ENV['BEAKER_PUPPET_COLLECTION'] == 'puppet5', unless: unsupported_puppetserver do
before(:context) do
describe 'Scenario: minor version upgrade', unless: unsupported_puppetserver do
before(:all) do
if check_for_package(default, 'puppetserver')
on default, puppet('resource package puppetserver ensure=purged')
on default, 'rm -rf /etc/sysconfig/puppetserver /etc/puppetlabs/puppetserver'
Expand All @@ -13,29 +13,43 @@
raise 'At least 256MB free memory required' if memoryfree_mb < 256
end

case ENV['BEAKER_PUPPET_COLLECTION']
when 'puppet7'
from_version = '7.0.0'
to_version = '7.2.0'
when 'puppet6'
from_version = '6.7.0'
to_version = '6.7.2'
when 'puppet5'
from_version = '5.3.6'
to_version = '5.3.7'
else
raise 'Unsupported Puppet collection'
end

case fact('osfamily')
when 'Debian'
from_version = "5.3.6-1#{fact('lsbdistcodename')}"
to_version = "5.3.7-1#{fact('lsbdistcodename')}"
from_version_exact = "#{from_version}-1#{fact('lsbdistcodename')}"
to_version_exact = "#{to_version}-1#{fact('lsbdistcodename')}"
else
from_version = '5.3.6'
to_version = '5.3.7'
from_version_exact = from_version
to_version_exact = to_version
end

context 'install 5.3.6' do
context "install #{from_version}" do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-EOS
class { 'puppet':
server => true,
server_version => '#{from_version}',
server_version => '#{from_version_exact}',
}
EOS
end
end

describe command('puppetserver --version') do
its(:stdout) { is_expected.to match("puppetserver version: 5.3.6\n") }
its(:stdout) { is_expected.to match("puppetserver version: #{from_version}\n") }
end

describe service('puppetserver') do
Expand All @@ -48,20 +62,20 @@ class { 'puppet':
end
end

context 'upgrade to 5.3.7' do
context "upgrade to #{to_version}" do
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-EOS
class { 'puppet':
server => true,
server_version => '#{to_version}',
server_version => '#{to_version_exact}',
}
EOS
end
end

describe command('puppetserver --version') do
its(:stdout) { is_expected.to match("puppetserver version: 5.3.7\n") }
its(:stdout) { is_expected.to match("puppetserver version: #{to_version}\n") }
end

describe service('puppetserver') do
Expand Down
Loading