X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fsliverauth.py;h=07986500cfe9360de78480602f19da4d2fdf5153;hb=0214164541351badc2c248962ee2cbd756d8e8a7;hp=b58492f0fb616750b22b34f8ae30a2e7958a9bc6;hpb=c0042c6fed55a418ba566d2a4a5f56b5ab45df45;p=nodemanager.git diff --git a/plugins/sliverauth.py b/plugins/sliverauth.py index b58492f..0798650 100644 --- a/plugins/sliverauth.py +++ b/plugins/sliverauth.py @@ -1,14 +1,13 @@ #!/usr/bin/python -tt # vim:set ts=4 sw=4 expandtab: # -# $Id$ -# $URL$ -# # NodeManager plugin for creating credentials in slivers # (*) empower slivers to make API calls throught hmac # (*) also create a ssh key - used by the OMF resource controller # for authenticating itself with its Experiment Controller -# xxx todo : a config option for turning these 2 things on or off ? +# in order to avoid spamming the DB with huge amounts of such tags, +# (*) slices need to have the 'enable_hmac' tag set +# (*) or the 'omf_control' tag set, respectively """ Sliver authentication support for NodeManager. @@ -46,12 +45,18 @@ def GetSlivers(data, config, plc): logger.log("sliverauth: plc-instantiated slice %s does not yet exist. IGNORING!" % sliver['name']) continue - manage_hmac (plc, sliver) + system_slice = False + for chunk in sliver['attributes']: + if chunk['tagname'] == "system": + if chunk['value'] in (True, 1, '1') or chunk['value'].lower() == "true": + system_slice = True for chunk in sliver['attributes']: + if chunk['tagname']=='enable_hmac' and not system_slice: + manage_hmac (plc, sliver) + if chunk['tagname']=='omf_control': manage_sshkey (plc, sliver) - break def SetSliverTag(plc, slice, tagname, value):