From 0c506cb404b72a9956718a64640f7389adbe0098 Mon Sep 17 00:00:00 2001 From: Peter Stachowski Date: Mon, 18 Apr 2016 14:56:59 -0400 Subject: [PATCH] Fixed module-apply on removed module If you apply a module, remove it and then apply it again it would no longer show up in the module-query command. This has been fixed and corresponding tests added to the module scenario run. Also added missing 'object' to ModuleManager class Change-Id: I3302a2547cf88f1da1ba4abca6617981572782d4 Closes-Bug: #1571799 --- ...e-apply-after-remove-97c84c30fb320a46.yaml | 5 ++++ trove/guestagent/module/module_manager.py | 3 +- trove/tests/scenario/groups/module_group.py | 29 ++++++++++++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/fix-module-apply-after-remove-97c84c30fb320a46.yaml diff --git a/releasenotes/notes/fix-module-apply-after-remove-97c84c30fb320a46.yaml b/releasenotes/notes/fix-module-apply-after-remove-97c84c30fb320a46.yaml new file mode 100644 index 0000000000..1e98e77455 --- /dev/null +++ b/releasenotes/notes/fix-module-apply-after-remove-97c84c30fb320a46.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - Fixed issue where module-apply after module-remove + caused module-query to skip reporting on that + module. Bug 1571799 diff --git a/trove/guestagent/module/module_manager.py b/trove/guestagent/module/module_manager.py index 15f844b2e7..6a2c174b79 100644 --- a/trove/guestagent/module/module_manager.py +++ b/trove/guestagent/module/module_manager.py @@ -31,7 +31,7 @@ LOG = logging.getLogger(__name__) CONF = cfg.CONF -class ModuleManager(): +class ModuleManager(object): """This is a Manager utility class (mixin) for managing module-related tasks. """ @@ -72,6 +72,7 @@ class ModuleManager(): status = 'OK' if applied else 'ERROR' admin_only = (not visible or tenant == cls.MODULE_APPLY_TO_ALL or auto_apply) + result['removed'] = None result['status'] = status result['message'] = message result['updated'] = now diff --git a/trove/tests/scenario/groups/module_group.py b/trove/tests/scenario/groups/module_group.py index 7c8cb021c3..f5ea7ce40e 100644 --- a/trove/tests/scenario/groups/module_group.py +++ b/trove/tests/scenario/groups/module_group.py @@ -397,8 +397,35 @@ class ModuleInstanceGroup(TestGroup): self.test_runner.run_module_query_empty() @test(groups=[GROUP, GROUP_MODULE_INSTANCE], - depends_on=[create_inst_with_mods], + depends_on=[module_remove], runs_after=[module_query_empty_after]) + def module_apply_again(self): + """Check that module-apply works a second time.""" + self.test_runner.run_module_apply() + + @test(groups=[GROUP, GROUP_MODULE_INSTANCE], + depends_on=[module_apply], + runs_after=[module_query_empty_after]) + def module_query_after_apply_again(self): + """Check that module-query works after second apply.""" + self.test_runner.run_module_query_after_apply() + + @test(groups=[GROUP, GROUP_MODULE_INSTANCE], + depends_on=[module_apply_again], + runs_after=[module_query_after_apply_again]) + def module_remove_again(self): + """Check that module-remove works again.""" + self.test_runner.run_module_remove() + + @test(groups=[GROUP, GROUP_MODULE_INSTANCE], + depends_on=[module_remove_again]) + def module_query_empty_after_again(self): + """Check that the instance has no modules applied after remove.""" + self.test_runner.run_module_query_empty() + + @test(groups=[GROUP, GROUP_MODULE_INSTANCE], + depends_on=[create_inst_with_mods], + runs_after=[module_query_empty_after_again]) def wait_for_inst_with_mods(self): """Wait for create instance with modules to finish.""" self.test_runner.run_wait_for_inst_with_mods()