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
broken build
[pyplnet.git]
/
modprobe.py
diff --git
a/modprobe.py
b/modprobe.py
index
d7fa2e3
..
b56f5d5
100644
(file)
--- a/
modprobe.py
+++ b/
modprobe.py
@@
-5,12
+5,13
@@
"""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
+import tempfile
-class Modprobe
()
:
+class Modprobe:
def __init__(self,filename="/etc/modprobe.conf"):
self.conffile = {}
self.origconffile = {}
def __init__(self,filename="/etc/modprobe.conf"):
self.conffile = {}
self.origconffile = {}
- for keyword in ("alias","options","install","remove","blacklist","MODULES"):
+ for keyword in ("alias","options","install","remove","blacklist","MODULES"
,"#"
):
self.conffile[keyword]={}
self.filename = filename
self.conffile[keyword]={}
self.filename = filename
@@
-23,7
+24,7
@@
class Modprobe():
table = self.conffile.get(command,None)
if table == None:
table = self.conffile.get(command,None)
if table == None:
- print "WARNING: command %s not recognize. Ignoring!" % command
+ print "WARNING: command %s not recognize
d
. Ignoring!" % command
continue
if command == "alias":
continue
if command == "alias":
@@
-80,8
+81,8
@@
class Modprobe():
return False
def output(self,filename="/etc/modprobe.conf",program="NodeManager"):
return False
def output(self,filename="/etc/modprobe.conf",program="NodeManager"):
-
tmpnam = os.tmpnam(
)
- fb =
file(tmpnam,
"w")
+
(fd, tmpnam) = tempfile.mkstemp(dir=os.path.dirname(filename)
)
+ fb =
os.fdopen(fd,
"w")
fb.write("# Written out by %s\n" % program)
for command in ("alias","options","install","remove","blacklist"):
fb.write("# Written out by %s\n" % program)
for command in ("alias","options","install","remove","blacklist"):
@@
-98,6
+99,7
@@
class Modprobe():
os.chmod(filename,0644)
return True
else:
os.chmod(filename,0644)
return True
else:
+ os.unlink(tmpnam)
return False
def probe(self,name):
return False
def probe(self,name):