Issue #23053 has been updated by Andrew Parker.

Status changed from Unreviewed to Rejected

Per the resolution for #5224 puppet unsets the `HOME` environment variable when 
executing commands. Right or wrong, that is what is happening here.

Corey, I believe your fix doesn't work because `#{ENV['HOME']}` results in an 
empty string and so I suspect that you are not ending up with the `.puppet` 
directory that is in the user's home directory.

John, I think your solution is more robust, but it also removes some of the 
flexibility that we get by using `HOME`.

The real solution in this case is to specify the HOME environment for the exec 
resource.

----------------------------------------
Bug #23053: couldn't find HOME environment -- expanding `~/.puppet' when 
running puppet command as non root
https://projects.puppetlabs.com/issues/23053#change-99625

* Author: Corey Osman
* Status: Rejected
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* Affected Puppet version: 2.6.0
* 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:

<pre>
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]
</pre>


-- 
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.

Reply via email to