Esempio n. 1
0
    def get_regions(self, boto3_cache: Boto3Cache = None):
        if boto3_cache is None:
            boto3_cache = Boto3Cache()

        region_objects: Dict[str, Dict[str, RegionObj]] = {}
        for test_name, test in self.config.tests.items():
            region_objects[test_name] = {}
            for region in test.regions:
                profile = test.auth.get(region,
                                        "default") if test.auth else "default"
                region_objects[test_name][region] = RegionObj(
                    name=region,
                    account_id=boto3_cache.account_id(profile),
                    partition=boto3_cache.partition(profile),
                    profile=profile,
                    _boto3_cache=boto3_cache,
                    taskcat_id=self.uid,
                )
        return region_objects
Esempio n. 2
0
 def _get_regions(self, region_parameter_name, test, boto3_cache: Boto3Cache = None):
     if boto3_cache is None:
         boto3_cache = Boto3Cache()
     region_object = {}
     for region in getattr(test, region_parameter_name, []):
         # TODO: comon_utils/determine_profile_for_region
         profile = (
             test.auth.get(region, test.auth.get("default", "default"))
             if test.auth
             else "default"
         )
         region_object[region] = RegionObj(
             name=region,
             account_id=boto3_cache.account_id(profile),
             partition=boto3_cache.partition(profile),
             profile=profile,
             _boto3_cache=boto3_cache,
             taskcat_id=self.uid,
             _role_name=test.role_name,
         )
     return region_object