From 372d2f5bc2858afbb2771a8c96fbcef22f6a8441 Mon Sep 17 00:00:00 2001 From: Fred-sun <37327967+Fred-sun@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:28:47 +0800 Subject: [PATCH] Enable azure_rm_iothub test case (#1641) * Enable azure_rm_iothub test case * Upgrade the azure-mgmt-iothub version to 3.0.0 --- plugins/modules/azure_rm_iothub.py | 5 +++-- requirements.txt | 2 +- tests/integration/targets/azure_rm_iothub/aliases | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/modules/azure_rm_iothub.py b/plugins/modules/azure_rm_iothub.py index 6415b7a9d..29f2da96c 100644 --- a/plugins/modules/azure_rm_iothub.py +++ b/plugins/modules/azure_rm_iothub.py @@ -548,7 +548,7 @@ try: from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common_ext import AzureRMModuleBaseExt - from azure.mgmt.iothub import models as IotHubModels + from azure.mgmt.iothub.v2023_06_30_preview import models as IotHubModels except ImportError: # This is handled in azure_rm_common pass @@ -966,7 +966,8 @@ def to_dict(self, hub): result['fallback_route'] = self.route_to_dict(properties.routing.fallback_route) result['status'] = properties.state result['storage_endpoints'] = self.instance_dict_to_dict(properties.storage_endpoints) - result['identity'] = hub.identity.as_dict() if hub.identity else None + if hasattr(hub, 'identity'): + result['identity'] = hub.identity.as_dict() if hub.identity else None return result diff --git a/requirements.txt b/requirements.txt index d4774b8bb..fd82d0371 100644 --- a/requirements.txt +++ b/requirements.txt @@ -43,7 +43,7 @@ azure-mgmt-hdinsight==9.0.0 azure-mgmt-devtestlabs==9.0.0 azure-mgmt-loganalytics==12.0.0 azure-mgmt-automation==1.0.0 -azure-mgmt-iothub==2.2.0 +azure-mgmt-iothub==3.0.0 azure-iot-hub==2.6.1;platform_machine=="x86_64" azure-mgmt-recoveryservices==2.0.0 azure-mgmt-recoveryservicesbackup==3.0.0 diff --git a/tests/integration/targets/azure_rm_iothub/aliases b/tests/integration/targets/azure_rm_iothub/aliases index cbb31e489..aa77c071a 100644 --- a/tests/integration/targets/azure_rm_iothub/aliases +++ b/tests/integration/targets/azure_rm_iothub/aliases @@ -1,4 +1,3 @@ cloud/azure shippable/azure/group2 destructive -disabled