3131
3232
3333def check_module (name ):
34- '''
34+ """
3535 Check if given module contains one of removed types and comment out corresponding lines.
3636
3737 The function expects a text file "$name" containing cil policy
3838 to be present in the current directory.
3939
4040 Returns a list of invalid lines.
41- '''
41+ """
4242 try :
4343 removed = run (['grep' , '-w' , '-E' , "|" .join (REMOVED_TYPES_ ), name ], split = True )
4444 # Add ";" at the beginning of invalid lines (comment them out)
@@ -49,11 +49,11 @@ def check_module(name):
4949
5050
5151def list_selinux_modules ():
52- '''
52+ """
5353 Produce list of SELinux policy modules
5454
5555 Returns list of tuples (name,priority)
56- '''
56+ """
5757 try :
5858 semodule = run (['semodule' , '-lfull' ], split = True )
5959 except CalledProcessError :
@@ -75,7 +75,7 @@ def list_selinux_modules():
7575
7676
7777def get_selinux_modules ():
78- '''
78+ """
7979 Read all custom SELinux policy modules from the system
8080
8181 Returns 3-tuple (modules, retain_rpms, install_rpms)
@@ -84,7 +84,7 @@ def get_selinux_modules():
8484 during the upgrade and "install_rpms" is a list of RPMs
8585 that should be installed during the upgrade
8686
87- '''
87+ """
8888
8989 modules = list_selinux_modules ()
9090 semodule_list = []
@@ -172,15 +172,15 @@ def get_selinux_modules():
172172
173173
174174def get_selinux_customizations ():
175- '''
175+ """
176176 Extract local SELinux customizations introduced by semanage command
177177
178178 Returns tuple (semanage_valid, semanage_removed)
179179 where "semanage_valid" is a list of semanage commands
180180 which should be safe to re-apply on RHEL 8 system
181181 and "semanage_removed" is a list of commands that
182182 will no longer be valid after system upgrade
183- '''
183+ """
184184
185185 semanage_removed = []
186186 semanage_valid = []
0 commit comments