+"""A build trigger"""
+
import base64
try:
import json
from common.utils import unicode_to_str
def trigger_next(job_name, data):
- print "====LOG:TRIGGER_NEXT:%s ========================================" %job_name.upper()
- with open("%s.env" %job_name, 'w') as fh:
- fh.write('TRIGGER_INFO=%s\n' % base64.b64encode(json.dumps(data)))
+ """Trigger next job"""
+
+ print "====LOG:TRIGGER_NEXT:%s =======================" % job_name.upper()
+ with open("%s.env" % job_name, 'w') as info_file:
+ info_file.write('TRIGGER_INFO=%s\n' % \
+ base64.b64encode(json.dumps(data)))
for key in data.keys():
- print "%s='%s'" %(key, data[key])
- print "====LOG:TRIGGER_NEXT:========================================end=="
+ print "%s='%s'" % (key, data[key])
+ print "====LOG:TRIGGER_NEXT:======================end=="
+
+def trigger_info(_trigger_info):
+ "Return a trigger info dict"""
-def trigger_info(TRIGGER_INFO):
- print "====LOG:TRIGGER_INFO:========================================"
- content_dict = unicode_to_str(json.loads(base64.b64decode(TRIGGER_INFO)))
+ print "====LOG:TRIGGER_INFO:==========================="
+ content_dict = unicode_to_str(json.loads(base64.b64decode(_trigger_info)))
print json.dumps(content_dict, indent = 4)
- print "====LOG:TRIGGER_INFO:========================================end=="
+ print "====LOG:TRIGGER_INFO:======================end=="
return content_dict