Consider the following manifest:
$server = nas.test.com
$path = nas_export
$fstype = nfs #(In our real-world issue it's gluster, but any fstype works
to reproduce)
mount {'/mnt/test':
ensure => 'mounted',
device => "$server:$path",
fstype => $fstype,
options => 'defaults',
atboot => true,
require => File['/mnt/test'];
}
}
mount{ '/var/mnt':
ensure => 'mounted',
device => "/mnt/test",
fstype => 'none',
options => 'rw,bind',
atboot => 'true',
require => [Mount['/mnt/test'],File['/var/mnt']];
}
When run on a clean system, it correctly creates & executes the mounts and
the entries in /etc/fstab. This is good.
However, if one unmounts /mnt/test and /var/mnt, and re-runs puppet, the
NFS mount /mnt/test is not re-mounted. Only the bind mount /var/mnt to
/mnt/test is re-mounted. Puppet throws no errors.
This occurs because puppet calls the mount command in the above scenario as
"debug: Puppet::Type::Mount::ProviderParsed: Executing '/bin/mount -o
defaults /mnt/test'". mount interprets "/mnt/test" as the *device* to be
mounted and performs the bind mount (which works, so no error is thrown),
rather than as the *location* which should be attached to
nas.test.com:nfs_export.
This is probably "mount" default behavior. When passed an argument that
could be either a device or a location, and both a device and a location
for that exist in /etc/fstab, it processes the argument as the device.
A solution would be for puppet to call the "mount -o <options> <device>
<mount point>" removing the ambiguity of "/mnt/test".
A workaround is adjust the mount manifests to ensure => present rather than
mounted, and to notify an exec manifest which requires both Mounts and
which runs "mount -a" (since /etc/fstab entries are created correctly,
"mount -a" works correctly).
However, I would prefer to not use an exec. Is there a way to get the mount
working correctly without changing puppet code?
Best regards,
Will
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-dev/-/TPmqCcl6rV0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.