Set Home environment at runtime

274 views
Skip to first unread message

shashank

unread,
Oct 30, 2014, 2:21:25 AM10/30/14
to puppet...@googlegroups.com
Hi,

Require to execute some puppet commands on puppet server i.e master node eg: puppet resource user  or puppet cert clean pclient.
While trying to execute these commands through generate() I am continuously getting error i.e Error: Could not initialize global default settings: couldn't find HOME environment -- expanding `~/.puppet', I think the error appears as Puppet cannot find its home directory because ruby doesn't have a pure bash shell with is required to expand the tilde.

The solution I found is to modify run_mod.rb
class UnixRunMode < RunMode
      def conf_dir
        which_dir("/etc/puppet", "~/.puppet")       
       # which_dir("/etc/puppet", "#{Etc.getpwuid.dir}/.puppet")
      end

      def var_dir
        which_dir("/var/lib/puppet", "~/.puppet/var")       
        #which_dir("/var/lib/puppet", "#{Etc.getpwuid.dir}/.puppet/var")
      end
    end
This will solve the problem but I don't want to do any changes with the library files.So, my query is:

Is there any way to set the home environment through puppet configuration file or can we set the HOME environment at the run time of the generate() method or before running the generate.

Thanks
Shashank

Felix Frank

unread,
Nov 9, 2014, 7:11:53 PM11/9/14
to puppet...@googlegroups.com
On 10/30/2014 07:21 AM, shashank wrote:
> Require to execute some puppet commands on puppet server i.e master
> node eg: puppet resource user or puppet cert clean pclient.

Let's take a step back - are you certain that it makes sense for the
puppet user to execute these?

"puppet cert clean" sounds as if only root should be allowed to run it.

What are you trying to solve?
Reply all
Reply to author
Forward
0 new messages