Issue #23053 has been updated by Corey Osman.
changing the run_mode.rb file from ~ to ENV['HOME'] seems to fix this issue.
<pre>
class UnixRunMode < RunMode
def conf_dir
which_dir("/etc/puppet", "#{ENV['HOME']}/.puppet")
end
def var_dir
which_dir("/var/lib/puppet", "#{ENV['HOME']}/.puppet/var")
end
end
class WindowsRunMode < RunMode
def conf_dir
which_dir(File.join(windows_common_base("etc")),
"#{ENV['HOME']}/.puppet")
end
def var_dir
which_dir(File.join(windows_common_base("var")),
"#{ENV['HOME']}/.puppet/var")
end
private
def windows_common_base(*extra)
[Dir::COMMON_APPDATA, "PuppetLabs", "puppet"] + extra
end
end
</pre>
----------------------------------------
Bug #23053: couldn't find HOME environment -- expanding `~/.puppet' when
running puppet command as non root
https://projects.puppetlabs.com/issues/23053#change-99416
* Author: Corey Osman
* Status: Unreviewed
* Priority: Normal
* Assignee:
* Category:
* Target version:
* Affected Puppet version: 3.2.4
* Keywords: nonroot
* Branch:
----------------------------------------
Puppet seems to have an issue when trying to call itself. This would normally
work under root permission but when using a non root user it can't seem to find
its HOME despite the .puppet directory exists.
for the longest time I though this was just my problem but now its easy to
reproduce.
Below is a simple test you can run to reproduce the issue. While printing the
config issue is not something we do, the output is the same no matter what
puppet command you run.
<pre>
cat > test.pp << EOF
exec{'puppet_test_nonroot':
path => ['/bin', '/usr/sbin', '/sbin', '/usr/bin'],
command => 'puppet config print > /tmp/puppetconfig.txt',
logoutput => true
}
EOF
puppet apply --verbose test.pp
</pre>
You should get the error:
Notice: /Stage[main]//Exec[puppet_test_nonroot]/returns: Error: Could not
intialize global default settings: couldn't find HOME environment -- expanding
`~/.puppet'
Error: puppet config print > /tmp/puppetconfig.txt returned 1 instead of one of
[0]
Error: /Stage[main]//Exec[puppet_test_nonroot]/returns: change from notrun to 0
failed: puppet config print > /tmp/puppetconfig.txt returned 1 instead of one
of [0]
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.