From ecc4828c914e018c5c1dc56f467c8ed8ab687609 Mon Sep 17 00:00:00 2001 From: Luka Peschke Date: Thu, 8 Aug 2019 10:39:55 +0200 Subject: [PATCH] Fix call to storage.delete() in ScopeEndpoint RPC endpoint This removes the filters on fetcher and collector in the call to storage.delete() in the ScopeEndpoint RPC endpoint. Until now, a filter on the collector and the fetcher were passed to the function, leading to no match from any point. Change-Id: I4ad72870da08d9be7c1e0c27a6c89d6d27c49f8e --- cloudkitty/orchestrator.py | 2 -- cloudkitty/tests/test_orchestrator.py | 13 +++++-------- ...-scope-state-reset-filters-0a1f5ea503bd32a1.yaml | 5 +++++ 3 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 releasenotes/notes/fix-scope-state-reset-filters-0a1f5ea503bd32a1.yaml diff --git a/cloudkitty/orchestrator.py b/cloudkitty/orchestrator.py index f8a858bb..684108e5 100644 --- a/cloudkitty/orchestrator.py +++ b/cloudkitty/orchestrator.py @@ -170,8 +170,6 @@ class ScopeEndpoint(object): try: self._storage.delete(begin=state_dt, end=None, filters={ scope['scope_key']: scope['scope_id'], - 'collector': scope['collector'], - 'fetcher': scope['fetcher'], }) self._state.set_state( scope['scope_id'], diff --git a/cloudkitty/tests/test_orchestrator.py b/cloudkitty/tests/test_orchestrator.py index 9dc7bfb0..9373065e 100644 --- a/cloudkitty/tests/test_orchestrator.py +++ b/cloudkitty/tests/test_orchestrator.py @@ -84,18 +84,15 @@ class ScopeEndpointTest(tests.TestCase): begin=tzutils.utc_to_local( datetime.datetime(2019, 7, 16, 8, 55, 1)), end=None, - filters={ - 'project_id': 'f266f30b11f246b589fd266f85eeec39', - 'collector': 'prometheus', - 'fetcher': 'prometheus'}), + filters={'project_id': 'f266f30b11f246b589fd266f85eeec39'} + ), mock.call( begin=tzutils.utc_to_local( datetime.datetime(2019, 7, 16, 8, 55, 1)), end=None, - filters={ - 'project_id': '4dfb25b0947c4f5481daf7b948c14187', - 'collector': 'gnocchi', - 'fetcher': 'gnocchi'})], any_order=True) + filters={'project_id': '4dfb25b0947c4f5481daf7b948c14187'}, + ) + ], any_order=True) ss.assert_has_calls([ mock.call( diff --git a/releasenotes/notes/fix-scope-state-reset-filters-0a1f5ea503bd32a1.yaml b/releasenotes/notes/fix-scope-state-reset-filters-0a1f5ea503bd32a1.yaml new file mode 100644 index 00000000..3d2b4459 --- /dev/null +++ b/releasenotes/notes/fix-scope-state-reset-filters-0a1f5ea503bd32a1.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + An issue causing data not to be deleted from the storage backend when + resetting a scope's state through the API has been fixed.