From d14eb3037f88cb0b85b16e44a7cb5c4a0e54e20d Mon Sep 17 00:00:00 2001 From: Mario Lenz Date: Thu, 26 Oct 2023 19:04:35 +0200 Subject: [PATCH] Module util vmware_rest_client: Remove get_tag_by_category (#1899) Module util vmware_rest_client: Remove get_tag_by_category SUMMARY Fixes: #1898 Remove get_tag_by_category(). It's deprecated and not used anymore in the collection. ISSUE TYPE Feature Pull Request COMPONENT NAME vmware_rest_client ADDITIONAL INFORMATION #1605 --- .../fragments/1898-vmware_rest_client.yml | 2 ++ plugins/module_utils/vmware_rest_client.py | 33 ------------------- 2 files changed, 2 insertions(+), 33 deletions(-) create mode 100644 changelogs/fragments/1898-vmware_rest_client.yml diff --git a/changelogs/fragments/1898-vmware_rest_client.yml b/changelogs/fragments/1898-vmware_rest_client.yml new file mode 100644 index 000000000..f8b50e5cf --- /dev/null +++ b/changelogs/fragments/1898-vmware_rest_client.yml @@ -0,0 +1,2 @@ +breaking_changes: + - vmware_rest_client - Remove deprecated method `get_tag_by_category()` (https://github.com/ansible-collections/community.vmware/issues/1898). diff --git a/plugins/module_utils/vmware_rest_client.py b/plugins/module_utils/vmware_rest_client.py index c98496c2b..b56652d44 100644 --- a/plugins/module_utils/vmware_rest_client.py +++ b/plugins/module_utils/vmware_rest_client.py @@ -539,36 +539,3 @@ def get_tag_by_category_name(self, tag_name=None, category_name=None): category_id = category_obj.id return self.get_tag_by_category_id(tag_name=tag_name, category_id=category_id) - - def get_tag_by_category(self, tag_name=None, category_name=None, category_id=None): - """ - Return tag object by name and category name specified - Args: - tag_name: Name of tag - category_name: Name of category (mutually exclusive with 'category_id') - category_id: Id of category, if known in advance (mutually exclusive with 'category_name') - Returns: Tag object if found else None - """ - message = "The method 'get_tag_by_category' is deprecated and scheduled for removal. "\ - "Please update your code and use 'get_tag_by_category_id' or 'get_tag_by_category_name' instead" - self.module.deprecate(message, version='4.0.0', collection_name='community.vmware') - - if not tag_name: - return None - - if category_id or category_name: - if not category_id: - category_obj = self.get_category_by_name(category_name=category_name) - - if not category_obj: - return None - - category_id = category_obj.id - - for tag_object in self.api_client.tagging.Tag.list_tags_for_category(category_id): - tag_obj = self.api_client.tagging.Tag.get(tag_object) - - if tag_obj.name == tag_name: - return tag_obj - else: - return self.search_svc_object_by_name(service=self.api_client.tagging.Tag, svc_obj_name=tag_name)