From 813ab8a7c6895b9364da19d50e0eb8856b0ab3cf Mon Sep 17 00:00:00 2001 From: Yaarit Hatuka Date: Wed, 12 Jan 2022 05:01:48 +0000 Subject: [PATCH] mgr/telemetry: verify there are new collections when nagging due to a major upgrade When adding a new collection we define whether to nag the user about it. We may add many collections and nag about none of them. However, in case of a major upgrade, we wish to notify the user about these new collections. This commit verifies there are indeed new collections when nagging due to a major upgrade. Signed-off-by: Yaarit Hatuka --- src/pybind/mgr/telemetry/module.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index 4d75bb914da..c30a488fee4 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -1180,8 +1180,15 @@ class Module(MgrModule): return True # user might be opted-in to the most recent collection, or there is no - # new collection which requires nagging about - return self.is_major_upgrade() + # new collection which requires nagging about; thus nag in case it's a + # major upgrade and there are new collections + # (which their own nag == False): + new_collections = False + col_delta = self.collection_delta() + if col_delta is not None and len(col_delta) > 0: + new_collections = True + + return self.is_major_upgrade() and new_collections def init_collection(self) -> None: # We fetch from db the collections the user had already opted-in to. -- 2.39.5