Ryan Lane has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/89495


Change subject: Salt 0.17 compatibility for deployment scripts
......................................................................

Salt 0.17 compatibility for deployment scripts

Between an older salt release and 0.17 salt-call pillar results
were returned directly, rather than including them within a 'local'
hash. Having a 'local' hash makes peer returned pillar results and
salt master returned pillar results more consistent.

This change adds in a conditional to check if local is available
to provide backwards compatibility for our current version of salt.
After we've upgraded I'll remove it.

Change-Id: I385267b28151f476a3317f8a771dff008358e521
---
M modules/deployment/files/git-deploy/hooks/deploylib.py
M modules/deployment/files/git-deploy/utils/deploy-info
2 files changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/95/89495/1

diff --git a/modules/deployment/files/git-deploy/hooks/deploylib.py 
b/modules/deployment/files/git-deploy/hooks/deploylib.py
index 3c1a226..2221ec5 100755
--- a/modules/deployment/files/git-deploy/hooks/deploylib.py
+++ b/modules/deployment/files/git-deploy/hooks/deploylib.py
@@ -19,7 +19,10 @@
                              stderr=subprocess.PIPE)
         out = p.communicate()[0]
         try:
-            pillar = json.loads(out)
+            if 'local' in pillar:
+                pillar = json.loads(out)['local']
+            else:
+                pillar = json.loads(out)
             try:
                 repo_config = pillar['repo_config'][prefix]
                 parent_dir = pillar['deployment_config']['parent_dir']
diff --git a/modules/deployment/files/git-deploy/utils/deploy-info 
b/modules/deployment/files/git-deploy/utils/deploy-info
index 06cafcb..929ba59 100644
--- a/modules/deployment/files/git-deploy/utils/deploy-info
+++ b/modules/deployment/files/git-deploy/utils/deploy-info
@@ -22,8 +22,11 @@
     serv = redis.Redis(host='localhost', port=6379, db=0)
     p = subprocess.Popen("sudo salt-call -l quiet --out json pillar.data", 
shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     out = p.communicate()[0]
-    try:   
-        pillar = json.loads(out)
+    try:
+        if 'local' in pillar:
+            pillar = json.loads(out)['local']
+        else:
+            pillar = json.loads(out)
     except ValueError:
         print "JSON data wasn't loaded from the pillar call. git-deploy can't 
configure itself. Exiting."
         return None

-- 
To view, visit https://gerrit.wikimedia.org/r/89495
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I385267b28151f476a3317f8a771dff008358e521
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ryan Lane <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to