From: Thierry Parmentelat Date: Fri, 11 May 2012 12:14:23 +0000 (+0200) Subject: fix authority registration X-Git-Tag: sfa-2.1-6~4 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=3f7cedc8536a8bcddd68c0536760c3d08bd3e22a;p=sfa.git fix authority registration --- diff --git a/sfa/plc/pldriver.py b/sfa/plc/pldriver.py index 66c7a231..e0c6e3bb 100644 --- a/sfa/plc/pldriver.py +++ b/sfa/plc/pldriver.py @@ -27,7 +27,7 @@ from sfa.plc.plshell import PlShell import sfa.plc.peers as peers from sfa.plc.plaggregate import PlAggregate from sfa.plc.plslices import PlSlices -from sfa.util.plxrn import slicename_to_hrn, hostname_to_hrn, hrn_to_pl_slicename, hrn_to_pl_login_base +from sfa.util.plxrn import PlXrn, slicename_to_hrn, hostname_to_hrn, hrn_to_pl_slicename def list_to_dict(recs, key): @@ -118,7 +118,7 @@ class PlDriver (Driver): self.shell.AddPersonKey(pointer, {'key_type' : 'ssh', 'key' : pub_key}) elif type == 'node': - login_base = hrn_to_pl_login_base(sfa_record['authority']) + login_base = PlXrn(xrn=sfa_record['authority'],type='node').pl_login_base() nodes = self.shell.GetNodes([pl_record['hostname']]) if not nodes: pointer = self.shell.AddNode(login_base, pl_record) @@ -244,7 +244,7 @@ class PlDriver (Driver): pl_record["model"] = "geni" elif type == "authority": - pl_record["login_base"] = hrn_to_pl_login_base(hrn) + pl_record["login_base"] = PlXrn(xrn=hrn,type='authority').pl_login_base() if "name" not in sfa_record: pl_record["name"] = hrn if "abbreviated_name" not in sfa_record: diff --git a/sfa/util/plxrn.py b/sfa/util/plxrn.py index 17d0c15b..6d57dccb 100644 --- a/sfa/util/plxrn.py +++ b/sfa/util/plxrn.py @@ -13,8 +13,9 @@ def email_to_hrn (auth_hrn, email): return PlXrn(auth=auth_hrn, email=email).get_hrn() def hrn_to_pl_slicename (hrn): return PlXrn(xrn=hrn,type='slice').pl_slicename() -def hrn_to_pl_login_base (hrn): - return PlXrn(xrn=hrn,type='slice').pl_login_base() +# removed-dangerous - was used for non-slice objects +#def hrn_to_pl_login_base (hrn): +# return PlXrn(xrn=hrn,type='slice').pl_login_base() def hrn_to_pl_authname (hrn): return PlXrn(xrn=hrn,type='any').pl_authname() def xrn_to_hostname(hrn): @@ -73,7 +74,6 @@ class PlXrn (Xrn): self._normalize() return self.leaf - #def hrn_to_pl_login_base(hrn): def pl_login_base (self): self._normalize() base = self.authority[-1]