mirror of
https://github.com/vmware/vsphere-automation-sdk-python.git
synced 2024-11-24 10:19:59 -05:00
Don't pass account link sddc config when no connected account available
This commit is contained in:
parent
c60d430a4f
commit
8799c5d6b5
@ -112,8 +112,14 @@ class CreateDeleteSDDC(object):
|
||||
print('\n# Example: Create a SDDC ({}) in org {}:'.format(
|
||||
self.sddc_name, self.org_id))
|
||||
|
||||
account_id = self.vmc_client.orgs.account_link.ConnectedAccounts.get(
|
||||
self.org_id)[0].id
|
||||
account_linking_config = None
|
||||
|
||||
# Get connected accounts if any
|
||||
account_ids = self.vmc_client.orgs.account_link.ConnectedAccounts.get(
|
||||
self.org_id)
|
||||
|
||||
if len(account_ids) > 0 :
|
||||
account_id = account_ids[0].id
|
||||
|
||||
vpc_map = self.vmc_client.orgs.account_link.CompatibleSubnets.get(
|
||||
org=self.org_id, linked_account_id=account_id).vpc_map
|
||||
@ -123,16 +129,16 @@ class CreateDeleteSDDC(object):
|
||||
raise ValueError('No available subnet for region {}'.format(
|
||||
self.region))
|
||||
|
||||
account_linking_config = AccountLinkSddcConfig(
|
||||
customer_subnet_ids=[customer_subnet_id],
|
||||
connected_account_id=account_id)
|
||||
|
||||
sddc_config = AwsSddcConfig(
|
||||
region=self.region,
|
||||
name=self.sddc_name,
|
||||
account_link_sddc_config=[
|
||||
AccountLinkSddcConfig(
|
||||
customer_subnet_ids=[customer_subnet_id],
|
||||
connected_account_id=account_id)
|
||||
],
|
||||
account_link_sddc_config=[account_linking_config] if account_linking_config else None,
|
||||
provider=os.environ.get('VMC_PROVIDER', SddcConfig.PROVIDER_AWS),
|
||||
num_hosts=1,
|
||||
num_hosts=4,
|
||||
deployment_type=SddcConfig.DEPLOYMENT_TYPE_SINGLEAZ)
|
||||
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user