Commit a7e902d
authored
Merge pull request #452 from juju/johnsca/NoneType-results
#452
Apparently, `list_offers` can return a result with a None value instead of an empty list (or no response key), leading to an error like the following:
```python-traceback
Traceback (most recent call last):
File "/home/johnsca/juju/projects/kubernetes-jenkins/jobs/integration/conftest.py", line 233, in k8s_model
offers = [offer.offer_name for offer in (await k8s_model.list_offers()).results]
File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/model.py", line 1989, in list_offers
return await controller.list_offers(self.info.name)
File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/controller.py", line 769, in list_offers
return await facade.ListApplicationOffers(filters=[params])
File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/facade.py", line 480, in wrapper
reply = await f(*args, **kwargs)
File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/_client2.py", line 2413, in ListApplicationOffers
reply = await self.rpc(msg)
File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/facade.py", line 623, in rpc
result = await self.connection.rpc(msg, encoder=TypeEncoder)
File "/home/johnsca/juju/projects/kubernetes-jenkins/.tox/py3/lib/python3.8/site-packages/juju/client/connection.py", line 484, in rpc
for res in result['response']['results']:
TypeError: 'NoneType' object is not iterable
```2 files changed
Lines changed: 31 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
485 | | - | |
| 485 | + | |
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
0 commit comments