diff options
author | Torben <torben.letorbi@gmail.com> | 2016-07-08 13:55:33 +0200 |
---|---|---|
committer | Torben <torben.letorbi@gmail.com> | 2016-07-08 13:55:33 +0200 |
commit | 651a55b91935b65efeac7a845c1dea5f7ec944a8 (patch) | |
tree | 5ee1b8d23074c5f1b4785513a84ed888d1dd35a5 | |
parent | 84c9cbc1533dab6ba67ece85f9fb371435681918 (diff) | |
download | Git-Auto-Deploy-651a55b91935b65efeac7a845c1dea5f7ec944a8.zip Git-Auto-Deploy-651a55b91935b65efeac7a845c1dea5f7ec944a8.tar.gz Git-Auto-Deploy-651a55b91935b65efeac7a845c1dea5f7ec944a8.tar.bz2 |
Update existing repositories after start
-rw-r--r-- | gitautodeploy/gitautodeploy.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/gitautodeploy/gitautodeploy.py b/gitautodeploy/gitautodeploy.py index c553362..189a9df 100644 --- a/gitautodeploy/gitautodeploy.py +++ b/gitautodeploy/gitautodeploy.py @@ -110,18 +110,21 @@ class GitAutoDeploy(object): 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']) + # Pull repository + logger.debug("Repository %s already present and will be updated" % repo_config['url']) + ret = GitWrapper.pull(repo_config) + if ret == 0: + logger.info("Repository %s successfully pulled" % repo_config['url']) + else: + logger.error("Unable to pull %s branch of repository %s" % (repo_config['branch'], repo_config['url'])) else: - logger.error("Unable to clone %s branch of repository %s" % (repo_config['branch'], repo_config['url'])) + # Clone repository + logger.info("Repository %s not present and needs to be cloned" % repo_config['url']) + 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']) + else: + logger.error("Unable to clone %s branch of repository %s" % (repo_config['branch'], repo_config['url'])) def ssh_key_scan(self): import re |