I am running into a weird issue when trying to execute an installer on Ubuntu 10.04/12.04 machines. I am using Puppet 3.2.1, and 3.2.2 respectively from Puppet Labs repo.
class installpackage {
file { 'MyInstallerFile':
path => '/tmp/MyInstallerFile',
ensure => present,
owner => 'root',
group => 'root',
mode => '777',
source => 'puppet:///extra_files/MyInstallerFile',
}
file { 'answer_file':
path => '/tmp/answer_file',
ensure => present,
owner => 'root',
group => 'root',
mode => '777',
source => 'puppet:///extra_file/answer_file',
}
exec { "install":
cwd => '/tmp',
command => '/tmp/MyInstallerFile --answer /tmp/answer_file',
logoutput => true,
require => File['MyInstallerFile', 'answer_file'],
}
}
The error I get is this (i.e. it can't find $HOME set):
Info: Retrieving plugin
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
Info: Caching catalog for puppetagent.example.com
Info: Applying configuration version '1370899438'
Notice: /Stage[main]/Installpackage/Exec[install]/returns: couldn't find HOME environment variable to expand path
Notice: /Stage[main]/Installpackage/Exec[install]/returns: while executing
Notice: /Stage[main]/Installpackage/Exec[install]/returns: "file normalize ~"
Notice: /Stage[main]/Installpackage/Exec[install]/returns: (procedure "::InstallJammer::HomeDir" line 2)
Notice: /Stage[main]/Installpackage/Exec[install]/returns: invoked from within
Notice: /Stage[main]/Installpackage/Exec[install]/returns: "::InstallJammer::HomeDir"
Notice: /Stage[main]/Installpackage/Exec[install]/returns: (procedure "::InstallJammer::CommonInit" line 183)
Notice: /Stage[main]/Installpackage/Exec[install]/returns: invoked from within
Notice: /Stage[main]/Installpackage/Exec[install]/returns: "::InstallJammer::CommonInit"
Notice: /Stage[main]/Installpackage/Exec[install]/returns: (procedure "::InstallJammer::InitInstall" line 19)
Notice: /Stage[main]/Installpackage/Exec[install]/returns: invoked from within
Notice: /Stage[main]/Installpackage/Exec[install]/returns: "::InstallJammer::InitInstall"
Notice: /Stage[main]/Installpackage/Exec[install]/returns: (file "/installkitvfs/main.tcl" line 71313)
Error: /tmp/MyInstallerFile --answer /tmp/answer_file returned 1 instead of one of [0]
Error: /Stage[main]/Installpackage/Exec[install]/returns: change from notrun to 0 failed: MyInstallerFile --answer /tmp/answer_file returned 1 instead of one of [0]
Notice: Finished catalog run in 5.31 seconds
I did notice that if I append "sudo" before the command I want to execute, it works. Is there a more elegant solution?
Please advise.
F.