Skip to content

Commit

Permalink
(PE-12299) fixed test option for remove existing repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jbcraig authored and Britt Gresham committed Feb 8, 2016
1 parent 967ab52 commit b09ff24
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions manifests/osfamily/solaris.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,23 @@

$pkgrepo_dir = '/etc/puppetlabs/installer/solaris.repo'

# Make sure the pkg publishers are all available. Broken
# publisher entries will stop the installation process.
# This must happen before removing any packages.
exec { 'puppet_agent ensure pkg publishers are available':
command => 'pkg refresh',
path => '/bin:/usr/bin:/sbin:/usr/sbin',
logoutput => 'on_failure',
notify => Exec['puppet_agent remove existing repo'],
}

exec { 'puppet_agent remove existing repo':
command => "pkgrepo remove -s '${pkgrepo_dir}' '*'",
command => "rm -rf '${pkgrepo_dir}'",
path => '/bin:/usr/bin:/sbin:/usr/sbin',
onlyif => "test -f ${pkgrepo_dir}/pkg5.repository",
onlyif => "test -d ${pkgrepo_dir}",
logoutput => 'on_failure',
notify => Exec['puppet_agent create repo'],
require => Exec['puppet_agent ensure pkg publishers are available'],
}

exec { 'puppet_agent create repo':
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/puppet_agent_osfamily_solaris_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
is_expected.to contain_exec('puppet_agent backup /etc/puppetlabs/').with({
'command' => 'cp -r /etc/puppetlabs/ /tmp/puppet_agent/',
})
is_expected.to contain_exec('puppet_agent remove existing repo').with_command("pkgrepo remove -s '/etc/puppetlabs/installer/solaris.repo' '*'")
is_expected.to contain_exec('puppet_agent remove existing repo').with_command("rm -rf '/etc/puppetlabs/installer/solaris.repo'")
is_expected.to contain_exec('puppet_agent create repo').with_command('pkgrepo create /etc/puppetlabs/installer/solaris.repo')
is_expected.to contain_exec('puppet_agent set publisher').with_command('pkgrepo set -s /etc/puppetlabs/installer/solaris.repo publisher/prefix=puppetlabs.com')
is_expected.to contain_exec('puppet_agent copy packages').with_command("pkgrecv -s file:///opt/puppetlabs/packages/puppet-agent@1.2.5,5.11-1.i386.p5p -d /etc/puppetlabs/installer/solaris.repo '*'")
Expand Down Expand Up @@ -120,7 +120,7 @@
is_expected.to contain_exec('puppet_agent backup /etc/puppetlabs/').with({
'command' => 'cp -r /etc/puppetlabs/ /tmp/puppet_agent/',
})
is_expected.to contain_exec('puppet_agent remove existing repo').with_command("pkgrepo remove -s '/etc/puppetlabs/installer/solaris.repo' '*'")
is_expected.to contain_exec('puppet_agent remove existing repo').with_command("rm -rf '/etc/puppetlabs/installer/solaris.repo'")
is_expected.to contain_exec('puppet_agent create repo').with_command('pkgrepo create /etc/puppetlabs/installer/solaris.repo')
is_expected.to contain_exec('puppet_agent set publisher').with_command('pkgrepo set -s /etc/puppetlabs/installer/solaris.repo publisher/prefix=puppetlabs.com')
is_expected.to contain_exec('puppet_agent copy packages').with_command("pkgrecv -s file:///opt/puppetlabs/packages/puppet-agent@1.2.5,5.11-1.sparc.p5p -d /etc/puppetlabs/installer/solaris.repo '*'")
Expand Down

0 comments on commit b09ff24

Please sign in to comment.