def gen_fs_hash(self): '''Get the filesystem hash if the image class was created with a tar_file''' if self.__tar_file: fs_dir = rootfs.get_untar_dir(self.__tar_file) tar_file = rootfs.get_layer_tar_path(self.__tar_file) # remove the fs directory if it already exists if os.path.isdir(fs_dir): rootfs.root_command(rootfs.remove, fs_dir) rootfs.extract_layer_tar(tar_file, fs_dir) self.__fs_hash = rootfs.calc_fs_hash(fs_dir)
def clean_image_tars(image_obj): '''Clean up untar directories''' for layer in image_obj.layers: fspath = rootfs.get_untar_dir(layer.tar_file) if os.path.exists(fspath): rootfs.root_command(rootfs.remove, fspath)