diff mbox

[KVM-AUTOTEST,06/06] kvm_config: Make split_and_strip function to strip the right quotes

Message ID 1244507691-9575-6-git-send-email-lmr@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Meneghel Rodrigues June 9, 2009, 12:34 a.m. UTC
In some occasions, the current logic to strip quotest from config
parameters might remove valid quotes from the params. This patch
fixes this problem.

Signed-off-by: Yolkfull Chow <yzhou@redhat.com>
---
 client/tests/kvm/kvm_config.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Comments

Lucas Meneghel Rodrigues June 10, 2009, 7:30 p.m. UTC | #1
On Mon, 2009-06-08 at 21:34 -0300, Lucas Meneghel Rodrigues wrote:
> In some occasions, the current logic to strip quotest from config
> parameters might remove valid quotes from the params. This patch
> fixes this problem.

Applied, thanks!

> Signed-off-by: Yolkfull Chow <yzhou@redhat.com>
> ---
>  client/tests/kvm/kvm_config.py |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
> index 40f16f1..5d9b69e 100755
> --- a/client/tests/kvm/kvm_config.py
> +++ b/client/tests/kvm/kvm_config.py
> @@ -139,7 +139,10 @@ class config:
>          temp = str.split(sep, 1)
>          for i in range(len(temp)):
>              temp[i] = temp[i].strip()
> -            temp[i] = temp[i].strip("\"\'")
> +            if re.findall("^\".*\"$", temp[i]):
> +                temp[i] = temp[i].strip("\"")
> +            elif re.findall("^\'.*\'$", temp[i]):
> +                temp[i] = temp[i].strip("\'")
>          return temp
>  
>
diff mbox

Patch

diff --git a/client/tests/kvm/kvm_config.py b/client/tests/kvm/kvm_config.py
index 40f16f1..5d9b69e 100755
--- a/client/tests/kvm/kvm_config.py
+++ b/client/tests/kvm/kvm_config.py
@@ -139,7 +139,10 @@  class config:
         temp = str.split(sep, 1)
         for i in range(len(temp)):
             temp[i] = temp[i].strip()
-            temp[i] = temp[i].strip("\"\'")
+            if re.findall("^\".*\"$", temp[i]):
+                temp[i] = temp[i].strip("\"")
+            elif re.findall("^\'.*\'$", temp[i]):
+                temp[i] = temp[i].strip("\'")
         return temp