git://git.onelab.eu
/
nodemanager.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
blind and brutal 2to3
[nodemanager.git]
/
plugins
/
hostmap.py
diff --git
a/plugins/hostmap.py
b/plugins/hostmap.py
index
8bd1c08
..
d73a6ce
100644
(file)
--- a/
plugins/hostmap.py
+++ b/
plugins/hostmap.py
@@
-6,7
+6,7
@@
import logger
import os
import curlwrapper
import re
import os
import curlwrapper
import re
-import xmlrpc
lib
+import xmlrpc
.client
try:
from hashlib import sha1 as sha
except ImportError:
try:
from hashlib import sha1 as sha
except ImportError:
@@
-30,7
+30,7
@@
SUFFIX = "# ----- End -----"
def GetSlivers(data, config=None, plc=None):
if 'slivers' not in data:
def GetSlivers(data, config=None, plc=None):
if 'slivers' not in data:
- logger.log_missing_data("hostmap.GetSlivers",'slivers')
+ logger.log_missing_data("hostmap.GetSlivers",
'slivers')
return
if 'hostname' not in data:
return
if 'hostname' not in data:
@@
-48,7
+48,8
@@
def GetSlivers(data, config=None, plc=None):
if not os.path.exists(fn):
continue
if not os.path.exists(fn):
continue
- contents = file(fn,"r").read()
+ with open(fn) as f:
+ contents = f.read()
hostmap = []
for index, entry in enumerate(tag["value"].split("\n")):
hostmap = []
for index, entry in enumerate(tag["value"].split("\n")):
@@
-84,7
+85,8
@@
def GetSlivers(data, config=None, plc=None):
contents = contents + hostmap
try:
contents = contents + hostmap
try:
- file(fn, "w").write(contents)
+ with open(fn, "w") as f:
+ f.write(contents)
except:
logger.log_exc("hostmap (%s): failed to write %s" % (slicename, fn))
except:
logger.log_exc("hostmap (%s): failed to write %s" % (slicename, fn))