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

(maint) Update supported platforms #92

Merged
merged 3 commits into from
Mar 16, 2016
Merged
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
15 changes: 6 additions & 9 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

## Overview

A module for upgrading Puppet 3.8 agents to puppet-agent in Puppet Collection 1 (i.e., Puppet 4).
A module for upgrading Puppet 3 agents to puppet-agent in Puppet Collection 1 (i.e., Puppet 4).

## Module Description

Expand All @@ -37,7 +37,9 @@ The puppet_agent module installs the Puppet Collection 1 repo (on systems that s

### Setup Requirements

Your agents must be running Puppet 3.8 with `stringify_facts` set to 'false'. Agents should already be pointed at a master running Puppet Server 2.1 or greater, and thus successfully applying catalogs compiled with the Puppet 4 language.
Your agents must be running Puppet 3 with `stringify_facts` set to 'false'. Agents should already be pointed at a master running Puppet Server 2.1 or greater, and thus successfully applying catalogs compiled with the Puppet 4 language.

Puppet 3.7 with future parser is required to compile this module, meaning it can be applied to masterless Puppet 3.7+, or earlier Puppet 3 agents connecting to a Puppet 3.7+ master.

### Beginning with puppet_agent

Expand Down Expand Up @@ -93,13 +95,7 @@ Alternate source from which you wish to download the latest version of Puppet.

## Limitations

This module supports:

* RHEL 5, 6, 7
* Centos 5, 6, 7
* Debian 6, 7
* Ubuntu 12.04, 14.04
* Windows Server 2003 or later
This module supports [all PE-supported platforms](https://forge.puppetlabs.com/supported#compat-matrix) except Solaris 11.

###Known issues

Expand All @@ -116,6 +112,7 @@ Specifically in the 1.1.0 Release:
* For Windows, you must trigger an agent run after upgrading so that Puppet can create the necessary directory structures.
* Upgrading from 2015.2.x to 2015.3.x is not yet supported.
* Solaris 11 is not yet supported.
* AIX package names are based on PowerPC architecture version. PowerPC 8 is not yet supported.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could fix this by dropping the exclusion of PowerPC_POWER8. Happy to do that here or another PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, either is fine to me. Maybe lets get it in another PR so we don't overload this one.


##Development

Expand Down
2 changes: 0 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
} elsif $::operatingsystem == 'aix' and $::architecture =~ /PowerPC_POWER[5,6,7]/ {
$aix_ver_number = regsubst($::platform_tag,'aix-(\d+\.\d+)-power','\1')
$_package_file_name = "${puppet_agent::package_name}-${puppet_agent::params::master_agent_version}-1.aix${aix_ver_number}.ppc.rpm"
} elsif $::operatingsystem == 'Darwin' and $::macosx_productversion_major =~ /10\.[9,10,11]/ {
$_package_file_name = "${puppet_agent::package_name}-${puppet_agent::params::master_agent_version}-1.osx${$::macosx_productversion_major}.dmg"
} elsif $::osfamily == 'windows' {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This section was redundant, see lines 42-43 above.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, must have been a bad re-base.

$_arch = $::kernelmajversion ?{
/^5\.\d+/ => 'x86', # x64 is never allowed on windows 2003
Expand Down
12 changes: 4 additions & 8 deletions manifests/osfamily/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
if $::operatingsystem == 'Fedora' {
$urlbit = 'fedora/f$releasever'
}
elsif $::operatingsystem == 'Amazon' {
$urlbit = 'el/6'
}
else {
$urlbit = 'el/$releasever'
}
Expand All @@ -23,15 +26,8 @@
$_sslclientcert_path = "${_ssl_dir}/certs/${::clientcert}.pem"
$_sslclientkey_path = "${_ssl_dir}/private_keys/${::clientcert}.pem"

# Treat Amazon Linux just like Enterprise Linux 6
if $::operatingsystem == 'Amazon' {
$_repo_dir = "el-6-${::architecture}"
}
else {
$_repo_dir = $::platform_tag
}
$pe_server_version = pe_build_version()
$source = "${::puppet_agent::source}/${pe_server_version}/${_repo_dir}"
$source = "${::puppet_agent::source}/${pe_server_version}/${::puppet_agent::params::pe_repo_dir}"

# Due to the file paths changing on the PE Master, the 3.8 repository is no longer valid.
# On upgrade, remove the repo file so that a dangling reference is not left behind returning
Expand Down
8 changes: 7 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}

case $::osfamily {
'RedHat', 'Amazon', 'Debian', 'Suse', 'Solaris', 'Darwin', 'AIX': {
'RedHat', 'Debian', 'Suse', 'Solaris', 'Darwin', 'AIX': {
$package_name = 'puppet-agent'
$service_names = ['puppet', 'mcollective']

Expand Down Expand Up @@ -67,6 +67,12 @@
}
}

# Treat Amazon Linux just like Enterprise Linux 6
$pe_repo_dir = ($::operatingsystem == 'Amazon') ? {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 to keeping the platform variables contained to params.pp

true => "el-6-${::architecture}",
default => $::platform_tag,
}

# The aio puppet-agent version currently installed on the compiling master
# (only used in PE)
$master_agent_version = $_is_pe ? {
Expand Down
62 changes: 50 additions & 12 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"4",
"5",
"6",
"7"
Expand All @@ -25,33 +26,51 @@
]
},
{
"operatingsystem": "Darwin",
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"10.9",
"10.10",
"10.11"
]
"5",
"6",
"7"
]
},
{
"operatingsystem": "Debian",
"operatingsystem": "Scientific",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "SLES",
"operatingsystemrelease": [
"10",
"11",
"12"
]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"6",
"7",
"8"
]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"10.04",
"12.04",
"14.04"
"14.04",
"15.04",
"15.10"
]
},
{
"operatingsystem": "SLES",
"operatingsystem": "Fedora",
"operatingsystemrelease": [
"10",
"11",
"12"
"22"
]
},
{
Expand All @@ -69,9 +88,28 @@
"Server 2008 R2",
"Server 2012",
"Server 2012 R2",
"Vista",
"7",
"8"
"8",
"8.1",
"10"
]
},
{
"operatingsystem": "AIX",
"operatingsystemmajrelease": [
"5.3",
"6.1",
"7.1"
]
},
{
"operatingsystem": "OSX",
"operatingsystemrelease": [
"10.9",
"10.10",
"10.11"
]
}
],
"requirements": [
Expand Down
65 changes: 34 additions & 31 deletions spec/classes/puppet_agent_osfamily_redhat_spec.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
require 'spec_helper'

describe 'puppet_agent', :unless => Puppet.version < "3.8.0" || Puppet.version >= "4.0.0" do
[['Fedora', 'fedora/f$releasever'], ['CentOS', 'el/$releasever']].each do |os, urlbit|
[['Fedora', 'fedora/f$releasever'], ['CentOS', 'el/$releasever'], ['Amazon', 'el/6']].each do |os, urlbit|
context "with #{os} and #{urlbit}" do
facts = {
let(:facts) {{
:osfamily => 'RedHat',
:operatingsystem => os,
:architecture => 'x64',
:servername => 'master.example.vm',
:clientcert => 'foo.example.vm',
}

let(:facts) { facts }
}}

it { is_expected.to contain_exec('import-RPM-GPG-KEY-puppetlabs').with({
'path' => '/bin:/usr/bin:/sbin:/usr/sbin',
Expand Down Expand Up @@ -44,39 +42,44 @@
'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs',
}) }
end
end
end

context 'when PE' do
before(:each) do
# Need to mock the PE functions
[['RedHat', 'el-7-x86_64', 'el-7-x86_64'], ['Amazon', '', 'el-6-x64']].each do |os, tag, repodir|
context "when PE on #{os}" do
before(:each) do
# Need to mock the PE functions

Puppet::Parser::Functions.newfunction(:pe_build_version, :type => :rvalue) do |args|
'4.0.0'
end
Puppet::Parser::Functions.newfunction(:pe_build_version, :type => :rvalue) do |args|
'4.0.0'
end

Puppet::Parser::Functions.newfunction(:pe_compiling_server_aio_build, :type => :rvalue) do |args|
'1.2.5'
end
Puppet::Parser::Functions.newfunction(:pe_compiling_server_aio_build, :type => :rvalue) do |args|
'1.2.5'
end
end

let(:facts) {
facts.merge({
:is_pe => true,
:platform_tag => 'el-7-x86_64',
})
}
let(:facts) {{
:osfamily => 'RedHat',
:operatingsystem => os,
:architecture => 'x64',
:servername => 'master.example.vm',
:clientcert => 'foo.example.vm',
:is_pe => true,
:platform_tag => tag,
}}

it { is_expected.to contain_yumrepo('puppetlabs-pepackages').with_ensure('absent') }
it { is_expected.to contain_yumrepo('puppetlabs-pepackages').with_ensure('absent') }

it { is_expected.to contain_yumrepo('pc1_repo').with({
'baseurl' => "https://master.example.vm:8140/packages/4.0.0/el-7-x86_64",
'enabled' => 'true',
'gpgcheck' => '1',
'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs',
'sslcacert' => '/etc/puppetlabs/puppet/ssl/certs/ca.pem',
'sslclientcert' => '/etc/puppetlabs/puppet/ssl/certs/foo.example.vm.pem',
'sslclientkey' => '/etc/puppetlabs/puppet/ssl/private_keys/foo.example.vm.pem',
}) }
end
it { is_expected.to contain_yumrepo('pc1_repo').with({
'baseurl' => "https://master.example.vm:8140/packages/4.0.0/#{repodir}",
'enabled' => 'true',
'gpgcheck' => '1',
'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs',
'sslcacert' => '/etc/puppetlabs/puppet/ssl/certs/ca.pem',
'sslclientcert' => '/etc/puppetlabs/puppet/ssl/certs/foo.example.vm.pem',
'sslclientkey' => '/etc/puppetlabs/puppet/ssl/private_keys/foo.example.vm.pem',
}) }
end
end
end