[chef] Re: Re: Use template or cookbook_file resources to put something in a user's home directory?


Chronological Thread 
  • From: "Moser, Kevin" < >
  • To: " " < >
  • Subject: [chef] Re: Re: Use template or cookbook_file resources to put something in a user's home directory?
  • Date: Tue, 7 Jan 2014 16:26:34 +0000
  • Accept-language: en-US

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.

§