- From: Stephen Corbesero <
>
- To: "'
'" <
>
- Subject: [chef] RE: Re: RE: Re: Re: Use template or cookbook_file resources to put something in a user's home directory?
- Date: Tue, 7 Jan 2014 12:52:22 -0500
- Accept-language: en-US
- Acceptlanguage: en-US
It worked, but I wonder if compile time is too soon.
If this is part of the first run of a chef-client, that user would not exist
at the beginning of the run.
Do all the recipes get compiled before any of them start executing?
--
Stephen Corbesero, Performance Engineer
-----Original Message-----
From: Moser, Kevin
[mailto:
Sent: Tuesday, January 07, 2014 11:35 AM
To:
Subject: [chef] Re: RE: Re: Re: Use template or cookbook_file resources to
put something in a user's home directory?
Yup, you should be able to, assuming at the time of compile that the user
exists. As this code would get executed at compile time.
On 1/7/14 8:32 AM, "Stephen Corbesero"
<
>
wrote:
>
Can I put that in the name of a resource?
>
>
For example,
>
>
cookbook_file "#{Dir.home(someuser)}/xyzzy" do
>
...
>
End
>
>
>
--
>
Stephen Corbesero, Performance Engineer
>
>
-----Original Message-----
>
From: Moser, Kevin
>
[mailto:
>
Sent: Tuesday, January 07, 2014 11:27 AM
>
To:
>
>
Subject: [chef] Re: Re: Use template or cookbook_file resources to put
>
something in a user's home directory?
>
>
Dir.home will give you the current users home directory.
>
>
>
Dir.home(user) will give you the home directory of the user specified
>
>
>
On 1/7/14 8:24 AM, "Julian C. Dunn"
>
<
>
>
wrote:
>
>
>On Tue, Jan 7, 2014 at 11:08 AM, Stephen Corbesero
>
><
>
>
> wrote:
>
>
>
>> Is there any way to use the template and cookbook_file resources to
>
>>put files in or under a user¹s home directory without hardcoding the
>
>>directory as ³/home/username²?
>
>>
>
>> Is there some way to get the chef-client to interpret ~username like
>
>> the shell does?
>
>
>
>I think File.expand_path should do it?
>
>
>
>irb(main):002:0> File.expand_path('~juliandunn') => "/Users/juliandunn"
>
>
>
>- Julian
>
>
>
>--
>
>[ Julian C. Dunn
>
><
>
>
> * Sorry, I'm ]
>
>[ WWW: http://www.aquezada.com/staff/julian * only Web 1.0 ]
>
>[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
>
>[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]
>
Archive powered by MHonArc 2.6.16.