From: Thierry Parmentelat Date: Wed, 15 Dec 2010 11:41:51 +0000 (+0100) Subject: reviewed error msg formatting - fixed a couple glitches X-Git-Tag: sfa-1.0-10~3 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=cf59bcc9979bbfda3154180b5505106bd6b4ff67;p=sfa.git reviewed error msg formatting - fixed a couple glitches --- diff --git a/sfa/plc/sfaImport.py b/sfa/plc/sfaImport.py index ecad66fb..665a053c 100644 --- a/sfa/plc/sfaImport.py +++ b/sfa/plc/sfaImport.py @@ -92,7 +92,7 @@ class sfaImport: if not auth_record: auth_record = SfaRecord(hrn=hrn, gid=auth_info.get_gid_object(), type="authority", pointer=-1) auth_record['authority'] = get_authority(auth_record['hrn']) - self.logger.info("Import: inserting authority record for " + hrn) + self.logger.info("Import: inserting authority record for %s"%hrn) table.insert(auth_record) @@ -103,7 +103,7 @@ class sfaImport: if len(hrn) > 64: hrn = hrn[:64] - self.logger.info("Import: person " + hrn) + self.logger.info("Import: person %s"%hrn) key_ids = [] if 'key_ids' in person and person['key_ids']: key_ids = person["key_ids"] @@ -141,11 +141,11 @@ class sfaImport: slicename = _cleanup_string(slicename) if not slicename: - self.logger.error("Import: failed to parse slice name " + slice['name']) + self.logger.error("Import: failed to parse slice name %s" %slice['name']) return hrn = parent_hrn + "." + slicename - self.logger.info("Import: slice " + hrn) + self.logger.info("Import: slice %s"%hrn) pkey = Keypair(create=True) urn = hrn_to_urn(hrn, 'slice') @@ -167,7 +167,7 @@ class sfaImport: nodename = _cleanup_string(nodename) if not nodename: - self.logger.error("Import: failed to parse node name " + node['hostname']) + self.logger.error("Import: failed to parse node %s" %node['hostname']) return hrn = parent_hrn + "." + nodename @@ -211,7 +211,7 @@ class sfaImport: hrn = ".".join([parent_hrn, "internet2", sitename]) urn = hrn_to_urn(hrn, 'authority') - self.logger.info("Import: site " + hrn) + self.logger.info("Import: site %s"%hrn) # create the authority if not self.AuthHierarchy.auth_exists(urn): diff --git a/sfa/server/modpythonapi/ModPython.py b/sfa/server/modpythonapi/ModPython.py index b5b12816..5d09d096 100755 --- a/sfa/server/modpythonapi/ModPython.py +++ b/sfa/server/modpythonapi/ModPython.py @@ -52,5 +52,5 @@ def handler(req): except Exception, err: # Log error in /var/log/httpd/(ssl_)?error_log - sfa_logger().log_exc("%r"%e) + sfa_logger().log_exc("%r"%err) return apache.HTTP_INTERNAL_SERVER_ERROR diff --git a/sfa/server/sfa-server.py b/sfa/server/sfa-server.py index 31e5fc4f..15621930 100755 --- a/sfa/server/sfa-server.py +++ b/sfa/server/sfa-server.py @@ -113,7 +113,7 @@ def init_server_cert(hrn, key, server_cert_file, self_signed=False): else: try: # look for gid file - sfa_logger().debug("generating server cert from gid: ", hrn) + sfa_logger().debug("generating server cert from gid: %s"% hrn) hierarchy = Hierarchy() auth_info = hierarchy.get_auth_info(hrn) gid = GID(filename=auth_info.gid_filename) diff --git a/sfa/trust/auth.py b/sfa/trust/auth.py index e74dc161..218783e2 100644 --- a/sfa/trust/auth.py +++ b/sfa/trust/auth.py @@ -43,7 +43,7 @@ class Auth: valid.append(cred) except: cred_obj=Credential(string=cred) - sfa_logger().debug("failed to validate credential - dump="+cred_obj.dump_string(dump_parents=True)) + sfa_logger().debug("failed to validate credential - dump=%s"%cred_obj.dump_string(dump_parents=True)) error = sys.exc_info()[:2] continue diff --git a/sfa/trust/certificate.py b/sfa/trust/certificate.py index 6937f7f2..ed1792e7 100644 --- a/sfa/trust/certificate.py +++ b/sfa/trust/certificate.py @@ -632,7 +632,7 @@ class Certificate: return CertNotSignedByParent(self.get_subject()) # if the parent isn't verified... - sfa_logger().debug("verify_chain: .. %s, -> verifying parent %s",self.get_subject(),self.parent.get_subject()) + sfa_logger().debug("verify_chain: .. %s, -> verifying parent %s"%(self.get_subject(),self.parent.get_subject())) self.parent.verify_chain(trusted_certs) return diff --git a/sfa/trust/credential.py b/sfa/trust/credential.py index 3268026d..774690b2 100644 --- a/sfa/trust/credential.py +++ b/sfa/trust/credential.py @@ -677,7 +677,7 @@ class Credential(object): trusted_cert_objects.append(GID(filename=f)) ok_trusted_certs.append(f) except Exception, exc: - sfa_logger().error("Failed to load trusted cert from %s: %r", f, exc) + sfa_logger().error("Failed to load trusted cert from %s: %r"%( f, exc)) trusted_certs = ok_trusted_certs # Use legacy verification if this is a legacy credential diff --git a/sfa/trust/hierarchy.py b/sfa/trust/hierarchy.py index 4732dbc7..5d7db6f6 100644 --- a/sfa/trust/hierarchy.py +++ b/sfa/trust/hierarchy.py @@ -159,7 +159,7 @@ class Hierarchy: def create_auth(self, xrn, create_parents=False): hrn, type = urn_to_hrn(xrn) - sfa_logger().debug("Hierarchy: creating authority: " + hrn) + sfa_logger().debug("Hierarchy: creating authority: %s"% hrn) # create the parent authority if necessary parent_hrn = get_authority(hrn)