command = parts[0].lower()
# check if its a command we support
- if not self.conffile.has_key(command):
- print "WARNING: command %s not recognized." % command
+ if command not in self.conffile:
+ print("WARNING: command %s not recognized." % command)
continue
func = funcs.get(command,__default)
fb.close()
return buf_a == buf_b
- except IOError, e:
+ except IOError as e:
return False
def output(self,filename="/etc/modprobe.conf",program="NodeManager"):
for command in ("alias","options","install","remove","blacklist"):
table = self.conffile[command]
- keys = table.keys()
+ keys = list(table.keys())
keys.sort()
for k in keys:
v = table[k]
fb.close()
if not self._comparefiles(tmpnam,filename):
os.rename(tmpnam,filename)
- os.chmod(filename,0644)
+ os.chmod(filename,0o644)
return True
else:
os.unlink(tmpnam)
m.input()
blacklist = Modprobe()
- blacklistfiles = ("blacklist","blacklist-compat","blacklist-firewire")
+ blacklistfiles = os.listdir("/etc/modprobe.d")
for blf in blacklistfiles:
if os.path.exists("/etc/modprobe.d/%s"%blf):
blacklist.input("/etc/modprobe.d/%s"%blf)