fix authority registration
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 11 May 2012 12:14:23 +0000 (14:14 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 11 May 2012 12:14:23 +0000 (14:14 +0200)
sfa/plc/pldriver.py
sfa/util/plxrn.py

index 66c7a23..e0c6e3b 100644 (file)
@@ -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:
index 17d0c15..6d57dcc 100644 (file)
@@ -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]