[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL for 2.9 02/49] qmp: allow setting properties to empty
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL for 2.9 02/49] qmp: allow setting properties to empty string in qmp-shell |
Date: |
Thu, 16 Mar 2017 07:27:18 +0100 |
From: "Daniel P. Berrange" <address@hidden>
The qmp-shell property parser currently rejects attempts to
set string properties to the empty string eg
(QEMU) migrate-set-parameters tls-hostname=
Error while parsing command line: Expected a key=value pair, got
'tls-hostname='
command format: <command-name> [arg-name1=arg1] ... [arg-nameN=argN]
This is caused by checking the wrong condition after splitting
the parameter on '='. The "partition" method will return "" for
the separator field, if the seperator was not present, so that
is the correct thing to check for malformed syntax.
Signed-off-by: Daniel P. Berrange <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
scripts/qmp/qmp-shell | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index 0373b24..eccb88a 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -166,8 +166,8 @@ class QMPShell(qmp.QEMUMonitorProtocol):
def __cli_expr(self, tokens, parent):
for arg in tokens:
- (key, _, val) = arg.partition('=')
- if not val:
+ (key, sep, val) = arg.partition('=')
+ if sep != '=':
raise QMPShellError("Expected a key=value pair, got '%s'" %
arg)
value = self.__parse_value(val)
--
2.7.4
- [Qemu-devel] [PULL for 2.9 00/49] QAPI patches for 2017-03-16, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 02/49] qmp: allow setting properties to empty string in qmp-shell,
Markus Armbruster <=
- [Qemu-devel] [PULL for 2.9 03/49] qapi: Factor QAPISchemaParser._include() out of .__init__(), Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 06/49] docs/qapi-code-gen.txt: Drop confusing reference to 'gen', Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 10/49] tests/qapi-schema: Cover empty union base, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 11/49] qapi: Fix to reject empty union base gracefully, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 01/49] qapi2texi: change texi formatters, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 08/49] qapi: Have each QAPI schema declare its name rule violations, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 07/49] qapi: Have each QAPI schema declare its returns white-list, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 12/49] qapi2texi: Fix up output around #optional, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 04/49] qapi: Make doc comments optional where we don't need them, Markus Armbruster, 2017/03/16
- [Qemu-devel] [PULL for 2.9 20/49] qapi: Use raw strings for regular expressions consistently, Markus Armbruster, 2017/03/16