[elbe-devel] [PATCH 05/10] initvmaction: prepare the connection exception processing for retry
Bastian Germann
bage at linutronix.de
Thu Apr 1 18:21:06 CEST 2021
Am 01.04.21 um 13:15 schrieb Torben Hohn:
> currently any thrown exception results in a failure. Either via
> sys.exit(20) with a printed message. Or via raise.
>
> Prepare to catch an exception and then retry the connection without
> exiting.
>
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
Reviewed-by: Bastian Germann <bage at linutronix.de>
> ---
> elbepack/initvmaction.py | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
> index ed5f38c7f..246d047ca 100644
> --- a/elbepack/initvmaction.py
> +++ b/elbepack/initvmaction.py
> @@ -95,7 +95,7 @@ class InitVMAction:
> print("installed, and the service is running properly", file=sys.stderr)
> sys.exit(20)
>
> - if verr.args[0].startswith('authentication unavailable'):
> + elif verr.args[0].startswith('authentication unavailable'):
> print("", file=sys.stderr)
> print("Accessing libvirt provider system not allowed.", file=sys.stderr)
> print("Users which want to use elbe need to be members of the 'libvirt' group.", file=sys.stderr)
> @@ -103,7 +103,7 @@ class InitVMAction:
> print("should fix the problem.", file=sys.stderr)
> sys.exit(20)
>
> - if verr.args[0].startswith('error from service: CheckAuthorization'):
> + elif verr.args[0].startswith('error from service: CheckAuthorization'):
> print("", file=sys.stderr)
> print("Accessing libvirt failed.", file=sys.stderr)
> print("Probably entering the password for accssing libvirt", file=sys.stderr)
> @@ -112,8 +112,9 @@ class InitVMAction:
> print("continue.", file=sys.stderr)
> sys.exit(20)
>
> - # In case we get here, the exception is unknown, and we want to see it
> - raise
> + else:
> + # In case we get here, the exception is unknown, and we want to see it
> + raise
>
> doms = self.conn.listAllDomains()
>
>
More information about the elbe-devel
mailing list