Chef mount not working with directory

HI there,

I have q question regarding the resource type „mount“.
If I first create a directory resource and afterwards uses the resource
mount to mount a remote file system on the previous created directory it
works only for the first chef-client run.
After the mount of the remote filesystem, the resource directory will fail
during the next chef-client run.

Following code:

directory “#{tomcat_bag[‘webserver’][‘mountpoint_fs_install’]}” do
’tomcatusr1’
group 'tomcatusr1’
mode 0755
action :create
end

mount tomcat_bag[servertype][‘mountpoint_fs_install’] do
device tomcat_bag[servertype][‘mountsource_fs_install’]
fstype "nfs"
options "rw"
action [:mount, :enable]
End

Log:
First run:

  • directory[/apps/install] action create (up to date)
  • mount[/apps/install] action mount
  • mount[/apps/install] action enable (up to date)

Second run:

  • directory[/apps/install] action create
    ===========================================================================
    =====
    Error executing action create on resource ‘directory[/apps/install]’
    ===========================================================================
    =====

Errno::EINVAL

Invalid argument - /apps/install

Resource Declaration:

In /var/chef/cache/cookbooks/tomcat/recipes/webserver.rb

27: directory “#{tomcat_bag[‘webserver’][‘mountpoint_fs_install’]}” do
28: owner 'tomcatusr1’
29: group 'tomcatusr1’
30: mode 0755
31: action :create
32: end
33:

Compiled Resource:

Declared in /var/chef/cache/cookbooks/tomcat/recipes/webserver.rb:27:in

`from_file’

directory("/apps/install") do
provider Chef::Provider::Directory
action [:create]
retries 0
retry_delay 2
guard_interpreter :default
path "/apps/install"
owner "tomcatusr1"
group "tomcatusr1"
mode 493
cookbook_name "tomcat"
recipe_name "webserver"
end

Does anybody of you have an idea, how I can fix this problem?

Thanks,
Christian

What operating system and Chef client version? It works ok for me here:

$ mount|grep amholding
/dev/mapper/vg00-lv05 on /amholding type ext4
(rw,nosuid,nodev,relatime,seclabel,data=ordered)
$ sudo chef-apply -s
[sudo] password for jdunn:
directory '/amholding' do
owner 'amandabackup'
group 'tape'
mode 0700
action :create
end
Recipe: (chef-apply cookbook)::(chef-apply recipe)

  • directory[/amholding] action create (up to date)
  • Julian

On Wed, May 7, 2014 at 11:09 AM, Christian Fröstl
christian.froestl@nubon.com wrote:

HI there,

I have q question regarding the resource type „mount“.
If I first create a directory resource and afterwards uses the resource
mount to mount a remote file system on the previous created directory it
works only for the first chef-client run.
After the mount of the remote filesystem, the resource directory will fail
during the next chef-client run.

Following code:

directory "#{tomcat_bag['webserver']['mountpoint_fs_install']}" do
'tomcatusr1'
group 'tomcatusr1'
mode 0755
action :create
end

mount tomcat_bag[servertype]['mountpoint_fs_install'] do
device tomcat_bag[servertype]['mountsource_fs_install']
fstype "nfs"
options "rw"
action [:mount, :enable]
End

Log:
First run:

  • directory[/apps/install] action create (up to date)
  • mount[/apps/install] action mount
  • mount[/apps/install] action enable (up to date)

Second run:

  • directory[/apps/install] action create
    ===========================================================================
    =====
    Error executing action create on resource 'directory[/apps/install]'
    ===========================================================================
    =====

Errno::EINVAL

Invalid argument - /apps/install

Resource Declaration:

In /var/chef/cache/cookbooks/tomcat/recipes/webserver.rb

27: directory "#{tomcat_bag['webserver']['mountpoint_fs_install']}" do
28: owner 'tomcatusr1'
29: group 'tomcatusr1'
30: mode 0755
31: action :create
32: end
33:

Compiled Resource:

Declared in /var/chef/cache/cookbooks/tomcat/recipes/webserver.rb:27:in

`from_file'

directory("/apps/install") do
provider Chef::Provider::Directory
action [:create]
retries 0
retry_delay 2
guard_interpreter :default
path "/apps/install"
owner "tomcatusr1"
group "tomcatusr1"
mode 493
cookbook_name "tomcat"
recipe_name "webserver"
end

Does anybody of you have an idea, how I can fix this problem?

Thanks,
Christian

--
[ Julian C. Dunn jdunn@aquezada.com * Sorry, I'm ]
[ WWW: Julian Dunn's Blog - Commentary on media, technology, and everything in between. * only Web 1.0 ]
[ gopher://sdf.org/1/users/keymaker/ * compliant! ]
[ PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9 ]

It might be a chwon/chgrp issue on NFS mounts.

At the first run, the directory resource created the local directory /apps/install,
then chwoned and chgrped it. When the second run, fil0001.stag.nubon.com:/install
was already mounted on /apps/install, and the resource tried to chown and chgrp it.

On Wed, May 7, 2014 at 11:09 AM, Christian Fröstl
christian.froestl@nubon.com wrote:

Log:
First run:

  • directory[/apps/install] action create (up to date)
  • mount[/apps/install] action mount
  • mount[/apps/install] action enable (up to date)

Second run:

  • directory[/apps/install] action create
    ===========================================================================
    =====
    Error executing action create on resource 'directory[/apps/install]'
    ===========================================================================
    =====

Errno::EINVAL

Invalid argument - /apps/install

--
YAMANO Yuji
OGIS-RI

Hi there,

Yes you were right. I fixt the rights for users and groups in nfs and
afterwards the resource directory problem was fixt, too.

Thanks,
Christian

Am 09.05.14 09:49 schrieb "YAMANO Yuji" unter Yamano_Yuji@ogis-ri.co.jp:

It might be a chwon/chgrp issue on NFS mounts.

At the first run, the directory resource created the local directory
/apps/install,
then chwoned and chgrped it. When the second run,
fil0001.stag.nubon.com:/install
was already mounted on /apps/install, and the resource tried to chown and
chgrp it.

On Wed, May 7, 2014 at 11:09 AM, Christian Fröstl
christian.froestl@nubon.com wrote:

Log:
First run:

  • directory[/apps/install] action create (up to date)
  • mount[/apps/install] action mount
  • mount[/apps/install] action enable (up to date)

Second run:

  • directory[/apps/install] action create

========================================================================

=====
Error executing action create on resource 'directory[/apps/install]'

========================================================================

=====

Errno::EINVAL

Invalid argument - /apps/install

--
YAMANO Yuji
OGIS-RI