summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,