~corey.bryant/ubuntu-reports/upstream-final

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/python

import sys
import logging

CURRENT_UBUNTU_STABLE = 'precise'
CURRENT_UBUNTU_DEV = 'trusty'

# map openstack releases to ubuntu releases
VERSION_MAP = {
    'folsom': {
        'ubuntu_stable': 'precise',
        'ubuntu_dev': 'quantal',
    },
    'grizzly': {
        'ubuntu_stable': 'precise',
        'ubuntu_dev': 'raring',
    },
    'havana': {
        'ubuntu_stable': 'precise',
        'ubuntu_dev': 'saucy',
    },
    'icehouse': {
        'ubuntu_stable': 'precise',
        'ubuntu_dev': 'trusty',
    },
    'juno': {
        'ubuntu_stable': 'trusty',
        'ubuntu_dev': 'utopic',
    },
    'kilo': {
        'ubuntu_stable': 'trusty',
        'ubuntu_dev': 'vivid',
    },
    'liberty': {
        'ubuntu_stable': 'trusty',
        'ubuntu_dev': 'wily',
    },
    'cloud-tools': {
        'ubuntu_stable': CURRENT_UBUNTU_STABLE,
        'ubuntu_dev': 'trusty',
    },
    'cloud-tools-next': {
        'ubuntu_stable': CURRENT_UBUNTU_STABLE,
        'ubuntu_dev': 'trusty',
        'staging_ppa': 'cloud-tools-next',
        'ca_pockets': [],
    }
}

CA_PACKAGES_URL = ("http://ubuntu-cloud.archive.canonical.com/ubuntu/dists/"
                   "%s-%s/%s/main/source/Sources.gz")


def packages_url(os_release, pocket):
    ubuntu_stable = VERSION_MAP[os_release]['ubuntu_stable']

    try:
        url = CA_PACKAGES_URL % (ubuntu_stable,
                                 pocket,
                                 os_release)
        return url
    except:
        logging.error('Couldnt determine packages URL.')
        sys.exit(1)