Move gbs_update_dashboard to gbsutils.py 64/170564/1
authorhyokeun <hyokeun.jeon@samsung.com>
Wed, 21 Feb 2018 00:09:56 +0000 (09:09 +0900)
committerhyokeun <hyokeun.jeon@samsung.com>
Wed, 21 Feb 2018 00:09:56 +0000 (09:09 +0900)
Change-Id: I162936d79bfb4964f9363cc8ec1eeb72921273ad

common/buildmonitor_extention.py
common/gbsutils.py

index b7c3be4..28246ed 100644 (file)
@@ -669,20 +669,4 @@ def find_my_ip():
     except Exception as err:
         return '0.0.0.0'
 
-def gbs_update_dashboard(raw_data, via='trigger'):
-    raw_data["_timestamp"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
-    raw_data["_worker"] = {"node_name": os.getenv('NODE_NAME'),
-                          "ip": find_my_ip()}
-    if via == 'trigger':
-        trigger_next("DASHBOARD_UPDATE_%s" % raw_data.get("tag").replace('/', '_'), raw_data)
-    else:
-        try:
-            encoded_data = base64.b64encode(json.dumps(raw_data))
-            remote_jenkins_build_job(os.getenv('JENKINS_URL_INTERNAL'), \
-                                     os.getenv('JENKINS_USER'), \
-                                     os.getenv('JENKINS_PW'), \
-                                     jobname=os.getenv('DASHBOARD_UPDATE_JOB_NAME'), \
-                                     data='TRIGGER_INFO="%s"' % (quote_plus(encoded_data)))
-        except Exception as err:
-            trigger_next("DASHBOARD_UPDATE_%s" % raw_data.get("tag").replace('/', '_'), raw_data)
 
index 99934a9..aa49a44 100644 (file)
@@ -29,8 +29,9 @@ import base64
 import json
 from common.git import Git, clone_gitproject
 from common.utils import sync
-from common.buildtrigger import remote_jenkins_build_job
+from common.buildtrigger import remote_jenkins_build_job, trigger_next
 from urllib import quote_plus
+from datetime import datetime
 
 class RuntimeException(Exception):
     """Local error handler"""
@@ -756,3 +757,20 @@ class GBSBuild:
 
         return rpm_file_info
 
+def gbs_update_dashboard(raw_data, via='trigger'):
+    raw_data["_timestamp"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+    raw_data["_worker"] = {"node_name": os.getenv('NODE_NAME'),
+                          "ip": find_my_ip()}
+    if via == 'trigger':
+        trigger_next("DASHBOARD_UPDATE_%s" % raw_data.get("tag").replace('/', '_'), raw_data)
+    else:
+        try:
+            encoded_data = base64.b64encode(json.dumps(raw_data))
+            remote_jenkins_build_job(os.getenv('JENKINS_URL_INTERNAL'), \
+                                     os.getenv('JENKINS_USER'), \
+                                     os.getenv('JENKINS_PW'), \
+                                     jobname=os.getenv('DASHBOARD_UPDATE_JOB_NAME'), \
+                                     data='TRIGGER_INFO="%s"' % (quote_plus(encoded_data)))
+        except Exception as err:
+            trigger_next("DASHBOARD_UPDATE_%s" % raw_data.get("tag").replace('/', '_'), raw_data)
+