From b4ace38abeddb4f8e2cf2b1cb65a550cf48bce8d Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Tue, 20 Aug 2024 16:53:22 +0200 Subject: [PATCH 1/2] Fix spacecmd type issue during bootstrap --- spacecmd/spacecmd.changes.mczernek.spacecmd-bootstrap-fix | 1 + spacecmd/src/spacecmd/system.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 spacecmd/spacecmd.changes.mczernek.spacecmd-bootstrap-fix diff --git a/spacecmd/spacecmd.changes.mczernek.spacecmd-bootstrap-fix b/spacecmd/spacecmd.changes.mczernek.spacecmd-bootstrap-fix new file mode 100644 index 000000000000..8894d7435249 --- /dev/null +++ b/spacecmd/spacecmd.changes.mczernek.spacecmd-bootstrap-fix @@ -0,0 +1 @@ +- Spacecmd bootstrap now works with specified port (bsc#1229437) diff --git a/spacecmd/src/spacecmd/system.py b/spacecmd/src/spacecmd/system.py index 4eb4cc1b1379..f032c194f390 100644 --- a/spacecmd/src/spacecmd/system.py +++ b/spacecmd/src/spacecmd/system.py @@ -4563,6 +4563,9 @@ def do_system_bootstrap(self, args): if answer in ['y', 'Y']: options.saltssh = True + if isinstance(options.port, str) and options.port.isnumeric(): + options.port = int(options.port) + if not options.hostname: logging.error(_N("Hostname must be provided")) return 1 From b31e453b23873bfcc3f8b29262793d0ca55e9012 Mon Sep 17 00:00:00 2001 From: Marek Czernek Date: Thu, 22 Aug 2024 15:37:47 +0200 Subject: [PATCH 2/2] Fail early if port is not numeric --- spacecmd/src/spacecmd/system.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spacecmd/src/spacecmd/system.py b/spacecmd/src/spacecmd/system.py index f032c194f390..5ef4bf1b5540 100644 --- a/spacecmd/src/spacecmd/system.py +++ b/spacecmd/src/spacecmd/system.py @@ -4563,7 +4563,10 @@ def do_system_bootstrap(self, args): if answer in ['y', 'Y']: options.saltssh = True - if isinstance(options.port, str) and options.port.isnumeric(): + if isinstance(options.port, str): + if not options.port.isnumeric(): + logging.error(_N("Provided port must be numeric")) + return 1 options.port = int(options.port) if not options.hostname: