juju / theblues

Python library for the juju charmstore (v4)
GNU Lesser General Public License v3.0
5 stars 22 forks source link

CharmStore.entity() fails with "unrecognized metadata name "published"" #43

Closed johnsca closed 8 years ago

johnsca commented 8 years ago

Attempting to access any entity fails with: unrecognized metadata name "published"

>>> from theblues.charmstore import CharmStore
>>> cs = CharmStore('https://api.jujucharms.com/v4')

>>> cs.entityId('ubuntu')
'cs:xenial/ubuntu-8'

>>> cs.entity('ubuntu')
ERROR:root:Error during request: https://api.jujucharms.com/v4/ubuntu/meta/any?include=bundle-machine-count&include=bundle-metadata&include=bundle-unit-count&include=bundles-containing&include=charm-config&include=charm-metadata&include=common-info&include=extra-info&include=owner&include=revision-info&include=published&include=stats&include=resources&include=supported-series&include=terms status code:(500) message: {"Message":"unrecognized metadata name \"published\"","Code":""}
Traceback (most recent call last):
  File "/home/johnsca/juju/python-libjuju/.tox/py35/lib/python3.5/site-packages/theblues/charmstore.py", line 57, in _get
    response.raise_for_status()
  File "/home/johnsca/juju/python-libjuju/.tox/py35/lib/python3.5/site-packages/requests/models.py", line 862, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://api.jujucharms.com/v4/ubuntu/meta/any?include=bundle-machine-count&include=bundle-metadata&include=bundle-unit-count&include=bundles-containing&include=charm-config&include=charm-metadata&include=common-info&include=extra-info&include=owner&include=revision-info&include=published&include=stats&include=resources&include=supported-series&include=terms

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/johnsca/juju/python-libjuju/.tox/py35/lib/python3.5/site-packages/theblues/charmstore.py", line 135, in entity
    return self._meta(entity_id, includes, channel=channel)
  File "/home/johnsca/juju/python-libjuju/.tox/py35/lib/python3.5/site-packages/theblues/charmstore.py", line 106, in _meta
    data = self._get(url)
  File "/home/johnsca/juju/python-libjuju/.tox/py35/lib/python3.5/site-packages/theblues/charmstore.py", line 72, in _get
    message)
theblues.errors.ServerError: (500, '{"Message":"unrecognized metadata name \\"published\\"","Code":""}', 'Error during request: https://api.jujucharms.com/v4/ubuntu/meta/any?include=bundle-machine-count&include=bundle-metadata&include=bundle-unit-count&include=bundles-containing&include=charm-config&include=charm-metadata&include=common-info&include=extra-info&include=owner&include=revision-info&include=published&include=stats&include=resources&include=supported-series&include=terms status code:(500) message: {"Message":"unrecognized metadata name \\"published\\"","Code":""}')
johnsca commented 8 years ago

Updating to v5 of the API fixes this. The summary of the repo is inaccurate, and it would be better if the API version was coded into the library, instead of being provided by the user. I will open a separate issue for that.