try legacy user hrn format
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Mon, 13 Aug 2012 15:25:21 +0000 (11:25 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Mon, 13 Aug 2012 15:25:21 +0000 (11:25 -0400)
sfa/client/sfaclientlib.py

index ef039e2..c5c5b80 100644 (file)
@@ -133,7 +133,12 @@ class SfaClientBootstrap:
         self.assert_private_key()
         registry_proxy = SfaServerProxy (self.registry_url, self.private_key_filename(),
                                          certificate_filename)
-        credential_string=registry_proxy.GetSelfCredential (certificate_string, self.hrn, "user")
+        try:
+            credential_string=registry_proxy.GetSelfCredential (certificate_string, self.hrn, "user")
+        except:
+            # some urns hrns may replace non hierarchy delimiters '.' with an '_' instead of escaping the '.'
+            hrn = Xrn(self.hrn).get_hrn().replace('\.', '_') 
+            credential_string=registry_proxy.GetSelfCredential (certificate_string, hrn, "user")
         self.plain_write (output, credential_string)
         self.logger.debug("SfaClientBootstrap: Wrote result of GetSelfCredential in %s"%output)
         return output