diff mbox series

[ovs-dev,v1] ovs-tcpdump: Default to OVS_RUNDIR if present.

Message ID 20220428134300.62159-1-mkp@redhat.com
State Changes Requested
Headers show
Series [ovs-dev,v1] ovs-tcpdump: Default to OVS_RUNDIR if present. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Mike Pattrick April 28, 2022, 1:43 p.m. UTC
Now ovs-tcpdump will check for an OVS_RUNDIR environment variable and
if present, use it instead of the default RUNDIR. This is useful when
used in conjunction with OVS_PAUSE_TEST while running the test suite.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
---
 utilities/ovs-tcpdump.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Ilya Maximets June 20, 2022, 6:18 p.m. UTC | #1
On 4/28/22 15:43, Mike Pattrick wrote:
> Now ovs-tcpdump will check for an OVS_RUNDIR environment variable and
> if present, use it instead of the default RUNDIR. This is useful when
> used in conjunction with OVS_PAUSE_TEST while running the test suite.
> 
> Signed-off-by: Mike Pattrick <mkp@redhat.com>
> ---

Hi, Mike.  Thanks for the patch and sorry for a late review.

The fix seems correct to me in general.  See one small
comment below.

>  utilities/ovs-tcpdump.in | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
> index 82d1bedfa..4798bdea6 100755
> --- a/utilities/ovs-tcpdump.in
> +++ b/utilities/ovs-tcpdump.in
> @@ -403,7 +403,10 @@ def py_which(executable):
>  
>  
>  def main():
> -    db_sock = 'unix:@RUNDIR@/db.sock'
> +    if 'OVS_RUNDIR' in os.environ:
> +        db_sock = 'unix:%s' % os.path.join(os.environ['OVS_RUNDIR'], 'db.sock')
> +    else:
> +        db_sock = 'unix:@RUNDIR@/db.sock'

I'm not a python expert, but it might be better to just call
os.environ.get('OVS_RUNDIR', '@RUNDIR@') and then construct
the db_sock path using the result.

What do you think?

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
index 82d1bedfa..4798bdea6 100755
--- a/utilities/ovs-tcpdump.in
+++ b/utilities/ovs-tcpdump.in
@@ -403,7 +403,10 @@  def py_which(executable):
 
 
 def main():
-    db_sock = 'unix:@RUNDIR@/db.sock'
+    if 'OVS_RUNDIR' in os.environ:
+        db_sock = 'unix:%s' % os.path.join(os.environ['OVS_RUNDIR'], 'db.sock')
+    else:
+        db_sock = 'unix:@RUNDIR@/db.sock'
     interface = None
     tcpdargs = []