git://git.onelab.eu
/
pyplnet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3605426
)
Create the directories and use root for the network file.
author
Daniel Hokka Zakrisson
<dhokka@cs.princeton.edu>
Fri, 5 Dec 2008 16:49:57 +0000
(16:49 +0000)
committer
Daniel Hokka Zakrisson
<dhokka@cs.princeton.edu>
Fri, 5 Dec 2008 16:49:57 +0000
(16:49 +0000)
plnet.py
patch
|
blob
|
history
diff --git
a/plnet.py
b/plnet.py
index
9150a18
..
8abc0af
100755
(executable)
--- a/
plnet.py
+++ b/
plnet.py
@@
-5,12
+5,18
@@
import os
import socket
import time
import tempfile
import socket
import time
import tempfile
+import errno
import sioc
import modprobe
def InitInterfaces(logger, plc, data, root="", files_only=False, program="NodeManager"):
sysconfig = "%s/etc/sysconfig/network-scripts" % root
import sioc
import modprobe
def InitInterfaces(logger, plc, data, root="", files_only=False, program="NodeManager"):
sysconfig = "%s/etc/sysconfig/network-scripts" % root
+ try:
+ os.makedirs(sysconfig)
+ except OSError, e:
+ if e.errno != errno.EEXIST:
+ raise e
# query running network interfaces
devs = sioc.gifconf()
# query running network interfaces
devs = sioc.gifconf()
@@
-187,7
+193,7
@@
def InitInterfaces(logger, plc, data, root="", files_only=False, program="NodeMa
time.sleep(2)
# Write network configuration file
time.sleep(2)
# Write network configuration file
- networkconf = file("%s/etc/sysconfig/network", "w")
+ networkconf = file("%s/etc/sysconfig/network"
% root
, "w")
networkconf.write("NETWORKING=yes\nHOSTNAME=%s\n" % hostname)
if gateway is not None:
networkconf.write("GATEWAY=%s\n" % gateway)
networkconf.write("NETWORKING=yes\nHOSTNAME=%s\n" % hostname)
if gateway is not None:
networkconf.write("GATEWAY=%s\n" % gateway)