Best Python code snippet using lisa_python
platform_.py
Source:platform_.py
...483 # init node484 node = environment.create_node_from_requirement(485 node_space,486 )487 aws_node_runbook = self._create_node_runbook(488 len(nodes_parameters),489 node_space,490 log,491 )492 # save parsed runbook back, for example, the version of marketplace may be493 # parsed from latest to a specified version.494 node.capability.set_extended_runbook(aws_node_runbook)495 nodes_parameters.append(aws_node_runbook)496 # Set data disk array497 aws_parameters.data_disks = self._generate_data_disks(498 node, aws_node_runbook499 )500 if not aws_parameters.location:501 # take first one's location502 aws_parameters.location = aws_node_runbook.location503 # save vm's information into node504 node_context = get_node_context(node)505 # vm's name, use to find it from aws506 node_context.vm_name = aws_node_runbook.name507 # ssh related information will be filled back once vm is created508 node_context.username = self.runbook.admin_username509 node_context.private_key_file = self.runbook.admin_private_key_file510 log.info(f"vm setting: {aws_node_runbook}")511 aws_parameters.nodes = nodes_parameters512 # In Azure, each VM should have only one nic in one subnet. So calculate513 # the max nic count, and set to subnet count.514 aws_parameters.subnet_count = max(x.nic_count for x in aws_parameters.nodes)515 # composite deployment properties516 parameters = aws_parameters.to_dict() # type:ignore517 parameters = {k: {"value": v} for k, v in parameters.items()}518 log.debug(f"parameters: {parameters}")519 return aws_parameters520 def _create_node_runbook(521 self,522 index: int,523 node_space: schema.NodeSpace,524 log: Logger,525 ) -> AwsNodeSchema:526 aws_node_runbook = node_space.get_extended_runbook(AwsNodeSchema, type_name=AWS)527 if not aws_node_runbook.name:528 aws_node_runbook.name = f"node-{index}"529 if not aws_node_runbook.vm_size:530 raise LisaException("vm_size is not detected before deploy")531 if not aws_node_runbook.location:532 raise LisaException("location is not detected before deploy")533 if not aws_node_runbook.marketplace:534 # set to default marketplace, if nothing specified...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!