diff options
author | Peter Stachowski <peter@tesora.com> | 2016-08-09 17:39:37 -0400 |
---|---|---|
committer | Peter Stachowski <peter@tesora.com> | 2016-08-15 20:11:48 +0000 |
commit | 21f56bc75ce8212e97c9044b6b223bde30eda252 (patch) | |
tree | 03d5636a34285429ead7e4622fb89b6d47dc7dcc /trove/module | |
parent | 980b5d2cc4fe60a4ac259439c58668defa64e893 (diff) | |
download | trove-21f56bc75ce8212e97c9044b6b223bde30eda252.tar.gz |
Module re-apply does not reflect updated values
If you apply a module, remove it, update the module with a new name,
and apply it again, module-query will still show the old name.
This also applies to datastore, datastore_version and type.
All four attributes are now updated correctly and scenario
tests added.
When writing the scenario tests it became evident that resetting
a module from a datastore to all_datastores was broken too,
so this was fixed (along with all_datastore_versions). This
fix required a change to the Trove client as well.
Change-Id: Ic2e9226bcd31c4a79d84ecb7941a47875eabd73d
Depends-On: I0f226f09db08f635c542b27d8d2f898050d327fa
Closes-Bug: #1611525
Closes-Bug: #1612430
Diffstat (limited to 'trove/module')
-rw-r--r-- | trove/module/service.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/trove/module/service.py b/trove/module/service.py index 3f5b87a0..f609454e 100644 --- a/trove/module/service.py +++ b/trove/module/service.py @@ -20,6 +20,7 @@ from oslo_log import log as logging import trove.common.apischema as apischema from trove.common import cfg +from trove.common import exception from trove.common.i18n import _ from trove.common import pagination from trove.common import wsgi @@ -110,12 +111,28 @@ class ModuleController(wsgi.Controller): if 'all_tenants' in body['module']: module.tenant_id = (None if body['module']['all_tenants'] else tenant_id) + ds_changed = False + ds_ver_changed = False if 'datastore' in body['module']: if 'type' in body['module']['datastore']: module.datastore_id = body['module']['datastore']['type'] + ds_changed = True if 'version' in body['module']['datastore']: module.datastore_version_id = ( body['module']['datastore']['version']) + ds_ver_changed = True + if 'all_datastores' in body['module']: + if ds_changed: + raise exception.ModuleInvalid( + reason=_('You cannot set a datastore and specify ' + '--all_datastores')) + module.datastore_id = None + if 'all_datastore_versions' in body['module']: + if ds_ver_changed: + raise exception.ModuleInvalid( + reason=_('You cannot set a datastore version and specify ' + '--all_datastore_versions')) + module.datastore_version_id = None if 'auto_apply' in body['module']: module.auto_apply = body['module']['auto_apply'] if 'visible' in body['module']: |