2014-08-14 01:05:08 +10:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'openstack_extras::repo::redhat::redhat' do
|
|
|
|
let :class_params do
|
|
|
|
{
|
|
|
|
:manage_rdo => true,
|
|
|
|
:manage_epel => true,
|
|
|
|
:repo_hash => {},
|
|
|
|
:gpgkey_hash => {},
|
|
|
|
:purge_unmanaged => false,
|
|
|
|
:package_require => false
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
let :paramclass_defaults do
|
|
|
|
{
|
2016-09-17 13:25:11 -04:00
|
|
|
:release => 'newton',
|
2014-08-14 01:05:08 +10:00
|
|
|
:repo_defaults => { 'enabled' => '1',
|
|
|
|
'gpgcheck' => '1',
|
|
|
|
'notify' => "Exec[yum_refresh]",
|
|
|
|
'mirrorlist' => 'absent',
|
|
|
|
'require' => "Anchor[openstack_extras_redhat]"
|
|
|
|
},
|
|
|
|
:gpgkey_defaults => { 'owner' => 'root',
|
|
|
|
'group' => 'root',
|
|
|
|
'mode' => '0644',
|
|
|
|
'before' => "Anchor[openstack_extras_redhat]"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
let :default_params do
|
|
|
|
class_params.merge!(paramclass_defaults)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on RedHat platforms' do
|
|
|
|
let :facts do
|
2016-01-08 16:20:23 -07:00
|
|
|
@default_facts.merge({
|
2014-08-14 01:05:08 +10:00
|
|
|
:osfamily => 'RedHat',
|
|
|
|
:operatingsystem => 'RedHat',
|
2015-05-08 18:18:58 -04:00
|
|
|
:operatingsystemrelease => '7.1',
|
2015-06-29 09:33:08 -04:00
|
|
|
:operatingsystemmajrelease => '7',
|
|
|
|
:puppetversion => Puppet.version,
|
2016-01-08 16:20:23 -07:00
|
|
|
})
|
2014-08-14 01:05:08 +10:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'with default parameters' do
|
|
|
|
let :params do
|
|
|
|
{}.merge!(default_params)
|
|
|
|
end
|
|
|
|
|
2015-09-14 09:52:06 +02:00
|
|
|
it { is_expected.to contain_yumrepo('rdo-release').with(
|
2016-09-17 13:25:11 -04:00
|
|
|
:baseurl => "http://mirror.centos.org/centos/7/cloud/$basearch/openstack-newton/",
|
|
|
|
:descr => "OpenStack Newton Repository",
|
2014-08-14 01:05:08 +10:00
|
|
|
:priority => 98,
|
2015-10-25 22:10:23 +09:00
|
|
|
:gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud",
|
2014-08-14 01:05:08 +10:00
|
|
|
:enabled => '1',
|
|
|
|
:gpgcheck => '1',
|
|
|
|
:mirrorlist => 'absent',
|
|
|
|
:require => "Anchor[openstack_extras_redhat]",
|
|
|
|
:notify => "Exec[yum_refresh]"
|
|
|
|
)}
|
|
|
|
|
2016-05-20 16:32:11 +02:00
|
|
|
it { is_expected.to contain_exec('installing_yum-plugin-priorities').with(
|
|
|
|
:command => '/usr/bin/yum install -y yum-plugin-priorities',
|
|
|
|
:logoutput => 'on_failure',
|
|
|
|
:tries => 3,
|
|
|
|
:try_sleep => 1,
|
|
|
|
:unless => '/usr/bin/rpm -qa | /usr/bin/grep -q yum-plugin-priorities',
|
|
|
|
) }
|
2016-01-27 10:54:46 -05:00
|
|
|
|
2015-06-29 09:33:08 -04:00
|
|
|
# 'metalink' property is supported from Puppet 3.5
|
|
|
|
if Puppet.version.to_f >= 3.5
|
2015-09-14 09:52:06 +02:00
|
|
|
it { is_expected.to contain_yumrepo('epel').with(
|
2015-06-29 09:33:08 -04:00
|
|
|
:metalink => "https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch",
|
|
|
|
:descr => 'Extra Packages for Enterprise Linux 7 - $basearch',
|
|
|
|
:gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7",
|
|
|
|
:failovermethod => 'priority',
|
|
|
|
:enabled => '1',
|
|
|
|
:gpgcheck => '1',
|
|
|
|
:mirrorlist => 'absent',
|
|
|
|
:require => "Anchor[openstack_extras_redhat]",
|
|
|
|
:notify => "Exec[yum_refresh]"
|
|
|
|
)}
|
|
|
|
else
|
2015-09-14 09:52:06 +02:00
|
|
|
it { is_expected.to contain_yumrepo('epel').with(
|
2015-06-29 09:33:08 -04:00
|
|
|
:baseurl => "https://download.fedoraproject.org/pub/epel/7/\$basearch",
|
|
|
|
:descr => 'Extra Packages for Enterprise Linux 7 - $basearch',
|
|
|
|
:gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7",
|
|
|
|
:failovermethod => 'priority',
|
|
|
|
:enabled => '1',
|
|
|
|
:gpgcheck => '1',
|
|
|
|
:mirrorlist => 'absent',
|
|
|
|
:require => "Anchor[openstack_extras_redhat]",
|
|
|
|
:notify => "Exec[yum_refresh]"
|
|
|
|
)}
|
|
|
|
end
|
2014-08-14 01:05:08 +10:00
|
|
|
|
2015-10-25 22:10:23 +09:00
|
|
|
it { is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud').with(
|
|
|
|
:source => "puppet:///modules/openstack_extras/RPM-GPG-KEY-CentOS-SIG-Cloud",
|
2014-08-14 01:05:08 +10:00
|
|
|
:owner => 'root',
|
|
|
|
:group => 'root',
|
|
|
|
:mode => '0644',
|
|
|
|
:before => "Anchor[openstack_extras_redhat]"
|
|
|
|
)}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'with overridden release' do
|
|
|
|
let :params do
|
|
|
|
default_params.merge!({ :release => 'juno' })
|
|
|
|
end
|
|
|
|
|
2015-09-14 09:52:06 +02:00
|
|
|
it { is_expected.to contain_yumrepo('rdo-release').with(
|
2015-10-25 22:10:23 +09:00
|
|
|
:baseurl => "http://mirror.centos.org/centos/7/cloud/\$basearch/openstack-juno/",
|
2014-08-14 01:05:08 +10:00
|
|
|
:descr => "OpenStack Juno Repository",
|
2015-10-25 22:10:23 +09:00
|
|
|
:gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud"
|
2014-08-14 01:05:08 +10:00
|
|
|
)}
|
|
|
|
|
2015-10-25 22:10:23 +09:00
|
|
|
it { is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud').with(
|
|
|
|
:source => "puppet:///modules/openstack_extras/RPM-GPG-KEY-CentOS-SIG-Cloud"
|
2014-08-14 01:05:08 +10:00
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'with overridden repo hash' do
|
|
|
|
let :params do
|
|
|
|
default_params.merge!({ :repo_hash => {
|
|
|
|
'CentOS-Base' => {
|
|
|
|
'baseurl' => 'http://mymirror/$releasever/os/$basearch/',
|
|
|
|
'descr' => 'CentOS-$releasever - Base',
|
|
|
|
'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6'
|
|
|
|
},
|
|
|
|
'CentOS-Updates' => {
|
|
|
|
'baseurl' => 'http://mymirror/$releasever/updates/$basearch/',
|
|
|
|
'descr' => 'CentOS-$releasever - Updates',
|
|
|
|
'gpgkey' => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2015-09-14 09:52:06 +02:00
|
|
|
it { is_expected.to contain_yumrepo('CentOS-Base').with(
|
2014-08-14 01:05:08 +10:00
|
|
|
:baseurl => "http://mymirror/$releasever/os/$basearch/",
|
|
|
|
:descr => "CentOS-$releasever - Base",
|
|
|
|
:enabled => '1',
|
|
|
|
:gpgcheck => '1',
|
|
|
|
:gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6',
|
|
|
|
:mirrorlist => 'absent',
|
|
|
|
:require => "Anchor[openstack_extras_redhat]",
|
|
|
|
:notify => "Exec[yum_refresh]"
|
|
|
|
)}
|
|
|
|
|
2015-09-14 09:52:06 +02:00
|
|
|
it { is_expected.to contain_yumrepo('CentOS-Updates').with(
|
2014-08-14 01:05:08 +10:00
|
|
|
:baseurl => "http://mymirror/$releasever/updates/$basearch/",
|
|
|
|
:descr => "CentOS-$releasever - Updates",
|
|
|
|
:enabled => '1',
|
|
|
|
:gpgcheck => '1',
|
|
|
|
:gpgkey => 'file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6',
|
|
|
|
:mirrorlist => 'absent',
|
|
|
|
:require => "Anchor[openstack_extras_redhat]",
|
|
|
|
:notify => "Exec[yum_refresh]"
|
|
|
|
)}
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'with overridden repo default' do
|
|
|
|
let :params do
|
|
|
|
default_params.merge!({ :repo_defaults => {
|
|
|
|
'proxy' => 'http://my.proxy.com:8000'
|
2016-05-13 21:58:42 +02:00
|
|
|
},
|
|
|
|
:centos_mirror_url => 'http://mirror.dfw.rax.openstack.org',
|
2014-08-14 01:05:08 +10:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2015-09-14 09:52:06 +02:00
|
|
|
it { is_expected.to contain_yumrepo('rdo-release').with(
|
2016-09-17 13:25:11 -04:00
|
|
|
:baseurl => "http://mirror.dfw.rax.openstack.org/centos/7/cloud/\$basearch/openstack-newton/",
|
|
|
|
:descr => "OpenStack Newton Repository",
|
2015-10-25 22:10:23 +09:00
|
|
|
:gpgkey => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud",
|
2014-08-14 01:05:08 +10:00
|
|
|
:proxy => "http://my.proxy.com:8000"
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'with overridden gpgkey default' do
|
|
|
|
let :params do
|
|
|
|
default_params.merge!({ :gpgkey_defaults => {
|
|
|
|
'owner' => 'steve'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2015-10-25 22:10:23 +09:00
|
|
|
it { is_expected.to contain_file('/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud').with(
|
2014-08-14 01:05:08 +10:00
|
|
|
:owner => "steve"
|
|
|
|
)}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'with epel management disabled' do
|
|
|
|
let :params do
|
|
|
|
default_params.merge!({ :manage_epel => false })
|
|
|
|
end
|
|
|
|
|
2015-09-14 09:52:06 +02:00
|
|
|
it { is_expected.to_not contain_yumrepo('epel') }
|
2014-08-14 01:05:08 +10:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'with rdo management disabled' do
|
|
|
|
let :params do
|
|
|
|
default_params.merge!({ :manage_rdo => false })
|
|
|
|
end
|
|
|
|
|
2015-09-14 09:52:06 +02:00
|
|
|
it { is_expected.to_not contain_yumrepo('rdo-release') }
|
2014-08-14 01:05:08 +10:00
|
|
|
end
|
2016-01-27 10:54:46 -05:00
|
|
|
describe 'with manage_priorities disabled' do
|
|
|
|
let :params do
|
|
|
|
default_params.merge!({ :manage_priorities => false })
|
|
|
|
end
|
|
|
|
|
2016-05-20 16:32:11 +02:00
|
|
|
it { is_expected.to_not contain_exec('installing_yum-plugin-priorities') }
|
2016-01-27 10:54:46 -05:00
|
|
|
end
|
2014-08-14 01:05:08 +10:00
|
|
|
end
|
|
|
|
end
|