On 21 Sep 2010, at 21:12, Mathew Hennessy wrote: > Hi, > Is there a way to guarantee changes to relevant fstab NFS mount flags > when made in a body mount? So far, I have to umount the dirs and delete > them from fstab on the client for a cf-agent run to repopulate fstab > with the changed flags.
In cfengine 2 I use a shellcommand to remount the filesystem if the current entries in mtab don't match the desired properties. I'm not using cfengine's mount stuff in cfengine 2, but doing it manually. Here's a subset of what I do: control: any:: actionsequence = ( editfiles shellcommands ) fstab = ( A(source,"software-${datacentre}:/vol/software_copy/general") A(mntpnt,"/vol/software") A(fstype,"nfs") A(mode,"ro") A(options,"vers=3,tcp,rsize=32768,wsize=32768,timeo=600,hard,intr") ) fstab_line = ( "${fstab[source]} ${fstab[mntpnt]} ${fstab[fstype]} ${fstab[options]},${fstab[mode]} 0 0" ) editfiles: linux:: { /etc/mtab BeginGroupIfLineMatching "${fstab[source]} ${fstab[mntpnt]} nfs .*" DefineInGroup "correct_fs_mounted" BeginGroupIfLineMatching "${fstab[source]} ${fstab[mntpnt]} nfs ${fstab[mode]},.*" DefineInGroup "correct_readorwrite" EndGroup EndGroup } { /etc/fstab BeginGroupIfNoLineMatching "${fstab_line}.*" DeleteLinesContaining " ${fstab[mntpnt]} " Append "${fstab_line}" EndGroup } shellcommands: linux.correct_fs_mounted.!correct_readorwrite:: "/bin/mount -o remount,${fstab[mode]} ${fstab[mntpnt]}" linux.!correct_fs_mounted:: "/bin/umount -l ${fstab[mntpnt]}" "/bin/mount ${fstab[mntpnt]}" All does the job quite nicely, and because it uses a lazy unmount if the mounted filesystem is wrong, no running processes are adversely affected if the desire fileserver changes. Regards, Tim _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine