[lxc-devel] [pylxd/master] Fixed string indeces must be integers issue
nanjj on Github
lxc-bot at linuxcontainers.org
Wed Jan 9 07:01:09 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 328 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190108/65eb2a1c/attachment.bin>
-------------- next part --------------
From 5718b77d1906448f8f2b222311c01607eca0e6e4 Mon Sep 17 00:00:00 2001
From: JUN JIE NAN <nanjj at cn.ibm.com>
Date: Wed, 9 Jan 2019 14:57:58 +0800
Subject: [PATCH] Fixed string indeces must be integers issue
Closes issue lxc/pylxd#350
---
pylxd/models/operation.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/pylxd/models/operation.py b/pylxd/models/operation.py
index 94e102d8..f1951197 100644
--- a/pylxd/models/operation.py
+++ b/pylxd/models/operation.py
@@ -59,7 +59,9 @@ def wait(self):
response = self._client.api.operations[self.id].wait.get()
try:
- if response.json()['metadata']['status'] == 'Failure':
+ md = response.json()['metadata']
+ if not md: md = response.json()
+ if md['status'] == 'Failure':
raise exceptions.LXDAPIException(response)
except KeyError:
# Support for legacy LXD
More information about the lxc-devel
mailing list