qmp.py: Avoid "has_key" usage

The "has_key" is deprecated in favor of "__in__" operator.

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20170818142613.32394-9-ldoktor@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Lukáš Doktor 2017-08-18 16:26:11 +02:00 committed by Eduardo Habkost
parent 3dd29b4133
commit 2cb05a3f36

View File

@ -197,7 +197,7 @@ class QEMUMonitorProtocol(object):
Build and send a QMP command to the monitor, report errors if any
"""
ret = self.cmd(cmd, kwds)
if ret.has_key('error'):
if "error" in ret:
raise Exception(ret['error']['desc'])
return ret['return']