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

(PE-12002) Add AIX support #74

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion manifests/init.pp
Expand Up @@ -21,7 +21,7 @@
$source = $::puppet_agent::params::_source,
) inherits ::puppet_agent::params {

validate_re($arch, ['^x86$','^x64$','^i386$','^i86pc$','^amd64$','^x86_64$','^power$', '^sun4[uv]$'])
validate_re($arch, ['^x86$','^x64$','^i386$','^i86pc$','^amd64$','^x86_64$','^power$','^sun4[uv]$','PowerPC_POWER'])

if versioncmp("${::clientversion}", '3.8.0') < 0 {
fail('upgrading requires Puppet 3.8')
Expand Down Expand Up @@ -49,6 +49,9 @@
}
} 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 $::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"
} else {
$_package_file_name = undef
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/install.pp
Expand Up @@ -13,7 +13,7 @@
) {
assert_private()

if $::operatingsystem == 'SLES' and $::operatingsystemmajrelease == '10' {
if ($::operatingsystem == 'SLES' and $::operatingsystemmajrelease == '10') or ($::operatingsystem == 'AIX' and $::architecture =~ 'PowerPC_POWER[5,6,7]') {
contain puppet_agent::install::remove_packages

exec { 'replace puppet.conf removed by package removal':
Expand Down
4 changes: 4 additions & 0 deletions manifests/install/remove_packages.pp
Expand Up @@ -20,6 +20,10 @@
uninstall_options => '--nodeps',
provider => 'rpm',
},
'AIX' => {
uninstall_options => '--nodeps',
provider => 'rpm',
},
'Solaris' => {
adminfile => '/opt/puppetlabs/packages/solaris-noask',
},
Expand Down
16 changes: 16 additions & 0 deletions manifests/osfamily/aix.pp
@@ -0,0 +1,16 @@
class puppet_agent::osfamily::aix(
$package_file_name = undef,
) {
assert_private()

class { 'puppet_agent::prepare::package':
package_file_name => $package_file_name,
}

contain puppet_agent::prepare::package

file { '/usr/local/bin/puppet':
ensure => 'link',
target => '/opt/puppetlabs/bin/puppet',
}
}
2 changes: 1 addition & 1 deletion manifests/params.pp
Expand Up @@ -22,7 +22,7 @@
}

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

Expand Down
99 changes: 99 additions & 0 deletions spec/classes/puppet_agent_osfamily_aix_spec.rb
@@ -0,0 +1,99 @@
require 'spec_helper'


describe 'puppet_agent', :unless => Puppet.version < "3.8.0" || Puppet.version >= "4.0.0" do
before(:each) do
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
end

facts = {
:is_pe => true,
:osfamily => 'AIX',
:operatingsystem => 'AIX',
:servername => 'master.example.vm',
:clientcert => 'foo.example.vm',
}

['7', '6', '5'].each do |aixver|
context "aix #{aixver}" do

let(:facts) do
facts.merge({
:architecture => "PowerPC_POWER#{aixver}",
:platform_tag => "aix-#{aixver}.1-power"
})
end

rpmname = "puppet-agent-1.2.5-1.aix#{aixver}.1.ppc.rpm"

it { is_expected.to contain_file('/etc/puppetlabs/puppet') }

it { is_expected.to contain_file('/etc/puppetlabs/puppet/puppet.conf') }

it { is_expected.to contain_file("/opt/puppetlabs/packages/#{rpmname}")}

it { is_expected.to contain_class('Puppet_agent::Install').with({
'package_file_name' => rpmname,
})
}

it {
is_expected.to contain_package('puppet-agent').with({
'source' => "/opt/puppetlabs/packages/#{rpmname}",
'ensure' => 'present',
'provider' => 'rpm'
})
}

[
'pe-augeas',
'pe-mcollective-common',
'pe-rubygem-deep-merge',
'pe-mcollective',
'pe-puppet-enterprise-release',
'pe-libldap',
'pe-libyaml',
'pe-ruby-stomp',
'pe-ruby-augeas',
'pe-ruby-shadow',
'pe-hiera',
'pe-facter',
'pe-puppet',
'pe-openssl',
'pe-ruby',
'pe-ruby-rgen',
'pe-virt-what',
'pe-ruby-ldap',
].each do |package|
it do
is_expected.to contain_package(package).with_ensure('absent')
is_expected.to contain_package(package).with_uninstall_options('--nodeps')
is_expected.to contain_package(package).with_provider('rpm')
end
end
end
end

['4', '8'].each do |aixver|
context "aix #{aixver}" do
let(:facts) do
facts.merge({
:architecture => "PowerPC_POWER#{aixver}",
:platform_tag => "aix-#{aixver}.1-power"
})
end

rpmname = "puppet-agent-1.2.5-1.aix#{aixver}.1.ppc.rpm"

it {
is_expected.to_not contain_file("/opt/puppetlabs/packages/#{rpmname}") }
end
end
end