remove explicit provider reg from azure_rm (#31369)

* now that it's handled automatically as of msrest > 0.4.9
pull/23568/merge
Matt Davis 7 years ago committed by GitHub
parent efe3c94b1b
commit 13e89b17cc

@ -677,19 +677,6 @@ class AzureRMModuleBase(object):
return self.get_poller_result(poller)
def _register(self, key):
try:
# We have to perform the one-time registration here. Otherwise, we receive an error the first
# time we attempt to use the requested client.
resource_client = self.rm_client
resource_client.providers.register(key)
except Exception as exc:
self.log("One-time registration of {0} failed - {1}".format(key, str(exc)))
self.log("You might need to register {0} using an admin account".format(key))
self.log(("To register a provider using the Python CLI: "
"https://docs.microsoft.com/azure/azure-resource-manager/"
"resource-manager-common-deployment-errors#noregisteredproviderfound"))
@property
def storage_client(self):
self.log('Getting storage client...')
@ -701,7 +688,6 @@ class AzureRMModuleBase(object):
base_url=self._cloud_environment.endpoints.resource_manager,
api_version='2017-06-01'
)
self._register('Microsoft.Storage')
return self._storage_client
@property
@ -715,7 +701,6 @@ class AzureRMModuleBase(object):
base_url=self._cloud_environment.endpoints.resource_manager,
api_version='2017-06-01'
)
self._register('Microsoft.Network')
return self._network_client
@property
@ -742,7 +727,6 @@ class AzureRMModuleBase(object):
base_url=self._cloud_environment.endpoints.resource_manager,
api_version='2017-03-30'
)
self._register('Microsoft.Compute')
return self._compute_client
@property
@ -755,7 +739,6 @@ class AzureRMModuleBase(object):
self.subscription_id,
base_url=self._cloud_environment.endpoints.resource_manager,
)
self._register('Microsoft.Dns')
return self._dns_client
@property
@ -768,7 +751,6 @@ class AzureRMModuleBase(object):
subscription_id=self.subscription_id,
base_url=self.base_url
)
self._register('Microsoft.Web')
return self._web_client
@property
@ -779,5 +761,4 @@ class AzureRMModuleBase(object):
self.azure_credentials,
self.subscription_id
)
self._register('Microsoft.ContainerService')
return self._containerservice_client

Loading…
Cancel
Save