summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/gitautodeploy.py
diff options
context:
space:
mode:
authorOliver Poignant <oliver@poignant.se>2016-08-26 22:48:24 +0200
committerOliver Poignant <oliver@poignant.se>2016-08-26 22:48:24 +0200
commitd23233780c4223404b9585b52d3bc993b5626b67 (patch)
tree00653bb61ffc0d03d92d3187d87a3178c4a60122 /gitautodeploy/gitautodeploy.py
parent4a40a946b8ff0da5d119fce57d872b597b8377b3 (diff)
parent0526f410b5dad1f97efc7c651e3afa55c831fb03 (diff)
downloadGit-Auto-Deploy-d23233780c4223404b9585b52d3bc993b5626b67.zip
Git-Auto-Deploy-d23233780c4223404b9585b52d3bc993b5626b67.tar.gz
Git-Auto-Deploy-d23233780c4223404b9585b52d3bc993b5626b67.tar.bz2
Merge branch 'feature/update-branch-when-changed-in-config' of git://github.com/letorbi/Git-Auto-Deploy into letorbi-feature/update-branch-when-changed-in-config
Diffstat (limited to 'gitautodeploy/gitautodeploy.py')
-rw-r--r--gitautodeploy/gitautodeploy.py30
1 files changed, 6 insertions, 24 deletions
diff --git a/gitautodeploy/gitautodeploy.py b/gitautodeploy/gitautodeploy.py
index 21f1f16..5d67851 100644
--- a/gitautodeploy/gitautodeploy.py
+++ b/gitautodeploy/gitautodeploy.py
@@ -97,31 +97,10 @@ class GitAutoDeploy(object):
# Iterate over all configured repositories
for repo_config in self._config['repositories']:
- # Only clone repositories with a configured path
- if 'url' not in repo_config:
- logger.critical("Repository has no configured URL")
- self.close()
- self.exit()
- return
-
- # Only clone repositories with a configured path
- if 'path' not in repo_config:
- logger.debug("Repository %s will not be cloned (no path configured)" % repo_config['url'])
- continue
-
if os.path.isdir(repo_config['path']) and os.path.isdir(repo_config['path']+'/.git'):
- logger.debug("Repository %s already present" % repo_config['url'])
- continue
-
- logger.info("Repository %s not present and needs to be cloned" % repo_config['url'])
-
- # Clone repository
- ret = GitWrapper.clone(url=repo_config['url'], branch=repo_config['branch'], path=repo_config['path'])
-
- if ret == 0 and os.path.isdir(repo_config['path']):
- logger.info("Repository %s successfully cloned" % repo_config['url'])
+ GitWrapper.init(repo_config)
else:
- logger.error("Unable to clone %s branch of repository %s" % (repo_config['branch'], repo_config['url']))
+ GitWrapper.clone(repo_config)
def ssh_key_scan(self):
import re
@@ -476,7 +455,10 @@ def main():
config['repositories'].append(repo_config)
# Initialize config by expanding with missing values
- init_config(config)
+ if init_config(config) != 0:
+ app.close()
+ app.exit()
+ return
app.setup(config)
app.serve_forever()