X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fclient%2Fsfaclientlib.py;h=7736e52a45084928a44d2e17baf704086b447692;hb=ecc85e0b923922cf7117d29b380f5284edb88f21;hp=bc4a1d141bcd016abdff460cdeb7ee5a064b9851;hpb=92b43f0e1f1a0fe453cd3a289f90c3961f12ab7c;p=sfa.git diff --git a/sfa/client/sfaclientlib.py b/sfa/client/sfaclientlib.py index bc4a1d14..7736e52a 100644 --- a/sfa/client/sfaclientlib.py +++ b/sfa/client/sfaclientlib.py @@ -1,7 +1,9 @@ # Thierry Parmentelat -- INRIA -# -# a minimal library for writing "lightweight" SFA clients -# +""" +a minimal library for writing "lightweight" SFA clients +""" + +from __future__ import print_function # xxx todo # this library should probably check for the expiration date of the various @@ -198,7 +200,7 @@ class SfaClientBootstrap: records = registry_proxy.Resolve (hrn, credential_string) records=[record for record in records if record['type']==type] if not records: - raise RecordNotFound, "hrn %s (%s) unknown to registry %s"%(hrn,type,self.registry_url) + raise RecordNotFound("hrn %s (%s) unknown to registry %s"%(hrn,type,self.registry_url)) record=records[0] self.plain_write (output, record['gid']) self.logger.debug("SfaClientBootstrap: Wrote GID for %s (%s) in %s"% (hrn,type,output)) @@ -217,9 +219,9 @@ class SfaClientBootstrap: openssl_command += [ "-in", self.my_gid_filename()] openssl_command += [ "-out", filename ] if subprocess.call(openssl_command) ==0: - print "Successfully created %s"%filename + print("Successfully created %s"%filename) else: - print "Failed to create %s"%filename + print("Failed to create %s"%filename) # Returns True if credential file is valid. Otherwise return false. def validate_credential(self, filename): @@ -314,7 +316,7 @@ class SfaClientBootstrap: def assert_filename (self, filename, kind): if not os.path.isfile (filename): - raise IOError,"Missing %s file %s"%(kind,filename) + raise IOError("Missing %s file %s"%(kind,filename)) return True def assert_private_key (self): @@ -352,7 +354,7 @@ class SfaClientBootstrap: message="Could not produce/retrieve %s (%s -- %s)"%\ (filename,error[0],error[1]) self.logger.log_exc(message) - raise Exception, message + raise Exception(message) return wrapped return wrap