summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2022-06-15 04:47:41 -0400
committerDaniil Baturin <daniil@vyos.io>2022-06-15 04:47:41 -0400
commitf08b850f297422925b8e0a16d67accee6843b9e1 (patch)
treea50d0ec5b635a65e5b3bd770ddfd2175be4c1042 /python/vyos
parenta90faa4ddcd909415e8df6806214471acdc4b17c (diff)
downloadvyos-1x-f08b850f297422925b8e0a16d67accee6843b9e1.tar.gz
vyos-1x-f08b850f297422925b8e0a16d67accee6843b9e1.zip
T2719: handle the case when script subcommand is not given
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/opmode.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/python/vyos/opmode.py b/python/vyos/opmode.py
index c0812c7fd..692e5fc98 100644
--- a/python/vyos/opmode.py
+++ b/python/vyos/opmode.py
@@ -13,6 +13,7 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
+import sys
import typing
@@ -97,6 +98,11 @@ def run(module):
# so that we can modify it and pack for passing to functions
args = vars(parser.parse_args())
+ if not args["subcommand"]:
+ print("Subcommand required!")
+ parser.print_usage()
+ sys.exit(1)
+
func = functions[args["subcommand"]]
# Remove the subcommand from the arguments,