From c61d165f956770f01158000d46b0cba2527254b8 Mon Sep 17 00:00:00 2001 From: Sinny Kumari Date: Apr 20 2018 20:18:17 +0000 Subject: Get back Atomic AMIs and include ap-south-1 and ap-northeast-2 regions With new fedimg-1.2.0 in use, json data from fedmsg AMI upload is a bit different. Now, destination fields doesn't contain EC2 in it. EC2 is defined in a separate field called service. Include messages from topic fedimg.image.upload only if status is completed. For status:started, now extra{} is non-empty and this can causes website build to fail. Signed-off-by: Sinny Kumari --- diff --git a/build.d/globalvar.py b/build.d/globalvar.py index b70f53b..d925a38 100644 --- a/build.d/globalvar.py +++ b/build.d/globalvar.py @@ -324,6 +324,8 @@ EC2_regions = [ region(u'Asia Pacific NE (Tokyo)', u'Tokyo', u'ap-northeast-1'), region(u'Asia Pacific SE (Sydney)', u'Sydney', u'ap-southeast-2'), region(u'South America East (Sāo Paulo)', u'Saopaolo', u'sa-east-1'), + region(u'Asia Pacific (Seoul)', u'Seoul', u'ap-northeast-2'), + region(u'Asia Pacific (Mumbai)', u'Mumbai', u'ap-south-1') ] path_stats={ diff --git a/getfedora.org/build/fedimg_vars.py b/getfedora.org/build/fedimg_vars.py index 3a3ea19..24b2d34 100755 --- a/getfedora.org/build/fedimg_vars.py +++ b/getfedora.org/build/fedimg_vars.py @@ -74,7 +74,6 @@ def collect(release): intermediary = collections.OrderedDict() target = template.format(**release) log.info("Looking for AMIs for %s" % target) - messages = get_messages(target) for message in messages: key = message['msg']['image_name'] @@ -97,7 +96,7 @@ def collect(release): if matches(upload['extra']): ami = upload['extra']['id'] # The region looks like "EC2 (REGION)", so we strip stuff. - region = upload['destination'][5:-1] + region = upload['destination'] results[name][region] = ami shelf['timestamp'] = datetime.utcnow() diff --git a/tools/fedimg_vars_lib.py b/tools/fedimg_vars_lib.py index 408f10f..fed4d24 100755 --- a/tools/fedimg_vars_lib.py +++ b/tools/fedimg_vars_lib.py @@ -62,7 +62,7 @@ def retrieve_messages(): def filter_messages(messages, target): for message in messages: - if target in str(message): + if target in str(message) and 'completed' in str(message): yield message @@ -116,7 +116,7 @@ def sanity_check(globalvar, collected_fedimg_vars): def mocked_fedimg(templates): regions = ['us-east-1', 'ap-northeast-1', 'sa-east-1', 'ap-southeast-1', 'ap-southeast-2', - 'us-west-2', 'us-west-1', 'eu-central-1', 'eu-west-1'] + 'us-west-2', 'us-west-1', 'eu-central-1', 'eu-west-1', 'ap-northeast-2', 'ap-south-1'] mockdata = {} for region in regions: mockdata[region] = 'ami-mocked'