Forum: CFEngine Help Subject: querying mountpoints Author: davidlee Link to topic: https://cfengine.com/forum/read.php?3,26982,26982#msg-26982
(cfengine 3.3.4; RHEL 5.x) Cfengine has a good range of functions (ref. manual, section 11) for querying the status of files ("isdir()", "fileexists()", etc.). We use these widely from across the breadth of our config files. But it seems to lack an equivalent capability to query mounted filesystems. Our particular wish is for an 'ismounted("/some/path")' capability, again to be called from various places across the breadth of our config files. Have I missed something? If so, please point me in the right direction. As interim workaround, I propose a "bundle common mount" (or some similar name) which does a "readstringarray()" on "/etc/mtab" (not "/proc/mounts": see at end) and defines a class per filesystem (globally, because this is a "common" bundle): if "/some/path" is present in the mount table, the bundle processing will define class "is_mounted__some_path" (name constructed via 'canonify()'). The user, who ideally would have liked a function 'ismounted("/some/path")', will instead do something like: ... ifvarclass => "is_mounted__some_path" hopefully constructing that name by use of 'canonify()'. How does that seem? Any alternative ideas? Yesterday I opened issue 1280 in the bugtracker as a request to investigate a proper 'ismounted()' function (and related functions). An aside about "/etc/mtab" vs. "/proc/mounts". For Linux I had attempted to read "/proc/mounts", but cfengine doesn't read in anything. I suspect this is because "/proc" presents this pseudo-file as zero-length until it is actually read, and that cfengine sees the "zero-length" attribute and skips the reading. Or something like that. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine