[hg] galaxy 2454: Add the hostname of the Galaxy instance to err...
details: http://www.bx.psu.edu/hg/galaxy/rev/d83b9225b5dd changeset: 2454:d83b9225b5dd user: Greg Von Kuster <greg@bx.psu.edu> date: Tue Jun 16 13:54:33 2009 -0400 description: Add the hostname of the Galaxy instance to error reports. 2 file(s) affected in this change: lib/galaxy/web/controllers/dataset.py lib/galaxy/web/framework/base.py diffs (54 lines): diff -r e899101e63d1 -r d83b9225b5dd lib/galaxy/web/controllers/dataset.py --- a/lib/galaxy/web/controllers/dataset.py Tue Jun 16 09:55:15 2009 -0400 +++ b/lib/galaxy/web/controllers/dataset.py Tue Jun 16 13:54:33 2009 -0400 @@ -16,7 +16,10 @@ GALAXY TOOL ERROR REPORT ------------------------ -This error report is in reference to output dataset ${dataset_id}. +This error report was sent from the Galaxy instance hosted on the server +"${remote_hostname}" +----------------------------------------------------------------------------- +This is in reference to output dataset ${dataset_id}. ----------------------------------------------------------------------------- The user '${email}' provided the following information: ${message} @@ -51,7 +54,7 @@ return job.stderr @web.expose - def report_error( self, trans, id, email="no email provided", message="" ): + def report_error( self, trans, id, email='', message="" ): smtp_server = trans.app.config.smtp_server if smtp_server is None: return trans.show_error_message( "Sorry, mail is not configured for this galaxy instance" ) @@ -61,9 +64,12 @@ # Get the dataset and associated job dataset = model.HistoryDatasetAssociation.get( id ) job = dataset.creating_job_associations[0].job + # Get the name of the server hosting the Galaxy instance from which this report originated + remote_hostname = trans.request.remote_hostname # Build the email message msg = MIMEText( string.Template( error_report_template ) - .safe_substitute( dataset_id=dataset.id, + .safe_substitute( remote_hostname=remote_hostname, + dataset_id=dataset.id, email=email, message=message, job_id=job.id, diff -r e899101e63d1 -r d83b9225b5dd lib/galaxy/web/framework/base.py --- a/lib/galaxy/web/framework/base.py Tue Jun 16 09:55:15 2009 -0400 +++ b/lib/galaxy/web/framework/base.py Tue Jun 16 13:54:33 2009 -0400 @@ -230,6 +230,12 @@ except socket.error: return self.remote_addr @lazy_property + def remote_hostname( self ): + try: + return socket.gethostbyaddr( self.remote_addr )[0] + except socket.error: + return self.remote_addr + @lazy_property def cookies( self ): return get_cookies( self.environ ) @lazy_property
participants (1)
-
Greg Von Kuster