diff options
author | Daniil Baturin <daniil@vyos.io> | 2022-06-15 04:47:41 -0400 |
---|---|---|
committer | Daniil Baturin <daniil@vyos.io> | 2022-06-15 04:47:41 -0400 |
commit | f08b850f297422925b8e0a16d67accee6843b9e1 (patch) | |
tree | a50d0ec5b635a65e5b3bd770ddfd2175be4c1042 /python/vyos | |
parent | a90faa4ddcd909415e8df6806214471acdc4b17c (diff) | |
download | vyos-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.py | 6 |
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, |