Commit 339537d Merge #847 `Fix atomic download urls with updated twoweek fedmsg structure`

1 file Merged and Committed by dustymabe 4 days ago
 1 @@ -145,7 +145,7 @@
 2               continue
 3   
 4           # Parse the composedate out of the image_name
 5 -         image_name = message['msg']['atomic_qcow2']['image_name']
 6 +         image_name = message['msg']['x86_64']['atomic_qcow2']['image_name']
 7           composedate = '.'.join(image_name.split('-')[-1].split('.')[:-2])
 8           log.info("    Found composedate: %s" % composedate)
 9           results['release'][composedate_prefix + 'atomic_composedate'] = composedate
10 @@ -161,8 +161,9 @@
11               'atomic_raw': 'atomic_raw_cloud',
12               'atomic_vagrant_libvirt': 'atomic_libvag_cloud',
13               'atomic_vagrant_virtualbox': 'atomic_VBvag_cloud',
14 +             'atomic_dvd_ostree': 'atomic_dvd_iso',
15           }
16 -         for key, entry in message['msg'].items():
17 +         for key, entry in message['msg']['x86_64'].items():
18               # There are some other keys in there we don't care about.
19               if not key.startswith('atomic_'):
20                   continue
21 @@ -173,12 +174,8 @@
22               if not url.startswith('http'):
23                   url = DL_URL_PREFIX + url
24                   download_url = download_fpo + entry['image_url']
25 -             response = requests.head(url)
26 -             if not bool(response):
27 -                 log.error("Failed to HEAD %s for size.  %r" % (url, response))
28 -                 continue
29   
30 -             length = int(response.headers['content-length']) / 1000000
31 +             length = int(entry['size']) / (1024 * 1024)
32               # Provide the download URL
33               url_key = mapping[key] + "_url"
34               results['release'][url_key] = download_url
35 @@ -193,20 +190,6 @@
36               iso_size_key = iso_size_prefix + mapping[key]
37               results['iso_size'][iso_size_key] = str(length)
38   
39 -     # Special case for Atomic ISO latest redirect rule mapping because it's
40 -     # not included in fedmsg data
41 -     atomic_iso_filename = "Fedora-AtomicHost-ostree-x86_64-{}-{}.iso".format(
42 -         globalvar.release['curr_atomic_id'],
43 -         results['release'][composedate_prefix + 'atomic_composedate']
44 -     )
45 -     results['release']['redir_map']['atomic_iso'] = {}
46 -     results['release']['redir_map']['atomic_iso']['redirect'] = \
47 -         globalvar.path['download_atomic'] + "/stable/Fedora-AtomicHost-" + \
48 -         globalvar.release['curr_atomic_id'] + '-' + \
49 -         results['release'][composedate_prefix + 'atomic_composedate'] + \
50 -         "/AtomicHost/x86_64/iso/{}".format(atomic_iso_filename)
51 -     results['release']['redir_map']['atomic_iso']['filename'] = atomic_iso_filename
52 - 
53       return results
54   
55