def prepareArtifactRegistryMocks(self, expected_builder_location=''): if not expected_builder_location: expected_builder_location = daisy_utils.GetRegionFromZone( self.zone) full_builder_location = 'projects/compute-image-tools/locations/{}'.format( expected_builder_location) repo_name = '{}/repositories/wrappers'.format(full_builder_location) package_name = '{}/packages/gce_ovf_import'.format(repo_name) msgs = self.mocked_artifacts_v1beta2_messages self.mocked_artifacts_v1beta2.projects_locations.List.Expect( msgs.ArtifactregistryProjectsLocationsListRequest( name='projects/compute-image-tools'), response=msgs.ListLocationsResponse(locations=[ msgs.Location(name=full_builder_location, locationId=expected_builder_location) ])) self.mocked_artifacts_v1beta2.projects_locations_repositories.Get.Expect( msgs.ArtifactregistryProjectsLocationsRepositoriesGetRequest( name=repo_name), response=msgs.Repository( name=repo_name, format=msgs.Repository.FormatValueValuesEnum.DOCKER)) self.mocked_artifacts_v1beta2.projects_locations_repositories_packages.Get.Expect( msgs. ArtifactregistryProjectsLocationsRepositoriesPackagesGetRequest( name=package_name), response=msgs.Package(name=package_name))
def GetBuilder(self, zone='', tag=daisy_utils._DEFAULT_BUILDER_VERSION): if self.builder: return self.builder if not zone: zone = self.zone builder_region = daisy_utils.GetRegionFromZone(zone).lower() return daisy_utils._REGIONALIZED_BUILDER_DOCKER_PATTERN.format( executable=daisy_utils._OVF_IMPORT_BUILDER_EXECUTABLE, region=builder_region, docker_image_tag=tag)
def PrepareMocks(self, step, async_flag=False, permissions=None, timeout='7200s', log_location=None, zone='us-west1-c'): self.PrepareDaisyMocks(step, async_flag=async_flag, permissions=permissions, timeout=timeout, log_location=log_location) self.prepareArtifactRegistryMocks( expected_builder_location=daisy_utils.GetRegionFromZone(zone))
def PrepareMocks(self, step, async_flag=False, permissions=None, timeout='7200s', log_location=None, zone=''): self.PrepareDaisyMocks(step, async_flag=async_flag, permissions=permissions, timeout=timeout, log_location=log_location) self.prepareArtifactRegistryMocks( expect_source_file_bucket_check=False if zone else True, expected_builder_location=daisy_utils.GetRegionFromZone(zone) if zone else '')
def GetBuilder(self, zone='', region='', tag=daisy_utils._DEFAULT_BUILDER_VERSION): if self.ovf_builder: return self.ovf_builder builder_region = '' if zone: builder_region = daisy_utils.GetRegionFromZone(zone).lower() elif region: builder_region = region.lower() if builder_region: return daisy_utils._REGIONALIZED_BUILDER_DOCKER_PATTERN.format( executable=daisy_utils._OVF_IMPORT_BUILDER_EXECUTABLE, region=builder_region, docker_image_tag=tag) else: return daisy_utils._DEFAULT_BUILDER_DOCKER_PATTERN.format( executable=daisy_utils._OVF_IMPORT_BUILDER_EXECUTABLE, docker_image_tag=tag)
def GetBucketLocation(self): if self.args.zone: return daisy_utils.GetRegionFromZone(self.args.zone) return super(ImportFromImageStager, self).GetBucketLocation()
def GetBucketLocation(self): if self.args.zone: return daisy_utils.GetRegionFromZone(self.args.zone) return super(ImportFromExternalCloudProviderStager, self).GetBucketLocation()