Ejemplo n.º 1
0
 def invoke_fetch(self, effect: token.FetchEffect) -> None:
     remote_url = effect.url
     package_name = os.path.basename(remote_url)
     fetch_archive = make_temp_path('fetch-archive') + '-' + package_name
     fetch_extract = make_temp_path('fetch-extract') + '-' + package_name
     # download
     transport = transport_provider(remote_url)
     transport.get(fetch_archive, remote_url)
     # extract
     packer = packer_provider(remote_url)
     packer.extract(fetch_archive, fetch_extract)
     # move
     source_path = fetch_extract + '/' + effect.source
     target_path = self.runtime_path(effect.target)
     SUDO.files_move(source_path, target_path)
     # clean
     SUDO.files_delete(fetch_archive)
     SUDO.files_delete(fetch_extract)
Ejemplo n.º 2
0
def perform_image_put_archive(image_store: ImageStore) -> None:
    provider = transport_provider(image_store.url)
    provider.put(image_store.archive_path(), image_store.url)
Ejemplo n.º 3
0
def perform_image_get_archive(image_store: ImageStore) -> ImageStore:
    provider = transport_provider(image_store.url)
    provider.smart_get(image_store.archive_path(), image_store.url)
    assert image_store.has_archive(
    ), f"transport get failure: {image_store.url}"
    return image_store