def extract(self, archive_path: str, extract_path: str) -> None: logger.debug(f"pack.extract.tar: {extract_path}") SUDO.file_assert(archive_path) extract_temp = make_temp_path("tar-extract-temp") SUDO.folder_ensure(extract_temp) tar = Tar() tar.with_archive(archive_path) tar.with_extract(extract_temp) tar.with_packer(archive_path) tar.with_make_unpack() # keep last tar.execute_unit_sert() if SUDO.folder_check(extract_path): # user rsync to preserve active machines SUDO.files_sync_full(extract_temp, extract_path) SUDO.files_delete(extract_temp) else: # user move for efficiency SUDO.files_move(extract_temp, extract_path) synchronize_header(archive_path, extract_path)
def invoke_push(self, effect: token.PushEffect) -> None: # assert self.image_url # source_image = self.build_image target_image = image_store_from_url(self.image_url) perform_image_move(source_image, target_image) # image_type = ImageTypeNspawn image_meta = ImageMeta( image_url=self.image_url, overlay_url_list=self.overlay_url_list, profile_command=self.profile_bucket.command, profile_entry_list=self.profile_bucket.render_entry_list(), ) target_image = target_image.with_image_type( image_type).with_image_meta(image_meta) # runtime_root = self.runtime_path('/') extract_root = target_image.extract_path() SUDO.files_sync_full(runtime_root, extract_root) # perform_image_put_steps(target_image)
def put(self, local_url: str, remote_url: str) -> None: logger.debug(f"file.put.upload: {remote_url}") local, remote = self.parse(local_url, remote_url) SUDO.files_sync_full(local.path, remote.path) synchronize_header(local.path, remote.path)
def get(self, local_url: str, remote_url: str) -> None: logger.debug(f"file.get.fetch: {remote_url}") local, remote = self.parse(local_url, remote_url) SUDO.files_sync_full(remote.path, local.path) synchronize_header(remote.path, local.path)