summaryrefslogtreecommitdiff
path: root/lorrycontroller/readconf.py
diff options
context:
space:
mode:
Diffstat (limited to 'lorrycontroller/readconf.py')
-rw-r--r--lorrycontroller/readconf.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/lorrycontroller/readconf.py b/lorrycontroller/readconf.py
index 8f95035..02f11a2 100644
--- a/lorrycontroller/readconf.py
+++ b/lorrycontroller/readconf.py
@@ -99,23 +99,18 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute):
def get_confgit(self):
if self.app_settings['debug-real-confgit']:
confdir = self.app_settings['configuration-directory']
- if not os.path.exists(confdir):
- self.git_clone_confgit(confdir)
- else:
- self.update_confgit(confdir)
+ self.fetch_confgit(confdir)
- def git_clone_confgit(self, confdir):
+ def fetch_confgit(self, confdir):
url = self.app_settings['confgit-url']
- branch = self.app_settings['confgit-branch']
- logging.info('Cloning %s to %s', url, confdir)
- cliapp.runcmd(['git', 'clone', '-b', branch, url, confdir])
+ origin_branch = 'origin/' + self.app_settings['confgit-branch']
+ logging.info('Fetching CONFGIT in %s', confdir)
- def update_confgit(self, confdir):
- logging.info('Updating CONFGIT in %s', confdir)
+ if not os.path.exists(confdir):
+ cliapp.runcmd(['git', 'init', confdir])
# First ensure that the confgit repo is using the correct
# upstream source.
- url = self.app_settings['confgit-url']
cliapp.runcmd(['git', 'remote', 'set-url', 'origin', url], cwd=confdir)
# The following sequence makes the working tree mirror
@@ -136,7 +131,6 @@ class ReadConfiguration(lorrycontroller.LorryControllerRoute):
# 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.
- origin_branch = 'origin/' + self.app_settings['confgit-branch']
cliapp.runcmd(
['git', 'reset', '--hard', origin_branch], cwd=confdir)