Provide an absolute path to a debootstrap tarball
Hi,
while using tarball: true in manifest file bootstrap-vz returns a debootstrap error E: Tarball must be given a complete path. Debootstrap expects an absolute path to tarball while bootstrap-vz provides relative path.
Bootstrap-vz should provide an absolute path to a debootstrap tarball.
Details:
As described in http://bootstrap-vz.readthedocs.io/en/master/manifests/index.html debootstrap can then be pointed at a tarball and use it instead of downloading packages from the internet.
bootstrapper:
workspace: ./dist
tarball: true
Running bootstrap-vz with the manifest that contains tarball: true returns an error:
[...]
Installing Debian
Command 'debootstrap --arch=amd64 --include=locales --unpack-tarball=./dist/debootstrap-6c80f35a.tar stretch ./dist/e190f459/root http://deb.debian.org/debian/' returned non-zero exit status 1
Traceback (most recent call last):
File "/home/users/mengelmann/bootstrap-vz/bootstrapvz/base/main.py", line 111, in run
tasklist.run(info=bootstrap_info, dry_run=dry_run)
File "/home/users/mengelmann/bootstrap-vz/bootstrapvz/base/tasklist.py", line 44, in run
task.run(info)
File "/home/users/mengelmann/bootstrap-vz/bootstrapvz/common/tasks/bootstrap.py", line 84, in run
log_check_call(executable + options + arguments)
File "/home/users/mengelmann/bootstrap-vz/bootstrapvz/common/tools.py", line 13, in log_check_call
raise e
CalledProcessError: Command 'debootstrap --arch=amd64 --include=locales --unpack-tarball=./dist/debootstrap-6c80f35a.tar stretch ./dist/e190f459/root http://deb.debian.org/debian/' returned non-zero exit status 1
Rolling back
Unmounting the bootstrap volume
[...]
Running debotstrap directly with given options returns an error "E: Tarball must be given a complete path". Link to debootstrap source code https://anonscm.debian.org/cgit/d-i/debootstrap.git/tree/debootstrap#n530
$ sudo debootstrap --arch=amd64 --include=locales --unpack-tarball=./dist/debootstrap-6c80f35a.tar stretch ./dist/e190f459/root http://deb.debian.org/debian/
E: Tarball must be given a complete path
Hm, I think what we need to do here is fix how the workspace path is handled. I never thought of using a relative path for that part. To keep things consistent, I think we should simultaneously make the workspace path relative to the manifest, like we do with a lot of other paths in the manifest.
@andsens sorry for the delay.
You are right - debootstrap finds tarball just fine while using a relative path for workspace in a manifest file.
In my opinion, we should prefer a relative path instead of an absolute path.
Our use case is as follows:
- we have manifest files in a private git repository
- many DevOps may use the manifest files to develop and build images
- many DevOps may work on single dev machine (VM)
- CI system builds images as well
So:
- the hardcoded absolute path within a home directory is not possible
- the hardcoded absolute path out of a home directory (e.g. /target) may conflict when used multiple users
Making workspace path relative to the manifest as you suggested looks great for me (consistency and no need for absolute paths).
Other issue related to relative/absolute paths #368.
@andsens I can try to prepare PR for this issue, but please give me some hints how you would like to get the workspace path relative to the manifest done.
please give me some hints how you would like to get the workspace path relative to the manifest done.
Oh, that's easy. Just use rel_path like all other tasks do. Give it info.manifest.path as the first arg and the relative path in question as the second one.