Giuseppe Lavagetto has uploaded a new change for review.
https://gerrit.wikimedia.org/r/266231
Change subject: deployment: allow fixing the git remote repository
......................................................................
deployment: allow fixing the git remote repository
Change-Id: Ied4bcde607cb1b86f9fed555e2b179daedda858c
---
M modules/deployment/files/modules/deploy.py
1 file changed, 24 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/31/266231/1
diff --git a/modules/deployment/files/modules/deploy.py
b/modules/deployment/files/modules/deploy.py
index b0cfeae..d6a96cc 100644
--- a/modules/deployment/files/modules/deploy.py
+++ b/modules/deployment/files/modules/deploy.py
@@ -770,3 +770,27 @@
return {'status': status, 'repo': repo, 'dependencies': depstats}
else:
return {}
+
+
+def _fix_remote(repo, repo_config, server):
+ cmd = '/usr/bin/git remote set-url origin {0}/.git'.format(
+ repo_config['url'])
+ status = __salt__['cmd.retcode'](cmd, cwd=config['location'])
+ if status != 0:
+ return status
+
+
+def fixurl(git_server):
+ """
+ Allows to recursively fix all the remotes in git repositories on a target.
+ """
+ repo_config = __pillar__.get('repo_config')
+ deployment_target = __grains__.get('deployment_target')
+ for repo in repo_config:
+ if repo not in deployment_target:
+ continue
+ conf = get_config(repo)
+ # If it has not been checked out, there is no reason to fix the url
+ if not __salt__['file.directory_exists'](conf['location']):
+ continue
+ _fix_remote(repo, conf, git_server)
--
To view, visit https://gerrit.wikimedia.org/r/266231
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied4bcde607cb1b86f9fed555e2b179daedda858c
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits