X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fvsys_privs.py;h=1a3e4b24bf1d5ec814a7bd2fbe53fcb3d7b6f8c8;hb=74a8cfb9d2eac39ae02e5323e1fb5b1d33297981;hp=2dad07511af75876d98b2da0113a176c180e5a02;hpb=9b3ae65c0b7bd654368820010354a9b131388af5;p=nodemanager.git diff --git a/plugins/vsys_privs.py b/plugins/vsys_privs.py index 2dad075..1a3e4b2 100755 --- a/plugins/vsys_privs.py +++ b/plugins/vsys_privs.py @@ -1,3 +1,6 @@ +# $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 @@ -11,15 +14,24 @@ from sets import Set VSYS_PRIV_DIR = "/etc/planetlab/vsys-attributes" def start(options, conf): - logger.log("vsys_privs plugin v0.1") + logger.log("vsys_privs: plugin starting") if (not os.path.exists(VSYS_PRIV_DIR)): os.makedirs(VSYS_PRIV_DIR) - logger.log("Created vsys attributes dir") + logger.log("vsys_privs: Created vsys attributes dir") def GetSlivers(data, config=None, plc=None): + + if 'slivers' not in data: + logger.log_missing_data("vsys_privs.GetSlivers",'slivers') + return + + privs = {} # Parse attributes and update dict of scripts + if 'slivers' not in data: + logger.log_missing_data("vsys_privs.GetSlivers",'slivers') + return for sliver in data['slivers']: slice = sliver['name'] for attribute in sliver['attributes']: @@ -78,7 +90,6 @@ def write_privs(cur_privs,privs): and cur_privs[slice].has_key(k) and cur_privs[slice][k] == v): # The binding has not changed - print "Binding for %s, %s has not changed"%(slice,k) pass else: v_file = os.path.join(slice_dir, k) @@ -86,6 +97,7 @@ def write_privs(cur_privs,privs): data = '\n'.join(v) f.write(data) f.close() + logger.log("vsys_privs: added vsys attribute %s for %s"%(k,slice)) # Remove files and directories # that are invalid