From 9647a5916458c8d0c01069c2ea2202c38d5415d8 Mon Sep 17 00:00:00 2001 From: Alberto Faria Date: Wed, 17 Apr 2024 20:47:15 +0100 Subject: [PATCH] create: Add a --print-config-json flag Useful for debugging. Signed-off-by: Alberto Faria --- src/commands/create/custom_opts.rs | 3 +++ src/commands/create/mod.rs | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/commands/create/custom_opts.rs b/src/commands/create/custom_opts.rs index 34b94f7..14d4a2b 100644 --- a/src/commands/create/custom_opts.rs +++ b/src/commands/create/custom_opts.rs @@ -63,6 +63,9 @@ pub struct CustomOptions { #[clap(long)] pub print_libvirt_xml: bool, + + #[clap(long, conflicts_with = "print_libvirt_xml")] + pub print_config_json: bool, } impl CustomOptions { diff --git a/src/commands/create/mod.rs b/src/commands/create/mod.rs index 799040b..d092c86 100644 --- a/src/commands/create/mod.rs +++ b/src/commands/create/mod.rs @@ -151,9 +151,12 @@ fn set_up_container_root( // configure container entrypoint - let command = match custom_options.print_libvirt_xml { - true => vec!["cat", "/crun-vm/domain.xml"], - false => vec!["/crun-vm/entrypoint.sh"], + let command = if custom_options.print_libvirt_xml { + vec!["cat", "/crun-vm/domain.xml"] + } else if custom_options.print_config_json { + vec!["cat", "/crun-vm/config.json"] + } else { + vec!["/crun-vm/entrypoint.sh"] }; spec.set_process({