diff options
author | Daniel Vonthethoff <daniel@enigmaalgorithms.com> | 2019-12-17 04:58:15 +0000 |
---|---|---|
committer | Daniel Vonthethoff <daniel@enigmaalgorithms.com> | 2019-12-17 04:58:15 +0000 |
commit | 9531f0b942963c7c6d40b04196c8e49e729e76c5 (patch) | |
tree | 241b94c02cbcaa4ed1c798f59cb4cfe14de22a1a | |
parent | d12eb68d5f1bf72a67ea3b0b92b5699ce026e446 (diff) | |
download | vmdb2-9531f0b942963c7c6d40b04196c8e49e729e76c5.tar.gz |
Added keyring functionality to debootstrap
-rw-r--r-- | vmdb/plugins/debootstrap.mdwn | 3 | ||||
-rw-r--r-- | vmdb/plugins/debootstrap_plugin.py | 6 | ||||
-rw-r--r-- | vmdb/plugins/qemudebootstrap.mdwn | 3 | ||||
-rw-r--r-- | vmdb/plugins/qemudebootstrap_plugin.py | 26 |
4 files changed, 30 insertions, 8 deletions
diff --git a/vmdb/plugins/debootstrap.mdwn b/vmdb/plugins/debootstrap.mdwn index 6cece28..3d3b093 100644 --- a/vmdb/plugins/debootstrap.mdwn +++ b/vmdb/plugins/debootstrap.mdwn @@ -13,8 +13,11 @@ Step keys: * `mirror` — OPTIONAL; which Debian mirror to use +* `keyring` — OPTIONAL; which gpg keyring to use to verify the packages. + Example (in the .vmdb file): - debootstrap: buster target: root mirror: http://mirror.example.com/debian + keyring: /etc/apt/trusted.gpg diff --git a/vmdb/plugins/debootstrap_plugin.py b/vmdb/plugins/debootstrap_plugin.py index f52f718..1a59063 100644 --- a/vmdb/plugins/debootstrap_plugin.py +++ b/vmdb/plugins/debootstrap_plugin.py @@ -38,10 +38,14 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): tag = step['target'] target = state.tags.get_mount_point(tag) mirror = step['mirror'] + keyring = step.get('keyring', None) variant = step.get('variant', '-') if not (suite and tag and target and mirror): raise Exception('missing arg for debootstrap step') - vmdb.runcmd(['debootstrap', '--variant', variant, suite, target, mirror]) + if keyring: + vmdb.runcmd(['debootstrap', '--keyring', keyring, '--variant', variant, suite, target, mirror]) + else: + vmdb.runcmd(['debootstrap', '--variant', variant, suite, target, mirror]) def run_even_if_skipped(self, step, settings, state): tag = step['target'] diff --git a/vmdb/plugins/qemudebootstrap.mdwn b/vmdb/plugins/qemudebootstrap.mdwn index 26bd2bf..21dfc03 100644 --- a/vmdb/plugins/qemudebootstrap.mdwn +++ b/vmdb/plugins/qemudebootstrap.mdwn @@ -15,6 +15,8 @@ Step keys: * `mirror` — OPTIONAL; which Debian mirror to use. +* `keyring` — OPTIONAL; which gpg keyring to use to verify the packages. + * `arch` — REQUIRED; the foreign architecture touse. * `variant` — OPTIONAL; the variant for debootstrap. @@ -24,5 +26,6 @@ Example (in the .vmdb file): - qemu-debootstrap: buster target: root mirror: http://mirror.example.com/debian + keyring: /etc/apt/trusted.gpg arch: arm64 variant: buildd diff --git a/vmdb/plugins/qemudebootstrap_plugin.py b/vmdb/plugins/qemudebootstrap_plugin.py index 9a6ed97..3400474 100644 --- a/vmdb/plugins/qemudebootstrap_plugin.py +++ b/vmdb/plugins/qemudebootstrap_plugin.py @@ -38,18 +38,30 @@ class QemuDebootstrapStepRunner(vmdb.StepRunnerInterface): tag = step['target'] target = state.tags.get_mount_point(tag) mirror = step['mirror'] + keyring = step.get('keyring', None) variant = step.get('variant', '-') arch = step['arch'] components = step.get('components', ['main']) if not (suite and tag and target and mirror and arch): raise Exception('missing arg for qemu-debootstrap step') - vmdb.runcmd( - ['qemu-debootstrap', - '--arch', arch, - '--variant', variant, - '--components', ','.join(components), suite, - target, - mirror]) + if keyring: + vmdb.runcmd( + ['qemu-debootstrap', + '--keyring', keyring, + '--arch', arch, + '--variant', variant, + '--components', ','.join(components), suite, + target, + mirror]) + vmdb.runcmd_chroot(target, ['apt-get', 'update']) + else: + vmdb.runcmd( + ['qemu-debootstrap', + '--arch', arch, + '--variant', variant, + '--components', ','.join(components), suite, + target, + mirror]) vmdb.runcmd_chroot(target, ['apt-get', 'update']) def run_even_if_skipped(self, step, settings, state): |