allow overriding debootstrap parameters
In the light of the buster change to usrmerge, I feel the need to pass extra, arbitrary arguments to debootstrap. This is currently not supported by ganeti-instance-deboostrap itself but I found a workaround; by adding this to my variants.conf
(e.g. variants/buster.conf
) file:
debootstrap() {
/usr/sbin/debootstrap --no-merged-usr "$@"
}
... I can override how the debootstrap
command runs, because the variants.conf
files are just sourced by the create
command in ganeti-instance-debootsrap (which is just a shell script).
Yes, that's ugly as hell. But no, there's no way around this, unless we patch ganeti-instance-deboostrap. My previous experience with that did not work so well, so I doubt that's a good way forward.
This, by the way, would allow us to use faster bootstrapping tools like mmdebstrap as well, which shouldn't be neglected.
Unfortunately, the way this module is structured right now, we can't pass extra parameters like this in the variants files. At most we can define extra arbitrary variables, but not arbitrary shell code like this.
I feel the Ganeti::Variant
type is a little over-engineered and too tightly coupled with the ganeti-instance-deboostrap code. Whenever a new variable gets added or removed in the latter, we need to update the former. And we can't do customizations like that easily.
I would like to introduce a new variable in that type, maybe:
Optional[extra_code] => String[1],
... and just inject the hell out of this thing directly in the config. The variant would therefore look like:
class { 'ganeti':
debootstrap_variants => {
'buster+nomerge': {
'extra_code': "debootstrap() { /usr/sbin/debootstrap --no-merged-usr "$@" }\n",
}
},
}
Yes, that's ugly as hell. But no, I can't find another way.
Any other brilliant ideas before I submit this as a MR?
Thanks!