Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Charms facade version 7 #1157

Open
james-garner-canonical opened this issue Oct 10, 2024 · 0 comments
Open

Support Charms facade version 7 #1157

james-garner-canonical opened this issue Oct 10, 2024 · 0 comments
Labels
area/endpoint hint/3.x going on main branch kind/feature suggests new feature or enhancement kind/wishlist requested feature priority/normal normal priority

Comments

@james-garner-canonical
Copy link
Contributor

Description

The existing schema files contain a definition for Charms facade version 7, which python-libjuju generates code for (in _client7.py). Unfortunately, python-libjuju itself doesn't support this facade version (yet!). At least one place where changes are needed is supporting juju.client.CharmsFacade.ResolveCharms version 7, which will return a differently shaped result from Juju than version 6. This comes up in juju.model.Model._resolve_charm, where a result from version 7 fails on this line with a KeyError:

supported_series = result.get('supported_series', result.unknown_fields['supported-series'])

Version 7 results have 'supported_bases' instead (see #1156).

Below is an example of the response received from version 7, where we currently fail with a KeyError. We can't just use 'supported_bases' instead of 'supported_series' as it is passed to juju.utils.series_selector , which doesn't support bases.

<class 'juju.client._definitions.ResolveCharmWithChannelResults'>(
    {
        'charm_origin': <class 'juju.client._definitions.CharmOrigin'>(
            {
                'architecture': 'amd64',
                'base': <class 'juju.client._definitions.Base'>({'channel': '22.04/stable', 'name': 'ubuntu', 'unknown_fields': {}}),
                'branch': None,
                'hash_': None,
                'id_': '',
                'instance_key': None,
                'revision': 25,
                'risk': 'stable',
                'source': 'charm-hub',
                'track': 'latest',
                'type_': 'charm',
                'unknown_fields': {}
            }
        ),
        'error': None,
        'supported_bases': [
            <class 'juju.client._definitions.Base'>({'channel': '22.04', 'name': 'ubuntu', 'unknown_fields': {}}),
            <class 'juju.client._definitions.Base'>({'channel': '20.04', 'name': 'ubuntu', 'unknown_fields': {}}),
            <class 'juju.client._definitions.Base'>({'channel': '18.04', 'name': 'ubuntu', 'unknown_fields': {}}),
            <class 'juju.client._definitions.Base'>({'channel': '16.04', 'name': 'ubuntu', 'unknown_fields': {}}),
            <class 'juju.client._definitions.Base'>({'channel': '14.04', 'name': 'ubuntu', 'unknown_fields': {}}),
            <class 'juju.client._definitions.Base'>({'channel': '19.04', 'name': 'ubuntu', 'unknown_fields': {}})
        ],
        'url': 'ch:amd64/jammy/juju-qa-test-25',
        'unknown_fields': {}
    }
)

Resolving #1156 by implementing support for bases will almost resolve this issue -- we'd just need to add Charms version 7 to juju.client.connection.client_facades (and ensure it isn't manually marked to be excluded).

Urgency

It would save from a weird workaround

Code I'd Like to Run

...
@james-garner-canonical james-garner-canonical added kind/wishlist requested feature hint/3.x going on main branch priority/normal normal priority kind/feature suggests new feature or enhancement area/endpoint labels Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/endpoint hint/3.x going on main branch kind/feature suggests new feature or enhancement kind/wishlist requested feature priority/normal normal priority
Projects
None yet
Development

No branches or pull requests

1 participant