In regard to: Re: [Puppet Users] passing an environment variable to a...:

On Jun 28, 2013 2:06 PM, "Tim Mooney" <[email protected]> wrote:

works fine, but on hosts where we use our mysql module with the custom
types and provider, we can't do that.  We instead have to

        sudo su -
        puppet agent --test

An alternative and trivia in addition to what Nan said:

You can use

   sudo -H

to set $HOME, or

   sudo -i

to get a full login environment like 'su -' gives. There are also sudoers
config params that can make at least the former default, and probably the
latter too.

Thanks Wil.  I knew about each of these, but I would rather fix the
type/provider to work even with normal sudo usage, rather than requiring
people to remember to use one of these.  Yes, they could use aliases or
shell functions, but I still think it's a better solution to make
type/provider work for any case.

Additionally, you can explicitly pass the path of the `my.cnf`, rather than
relying on $HOME,

I've thought about this too and I agree that it's even better.  To
do it right, though, I would want to make it use the root_home fact.
That's one more thing I don't know how to do yet, though.  It looks like

        http://docs.puppetlabs.com/guides/provider_development.html

has a section on using facts in providers, so I'll do some experimenting
and see if I can't muddle through.

Tim
--
Tim Mooney                                             [email protected]
Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
Room 242-J6, IACC Building                             701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" 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-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to