You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ipa-healthcheck/SOURCES/0010-Validate-that-a-known-...

55 lines
1.7 KiB

From eb6cb8ec7abad0d627ad82fb2761fa313849f2fc Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcritten@redhat.com>
Date: Thu, 28 Apr 2022 08:33:35 -0400
Subject: [PATCH] Validate that a known output-type has been selected
A user may pass an unknown value in via the configuration file.
https://bugzilla.redhat.com/show_bug.cgi?id=2079698
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
---
src/ipahealthcheck/core/constants.py | 2 --
src/ipahealthcheck/core/core.py | 5 ++++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/ipahealthcheck/core/constants.py b/src/ipahealthcheck/core/constants.py
index 6a061f7..de27cea 100644
--- a/src/ipahealthcheck/core/constants.py
+++ b/src/ipahealthcheck/core/constants.py
@@ -2,8 +2,6 @@
# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
#
-DEFAULT_OUTPUT = 'json'
-
# Error reporting result
SUCCESS = 0
WARNING = 10
diff --git a/src/ipahealthcheck/core/core.py b/src/ipahealthcheck/core/core.py
index c5275b6..c04a6ee 100644
--- a/src/ipahealthcheck/core/core.py
+++ b/src/ipahealthcheck/core/core.py
@@ -320,7 +320,7 @@ class RunChecks:
def run_healthcheck(self):
framework = object()
plugins = []
- output = constants.DEFAULT_OUTPUT
+ output = None
logger.setLevel(logging.WARNING)
@@ -413,6 +413,9 @@ class RunChecks:
if out.__name__.lower() == options.output_type:
output = out(options)
break
+ if output is None:
+ print(f"Unknown output-type '{options.output_type}'")
+ return 1
if options.list_sources:
return list_sources(plugins)
--
2.31.1