From 02cba6e81f26db4aaacb7d32615faa397591cca6 Mon Sep 17 00:00:00 2001 From: Dave Wallace Date: Tue, 17 May 2022 17:36:58 -0400 Subject: [PATCH] Fix optional vpp args handling Signed-off-by: Dave Wallace --- vpp/applier.py | 9 +++++++-- vppcfg | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/vpp/applier.py b/vpp/applier.py index 3683fd4..c2d36f8 100644 --- a/vpp/applier.py +++ b/vpp/applier.py @@ -27,8 +27,13 @@ class Applier(VPPApi): # pylint: disable=unnecessary-pass - def __init__(self, address="/run/vpp/api.sock", clientname="vppcfg"): - VPPApi.__init__(self, address, clientname) + def __init__( + self, + vpp_api_socket="/run/vpp/api.sock", + vpp_json_dir="/usr/share/vpp/api/", + clientname="vppcfg", + ): + VPPApi.__init__(self, vpp_api_socket, vpp_json_dir, clientname) self.logger.info("VPP Applier: changing the dataplane is enabled") def set_interface_ip_address(self, ifname, address, is_set=True): diff --git a/vppcfg b/vppcfg index 7b8f3de..f2cf35e 100755 --- a/vppcfg +++ b/vppcfg @@ -199,9 +199,9 @@ def main(): ) opt_kwargs = {} - if "vpp_json_dir" in args: + if "vpp_json_dir" in args and args.vpp_json_dir is not None: opt_kwargs["vpp_json_dir"] = args.vpp_json_dir - if "vpp_api_socket" in args: + if "vpp_api_socket" in args and args.vpp_api_socket is not None: opt_kwargs["vpp_api_socket"] = args.vpp_api_socket if args.command == "dump":