mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix blob in non-public azure cloud (#44802)
* fix blob in non-public azure cloud * fix lint * fix typo
This commit is contained in:
parent
b4c148b6ea
commit
b58141555d
1 changed files with 7 additions and 2 deletions
|
@ -155,6 +155,7 @@ try:
|
|||
from azure.mgmt.marketplaceordering import MarketplaceOrderingAgreements
|
||||
from azure.mgmt.trafficmanager import TrafficManagerManagementClient
|
||||
from azure.storage.cloudstorageaccount import CloudStorageAccount
|
||||
from azure.storage.blob import PageBlobService, BlockBlobService
|
||||
from adal.authentication_context import AuthenticationContext
|
||||
from azure.mgmt.sql import SqlManagementClient
|
||||
from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
|
||||
|
@ -534,9 +535,13 @@ class AzureRMModuleBase(object):
|
|||
try:
|
||||
self.log('Create blob service')
|
||||
if storage_blob_type == 'page':
|
||||
return CloudStorageAccount(storage_account_name, account_keys.keys[0].value).create_page_blob_service()
|
||||
return PageBlobService(endpoint_suffix=self._cloud_environment.suffixes.storage_endpoint,
|
||||
account_name=storage_account_name,
|
||||
account_key=account_keys.keys[0].value)
|
||||
elif storage_blob_type == 'block':
|
||||
return CloudStorageAccount(storage_account_name, account_keys.keys[0].value).create_block_blob_service()
|
||||
return BlockBlobService(endpoint_suffix=self._cloud_environment.suffixes.storage_endpoint,
|
||||
account_name=storage_account_name,
|
||||
account_key=account_keys.keys[0].value)
|
||||
else:
|
||||
raise Exception("Invalid storage blob type defined.")
|
||||
except Exception as exc:
|
||||
|
|
Loading…
Reference in a new issue