Skip to content

Commit

Permalink
Make SELinux internal helper functions private.
Browse files Browse the repository at this point in the history
There are a handful of internal helper functions in the SELinux utility code,
dealing with finding the filesystem that a file resides on.  We may as well
make them private in the code.

Signed-off-by: Daniel Pittman <[email protected]>
  • Loading branch information
Daniel Pittman committed Aug 31, 2012
1 parent 94a1e72 commit 8fa6575
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions lib/puppet/util/selinux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,21 @@ def set_selinux_default_context(file)
nil
end

########################################################################
# Internal helper methods from here on in, kids. Don't fiddle.
private

# Check filesystem a path resides on for SELinux support against
# whitelist of known-good filesystems.
# Returns true if the filesystem can support SELinux labels and
# false if not.
def selinux_label_support?(file)
fstype = find_fs(file)
return false if fstype.nil?
filesystems = ['ext2', 'ext3', 'ext4', 'gfs', 'gfs2', 'xfs', 'jfs']
filesystems.include?(fstype)
end

# Internal helper function to read and parse /proc/mounts
def read_mounts
mounts = ""
Expand Down Expand Up @@ -201,16 +216,4 @@ def find_fs(path)
end
mnts['/']
end

# Check filesystem a path resides on for SELinux support against
# whitelist of known-good filesystems.
# Returns true if the filesystem can support SELinux labels and
# false if not.
def selinux_label_support?(file)
fstype = find_fs(file)
return false if fstype.nil?
filesystems = ['ext2', 'ext3', 'ext4', 'gfs', 'gfs2', 'xfs', 'jfs']
filesystems.include?(fstype)
end

end

0 comments on commit 8fa6575

Please sign in to comment.