From ce7951ae8f2725c427388eece9c1ad1ef28ba810 Mon Sep 17 00:00:00 2001 From: Ben Brown Date: Tue, 15 Dec 2015 11:28:47 +0000 Subject: Remove trailing whitespace While we're here, seeing as Adam mentioned it. Change-Id: I5ddb86c70d76a84cf12fbd4eb91f3802e490d745 --- ARCH | 2 +- lorry-controller-minion | 4 ++-- lorry-controller-remove-old-jobs | 2 +- lorry-controller-webapp | 6 +++--- lorrycontroller/__init__.py | 2 +- lorrycontroller/gitano.py | 2 +- lorrycontroller/proxy.py | 8 ++++---- lorrycontroller/readconf.py | 6 +++--- lorrycontroller/showlorry.py | 4 ++-- lorrycontroller/statedb.py | 10 +++++----- yarns.webapp/030-queue-management.yarn | 4 ++-- yarns.webapp/040-running-jobs.yarn | 8 ++++---- yarns.webapp/900-implementations.yarn | 16 ++++++++-------- 13 files changed, 37 insertions(+), 37 deletions(-) diff --git a/ARCH b/ARCH index 6eb8376..5721aba 100644 --- a/ARCH +++ b/ARCH @@ -343,7 +343,7 @@ Other requests: * `POST /1.0/read-configuration` causes WEBAPP to update its copy of CONFGIT and update STATEDB based on the new configuration, if it has changed. Returns OK/ERROR status. (RC/ADD, RC/RM, RC/START) - + This is called by systemd units at system startup and periodically (perhaps once a minute) otherwise. It can also be triggered by an admin (there is a button on the `/1.0/status-html` web page). diff --git a/lorry-controller-minion b/lorry-controller-minion index 95ccef1..72f1a39 100755 --- a/lorry-controller-minion +++ b/lorry-controller-minion @@ -119,7 +119,7 @@ class MINION(cliapp.Application): except WEBAPPError as e: logging.error(str(e)) return None - + obj = json.loads(body) if obj.get('job_id', None): return obj @@ -303,6 +303,6 @@ class MINION(cliapp.Application): except ValueError: logging.warning('error converting %r to string' % words[0]) return 0 - + MINION().run() diff --git a/lorry-controller-remove-old-jobs b/lorry-controller-remove-old-jobs index 8cdf601..2a54a30 100755 --- a/lorry-controller-remove-old-jobs +++ b/lorry-controller-remove-old-jobs @@ -102,7 +102,7 @@ class OldJobRemover(cliapp.Application): job_infos.append(self.get_job_info(job_id)) except urllib2.HTTPError as e: logging.warning( - 'Trouble getting job info for job %s: %s' % + 'Trouble getting job info for job %s: %s' % (job_id, str(e))) return job_infos diff --git a/lorry-controller-webapp b/lorry-controller-webapp index 2ed601c..ee573a2 100755 --- a/lorry-controller-webapp +++ b/lorry-controller-webapp @@ -210,14 +210,14 @@ class WEBAPP(cliapp.Application): class DebugServer(wsgiref.simple_server.WSGIServer): '''WSGI-like server that uses an ephemeral port. - + Rather than use a specified port, or default, the DebugServer connects to an ephemeral port and writes its number to debug-port-file, so a non-racy temporary port can be used. - + ''' - + def __init__(self, (host, port), *args, **kwargs): wsgiref.simple_server.WSGIServer.__init__( self, (host, 0), *args, **kwargs) diff --git a/lorrycontroller/__init__.py b/lorrycontroller/__init__.py index 9d46441..2c4a1c2 100644 --- a/lorrycontroller/__init__.py +++ b/lorrycontroller/__init__.py @@ -17,7 +17,7 @@ from statedb import ( StateDB, LorryNotFoundError, - WrongNumberLorriesRunningJob, + WrongNumberLorriesRunningJob, TroveNotFoundError) from route import LorryControllerRoute from readconf import ReadConfiguration diff --git a/lorrycontroller/gitano.py b/lorrycontroller/gitano.py index 6625757..c0cca05 100644 --- a/lorrycontroller/gitano.py +++ b/lorrycontroller/gitano.py @@ -94,7 +94,7 @@ class GitanoCommand(object): if exit != 0: logging.error( - 'Failed to run "%s" for %s:\n%s', + 'Failed to run "%s" for %s:\n%s', quoted_args, self.trovehost, stdout + stderr) raise GitanoCommandFailure( self.trovehost, diff --git a/lorrycontroller/proxy.py b/lorrycontroller/proxy.py index 22729d3..b9e75b8 100644 --- a/lorrycontroller/proxy.py +++ b/lorrycontroller/proxy.py @@ -36,15 +36,15 @@ def build_proxy_url(protocol, proxy_config): def setup_proxy(config_filename): """Tell urllib2 to use a proxy for http action by lorry-controller. - + Load the proxy information from the JSON file given by proxy_def, then set urllib2's url opener to open urls via an authenticated proxy. - + """ - + if not os.path.exists(config_filename): return - + with open(config_filename, 'r') as f: proxy_config = json.load(f) diff --git a/lorrycontroller/readconf.py b/lorrycontroller/readconf.py index f7a7404..4bcbce4 100644 --- a/lorrycontroller/readconf.py +++ b/lorrycontroller/readconf.py @@ -80,7 +80,7 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute): logging.error( 'Unknown section in configuration: %r', section) return ( - 'ERROR: Unknown section type in configuration: %r' % + 'ERROR: Unknown section type in configuration: %r' % section) for path in lorries_to_remove: @@ -228,7 +228,7 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute): pattern = os.path.join(dirname, base_pattern) result.extend(glob.glob(pattern)) return result - + def get_valid_lorry_specs(self, filename): # We do some basic validation of the .lorry file and the Lorry # specs contained within it. We silently ignore anything that @@ -332,7 +332,7 @@ class LorryControllerConfValidator(object): if type(conf_obj) is not list: raise ValidationError( 'type %r is not a JSON list' % type(conf_obj)) - + def _check_is_list_of_dicts(self, conf_obj): for item in conf_obj: if type(item) is not dict: diff --git a/lorrycontroller/showlorry.py b/lorrycontroller/showlorry.py index 19f9429..d54073a 100644 --- a/lorrycontroller/showlorry.py +++ b/lorrycontroller/showlorry.py @@ -74,7 +74,7 @@ class ShowLorryHTML(ShowLorryBase, lorrycontroller.LorryControllerRoute): lorry_info['last_run_nice'] = time.strftime( '%Y-%m-%d %H:%M:%S UTC', time.gmtime(lorry_info['last_run'])) - + lorry_info['disk_usage_nice'] = shower.format_bytesize( lorry_info['disk_usage']) @@ -82,7 +82,7 @@ class ShowLorryHTML(ShowLorryBase, lorrycontroller.LorryControllerRoute): due = lorry_info['last_run'] + lorry_info['interval'] lorry_info['due_nice'] = renderer.format_due_nicely(due, now) - + timestamp = time.strftime('%Y-%m-%d %H:%M:%S UTC', time.gmtime(now)) parts = urlparse.urlparse(bottle.request.url) diff --git a/lorrycontroller/statedb.py b/lorrycontroller/statedb.py index 7a26098..7f537f3 100644 --- a/lorrycontroller/statedb.py +++ b/lorrycontroller/statedb.py @@ -149,7 +149,7 @@ class StateDB(object): # Stupid table we can always write to to trigger the start of # a transaction. c.execute('CREATE TABLE stupid (value INT)') - + # Done. self._conn.commit() logging.debug('Finished initialising tables in STATEDB') @@ -240,7 +240,7 @@ class StateDB(object): prefixmap=None, ignore=None): logging.debug( 'StateDB.add_trove(%r,%r,%r,%r,%r,%r) called', - trovehost, lorry_interval, lorry_timeout, ls_interval, + trovehost, lorry_interval, lorry_timeout, ls_interval, prefixmap, ignore) assert trovehost is not None @@ -264,7 +264,7 @@ class StateDB(object): 'prefixmap, ignore) ' 'VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', (trovehost, protocol, username, password, - lorry_interval, lorry_timeout, ls_interval, 0, + lorry_interval, lorry_timeout, ls_interval, 0, prefixmap, ignore)) else: c = self.get_cursor() @@ -273,7 +273,7 @@ class StateDB(object): 'SET lorry_interval=?, lorry_timeout=?, ls_interval=?, ' 'prefixmap=?, ignore=?, protocol=? ' 'WHERE trovehost IS ?', - (lorry_interval, lorry_timeout, ls_interval, prefixmap, + (lorry_interval, lorry_timeout, ls_interval, prefixmap, ignore, protocol, trovehost)) def remove_trove(self, trovehost): @@ -603,7 +603,7 @@ class StateDB(object): This is a generator. ''' - + c = self.get_cursor() c.execute('SELECT job_id, path, exit FROM jobs') while True: diff --git a/yarns.webapp/030-queue-management.yarn b/yarns.webapp/030-queue-management.yarn index ebf50af..a90966a 100644 --- a/yarns.webapp/030-queue-management.yarn +++ b/yarns.webapp/030-queue-management.yarn @@ -60,7 +60,7 @@ when WEBAPP has never read its configuration. WHEN admin makes request GET /1.0/list-queue THEN response has queue set to [] - + Make WEBAPP read an empty configuration. Or rather, a configuration that does not match any existing `.lorry` files. @@ -92,7 +92,7 @@ Add two Lorries, then make sure they can reordered at will. WHEN admin makes request POST /1.0/read-configuration AND admin makes request GET /1.0/list-queue THEN response has queue set to ["upstream/bar", "upstream/foo"] - + WHEN admin makes request POST /1.0/move-to-top with path=upstream/foo AND admin makes request GET /1.0/list-queue THEN response has queue set to ["upstream/foo", "upstream/bar"] diff --git a/yarns.webapp/040-running-jobs.yarn b/yarns.webapp/040-running-jobs.yarn index 1c9a4de..5e47d1c 100644 --- a/yarns.webapp/040-running-jobs.yarn +++ b/yarns.webapp/040-running-jobs.yarn @@ -24,7 +24,7 @@ Then make sure we don't get a job when we request one. WHEN admin makes request POST /1.0/give-me-job with host=testhost&pid=123 THEN response has job_id set to null - + WHEN admin makes request GET /1.0/list-running-jobs THEN response has running_jobs set to [] @@ -52,7 +52,7 @@ Enable the queue, and off we go. WHEN admin makes request GET /1.0/lorry/upstream/foo THEN response has running_job set to 1 AND response has jobs set to [1] - + WHEN admin makes request GET /1.0/list-running-jobs THEN response has running_jobs set to [1] @@ -311,7 +311,7 @@ which marks all jobs finished that haven't had a `job-update` called on them for a long time. SCENARIO forget jobs without MINION updates in a long time - + Set up a WEBAPP that uses a CONFGIT with a Lorry file, so we can start a job. @@ -374,7 +374,7 @@ WEBAPP doesn't remove jobs automatically, it needs to be told to remove jobs. SCENARIO remove job - + Setup. GIVEN a new git repository in CONFGIT diff --git a/yarns.webapp/900-implementations.yarn b/yarns.webapp/900-implementations.yarn index 24dcf51..06411a7 100644 --- a/yarns.webapp/900-implementations.yarn +++ b/yarns.webapp/900-implementations.yarn @@ -28,7 +28,7 @@ be running until it crashes or is explicitly killed. IMPLEMENTS WHEN WEBAPP is started start_webapp - + Kill the running WEBAPP, using the recorded PID. We need to do this both as a WHEN and a FINALLY step. @@ -89,9 +89,9 @@ most of the configuration. python -c ' import os import yarnlib - + MATCH_1, MATCH_2, MATCH_3, MATCH_4 = yarnlib.matches() - + new = { "type": "lorries", "interval": "0s", @@ -117,7 +117,7 @@ most of the configuration. import yarnlib MATCH_1, MATCH_2, MATCH_3 = yarnlib.matches() - + new = { "type": "troves", "trovehost": MATCH_3, @@ -142,7 +142,7 @@ file. import os import json import yarnlib - + MATCH_1, MATCH_2, MATCH_3, MATCH_4 = yarnlib.matches() filename = os.path.join(yarnlib.DATADIR, MATCH_2, MATCH_1) @@ -207,9 +207,9 @@ file. Note that the Trove must already be in the configuration file. python -c ' import os import yarnlib - + MATCH_1, MATCH_2, MATCH_3, MATCH_4, MATCH_5 = yarnlib.matches() - + filename = os.path.join(yarnlib.DATADIR, MATCH_2, MATCH_1) objs = yarnlib.load_json_from_file(filename) @@ -432,7 +432,7 @@ purpose. # that's OK on filesystems that only store full-second timestamps. # We generate timestamps in (roughly) ISO 8601 format, with stat, # and those can be compared using simple string comparison. - + status=$(stat -c %y "$DATADIR/lc-status.html") request=$(stat -c %y "$DATADIR/request.timestamp") test "$request" = "$status" || test "$request" '<' "$status" -- cgit v1.2.1