summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/gitautodeploy.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitautodeploy/gitautodeploy.py')
-rw-r--r--gitautodeploy/gitautodeploy.py25
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