From 526234c0738fec1945127ba2875cc29b042fbce0 Mon Sep 17 00:00:00 2001 From: Thierry Escande Date: Fri, 18 Aug 2023 17:27:02 +0200 Subject: [PATCH] Add support for xe --force argument Some xe commands, like vtpm-destroy, need to be passed a --force parameter. Since it doesn't take any value, it needs to be handled like the --minimal argument. This patch adds support for a force=True|False parameter to host.xe(), with force=False being the default. Signed-off-by: Thierry Escande --- lib/host.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/host.py b/lib/host.py index d90a8e11a..2977d73ff 100644 --- a/lib/host.py +++ b/lib/host.py @@ -67,15 +67,17 @@ def scp(self, src, dest, check=True, suppress_fingerprint_warnings=True, local_d suppress_fingerprint_warnings=suppress_fingerprint_warnings, local_dest=local_dest ) - def xe(self, action, args={}, check=True, simple_output=True, minimal=False): + def xe(self, action, args={}, check=True, simple_output=True, minimal=False, force=False): maybe_param_minimal = ['--minimal'] if minimal else [] + maybe_param_force = ['--force'] if force else [] def stringify(key, value): if isinstance(value, bool): return "{}={}".format(key, to_xapi_bool(value)) return "{}={}".format(key, shlex.quote(value)) - command = ['xe', action] + maybe_param_minimal + [stringify(key, value) for key, value in args.items()] + command = ['xe', action] + maybe_param_minimal + maybe_param_force + \ + [stringify(key, value) for key, value in args.items()] result = self.ssh( command, check=check,