diff options
author | Ole Troan <ot@cisco.com> | 2017-08-17 10:34:32 +0200 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2017-08-17 13:21:27 +0000 |
commit | 6bf177ce815dc1454e8ac1b9d5bad08fde01d98d (patch) | |
tree | 19e90d9b2b07a3afe38fd96df4cf7fed398b1d6f /src/vpp-api/python/vpp_papi.py | |
parent | 89b931fdf9acfb8d78f11e973af69b46cdc7281d (diff) |
Python API: VPP-947 Empty chroot_prefix fails on encode()
Change-Id: Ide2cdc456f3ab3219930fb8e423b871810469cdc
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/vpp-api/python/vpp_papi.py')
-rw-r--r-- | src/vpp-api/python/vpp_papi.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vpp-api/python/vpp_papi.py b/src/vpp-api/python/vpp_papi.py index c1fa9e8bff9..489731ade66 100644 --- a/src/vpp-api/python/vpp_papi.py +++ b/src/vpp-api/python/vpp_papi.py @@ -449,8 +449,8 @@ class VPP(): def connect_internal(self, name, msg_handler, chroot_prefix, rx_qlen, async): - rv = vpp_api.vac_connect(name.encode(), chroot_prefix.encode(), - msg_handler, rx_qlen) + pfx = chroot_prefix.encode() if chroot_prefix else ffi.NULL + rv = vpp_api.vac_connect(name.encode(), pfx, msg_handler, rx_qlen) if rv != 0: raise IOError(2, 'Connect failed') self.connected = True @@ -465,7 +465,7 @@ class VPP(): self.control_ping_msgdef = self.messages['control_ping'] return rv - def connect(self, name, chroot_prefix=ffi.NULL, async=False, rx_qlen=32): + def connect(self, name, chroot_prefix=None, async=False, rx_qlen=32): """Attach to VPP. name - the name of the client. @@ -478,7 +478,7 @@ class VPP(): return self.connect_internal(name, msg_handler, chroot_prefix, rx_qlen, async) - def connect_sync(self, name, chroot_prefix=ffi.NULL, rx_qlen=32): + def connect_sync(self, name, chroot_prefix=None, rx_qlen=32): """Attach to VPP in synchronous mode. Application must poll for events. name - the name of the client. |