Juan Hernandez has uploaded a new change for review.

Change subject: cli: Support escape of double quote in strings
......................................................................

cli: Support escape of double quote in strings

Currently strings support escape sequences, but they aren't replaced by
the corresponding characters. For example, in the following command:

  # update vm myvv --name "My \"VM\""

The name of the VM will be set to exactly this:

  My \"VM\"

Note that the backslash isn't removed.

This makes it impossible to use strings that represent data that
contain double quotes, in particular it makes it impossible to use XML
documents, which are needed when setting the OVF representation of a VM.

This patch changes the CLI so that the escape character preceding the
double quote will be removed, thus the above command will result in the
following name:

  My "VM"

Change-Id: Ied53ac577efa3395438892de535c35cd068a12bd
Bug-Url: https://bugzilla.redhat.com/1211670
Signed-off-by: Juan Hernandez <[email protected]>
---
M src/cli/parser.py
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/90/40690/1

diff --git a/src/cli/parser.py b/src/cli/parser.py
index 70e9f27..e2b8fa2 100644
--- a/src/cli/parser.py
+++ b/src/cli/parser.py
@@ -69,6 +69,7 @@
         r'''(?s)("([^"\\]|\\.)*"|'[^']*')'''
         if t.value[0] == '"':
             t.value = t.value[1:-1].replace(r'\\', '\\')
+            t.value = t.value.replace('\\"', '"')
         else:
             t.value = t.value[1:-1]
         t.value = t.value.replace('\\\n', '')


-- 
To view, visit https://gerrit.ovirt.org/40690
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied53ac577efa3395438892de535c35cd068a12bd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to