juju_scaleway.get_images()   B
last analyzed

Complexity

Conditions 5

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 5
dl 0
loc 11
rs 8.5455
1
# -*- coding: utf-8 -*-
2
#
3
# Copyright (c) 2014-2015 Online SAS and Contributors. All Rights Reserved.
4
#                         Edouard Bonlieu <[email protected]>
5
#                         Julien Castets <[email protected]>
6
#                         Manfred Touron <[email protected]>
7
#                         Kevin Deldycke <[email protected]>
8
#
9
# Licensed under the BSD 2-Clause License (the "License"); you may not use this
10
# file except in compliance with the License. You may obtain a copy of the
11
# License at http://opensource.org/licenses/BSD-2-Clause
12
13
SERIES_MAP = {
14
    'Ubuntu Utopic (14.10)': 'utopic',
15
    'Ubuntu Trusty (14.04 LTS)': 'trusty',
16
}
17
18
19
def get_images(client):
20
    images = {}
21
    for i in client.get_images():
22
        if not i.public:
23
            continue
24
25
        for serie in SERIES_MAP:
26
            if ("%s" % serie) == i.name:
27
                images[SERIES_MAP[serie]] = i.id
28
29
    return images
30