Fix exec resource ensurability for auxiliary repos

Dependence on part of the files created by the exec
statements in nailgun::auxiliaryrepos was inadequate
to work with patching tests. Now replaced with unless
statements to ensure all files and directories.

Release file is now set to replace => false.

Change-Id: I3fe15130d3c70ab4441b7fe9e3b108f617738cc8
Closes-Bug: #1450124
This commit is contained in:
Matthew Mosesohn 2015-04-29 20:16:49 +03:00
parent e7a9d82e05
commit 4670009f3c

View File

@ -48,17 +48,21 @@ class nailgun::auxiliaryrepos(
exec { 'create_ubuntu_repo_dirs':
path => '/bin:/sbin:/usr/bin:/usr/sbin',
command => "bash -c \"mkdir -p ${ubuntu_dir}/pool/{main,restricted} ${ubuntu_dir}/dists/auxiliary/{main,restricted}/binary-amd64/\"",
creates => "${ubuntu_dir}/pool",
unless => "test -d ${ubuntu_dir}/pool && \
test -d ${ubuntu_dir}/dists/auxiliary/main/binary-amd64 && \
test -d ${ubuntu_dir}/dists/auxiliary/restricted/binary-amd64",
}
exec { 'create_ubuntu_repo_Packages':
path => '/bin:/sbin:/usr/bin:/usr/sbin',
command => "bash -c \"touch ${ubuntu_dir}/dists/auxiliary/{main,restricted}/binary-amd64/Packages\"",
creates => "${ubuntu_dir}/dists/auxiliary/main/binary-amd64/Packages",
unless => "test -f ${ubuntu_dir}/dists/auxiliary/main/binary-amd64/Packages && \
test -f ${ubuntu_dir}/dists/auxiliary/restricted/binary-amd64/Packages",
}
file { $release_files:
ensure => file,
replace => false,
source => 'puppet:///modules/nailgun/Release-auxiliary',
mode => '0644',
owner => 'root',