Blob Blame History Raw
From ff470338e6232d72f3e9f697d5c90c0f7e2a7993 Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Wed, 30 Jan 2019 15:13:17 +0100
Subject: [PATCH] fix crashes when using unsupported options

---
 pcs/config.py | 9 +++++----
 pcs/status.py | 1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/pcs/config.py b/pcs/config.py
index 304c9040..f0d80222 100644
--- a/pcs/config.py
+++ b/pcs/config.py
@@ -48,11 +48,12 @@ from pcs.cli.common.errors import CmdLineInputError
 # pylint: disable=too-many-branches, too-many-locals, too-many-statements
 
 def config_cmd(lib, argv, modifiers):
-    if not argv:
-        config_show(lib, argv, modifiers)
-        return
-
     try:
+        if not argv:
+            sub_cmd = "show"
+            config_show(lib, argv, modifiers)
+            return
+
         sub_cmd = argv.pop(0)
         if sub_cmd == "help":
             usage.config(argv)
diff --git a/pcs/status.py b/pcs/status.py
index 5b3af0d1..3ba7d152 100644
--- a/pcs/status.py
+++ b/pcs/status.py
@@ -23,6 +23,7 @@ from pcs.lib.sbd import get_sbd_service_name
 def status_cmd(lib, argv, modifiers):
     try:
         if not argv:
+            sub_cmd = "status"
             full_status(lib, argv, modifiers)
             sys.exit(0)
 
-- 
2.17.0