Checking if a directory is a mount point

121 views
Skip to first unread message

pbi...@pppl.gov

unread,
Nov 6, 2018, 6:24:30 PM11/6/18
to Puppet Users
I want to check to see of a directory is a mount point for a separate partition. For example, I'd like to check to see if /tmp is a separate partition or is just part of the root partition on a Linux system. What is the best way to do this. I thought I could use the in operator to see if '/tmp' exists in $fact['partitions']['mount'], but that doesn't seem to work. For example, I tried this code, where /boot is definitely a separate partition, but /tmp is not:

class mount_points {
  if '/tmp' in $facts['partitions']['mount'] {
    notify { '/tmp is a separate partition': }
  }
  else {
    notify { '/tmp is NOT a separate partition': }
  }
  if "/boot" in $facts['partitions']['mount'] {
    notify { '/boot is a separate partition': }
  }
  else {
    notify { '/boot is NOT a separate partition': }
  }
}

Unfortunately, when I run this, puppet says both directories are NOT separate partitions. Is there something wrong with this syntax, or is this approach entirely wrong?

Prentice


Dan White

unread,
Nov 6, 2018, 6:54:56 PM11/6/18
to puppet...@googlegroups.com
Try
$fact[‘mountpoints’]
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/6d292a30-1ed0-4d60-93c8-80c65949c765%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Prentice Bisbal

unread,
Nov 6, 2018, 10:16:21 PM11/6/18
to puppet...@googlegroups.com

$fact['mountpoints'] did it. Thanks.

--
Prentice

Reply all
Reply to author
Forward
0 new messages