-# $Id$
-# $URL$
-
"""
vsys sub-configurator. Maintains configuration parameters associated with vsys scripts.
All slice attributes with the prefix vsys_ are written into configuration files on the
VSYS_PRIV_DIR = "/etc/planetlab/vsys-attributes"
-def start(options, conf):
+def start():
logger.log("vsys_privs: plugin starting")
if (not os.path.exists(VSYS_PRIV_DIR)):
os.makedirs(VSYS_PRIV_DIR)
pass
for tagname in tagnames:
- tagfile = os.path.join(slicedir,tagname)
- values_n = file(tagfile).readlines()
- values = map(lambda s:s.rstrip(),values_n)
- slice = os.path.basename(slicedir)
- cur_privs[slice][tagname]=values
+ tagfilename = os.path.join(slicedir,tagname)
+ with open(tagfilename) as tagfile:
+ values_n = tagfile.readlines()
+ values = [ v.rstrip() for v in values_n ]
+ slice = os.path.basename(slicedir)
+ cur_privs[slice][tagname] = values
return cur_privs