From c29fe66edf7972dc8dd49f6216af2a2cfbe6add4 Mon Sep 17 00:00:00 2001 From: Timur Evdokimov Date: Thu, 7 Jun 2018 08:53:05 +0200 Subject: [PATCH] fixed passing non-default base_url from explicitly set cloud_environment (#40225) --- lib/ansible/module_utils/azure_rm_common.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/azure_rm_common.py b/lib/ansible/module_utils/azure_rm_common.py index 4597e46556..e7cbd0fe18 100644 --- a/lib/ansible/module_utils/azure_rm_common.py +++ b/lib/ansible/module_utils/azure_rm_common.py @@ -926,6 +926,10 @@ class AzureRMModuleBase(object): client_argspec = inspect.getargspec(client_type.__init__) + if not base_url: + # most things are resource_manager, don't make everyone specify + base_url = self._cloud_environment.endpoints.resource_manager + client_kwargs = dict(credentials=self.azure_credentials, subscription_id=self.subscription_id, base_url=base_url) api_profile_dict = {} @@ -933,10 +937,6 @@ class AzureRMModuleBase(object): if self.api_profile: api_profile_dict = self.get_api_profile(client_type.__name__, self.api_profile) - if not base_url: - # most things are resource_manager, don't make everyone specify - base_url = self._cloud_environment.endpoints.resource_manager - # unversioned clients won't accept profile; only send it if necessary # clients without a version specified in the profile will use the default if api_profile_dict and 'profile' in client_argspec.args: