genhomedircon: misc pylint cleanup
support/genhomedircon.py:297:5: R1714: Consider merging these comparisons with "in" to "o in ('--type', '-t')" (consider-using-in) support/genhomedircon.py:299:5: R1714: Consider merging these comparisons with "in" to "o in ('--nopasswd', '-n')" (consider-using-in) support/genhomedircon.py:301:5: R1714: Consider merging these comparisons with "in" to "o in ('--dir', '-d')" (consider-using-in) support/genhomedircon.py:238:2: R1705: Unnecessary "else" after "return" (no-else-return) support/genhomedircon.py:207:11: C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary) support/genhomedircon.py:146:2: R1705: Unnecessary "else" after "return" (no-else-return) support/genhomedircon.py:144:1: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements) Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
parent
9e48ce1f2e
commit
27e3099f40
|
@ -143,10 +143,9 @@ class selinuxConfig:
|
||||||
|
|
||||||
def getHomeRootContext(self, homedir):
|
def getHomeRootContext(self, homedir):
|
||||||
rc=getstatusoutput("grep HOME_ROOT %s | sed -e \"s|^HOME_ROOT|%s|\"" % ( self.getHomeDirTemplate(), homedir))
|
rc=getstatusoutput("grep HOME_ROOT %s | sed -e \"s|^HOME_ROOT|%s|\"" % ( self.getHomeDirTemplate(), homedir))
|
||||||
if rc[0] == 0:
|
if rc[0] != 0:
|
||||||
return rc[1]+"\n"
|
errorExit("sed error (" + str(rc[0]) + "): " + rc[1])
|
||||||
else:
|
return rc[1]+"\n"
|
||||||
errorExit("sed error " + rc[1])
|
|
||||||
|
|
||||||
def getUsersFile(self):
|
def getUsersFile(self):
|
||||||
return self.selinuxdir+self.setype+"/users/local.users"
|
return self.selinuxdir+self.setype+"/users/local.users"
|
||||||
|
@ -211,7 +210,7 @@ class selinuxConfig:
|
||||||
users = self.getUsers()
|
users = self.getUsers()
|
||||||
ret=""
|
ret=""
|
||||||
# Fill in HOME and ROLE for users that are defined
|
# Fill in HOME and ROLE for users that are defined
|
||||||
for u in users.keys():
|
for u in users:
|
||||||
ret += self.getHomeDirContext (u, users[u]["home"], users[u]["role"], users[u]["name"], users[u]["uid"])
|
ret += self.getHomeDirContext (u, users[u]["home"], users[u]["role"], users[u]["name"], users[u]["uid"])
|
||||||
return ret+"\n"
|
return ret+"\n"
|
||||||
|
|
||||||
|
@ -244,8 +243,7 @@ class selinuxConfig:
|
||||||
break
|
break
|
||||||
if exists == 1:
|
if exists == 1:
|
||||||
return 1
|
return 1
|
||||||
else:
|
return 0
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
def getHomeDirs(self):
|
def getHomeDirs(self):
|
||||||
|
@ -301,11 +299,11 @@ try:
|
||||||
'nopasswd',
|
'nopasswd',
|
||||||
'dir='])
|
'dir='])
|
||||||
for o,a in gopts:
|
for o,a in gopts:
|
||||||
if o == '--type' or o == "-t":
|
if o in ('--type', '-t'):
|
||||||
setype=a
|
setype=a
|
||||||
if o == '--nopasswd' or o == "-n":
|
if o in ('--nopasswd', '-n'):
|
||||||
usepwd=0
|
usepwd=0
|
||||||
if o == '--dir' or o == "-d":
|
if o in ('--dir', '-d'):
|
||||||
directory=a
|
directory=a
|
||||||
if o == '--help':
|
if o == '--help':
|
||||||
usage()
|
usage()
|
||||||
|
|
Loading…
Reference in New Issue