Hi,
I have this code here:
$filepackages = $operatingsystem ? {
debian => [ "tar", "gzip",
"bzip2", "diff", "sed", "wget"
],
default => [ "tar", "gzip",
"bzip2", "diff", "sed", "wget"
]
}
package { $filepackages:
ensure => latest
}
$requiredpackages = $operatingsystem ? {
debian => [ "gcc", "make", "binutils",
"zlib1g-dev", "python-dev",
"libncurses-dev", "libssl-dev",
"x11proto-core-dev", "bridge-utils",
"iproute", "udev", "tetex-bin",
"gs-common", "transfig" ],
# yes, all the packages are really required, don"t believe the
documentation as it"s a little
# economical!
default => [ "gcc", "make", "binutils",
"python-dev", "libncurses-dev",
"bridge-utils", "iproute" ]
}
package { $requiredpackages:
ensure => latest;
}
define wgetfile ( $url = '''', $file = '''',
$target = '''', $options = ''-Nt 10
--random-wait -o ${target}/${file}.log'' ) {
case $url {
'''': { err ( "Require valid url:
''$url''" ) }
}
case $file {
'''': { err ( "Require valid filename:
''$file''" ) }
}
case $target {
'''': { err ( "Requiredtarget directory:
''$target''" ) }
default: { exec { "wgetfile-$name":
command => "wget $options
${url}${file}",
path =>
"/usr/bin:/usr/sbin:/bin",
cwd => "$target",
require => $operatingsystem ? {
debian =>
Package["wget"]
}
}
}
}
}
define extracttar ( $file = '''', $target =
'''', $options = ''xf'' ) {
case $file {
'''': { err ( "Require valid filename:
''$file''" ) }
}
case $target {
'''': { err ( "Require target directory:
''$target''" ) }
}
exec { "extracttar-$name":
command => "tar $options $file",
path => "/usr/bin:/usr/sbin:/bin",
cwd => "$target",
require => $operatingsystem ? {
debian => [ Package["tar"],
Package["gzip"], Package["bzip2"] ]
}
}
}
define sedfile ( $file = '''', $target = '''',
$pattern = '''', $options = ''-i -n''
) {
case $file {
'''': { err ( "Require valid filename:
''$file''" ) }
}
case $target {
'''': { err ( "Require valid target directory:
''$target''" ) }
}
exec { "sedfile-$name":
command => "test ''sed ${options}
''${pattern}'' ${file}''",
path => "/usr/bin:/usr/sbin:/bin",
cwd => "$target",
logoutput => "true",
require => $operatingsystem ? {
debian => Package["sed"]
}
}
}
class al {
$xenrelease = ''3.0.4''
$xenpatchlevel = ''1''
$linuxrelease = ''2.6.16.33''
$xenurl = "
http://bits.xensource.com/oss-xen/release/${xenrelease}-${xenpatchlevel}/src.tgz/
"
$xenfile = "xen-${xenrelease}_${xenpatchlevel}-src.tgz"
$targetdir = "/usr/src"
$rulefile = "Rules.mk"
$rulefilecwd
"/usr/src/xen-${xenrelease}_${xenpatchlevel}-src/buildconfigs/"
wgetfile { "xen-source":
url => "$xenurl",
file => "$xenfile",
target => "$targetdir",
require => Package[$requiredpackages];
}
extracttar { "xen-source-verified":
file => "$xenfile",
target => "$targetdir",
options => "zxf",
require => Wgetfile["xen-source"];
}
sedfile { "change-to-local-mirror":
file => "${rulefile}",
pattern => "s#\(KERNEL_REPO.*=\).*#\1 ${mirror}#",
target => "$rulefilecwd",
options => "-i -n",
require => Extracttar["xen-source-verified"];
}
}
node a0 {
include al
}
When I run it the sequencing is not in the the order that I either expect or
need. Here''s the output:
puppet -v --use-nodes al.pp
info: Found a0 in al.pp
notice: //Package[libncurses-dev]/ensure: created
notice: //a0/al/wgetfile[xen-source]/Exec[wgetfile-xen-source]/returns:
executed successfully
Working directory ''/usr/src/xen-3.0.4_1-src/buildconfigs/''
does not exist at
al.pp:82
err:
//a0/al/sedfile[change-to-local-mirror]/Exec[sedfile-change-to-local-mirror]/returns:
change from notrun to 0 failed: Working directory ''/usr/src/xen-
3.0.4_1-src/buildconfigs/'' does not exist at al.pp:82
notice:
//a0/al/extracttar[xen-source-verified]/Exec[extracttar-xen-source-verified]/returns:
executed successfully
As there are dependancies between sedfile and extracttar, extracttar and
wgetfile, wgetfile and a list of packages I would have expected it to
execute in that order and not sedfile first which is causing a problem as
the tar file hasn''t yet been extracted.
What am I doing wrong?
Regards,
Andrew
_______________________________________________
Puppet-users mailing list
Puppet-users@madstop.com
https://mail.madstop.com/mailman/listinfo/puppet-users