Rfaulk has uploaded a new change for review.

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


Change subject: add - check lock file user, _get_current_lock_user.
......................................................................

add - check lock file user, _get_current_lock_user.

Change-Id: Idc49e108abe2d4a0f08415abebaf79313e54ed94
---
M sartoris/sartoris.py
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/17/82217/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 5b36fee..7c32539 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -234,6 +234,9 @@
 
         self.config['sync_dir'] = '{0}/sync'.format(self.config['hook_dir'])
 
+    def _get_current_lock_user(self):
+        return self.config['user']
+
     def _check_lock(self):
         """ Returns boolean flag on lock file existence """
         cmd = "ssh {0}@{1} ls {2}/{3}/{4}".format(
@@ -243,12 +246,17 @@
             self.DEPLOY_DIR,
             self.LOCK_FILE_HANDLE)
 
-        log.debug('{0}:: Executing - {1}'.format(__name__, cmd))
+        log.debug('{0} :: Executing - {1}'.format(__name__, cmd))
         proc = subprocess.Popen(cmd.split(),
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
         result = proc.communicate()[0].split('\n')
-        log.debug('{0}:: Result of {1} - {2}'.format(__name__, cmd, result))
+        log.debug('{0} :: Result of {1} - {2}'.format(__name__, cmd, result))
+
+        # lock file exists - check to ensure that the lock file user matches
+        if self._get_current_lock_user() != self.config['user']:
+            log.info('{0} :: Lock user doesn\'t match'.format(__name__))
+            return False
 
         if not proc.returncode:
             if result[0].strip() == self.LOCK_FILE_HANDLE:

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc49e108abe2d4a0f08415abebaf79313e54ed94
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk <[email protected]>

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

Reply via email to