~hopem/charms/trusty/cinder/lp1518975

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/utils.py

  • Committer: Corey Bryant
  • Date: 2016-01-04 21:26:14 UTC
  • Revision ID: corey.bryant@canonical.com-20160104212614-a2vyq97xbcxdulm1
[corey.bryant,r=trivial] Sync charm-helpers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
import six
28
28
import traceback
 
29
import uuid
29
30
import yaml
30
31
 
31
32
from charmhelpers.contrib.network import ip
41
42
    log as juju_log,
42
43
    charm_dir,
43
44
    INFO,
 
45
    related_units,
44
46
    relation_ids,
45
47
    relation_set,
46
48
    status_set,
84
86
    ('utopic', 'juno'),
85
87
    ('vivid', 'kilo'),
86
88
    ('wily', 'liberty'),
 
89
    ('xenial', 'mitaka'),
87
90
])
88
91
 
89
92
 
97
100
    ('2014.2', 'juno'),
98
101
    ('2015.1', 'kilo'),
99
102
    ('2015.2', 'liberty'),
 
103
    ('2016.1', 'mitaka'),
100
104
])
101
105
 
102
106
# The ugly duckling
121
125
    ('2.2.2', 'kilo'),
122
126
    ('2.3.0', 'liberty'),
123
127
    ('2.4.0', 'liberty'),
 
128
    ('2.5.0', 'liberty'),
124
129
])
125
130
 
126
131
# >= Liberty version->codename mapping
127
132
PACKAGE_CODENAMES = {
128
133
    'nova-common': OrderedDict([
129
134
        ('12.0.0', 'liberty'),
 
135
        ('13.0.0', 'mitaka'),
130
136
    ]),
131
137
    'neutron-common': OrderedDict([
132
138
        ('7.0.0', 'liberty'),
 
139
        ('8.0.0', 'mitaka'),
133
140
    ]),
134
141
    'cinder-common': OrderedDict([
135
142
        ('7.0.0', 'liberty'),
 
143
        ('8.0.0', 'mitaka'),
136
144
    ]),
137
145
    'keystone': OrderedDict([
138
146
        ('8.0.0', 'liberty'),
 
147
        ('9.0.0', 'mitaka'),
139
148
    ]),
140
149
    'horizon-common': OrderedDict([
141
150
        ('8.0.0', 'liberty'),
 
151
        ('9.0.0', 'mitaka'),
142
152
    ]),
143
153
    'ceilometer-common': OrderedDict([
144
154
        ('5.0.0', 'liberty'),
 
155
        ('6.0.0', 'mitaka'),
145
156
    ]),
146
157
    'heat-common': OrderedDict([
147
158
        ('5.0.0', 'liberty'),
 
159
        ('6.0.0', 'mitaka'),
148
160
    ]),
149
161
    'glance-common': OrderedDict([
150
162
        ('11.0.0', 'liberty'),
 
163
        ('12.0.0', 'mitaka'),
151
164
    ]),
152
165
    'openstack-dashboard': OrderedDict([
153
166
        ('8.0.0', 'liberty'),
 
167
        ('9.0.0', 'mitaka'),
154
168
    ]),
155
169
}
156
170
 
374
388
            'liberty': 'trusty-updates/liberty',
375
389
            'liberty/updates': 'trusty-updates/liberty',
376
390
            'liberty/proposed': 'trusty-proposed/liberty',
 
391
            'mitaka': 'trusty-updates/mitaka',
 
392
            'mitaka/updates': 'trusty-updates/mitaka',
 
393
            'mitaka/proposed': 'trusty-proposed/mitaka',
377
394
        }
378
395
 
379
396
        try:
858
875
        if charm_state != 'active' and charm_state != 'unknown':
859
876
            state = workload_state_compare(state, charm_state)
860
877
            if message:
861
 
                message = "{} {}".format(message, charm_message)
 
878
                charm_message = charm_message.replace("Incomplete relations: ",
 
879
                                                      "")
 
880
                message = "{}, {}".format(message, charm_message)
862
881
            else:
863
882
                message = charm_message
864
883
 
975
994
            action_set({'outcome': 'no upgrade available.'})
976
995
 
977
996
    return ret
 
997
 
 
998
 
 
999
def remote_restart(rel_name, remote_service=None):
 
1000
    trigger = {
 
1001
        'restart-trigger': str(uuid.uuid4()),
 
1002
    }
 
1003
    if remote_service:
 
1004
        trigger['remote-service'] = remote_service
 
1005
    for rid in relation_ids(rel_name):
 
1006
        # This subordinate can be related to two seperate services using
 
1007
        # different subordinate relations so only issue the restart if
 
1008
        # the principle is conencted down the relation we think it is
 
1009
        if related_units(relid=rid):
 
1010
            relation_set(relation_id=rid,
 
1011
                         relation_settings=trigger,
 
1012
                         )