git://git.onelab.eu
/
pyplnet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Setting tag pyplnet-7.0-0
[pyplnet.git]
/
modprobe.py
diff --git
a/modprobe.py
b/modprobe.py
index
5e4053d
..
f48fa8d
100644
(file)
--- a/
modprobe.py
+++ b/
modprobe.py
@@
-1,7
+1,4
@@
#
#
-# $Id$
-#
-
"""Modprobe is a utility to read/modify/write /etc/modprobe.conf"""
import os
"""Modprobe is a utility to read/modify/write /etc/modprobe.conf"""
import os
@@
-75,8
+72,8
@@
class Modprobe:
command = parts[0].lower()
# check if its a command we support
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)
continue
func = funcs.get(command,__default)
@@
-121,7
+118,7
@@
class Modprobe:
fb.close()
return buf_a == buf_b
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"):
return False
def output(self,filename="/etc/modprobe.conf",program="NodeManager"):
@@
-131,7
+128,7
@@
class Modprobe:
for command in ("alias","options","install","remove","blacklist"):
table = self.conffile[command]
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]
keys.sort()
for k in keys:
v = table[k]
@@
-140,7
+137,7
@@
class Modprobe:
fb.close()
if not self._comparefiles(tmpnam,filename):
os.rename(tmpnam,filename)
fb.close()
if not self._comparefiles(tmpnam,filename):
os.rename(tmpnam,filename)
- os.chmod(filename,0644)
+ os.chmod(filename,0
o
644)
return True
else:
os.unlink(tmpnam)
return True
else:
os.unlink(tmpnam)
@@
-174,7
+171,7
@@
if __name__ == '__main__':
m.input()
blacklist = Modprobe()
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)
for blf in blacklistfiles:
if os.path.exists("/etc/modprobe.d/%s"%blf):
blacklist.input("/etc/modprobe.d/%s"%blf)