summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lorrycontroller/gitano.py2
-rw-r--r--lorrycontroller/readconf.py26
-rw-r--r--templates/status.tpl2
3 files changed, 25 insertions, 5 deletions
diff --git a/lorrycontroller/gitano.py b/lorrycontroller/gitano.py
index 2de291c..3e36b81 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',
- self.trovehost, stdout + stderr)
+ quoted_args, self.trovehost, stdout + stderr)
raise GitanoCommandFailure(
self.trovehost,
' '.join(gitano_args),
diff --git a/lorrycontroller/readconf.py b/lorrycontroller/readconf.py
index d060067..4aa3161 100644
--- a/lorrycontroller/readconf.py
+++ b/lorrycontroller/readconf.py
@@ -101,7 +101,7 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute):
if not os.path.exists(confdir):
self.git_clone_confgit(confdir)
else:
- self.git_pull_confgit(confdir)
+ self.update_confgit(confdir)
def git_clone_confgit(self, confdir):
url = self.app_settings['confgit-url']
@@ -109,9 +109,29 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute):
logging.info('Cloning %s to %s', url, confdir)
cliapp.runcmd(['git', 'clone', '-b', branch, url, confdir])
- def git_pull_confgit(self, confdir):
+ def update_confgit(self, confdir):
logging.info('Updating CONFGIT in %s', confdir)
- cliapp.runcmd(['git', 'pull'], cwd=confdir)
+
+ # The following sequence makes the working tree mirror
+ # current upstream git repository as closely as possible.
+
+ # Get rid of any local changes. No human is meant to edit
+ # anything locally, but there may be remnants of failed
+ # runs.
+ cliapp.runcmd(['git', 'reset', '--hard'], cwd=confdir)
+
+ # Get rid of any files not known by git. This might be,
+ # say, core dumps.
+ cliapp.runcmd(['git', 'clean', '-fdx'], cwd=confdir)
+
+ # Fetch updates to remote branches.
+ cliapp.runcmd(['git', 'remote', 'update', 'origin'], cwd=confdir)
+
+ # Now move the current HEAD to wherever the remote master
+ # branch is, no questions asked. This doesn't do merging
+ # or any of the other things we don't want in this situation.
+ cliapp.runcmd(
+ ['git', 'reset', '--hard', 'origin/master'], cwd=confdir)
@property
def config_file_name(self):
diff --git a/templates/status.tpl b/templates/status.tpl
index e583883..eef9e95 100644
--- a/templates/status.tpl
+++ b/templates/status.tpl
@@ -75,7 +75,7 @@
% end
<p>See separate list of <a href="/1.0/list-jobs-html">all jobs that
- have ever been started.</a>.</p>
+ have ever been started</a>.</p>
<h2>Run-queue</h2>