コード例 #1
0
ファイル: stack.py プロジェクト: taskcat/taskcat
 def create(
     cls,
     region: TestRegion,
     stack_name: str,
     template: Template,
     tags: List[Tag] = None,
     disable_rollback: bool = True,
     test_name: str = "",
     uuid: UUID = None,
 ) -> "Stack":
     parameters = cls._cfn_format_parameters(region.parameters)
     uuid = uuid if uuid else uuid4()
     cfn_client = region.client("cloudformation")
     tags = [t.dump() for t in tags] if tags else []
     bucket_name: str = region.s3_bucket.name
     template.url = s3_url_maker(bucket_name, template.s3_key,
                                 region.client("s3"))
     stack_id = cfn_client.create_stack(
         StackName=stack_name,
         TemplateURL=template.url,
         Parameters=parameters,
         DisableRollback=disable_rollback,
         Tags=tags,
         Capabilities=Capabilities.ALL,
     )["StackId"]
     stack = cls(region, stack_id, template, test_name, uuid)
     # fetch property values from cfn
     stack.refresh()
     return stack
コード例 #2
0
ファイル: stack.py プロジェクト: jaymccon/taskcat-v9
 def create(
     cls,
     region: AWSRegionObject,
     stack_name: str,
     template: Template,
     parameters: List[Parameter] = None,
     tags: List[Tag] = None,
     disable_rollback: bool = True,
     test_name: str = "",
     uuid: UUID = None,
 ) -> "Stack":
     uuid = uuid if uuid else uuid4()
     cfn_client = region.client("cloudformation")
     parameters = [p.dump() for p in parameters] if parameters else []
     tags = [t.dump() for t in tags] if tags else []
     if isinstance(region.s3bucket, (S3Bucket, mock.Mock)):
         bucket_name: str = region.s3bucket.name
     else:
         raise TypeError("region object has unset bucket object")
     template.url = s3_url_maker(bucket_name, template.s3_key, region.client("s3"))
     stack_id = cfn_client.create_stack(
         StackName=stack_name,
         TemplateURL=template.url,
         Parameters=parameters,
         DisableRollback=disable_rollback,
         Tags=tags,
         Capabilities=Capabilities.ALL,
     )["StackId"]
     stack = cls(region, stack_id, template, test_name, uuid)
     # fetch property values from cfn
     stack.refresh()
     return stack