[sysadmin-bin] Call the fetch-username function and populate log-push accordingly (working version)



commit d629a1ca6c5342d2b8c0f6346a28b0d4a088b0c1
Author: Andrea Veri <averi redhat com>
Date:   Mon Nov 13 13:11:21 2017 +0100

    Call the fetch-username function and populate log-push accordingly (working version)

 git/log-push             |    6 +++++-
 gitlab/fetch-username.py |    6 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/git/log-push b/git/log-push
index 5a539bb..189ec5a 100755
--- a/git/log-push
+++ b/git/log-push
@@ -14,7 +14,11 @@ fi
 
 LOG_FILE="$GIT_DIR/gnome_pushlog"
 
-user=$(whoami)
+if [ $(hostname) == 'gitlab.gnome.org' ]; then
+    user=`sudo /home/admin/bin/gitlab/fetch-username.py $GL_USERNAME`
+else
+    user=$(whoami)
+fi
 # RFC 822 date with a fixed UTC timezone (Thu, 05 Feb 2009 19:25:44 +0000)
 date=$(TZ=UTC date -R)
 
diff --git a/gitlab/fetch-username.py b/gitlab/fetch-username.py
index c327a4a..617ccdb 100755
--- a/gitlab/fetch-username.py
+++ b/gitlab/fetch-username.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
-  
+
 import gitlab
-import os
+import sys
 
 execfile('/home/admin/secret/gitlab_ro')
 
@@ -9,7 +9,7 @@ gl = gitlab.Gitlab('https://gitlab.gnome.org', GITLAB_PRIVATE_RO_TOKEN, api_vers
 
 def fetch_username():
 
-    user = os.environ['GL_USERNAME']
+    user = sys.argv[1]
     user = gl.users.list(username='%s' % user)
     user = user[0]
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]