Check you environment path variable. Tar might not find something,
most probably, the gzip executable (not 100% sure on this part). Usually
if something doesn't work in specific cases, but it works in you bash
console, you can make a safe bet on environment variables and/or running
user.
Silviu
On 14.09.2010 21:35, jerry wrote:
I do have a really strange issue with exec a tar command with puppet
2.6.0. If I run it with puppetmasterd I get the following error
message:
(//my.domain.net//Stage[main]/Workerzone/Build::Install[top]/
Exec[extract-top]/returns) change from notrun to 0 failed: /bin/bash -
c '/usr/sbin/tar -xzvf /usr/local/src/top-3.7.tar.gz' returned 1
instead of one of [0] at /etc/puppet/modules/build/manifests/init.pp:
58
If I run the code manually with 'puppetd -t --debug' there are no
errors. What am I doing wrong? Here is my code:
# build::install { 'top':
# download => 'http://www.unixtop.org/dist/top-3.7.tar.gz',
# creates => '/url/local/bin/top',
# }
define build::install ($download, $creates, $pkg_folder='',
$pkg_format="tar", $pkg_extension="", $buildoptions="",
$rm_build_folder=true) {
if defined( Package['build-essential'] ) {
debug("build-essential already installed")
} else {
package { 'build-essential': ensure => installed }
}
$filename = basename($download)
$extension = $pkg_format ? {
zip => ".zip",
tar => ".tar.gz",
bzip => ".tar.bz2",
default => $pkg_extension,
}
$foldername = $pkg_folder ? {
'' => gsub($filename, $extension, ""),
default => $pkg_folder,
}
$extractor = $pkg_format ? {
zip => "/usr/bin/unzip -q -d /usr/local/src",
bzip => "/usr/sbin/tar -xjf",
default => "/usr/sbin/tar -xzf" ,
}
# download is fine
exec { "download-$name":
cwd => "/usr/local/src",
command => "/usr/bin/wget -q $download",
timeout => 120,
unless => "test -f $creates",
}
# here I always get an error
exec { "extract-$name":
cwd => "/usr/local/src",
command => "$extractor /usr/local/src/$filename",
timeout => 120,
path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
sbin:/bin",
require => Exec["download-$name"],
}
exec { "config-$name":
cwd => "/usr/local/src/$foldername",
command => "./configure $buildoptions",
timeout => 120,
require => Exec["extract-$name"],
}
exec { "make-install-$name":
cwd => "/usr/local/src/$foldername",
command => "/usr/bin/make&& /usr/bin/make install",
timeout => 600,
require => Exec["config-$name"],
}
# remove build folder
case $rm_build_folder {
true: {
notice("remove build folder")
exec { "remove-$name-build-folder":
command => "/usr/bin/rm -rf /usr/local/src/$foldername",
require => Exec["make-install-$name"],
} # exec
} # true
} # case
}
The code runs on a nexenta ncp 3.0 (SunOS) box. Any ideas?
Thanks
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.