preserve node's full hostname in urn/hrn
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Wed, 19 Jan 2011 20:01:53 +0000 (15:01 -0500)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Wed, 19 Jan 2011 20:01:53 +0000 (15:01 -0500)
sfa/util/plxrn.py
sfa/util/xrn.py

index 12e32d0..e538902 100644 (file)
@@ -30,7 +30,9 @@ class PlXrn (Xrn):
         if hostname is not None:
             self.type='node'
             # keep only the first part of the DNS name
-            self.hrn='.'.join( [auth,hostname.split(".")[0] ] )
+            #self.hrn='.'.join( [auth,hostname.split(".")[0] ] )
+            # escape the '.' in the hostname
+            self.hrn='.'.join( [auth,Xrn.escape(hostname)] )
             self.hrn_to_urn()
         #def slicename_to_hrn(auth_hrn, slicename):
         elif slicename is not None:
index d33bc4e..d5ad2d4 100644 (file)
@@ -153,9 +153,9 @@ class Xrn:
         authority_string = self.get_authority_urn()
 
         if self.type == None:
-            urn = "+".join(['',authority_string,name])
+            urn = "+".join(['',authority_string,Xrn.unescape(name)])
         else:
-            urn = "+".join(['',authority_string,self.type,name])
+            urn = "+".join(['',authority_string,self.type,Xrn.unescape(name)])
         
         self.urn = Xrn.URN_PREFIX + urn