How to use remove_security_group method in tempest

Best Python code snippet using tempest_python

project_prepare.py

Source:project_prepare.py Github

copy

Full Screen

...438 except Exception as err:439 AzureActions.remove_subnet(project_conf['resource_group_name'], project_conf['vpc_name'],440 project_conf['private_subnet_name'])441 try:442 AzureActions.remove_security_group(project_conf['resource_group_name'],443 project_conf['edge_security_group_name'])444 except:445 print("Edge Security group hasn't been created.")446 traceback.print_exc()447 dlab.fab.append_result("Failed creating security group for edge node.", str(err))448 raise Exception449 except:450 sys.exit(1)451 try:452 logging.info('[CREATE SECURITY GROUP FOR PRIVATE SUBNET]')453 print('[CREATE SECURITY GROUP FOR PRIVATE SUBNET]')454 notebook_list_rules = [455 {456 "name": "in-1",457 "protocol": "*",458 "source_port_range": "*",459 "destination_port_range": "*",460 "source_address_prefix": project_conf['private_subnet_cidr'],461 "destination_address_prefix": "*",462 "access": "Allow",463 "priority": 100,464 "direction": "Inbound"465 },466 {467 "name": "in-2",468 "protocol": "*",469 "source_port_range": "*",470 "destination_port_range": "*",471 "source_address_prefix": AzureMeta.get_subnet(project_conf['resource_group_name'],472 project_conf['vpc_name'],473 project_conf['subnet_name']).address_prefix,474 "destination_address_prefix": "*",475 "access": "Allow",476 "priority": 110,477 "direction": "Inbound"478 },479 {480 "name": "in-3",481 "protocol": "*",482 "source_port_range": "*",483 "destination_port_range": "*",484 "source_address_prefix": "*",485 "destination_address_prefix": "*",486 "access": "Deny",487 "priority": 200,488 "direction": "Inbound"489 },490 {491 "name": "out-1",492 "protocol": "*",493 "source_port_range": "*",494 "destination_port_range": "*",495 "source_address_prefix": "*",496 "destination_address_prefix": project_conf['private_subnet_cidr'],497 "access": "Allow",498 "priority": 100,499 "direction": "Outbound"500 },501 {502 "name": "out-2",503 "protocol": "*",504 "source_port_range": "*",505 "destination_port_range": "*",506 "source_address_prefix": "*",507 "destination_address_prefix": AzureMeta.get_subnet(project_conf['resource_group_name'],508 project_conf['vpc_name'],509 project_conf['subnet_name']).address_prefix,510 "access": "Allow",511 "priority": 110,512 "direction": "Outbound"513 },514 {515 "name": "out-3",516 "protocol": "*",517 "source_port_range": "*",518 "destination_port_range": "443",519 "source_address_prefix": "*",520 "destination_address_prefix": "*",521 "access": "Allow",522 "priority": 120,523 "direction": "Outbound"524 },525 {526 "name": "out-4",527 "protocol": "*",528 "source_port_range": "*",529 "destination_port_range": "*",530 "source_address_prefix": "*",531 "destination_address_prefix": "*",532 "access": "Deny",533 "priority": 200,534 "direction": "Outbound"535 }536 ]537 params = "--resource_group_name {} --security_group_name {} --region {} --tags '{}' --list_rules '{}'". \538 format(project_conf['resource_group_name'], project_conf['notebook_security_group_name'],539 project_conf['region'], json.dumps(project_conf['instance_tags']), json.dumps(notebook_list_rules))540 try:541 local("~/scripts/{}.py {}".format('common_create_security_group', params))542 except:543 traceback.print_exc()544 raise Exception545 except Exception as err:546 dlab.fab.append_result("Failed creating security group for private subnet.", str(err))547 AzureActions.remove_subnet(project_conf['resource_group_name'], project_conf['vpc_name'],548 project_conf['private_subnet_name'])549 AzureActions.remove_security_group(project_conf['resource_group_name'],550 project_conf['edge_security_group_name'])551 try:552 AzureActions.remove_security_group(project_conf['resource_group_name'],553 project_conf['notebook_security_group_name'])554 except:555 print("Notebook Security group hasn't been created.")556 sys.exit(1)557 logging.info('[CREATING SECURITY GROUPS FOR MASTER NODE]')558 print("[CREATING SECURITY GROUPS FOR MASTER NODE]")559 try:560 cluster_list_rules = [561 {562 "name": "in-1",563 "protocol": "*",564 "source_port_range": "*",565 "destination_port_range": "*",566 "source_address_prefix": project_conf['private_subnet_cidr'],567 "destination_address_prefix": "*",568 "access": "Allow",569 "priority": 100,570 "direction": "Inbound"571 },572 {573 "name": "in-2",574 "protocol": "*",575 "source_port_range": "*",576 "destination_port_range": "*",577 "source_address_prefix": AzureMeta.get_subnet(project_conf['resource_group_name'],578 project_conf['vpc_name'],579 project_conf['subnet_name']).address_prefix,580 "destination_address_prefix": "*",581 "access": "Allow",582 "priority": 110,583 "direction": "Inbound"584 },585 {586 "name": "in-3",587 "protocol": "*",588 "source_port_range": "*",589 "destination_port_range": "*",590 "source_address_prefix": "*",591 "destination_address_prefix": "*",592 "access": "Deny",593 "priority": 200,594 "direction": "Inbound"595 },596 {597 "name": "out-1",598 "protocol": "*",599 "source_port_range": "*",600 "destination_port_range": "*",601 "source_address_prefix": "*",602 "destination_address_prefix": project_conf['private_subnet_cidr'],603 "access": "Allow",604 "priority": 100,605 "direction": "Outbound"606 },607 {608 "name": "out-2",609 "protocol": "*",610 "source_port_range": "*",611 "destination_port_range": "*",612 "source_address_prefix": "*",613 "destination_address_prefix": AzureMeta.get_subnet(project_conf['resource_group_name'],614 project_conf['vpc_name'],615 project_conf['subnet_name']).address_prefix,616 "access": "Allow",617 "priority": 110,618 "direction": "Outbound"619 },620 {621 "name": "out-3",622 "protocol": "*",623 "source_port_range": "*",624 "destination_port_range": "443",625 "source_address_prefix": "*",626 "destination_address_prefix": "*",627 "access": "Allow",628 "priority": 120,629 "direction": "Outbound"630 },631 {632 "name": "out-4",633 "protocol": "*",634 "source_port_range": "*",635 "destination_port_range": "*",636 "source_address_prefix": "*",637 "destination_address_prefix": "*",638 "access": "Deny",639 "priority": 200,640 "direction": "Outbound"641 }642 ]643 params = "--resource_group_name {} --security_group_name {} --region {} --tags '{}' --list_rules '{}'".format(644 project_conf['resource_group_name'], project_conf['master_security_group_name'], project_conf['region'],645 json.dumps(project_conf['instance_tags']), json.dumps(cluster_list_rules))646 try:647 local("~/scripts/{}.py {}".format('common_create_security_group', params))648 except:649 traceback.print_exc()650 raise Exception651 except Exception as err:652 AzureActions.remove_subnet(project_conf['resource_group_name'], project_conf['vpc_name'],653 project_conf['private_subnet_name'])654 AzureActions.remove_security_group(project_conf['resource_group_name'],655 project_conf['edge_security_group_name'])656 AzureActions.remove_security_group(project_conf['resource_group_name'],657 project_conf['notebook_security_group_name'])658 try:659 AzureActions.remove_security_group(project_conf['resource_group_name'],660 project_conf['master_security_group_name'])661 except:662 print("Master Security group hasn't been created.")663 dlab.fab.append_result("Failed to create Security groups. Exception:" + str(err))664 sys.exit(1)665 logging.info('[CREATING SECURITY GROUPS FOR SLAVE NODES]')666 print("[CREATING SECURITY GROUPS FOR SLAVE NODES]")667 try:668 params = "--resource_group_name {} --security_group_name {} --region {} --tags '{}' --list_rules '{}'".format(669 project_conf['resource_group_name'], project_conf['slave_security_group_name'], project_conf['region'],670 json.dumps(project_conf['instance_tags']), json.dumps(cluster_list_rules))671 try:672 local("~/scripts/{}.py {}".format('common_create_security_group', params))673 except:674 traceback.print_exc()675 raise Exception676 except Exception as err:677 AzureActions.remove_subnet(project_conf['resource_group_name'], project_conf['vpc_name'],678 project_conf['private_subnet_name'])679 AzureActions.remove_security_group(project_conf['resource_group_name'],680 project_conf['edge_security_group_name'])681 AzureActions.remove_security_group(project_conf['resource_group_name'],682 project_conf['notebook_security_group_name'])683 AzureActions.remove_security_group(project_conf['resource_group_name'],684 project_conf['master_security_group_name'])685 try:686 AzureActions.remove_security_group(project_conf['resource_group_name'],687 project_conf['slave_security_group_name'])688 except:689 print("Slave Security group hasn't been created.")690 dlab.fab.append_result("Failed to create Security groups. Exception:" + str(err))691 sys.exit(1)692 try:693 logging.info('[CREATE SHARED STORAGE ACCOUNT AND CONTAINER]')694 print('[CREATE SHARED STORAGE ACCOUNT AND CONTAINER]')695 params = "--container_name {} --account_tags '{}' --resource_group_name {} --region {}". \696 format(project_conf['shared_container_name'], json.dumps(project_conf['shared_storage_account_tags']),697 project_conf['resource_group_name'], project_conf['region'])698 local("~/scripts/{}.py {}".format('common_create_storage_account', params))699 except Exception as err:700 dlab.fab.append_result("Failed to create storage account.", str(err))701 AzureActions.remove_subnet(project_conf['resource_group_name'], project_conf['vpc_name'],702 project_conf['private_subnet_name'])703 AzureActions.remove_security_group(project_conf['resource_group_name'],704 project_conf['edge_security_group_name'])705 AzureActions.remove_security_group(project_conf['resource_group_name'],706 project_conf['notebook_security_group_name'])707 AzureActions.remove_security_group(project_conf['resource_group_name'],708 project_conf['master_security_group_name'])709 AzureActions.remove_security_group(project_conf['resource_group_name'],710 project_conf['slave_security_group_name'])711 for storage_account in AzureMeta.list_storage_accounts(project_conf['resource_group_name']):712 if project_conf['shared_storage_account_name'] == storage_account.tags["Name"]:713 AzureActions.remove_storage_account(project_conf['resource_group_name'], storage_account.name)714 sys.exit(1)715 try:716 logging.info('[CREATE STORAGE ACCOUNT AND CONTAINERS]')717 print('[CREATE STORAGE ACCOUNT AND CONTAINERS]')718 params = "--container_name {} --account_tags '{}' --resource_group_name {} --region {}". \719 format(project_conf['edge_container_name'], json.dumps(project_conf['storage_account_tags']),720 project_conf['resource_group_name'], project_conf['region'])721 try:722 local("~/scripts/{}.py {}".format('common_create_storage_account', params))723 except:724 traceback.print_exc()725 raise Exception726 except Exception as err:727 dlab.fab.append_result("Failed to create storage account.", str(err))728 AzureActions.remove_subnet(project_conf['resource_group_name'], project_conf['vpc_name'],729 project_conf['private_subnet_name'])730 AzureActions.remove_security_group(project_conf['resource_group_name'],731 project_conf['edge_security_group_name'])732 AzureActions.remove_security_group(project_conf['resource_group_name'],733 project_conf['notebook_security_group_name'])734 AzureActions.remove_security_group(project_conf['resource_group_name'],735 project_conf['master_security_group_name'])736 AzureActions.remove_security_group(project_conf['resource_group_name'],737 project_conf['slave_security_group_name'])738 for storage_account in AzureMeta.list_storage_accounts(project_conf['resource_group_name']):739 if project_conf['edge_storage_account_name'] == storage_account.tags["Name"]:740 AzureActions.remove_storage_account(project_conf['resource_group_name'], storage_account.name)741 if project_conf['shared_storage_account_name'] == storage_account.tags["Name"]:742 AzureActions.remove_storage_account(project_conf['resource_group_name'], storage_account.name)743 sys.exit(1)744 if os.environ['azure_datalake_enable'] == 'true':745 try:746 logging.info('[CREATE DATA LAKE STORE DIRECTORY]')747 print('[CREATE DATA LAKE STORE DIRECTORY]')748 params = "--resource_group_name {} --datalake_name {} --directory_name {} --ad_user {} " \749 "--service_base_name {}".format(project_conf['resource_group_name'],750 project_conf['datalake_store_name'],751 project_conf['datalake_user_directory_name'],752 project_conf['azure_ad_user_name'],753 project_conf['service_base_name'])754 try:755 local("~/scripts/{}.py {}".format('common_create_datalake_directory', params))756 except:757 traceback.print_exc()758 raise Exception759 except Exception as err:760 dlab.fab.append_result("Failed to create Data Lake Store directory.", str(err))761 AzureActions.remove_subnet(project_conf['resource_group_name'], project_conf['vpc_name'],762 project_conf['private_subnet_name'])763 AzureActions.remove_security_group(project_conf['resource_group_name'],764 project_conf['edge_security_group_name'])765 AzureActions.remove_security_group(project_conf['resource_group_name'],766 project_conf['notebook_security_group_name'])767 AzureActions.remove_security_group(project_conf['resource_group_name'],768 project_conf['master_security_group_name'])769 AzureActions.remove_security_group(project_conf['resource_group_name'],770 project_conf['slave_security_group_name'])771 for storage_account in AzureMeta.list_storage_accounts(project_conf['resource_group_name']):772 if project_conf['edge_storage_account_name'] == storage_account.tags["Name"]:773 AzureActions.remove_storage_account(project_conf['resource_group_name'], storage_account.name)774 if project_conf['shared_storage_account_name'] == storage_account.tags["Name"]:775 AzureActions.remove_storage_account(project_conf['resource_group_name'], storage_account.name)776 try:777 for datalake in AzureMeta.list_datalakes(project_conf['resource_group_name']):778 if project_conf['datalake_store_name'] == datalake.tags["Name"]:779 AzureActions.remove_datalake_directory(datalake.name,780 project_conf['datalake_user_directory_name'])781 except:782 print("Data Lake Store directory hasn't been created.")783 sys.exit(1)784 if os.environ['conf_os_family'] == 'debian':785 project_conf['initial_user'] = 'ubuntu'786 project_conf['sudo_group'] = 'sudo'787 if os.environ['conf_os_family'] == 'redhat':788 project_conf['initial_user'] = 'ec2-user'789 project_conf['sudo_group'] = 'wheel'790 try:791 logging.info('[CREATE EDGE INSTANCE]')792 print('[CREATE EDGE INSTANCE]')793 params = "--instance_name {} --instance_size {} --region {} --vpc_name {} --network_interface_name {} \794 --security_group_name {} --subnet_name {} --service_base_name {} --resource_group_name {} \795 --dlab_ssh_user_name {} --public_ip_name {} --public_key '''{}''' --primary_disk_size {} \796 --instance_type {} --project_name {} --instance_storage_account_type {} --image_name {} --tags '{}'".\797 format(project_conf['instance_name'], os.environ['azure_edge_instance_size'], project_conf['region'],798 project_conf['vpc_name'], project_conf['network_interface_name'],799 project_conf['edge_security_group_name'], project_conf['subnet_name'],800 project_conf['service_base_name'], project_conf['resource_group_name'],801 project_conf['initial_user'], project_conf['static_public_ip_name'], project_conf['public_ssh_key'],802 project_conf['primary_disk_size'], 'edge', project_conf['project_name'],803 project_conf['instance_storage_account_type'],804 project_conf['image_name'], json.dumps(project_conf['instance_tags']))805 try:806 local("~/scripts/{}.py {}".format('common_create_instance', params))807 except:808 traceback.print_exc()809 raise Exception810 except Exception as err:811 try:812 AzureActions.remove_instance(project_conf['resource_group_name'], project_conf['instance_name'])813 except:814 print("The instance hasn't been created.")815 AzureActions.remove_subnet(project_conf['resource_group_name'], project_conf['vpc_name'],816 project_conf['private_subnet_name'])817 AzureActions.remove_security_group(project_conf['resource_group_name'],818 project_conf['edge_security_group_name'])819 AzureActions.remove_security_group(project_conf['resource_group_name'],820 project_conf['notebook_security_group_name'])821 AzureActions.remove_security_group(project_conf['resource_group_name'],822 project_conf['master_security_group_name'])823 AzureActions.remove_security_group(project_conf['resource_group_name'],824 project_conf['slave_security_group_name'])825 for storage_account in AzureMeta.list_storage_accounts(project_conf['resource_group_name']):826 if project_conf['edge_storage_account_name'] == storage_account.tags["Name"]:827 AzureActions.remove_storage_account(project_conf['resource_group_name'], storage_account.name)828 if project_conf['shared_storage_account_name'] == storage_account.tags["Name"]:829 AzureActions.remove_storage_account(project_conf['resource_group_name'], storage_account.name)830 if os.environ['azure_datalake_enable'] == 'true':831 for datalake in AzureMeta.list_datalakes(project_conf['resource_group_name']):832 if project_conf['datalake_store_name'] == datalake.tags["Name"]:833 AzureActions.remove_datalake_directory(datalake.name,834 project_conf['datalake_user_directory_name'])835 dlab.fab.append_result("Failed to create instance. Exception:" + str(err))...

Full Screen

Full Screen

edge_prepare.py

Source:edge_prepare.py Github

copy

Full Screen

...384 except Exception as err:385 AzureActions().remove_subnet(edge_conf['resource_group_name'], edge_conf['vpc_name'],386 edge_conf['private_subnet_name'])387 try:388 AzureActions().remove_security_group(edge_conf['resource_group_name'],389 edge_conf['edge_security_group_name'])390 except:391 print("Edge Security group hasn't been created.")392 traceback.print_exc()393 append_result("Failed creating security group for edge node.", str(err))394 raise Exception395 except:396 sys.exit(1)397 try:398 logging.info('[CREATE SECURITY GROUP FOR PRIVATE SUBNET]')399 print('[CREATE SECURITY GROUP FOR PRIVATE SUBNET]')400 notebook_list_rules = [401 {402 "name": "in-1",403 "protocol": "*",404 "source_port_range": "*",405 "destination_port_range": "*",406 "source_address_prefix": edge_conf['private_subnet_cidr'],407 "destination_address_prefix": "*",408 "access": "Allow",409 "priority": 100,410 "direction": "Inbound"411 },412 {413 "name": "in-2",414 "protocol": "*",415 "source_port_range": "*",416 "destination_port_range": "*",417 "source_address_prefix": AzureMeta().get_subnet(edge_conf['resource_group_name'], edge_conf['vpc_name'],418 edge_conf['subnet_name']).address_prefix,419 "destination_address_prefix": "*",420 "access": "Allow",421 "priority": 110,422 "direction": "Inbound"423 },424 {425 "name": "in-3",426 "protocol": "*",427 "source_port_range": "*",428 "destination_port_range": "*",429 "source_address_prefix": "*",430 "destination_address_prefix": "*",431 "access": "Deny",432 "priority": 200,433 "direction": "Inbound"434 },435 {436 "name": "out-1",437 "protocol": "*",438 "source_port_range": "*",439 "destination_port_range": "*",440 "source_address_prefix": "*",441 "destination_address_prefix": edge_conf['private_subnet_cidr'],442 "access": "Allow",443 "priority": 100,444 "direction": "Outbound"445 },446 {447 "name": "out-2",448 "protocol": "*",449 "source_port_range": "*",450 "destination_port_range": "*",451 "source_address_prefix": "*",452 "destination_address_prefix": AzureMeta().get_subnet(edge_conf['resource_group_name'], edge_conf['vpc_name'],453 edge_conf['subnet_name']).address_prefix,454 "access": "Allow",455 "priority": 110,456 "direction": "Outbound"457 },458 {459 "name": "out-3",460 "protocol": "*",461 "source_port_range": "*",462 "destination_port_range": "443",463 "source_address_prefix": "*",464 "destination_address_prefix": "*",465 "access": "Allow",466 "priority": 120,467 "direction": "Outbound"468 },469 {470 "name": "out-4",471 "protocol": "*",472 "source_port_range": "*",473 "destination_port_range": "*",474 "source_address_prefix": "*",475 "destination_address_prefix": "*",476 "access": "Deny",477 "priority": 200,478 "direction": "Outbound"479 }480 ]481 params = "--resource_group_name {} --security_group_name {} --region {} --tags '{}' --list_rules '{}'". \482 format(edge_conf['resource_group_name'], edge_conf['notebook_security_group_name'], edge_conf['region'],483 json.dumps(edge_conf['instance_tags']), json.dumps(notebook_list_rules))484 try:485 local("~/scripts/{}.py {}".format('common_create_security_group', params))486 except:487 traceback.print_exc()488 raise Exception489 except Exception as err:490 print('Error: {0}'.format(err))491 AzureActions().remove_subnet(edge_conf['resource_group_name'], edge_conf['vpc_name'],492 edge_conf['private_subnet_name'])493 AzureActions().remove_security_group(edge_conf['resource_group_name'], edge_conf['edge_security_group_name'])494 try:495 AzureActions().remove_security_group(edge_conf['resource_group_name'],496 edge_conf['notebook_security_group_name'])497 except:498 print("Notebook Security group hasn't been created.")499 sys.exit(1)500 logging.info('[CREATING SECURITY GROUPS FOR MASTER NODE]')501 print("[CREATING SECURITY GROUPS FOR MASTER NODE]")502 try:503 cluster_list_rules = [504 {505 "name": "in-1",506 "protocol": "*",507 "source_port_range": "*",508 "destination_port_range": "*",509 "source_address_prefix": edge_conf['private_subnet_cidr'],510 "destination_address_prefix": "*",511 "access": "Allow",512 "priority": 100,513 "direction": "Inbound"514 },515 {516 "name": "in-2",517 "protocol": "*",518 "source_port_range": "*",519 "destination_port_range": "*",520 "source_address_prefix": AzureMeta().get_subnet(edge_conf['resource_group_name'],521 edge_conf['vpc_name'],522 edge_conf['subnet_name']).address_prefix,523 "destination_address_prefix": "*",524 "access": "Allow",525 "priority": 110,526 "direction": "Inbound"527 },528 {529 "name": "in-3",530 "protocol": "*",531 "source_port_range": "*",532 "destination_port_range": "*",533 "source_address_prefix": "*",534 "destination_address_prefix": "*",535 "access": "Deny",536 "priority": 200,537 "direction": "Inbound"538 },539 {540 "name": "out-1",541 "protocol": "*",542 "source_port_range": "*",543 "destination_port_range": "*",544 "source_address_prefix": "*",545 "destination_address_prefix": edge_conf['private_subnet_cidr'],546 "access": "Allow",547 "priority": 100,548 "direction": "Outbound"549 },550 {551 "name": "out-2",552 "protocol": "*",553 "source_port_range": "*",554 "destination_port_range": "*",555 "source_address_prefix": "*",556 "destination_address_prefix": AzureMeta().get_subnet(edge_conf['resource_group_name'],557 edge_conf['vpc_name'],558 edge_conf['subnet_name']).address_prefix,559 "access": "Allow",560 "priority": 110,561 "direction": "Outbound"562 },563 {564 "name": "out-3",565 "protocol": "*",566 "source_port_range": "*",567 "destination_port_range": "443",568 "source_address_prefix": "*",569 "destination_address_prefix": "*",570 "access": "Allow",571 "priority": 120,572 "direction": "Outbound"573 },574 {575 "name": "out-4",576 "protocol": "*",577 "source_port_range": "*",578 "destination_port_range": "*",579 "source_address_prefix": "*",580 "destination_address_prefix": "*",581 "access": "Deny",582 "priority": 200,583 "direction": "Outbound"584 }585 ]586 params = "--resource_group_name {} --security_group_name {} --region {} --tags '{}' --list_rules '{}'".format(587 edge_conf['resource_group_name'], edge_conf['master_security_group_name'], edge_conf['region'],588 json.dumps(edge_conf['instance_tags']), json.dumps(cluster_list_rules))589 try:590 local("~/scripts/{}.py {}".format('common_create_security_group', params))591 except:592 traceback.print_exc()593 raise Exception594 except Exception as err:595 print('Error: {0}'.format(err))596 AzureActions().remove_subnet(edge_conf['resource_group_name'], edge_conf['vpc_name'],597 edge_conf['private_subnet_name'])598 AzureActions().remove_security_group(edge_conf['resource_group_name'], edge_conf['edge_security_group_name'])599 AzureActions().remove_security_group(edge_conf['resource_group_name'],600 edge_conf['notebook_security_group_name'])601 try:602 AzureActions().remove_security_group(edge_conf['resource_group_name'],603 edge_conf['master_security_group_name'])604 except:605 print("Master Security group hasn't been created.")606 append_result("Failed to create Security groups. Exception:" + str(err))607 sys.exit(1)608 logging.info('[CREATING SECURITY GROUPS FOR SLAVE NODES]')609 print("[CREATING SECURITY GROUPS FOR SLAVE NODES]")610 try:611 params = "--resource_group_name {} --security_group_name {} --region {} --tags '{}' --list_rules '{}'".format(612 edge_conf['resource_group_name'], edge_conf['slave_security_group_name'], edge_conf['region'],613 json.dumps(edge_conf['instance_tags']), json.dumps(cluster_list_rules))614 try:615 local("~/scripts/{}.py {}".format('common_create_security_group', params))616 except:617 traceback.print_exc()618 raise Exception619 except Exception as err:620 print('Error: {0}'.format(err))621 AzureActions().remove_subnet(edge_conf['resource_group_name'], edge_conf['vpc_name'],622 edge_conf['private_subnet_name'])623 AzureActions().remove_security_group(edge_conf['resource_group_name'], edge_conf['edge_security_group_name'])624 AzureActions().remove_security_group(edge_conf['resource_group_name'],625 edge_conf['notebook_security_group_name'])626 AzureActions().remove_security_group(edge_conf['resource_group_name'],627 edge_conf['master_security_group_name'])628 try:629 AzureActions().remove_security_group(edge_conf['resource_group_name'],630 edge_conf['slave_security_group_name'])631 except:632 print("Slave Security group hasn't been created.")633 append_result("Failed to create Security groups. Exception:" + str(err))634 sys.exit(1)635 try:636 logging.info('[CREATE STORAGE ACCOUNT AND CONTAINERS]')637 print('[CREATE STORAGE ACCOUNT AND CONTAINERS]')638 params = "--container_name {} --account_tags '{}' --resource_group_name {} --region {}". \639 format(edge_conf['edge_container_name'], json.dumps(edge_conf['storage_account_tags']),640 edge_conf['resource_group_name'], edge_conf['region'])641 try:642 local("~/scripts/{}.py {}".format('common_create_storage_account', params))643 except:644 traceback.print_exc()645 raise Exception646 except Exception as err:647 print('Error: {0}'.format(err))648 append_result("Failed to create storage account.", str(err))649 AzureActions().remove_subnet(edge_conf['resource_group_name'], edge_conf['vpc_name'],650 edge_conf['private_subnet_name'])651 AzureActions().remove_security_group(edge_conf['resource_group_name'], edge_conf['edge_security_group_name'])652 AzureActions().remove_security_group(edge_conf['resource_group_name'], edge_conf['notebook_security_group_name'])653 AzureActions().remove_security_group(edge_conf['resource_group_name'],654 edge_conf['master_security_group_name'])655 AzureActions().remove_security_group(edge_conf['resource_group_name'],656 edge_conf['slave_security_group_name'])657 for storage_account in AzureMeta().list_storage_accounts(edge_conf['resource_group_name']):658 if edge_conf['edge_storage_account_name'] == storage_account.tags["Name"]:659 AzureActions().remove_storage_account(edge_conf['resource_group_name'], storage_account.name)660 sys.exit(1)661 if os.environ['azure_datalake_enable'] == 'true':662 try:663 logging.info('[CREATE DATA LAKE STORE DIRECTORY]')664 print('[CREATE DATA LAKE STORE DIRECTORY]')665 params = "--resource_group_name {} --datalake_name {} --directory_name {} --ad_user {} --service_base_name {}". \666 format(edge_conf['resource_group_name'], edge_conf['datalake_store_name'],667 edge_conf['datalake_user_directory_name'], edge_conf['azure_ad_user_name'],668 edge_conf['service_base_name'])669 try:670 local("~/scripts/{}.py {}".format('common_create_datalake_directory', params))671 except:672 traceback.print_exc()673 raise Exception674 except Exception as err:675 print('Error: {0}'.format(err))676 append_result("Failed to create Data Lake Store directory.", str(err))677 AzureActions().remove_subnet(edge_conf['resource_group_name'], edge_conf['vpc_name'],678 edge_conf['private_subnet_name'])679 AzureActions().remove_security_group(edge_conf['resource_group_name'], edge_conf['edge_security_group_name'])680 AzureActions().remove_security_group(edge_conf['resource_group_name'], edge_conf['notebook_security_group_name'])681 AzureActions().remove_security_group(edge_conf['resource_group_name'],682 edge_conf['master_security_group_name'])683 AzureActions().remove_security_group(edge_conf['resource_group_name'],684 edge_conf['slave_security_group_name'])685 for storage_account in AzureMeta().list_storage_accounts(edge_conf['resource_group_name']):686 if edge_conf['edge_storage_account_name'] == storage_account.tags["Name"]:687 AzureActions().remove_storage_account(edge_conf['resource_group_name'], storage_account.name)688 try:689 for datalake in AzureMeta().list_datalakes(edge_conf['resource_group_name']):690 if edge_conf['datalake_store_name'] == datalake.tags["Name"]:691 AzureActions().remove_datalake_directory(datalake.name, edge_conf['datalake_user_directory_name'])692 except Exception as err:693 print('Error: {0}'.format(err))694 print("Data Lake Store directory hasn't been created.")695 sys.exit(1)696 if os.environ['conf_os_family'] == 'debian':697 initial_user = 'ubuntu'698 sudo_group = 'sudo'699 if os.environ['conf_os_family'] == 'redhat':700 initial_user = 'ec2-user'701 sudo_group = 'wheel'702 try:703 logging.info('[CREATE EDGE INSTANCE]')704 print('[CREATE EDGE INSTANCE]')705 params = "--instance_name {} --instance_size {} --region {} --vpc_name {} --network_interface_name {} \706 --security_group_name {} --subnet_name {} --service_base_name {} --resource_group_name {} \707 --dlab_ssh_user_name {} --public_ip_name {} --public_key '''{}''' --primary_disk_size {} \708 --instance_type {} --user_name {} --instance_storage_account_type {} --image_name {} --tags '{}'".\709 format(edge_conf['instance_name'], os.environ['azure_edge_instance_size'], edge_conf['region'],710 edge_conf['vpc_name'], edge_conf['network_interface_name'], edge_conf['edge_security_group_name'],711 edge_conf['subnet_name'], edge_conf['service_base_name'], edge_conf['resource_group_name'],712 initial_user, edge_conf['static_public_ip_name'], edge_conf['public_ssh_key'],713 edge_conf['primary_disk_size'], 'edge', edge_conf['user_name'], edge_conf['instance_storage_account_type'],714 edge_conf['image_name'], json.dumps(edge_conf['instance_tags']))715 try:716 local("~/scripts/{}.py {}".format('common_create_instance', params))717 except:718 traceback.print_exc()719 raise Exception720 except Exception as err:721 print('Error: {0}'.format(err))722 try:723 AzureActions().remove_instance(edge_conf['resource_group_name'], edge_conf['instance_name'])724 except:725 print("The instance hasn't been created.")726 AzureActions().remove_subnet(edge_conf['resource_group_name'], edge_conf['vpc_name'],727 edge_conf['private_subnet_name'])728 AzureActions().remove_security_group(edge_conf['resource_group_name'], edge_conf['edge_security_group_name'])729 AzureActions().remove_security_group(edge_conf['resource_group_name'], edge_conf['notebook_security_group_name'])730 AzureActions().remove_security_group(edge_conf['resource_group_name'],731 edge_conf['master_security_group_name'])732 AzureActions().remove_security_group(edge_conf['resource_group_name'],733 edge_conf['slave_security_group_name'])734 for storage_account in AzureMeta().list_storage_accounts(edge_conf['resource_group_name']):735 if edge_conf['edge_storage_account_name'] == storage_account.tags["Name"]:736 AzureActions().remove_storage_account(edge_conf['resource_group_name'], storage_account.name)737 if os.environ['azure_datalake_enable'] == 'true':738 for datalake in AzureMeta().list_datalakes(edge_conf['resource_group_name']):739 if edge_conf['datalake_store_name'] == datalake.tags["Name"]:740 AzureActions().remove_datalake_directory(datalake.name, edge_conf['datalake_user_directory_name'])741 append_result("Failed to create instance. Exception:" + str(err))...

Full Screen

Full Screen

nova_disassociate_security_group_request_body.py

Source:nova_disassociate_security_group_request_body.py Github

copy

Full Screen

...28 self._remove_security_group = None29 self.discriminator = None30 self.remove_security_group = remove_security_group31 @property32 def remove_security_group(self):33 """Gets the remove_security_group of this NovaDisassociateSecurityGroupRequestBody.34 :return: The remove_security_group of this NovaDisassociateSecurityGroupRequestBody.35 :rtype: :class:`huaweicloudsdkecs.v2.NovaRemoveSecurityGroupOption`36 """37 return self._remove_security_group38 @remove_security_group.setter39 def remove_security_group(self, remove_security_group):40 """Sets the remove_security_group of this NovaDisassociateSecurityGroupRequestBody.41 :param remove_security_group: The remove_security_group of this NovaDisassociateSecurityGroupRequestBody.42 :type remove_security_group: :class:`huaweicloudsdkecs.v2.NovaRemoveSecurityGroupOption`43 """44 self._remove_security_group = remove_security_group45 def to_dict(self):46 """Returns the model properties as a dict"""47 result = {}48 for attr, _ in six.iteritems(self.openapi_types):49 value = getattr(self, attr)50 if isinstance(value, list):51 result[attr] = list(map(52 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,53 value...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful