@@ -35,12 +35,13 @@ def main(tenant_id_arg, client_id_arg, client_secret_arg, subscription_id_arg, u
3535 resource_name_vnet = 'vnet_resource_group'
3636 # Deploy a resource group with a virtual network and specified number of subnets
3737 try :
38- subnet_name , vnet_name = DeployOp .create_vnet (credentials ,
38+ subnet_name_list , vnet_name = DeployOp .create_vnet (credentials ,
3939 subscription_id ,
4040 location ,
4141 subnets_cidr ,
4242 resource_name_vnet ,
4343 vnet_cidr )
44+ subnet_name = subnet_name_list [0 ]
4445 network_client = NetworkManagementClient (credentials , subscription_id )
4546 # Add service endpoint to subnets
4647 subnet = network_client .subnets .get (resource_name_vnet , vnet_name , subnet_name )
@@ -49,7 +50,7 @@ def main(tenant_id_arg, client_id_arg, client_secret_arg, subscription_id_arg, u
4950 subnet .service_endpoints .append (
5051 ServiceEndpointPropertiesFormat (service = 'Microsoft.Storage' )
5152 )
52- updated_subnet = network_client .subnets .create_or_update (
53+ updated_subnet = network_client .subnets .begin_create_or_update (
5354 resource_name_vnet ,
5455 vnet_name ,
5556 subnet_name ,
@@ -73,7 +74,7 @@ def main(tenant_id_arg, client_id_arg, client_secret_arg, subscription_id_arg, u
7374 "Deploy to New or Existing Virtual Network" : "existing" ,
7475 "Name of Virtual Network Where MATLAB Web App Server Will Be Deployed" : vnet_name ,
7576 "Virtual Network CIDR Range" : vnet_cidr ,
76- "Name of Subnet for MATLAB Web App Server" : subnet_name [ 0 ] ,
77+ "Name of Subnet for MATLAB Web App Server" : subnet_name ,
7778 "Server Subnet CIDR Range" : subnets_cidr [0 ],
7879 "Specify Private IP Address to VM Hosting MATLAB Web App Server" : '10.1.0.4' ,
7980 "Resource Group Name Of Virtual Network" : resource_name_vnet ,
@@ -84,7 +85,10 @@ def main(tenant_id_arg, client_id_arg, client_secret_arg, subscription_id_arg, u
8485 res = requests .get (
8586 f"https://github.com/mathworks-ref-arch/{ ref_arch_name } /tree/main/releases/"
8687 )
87- latest_releases = [re .findall ("releases/(R\d{4}[ab]\\ b)" , res .text )[- 1 ], re .findall ("releases/(R\d{4}[ab]\\ b)" , res .text )[- 2 ]]
88+ latest_releases = [
89+ re .findall (r"releases/(R\d{4}[ab]\b)" , res .text )[- 1 ],
90+ re .findall (r"releases/(R\d{4}[ab]\b)" , res .text )[- 2 ]
91+ ]
8892 for i in range (2 ):
8993 matlab_release = latest_releases [i ]
9094 print ("Testing Health Check Release: " + matlab_release + "\n " )
@@ -114,15 +118,17 @@ def main(tenant_id_arg, client_id_arg, client_secret_arg, subscription_id_arg, u
114118 print ("Deleted the deployment which is deployed using existing virtual network:-" ,ct )
115119 # Wait for above deployment deletion
116120 time .sleep (900 )
117- # Delete deployment with virtual network
118- DeployOp .delete_resourcegroup (credentials , subscription_id , resource_name_vnet )
119- ct = datetime .datetime .now ()
120- print ("Deleted the deployment which contains the virtual network:-" ,ct )
121121 else :
122122 # Delete the deployment
123123 deployment_deletion = DeployOp .delete_resourcegroup (credentials , subscription_id , resource_group_name )
124124 ct = datetime .datetime .now ()
125125 print ("Date time after deployment and deletion of stack:-" , ct )
126126
127+ if existingVPC == 'true' :
128+ # Delete deployment with virtual network
129+ DeployOp .delete_resourcegroup (credentials , subscription_id , resource_name_vnet )
130+ ct = datetime .datetime .now ()
131+ print ("Deleted the deployment which contains the virtual network:-" , ct )
132+
127133if __name__ == '__main__' :
128134 main (sys .argv [1 ], sys .argv [2 ], sys .argv [3 ], sys .argv [4 ], sys .argv [5 ], sys .argv [6 ], sys .argv [7 ], sys .argv [8 ], sys .argv [9 ], sys .argv [10 ], sys .argv [11 ], sys .argv [12 ])
0 commit comments