[chef] Re: Directory owner only set correctly on second run


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Directory owner only set correctly on second run
  • Date: Mon, 18 Nov 2013 09:02:10 -0800


On Saturday, November 16, 2013 at 4:01 PM, Steve Hummingbird wrote:

I am testing a cookbook using vagrant and chef 11.8.0

This is the relevant part of my recipe:

Chef::Log.info("creating log dir: " + File.expand_path("..", node['mongodb']['config']['logpath']) + " for user: " + node['mongodb']['user'])
directory File.expand_path("..", node['mongodb']['config']['logpath']) do
owner node['mongodb']['user']
group 'root'
mode "0755"
action :create
end


which should create a directory, which belongs to the mongodb user.

This is the output if I run 'vagrant up'

[2013-11-16T23:48:29+00:00] INFO: creating log dir: /logs/mongodb for user: mongodb

[2013-11-16T23:48:53+00:00] INFO: directory[/logs/mongodb] created directory /logs/mongodb
[2013-11-16T23:48:53+00:00] INFO: directory[/logs/mongodb] group changed to 0
[2013-11-16T23:48:53+00:00] INFO: directory[/logs/mongodb] mode changed to 755


This is the output if I run 'vagrant provision' after that run:

[2013-11-16T23:53:18+00:00] INFO: directory[/logs/mongodb] owner changed to 104

As you can see, it needs the second run to set the owner of the directory correctly.

Is there anything wrong with my approach, or might this be a bug?

Thanks,
Steve
Are you sure nothing else is changing anything about that user during the chef run?

-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§