rfe: import local containers from a relative path
Importing a local container from a .tar appears to only work when a full path is specified.
# wwctl container import fuzzball-substrate-compute.tar fuzzball-substrate-compute
ERROR : Could not import image: error opening file "/fuzzball-substrate-compute.tar": open /fuzzball-substrate-compute.tar: no such file or directory
Even this didn't work.
# wwctl container import ./fuzzball-substrate-compute.tar fuzzball-substrate-compute2
ERROR : Could not import image: error opening file "/./fuzzball-substrate-compute.tar": open /./fuzzball-substrate-compute.tar: no such file or directory
I was able to get around it with readlink.
# wwctl container import $(readlink -f fuzzball-substrate-compute.tar) fuzzball-substrate-compute2
But this seems unnecessarily baroque, and import should be able to receive a relative path to the file to import.
The official syntax is to use file://pathToTarBall so with this syntax a relative path is not sensible. That it's possible to use this without file prefix is a kind bug.
Syntax without a prefix is explicitly documented.
$ wwctl container import -h
This command will pull and import a container into Warewulf from SOURCE,
optionally renaming it to NAME. The SOURCE must be in a supported URI format. Formats
are:
* docker://registry.example.org/example:latest
* docker-daemon://example:latest
* file://path/to/archive/tar/ball
* /path/to/archive/tar/ball
* /path/to/chroot/
[...]
$ man wwctl-container-import
NAME
wwctl-container-import - Import a container into Warewulf
SYNOPSIS
wwctl container import [OPTIONS] SOURCE [NAME]
DESCRIPTION
This command will pull and import a container into Warewulf from SOURCE, optionally renaming it to NAME. The SOURCE must be in a supported URI format. Formats are:
* docker://registry.example.org/example:latest
* docker-daemon://example:latest
* file://path/to/archive/tar/ball
* /path/to/archive/tar/ball
* /path/to/chroot/ Imported containers are used to create bootable VNFS images.
[...]
Also at https://warewulf.org/docs/enchiridion/containers
sudo wwctl container import /tmp/newroot containername
I remember that I didn't want to write "/absolute/path/to/archive/tar/ball" So the problem here is that the underlying API wants the absolute paths, so as there might be a proper reason for this constraint, and I did not have the time for a proper investigation.
Even if the API wants an absolute path, the CLI could resolve the absolute path automatically.
I'm going to look into this.