File: 02_verify_slash_selinux.py

package info (click to toggle)
selinux-basics 0.6.0
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 144 kB
  • sloc: python: 280; sh: 120; perl: 95; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 548 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class TestSlashSELinux(TestBase):
	"""
	Verify that /sys/fs/selinux or /selinux is present
	"""
	class ErrorNoSlashSELinux(ErrorBase):
		def __str__(self):
			return "The directories /sys/fs/selinux and /selinux are missing."
		def fixable(self):
			return True
		def fix(self):
			import os
			return os.mkdir("/selinux")

	@staticmethod
	def test():
		import os
		if not os.access("/sys/fs/selinux",os.F_OK):
			if not os.access("/selinux",os.F_OK):
				return [TestSlashSELinux.ErrorNoSlashSELinux()]
		return []
register_test(TestSlashSELinux)