Beispiel #1
0
def package_image(argv):
    args = parse_args(argv)
    with open(args.subvolume_json) as infile:
        Format.make(args.format).package_full(
            SubvolumeOnDisk.from_json_file(infile, args.subvolumes_dir),
            output_path=args.output_path,
        )
def find_built_subvol(layer_output, path_in_repo=None):
    with open(os.path.join(layer_output, 'layer.json')) as infile:
        return Subvol(
            SubvolumeOnDisk.from_json_file(
                infile,
                subvolumes_dir(path_in_repo),
            ).subvolume_path(),
            already_exists=True,
        )
Beispiel #3
0
def find_built_subvol(
    layer_output, *, path_in_repo=None, subvolumes_dir=None,
):
    # It's OK for both to be None (uses the current file to find repo), but
    # it's not OK to set both.
    assert (path_in_repo is None) or (subvolumes_dir is None)
    with open(Path(layer_output) / 'layer.json') as infile:
        return Subvol(
            SubvolumeOnDisk.from_json_file(
                infile,
                subvolumes_dir if subvolumes_dir
                    else _get_subvolumes_dir(path_in_repo),
            ).subvolume_path(),
            already_exists=True,
        )
Beispiel #4
0
def get_subvolume_path(layer_json, subvolumes_dir):
    with open(layer_json) as infile:
        return SubvolumeOnDisk.from_json_file(infile,
                                              subvolumes_dir).subvolume_path()