Skip to content

Commit

Permalink
ovs-vtep: Use shlex module to split args.
Browse files Browse the repository at this point in the history
string.split() function splits a quoted string if there is a whitespace
inside the quote.
ex: The following code snippet will output ['printing', '"No', 'Diagnostic"']
args = 'printing "No Diagnostic"'
print args.split()

The above is a problem if we run the following command through vtep_ctl().
vtep-ctl set tunnel $uuid bfd_status:diagnostic="No Diagnostic"

The workaround is to use the split() function from shlex module.

Signed-off-by: Gurucharan Shetty <[email protected]>
Acked-by: Ariel Tubaltsev <[email protected]>
Acked-by: Justin Pettit <[email protected]>
  • Loading branch information
shettyg committed Sep 25, 2014
1 parent cedb277 commit 260f76b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions vtep/ovs-vtep
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import argparse
import re
import shlex
import subprocess
import sys
import time
Expand Down Expand Up @@ -55,13 +56,13 @@ def call_prog(prog, args_list):
return output

def ovs_vsctl(args):
return call_prog("ovs-vsctl", args.split())
return call_prog("ovs-vsctl", shlex.split(args))

def ovs_ofctl(args):
return call_prog("ovs-ofctl", args.split())
return call_prog("ovs-ofctl", shlex.split(args))

def vtep_ctl(args):
return call_prog("vtep-ctl", args.split())
return call_prog("vtep-ctl", shlex.split(args))


def unixctl_exit(conn, unused_argv, unused_aux):
Expand Down

0 comments on commit 260f76b

Please sign in to comment.