[chef] Directory owner only set correctly on second run


Chronological Thread 
  • From: Steve Hummingbird < >
  • To:
  • Subject: [chef] Directory owner only set correctly on second run
  • Date: Sun, 17 Nov 2013 01:01:17 +0100
  • Authentication-results: smtp2h.mail.yandex.net; dkim=pass

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


Archive powered by MHonArc 2.6.16.

§