From a2710a98d95e460a2b6c1c7921360eb12f6d2bd8 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Fri, 17 Apr 2015 07:39:44 -0700 Subject: [PATCH] Only consider the last interesting event when checking traits. Was previously looking at the last .start event when comparing important traits against the .exists event. Now it will look at the last important .end event it found (if any). For delete operations, it will be the last event in the chain. This may need to change to a specific event as well, like compute.instance.delete.end or something. Change-Id: Ie85e69716cd730c3546d06bae28e52e0c301940f --- setup.cfg | 2 +- tests/test_usage_handler.py | 2 +- winchester/pipeline_handler.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/setup.cfg b/setup.cfg index 0cc643b..49d621e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] description-file = README.md name = winchester -version = 0.54 +version = 0.55 author = Monsyne Dragon author_email = mdragon@rackspace.com summary = An OpenStack notification event processing library. diff --git a/tests/test_usage_handler.py b/tests/test_usage_handler.py index e3453c4..710064a 100644 --- a/tests/test_usage_handler.py +++ b/tests/test_usage_handler.py @@ -268,7 +268,7 @@ class TestUsageHandler(unittest.TestCase): @mock.patch.object(pipeline_handler.UsageHandler, '_find_deleted_events') @mock.patch.object(pipeline_handler.UsageHandler, '_confirm_delete') def test_do_check_interesting(self, cd, fde, inee, vf, gcf, cla): - block = [{'event_type': 'compute.instance.rebuild.start', + block = [{'event_type': 'compute.instance.rebuild.end', 'message_id': 1}] exists = {'event_type': 'compute.instance.exists', 'message_id': 2} diff --git a/winchester/pipeline_handler.py b/winchester/pipeline_handler.py index 094eccb..22016e3 100644 --- a/winchester/pipeline_handler.py +++ b/winchester/pipeline_handler.py @@ -291,7 +291,7 @@ class UsageHandler(PipelineHandlerBase): raise UsageException("U7", "Multiple .delete.end events") if delete_events: - self._verify_fields(exists, delete_events[0], fields) + self._verify_fields(exists, delete_events[-1], fields) def _confirm_launched_at(self, block, exists): if exists.get('state') != 'active': @@ -319,9 +319,9 @@ class UsageHandler(PipelineHandlerBase): 'os_architecture', 'os_version', 'os_distro'] def _do_checks(self, block, exists): - interesting = ['compute.instance.rebuild.start', - 'compute.instance.resize.prep.start', - 'compute.instance.rescue.start'] + interesting = ['compute.instance.rebuild.end', + 'compute.instance.resize.prep.end', + 'compute.instance.rescue.end'] self._confirm_launched_at(block, exists)