diff options
author | Mehdi Abaakouk <sileht@redhat.com> | 2017-01-05 07:32:28 +0100 |
---|---|---|
committer | Mehdi Abaakouk <sileht@redhat.com> | 2017-01-05 09:41:10 +0100 |
commit | 407b726fc2ba76a7a149a8722b7cf9b09d8dc0d3 (patch) | |
tree | f15e7baa1c42f2307702a841105f2f1269abfc08 /ceilometer/gnocchi_client.py | |
parent | 75539b272585daef7c51bd063713bc8204bc0853 (diff) | |
download | ceilometer-407b726fc2ba76a7a149a8722b7cf9b09d8dc0d3.tar.gz |
upgrade: fix gnocchi resource update
This fix the gnocchi upgrade code.
Also it makes devstack fail if the upgrade don't work.
Change-Id: I658adf71fb997b63daeb2a56d9a6303103ef446d
Diffstat (limited to 'ceilometer/gnocchi_client.py')
-rw-r--r-- | ceilometer/gnocchi_client.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ceilometer/gnocchi_client.py b/ceilometer/gnocchi_client.py index e0a19427..8f7cff86 100644 --- a/ceilometer/gnocchi_client.py +++ b/ceilometer/gnocchi_client.py @@ -98,7 +98,8 @@ resources_update_operation = [ "type": "update_attribute_type", "resource_type": "volume", "data": { - "attribute": "/attributes/volume_type", + "op": "add", + "path": "/attributes/volume_type", "value": {"type": "string", "min_length": 0, "max_length": 255, "required": False}}}, ] @@ -119,6 +120,12 @@ def upgrade_resource_types(conf): for op in resources_update_operation: if op['type'] == 'update_attribute_type': + rt = gnocchi.resource_type.get(name=op['resource_type']) + attrib = op['data']['path'].replace('/attributes', '') + if op['data']['op'] == 'add' and attrib in rt['attributes']: + continue + if op['data']['op'] == 'remove' and attrib not in rt['attributes']: + continue try: gnocchi.resource_type.update(op['resource_type'], op['data']) except Exception: |