-
Notifications
You must be signed in to change notification settings - Fork 102
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
Incorrect schema is used to generate the clients #1099
Comments
I've been looking into this, and I have some questions. What changes might need to be made in the juju repo?
Maybe we add a On the other hand, if no one should be using non-client schema, then do we want to just modify
Generating schemas for these older releases is made a little bit more painful by the fact that the schema generation code lives in the Juju repo. Would it be good to commit new schema generation code and new schemas to the relevant Juju branches? Alternatively, we could just generate the client only schemas without committing any changes to Juju. Is python-libjuju missing schema updates for recent releases?
The latest schema in the main branch of python-libjuju, which tracks the Juju Is it plausible that there haven't been any changes involving facades since
python-libjuju/juju/client/connection.py contains what appears to be a manually maintained list of class names and versions, which saw changes when the # Please keep in alphabetical order
client_facades = {
'Action': {'versions': [2, 6, 7]},
'ActionPruner': {'versions': [1]},
'Agent': {'versions': [2, 3]},
...
'VolumeAttachmentsWatcher': {'versions': [2]},
'VolumeAttachmentPlansWatcher': {'versions': [1]},
} If we need to add schemas for missing releases, how do we figure out the It might be nice if we could pre-emptively address this purely in python-libjuju. If there was a good way to just filter the schemas, then we could skip any changes for old releases of Juju, and filter the schemas in Unfortunately I couldn't see an equivalent to the |
I strongly suspect Juju uses that full schema JSON for other purposes, so we probably need to add a And yes, looks like we should get the schemas up to date. I'm not sure about the manually-maintained list of class names and versions in I'll ask for the Juju team's take on this on Matrix, and we can set up a meeting with a few key people to discuss if needed. |
For (1), the other groups exist to support the Juju Controller work, and for Juju Agent work, and I don't know of anyone trying to build their own Juju Agent via python-libjuju (and it wouldn't be supported if they did). They would also need a different set of credentials, otherwise they would get permission denied even if they tried accessing them as a normal User. For (2), I don't think we particularly care to ship a new version of python-libjuju for 2.9 just to drop extra facades that aren't used. If we were already doing something there, maybe. But espec. 2.9 should not really have much focus given to it. Consider what is there to be stable, and focus more on the newer releases. The supported API changes (from the Juju CLI, but it keeps up to date with the controller) would be available from:
This is what I see:
In general, anything that a 3.3 client was doing (vs a 3.3 controller) should be supported and possible to do versus any 3.4/5/6 controller. It is better to negotiate a discussion on the version that you know works than to jump to the version in 3.5 which might now require an additional field, etc. |
Thank you @benhoyt and @jameinel for your responses. If I'm understanding correctly, In terms of contributing to For If checking This leaves me with a couple of additional questions.
|
Thanks James. From a quick look I'd say yes to both (1b and 2) -- even though it's more work, if we get this right now, it'll clean things up considerably for future work. |
+1 on this plan, (1b and 2). |
@dimaqq also noted that we do only need the latest patch version schema for each minor version, so we can remove the 3.3.0 and 3.3.1 schemas when adding 3.3.6 Can we also remove the 3.1.X and 3.2.X schemas? It doesn't seem worthwhile for future releases of python-libjuju to put effort into continuing to support EOL versions of juju. And @dimaqq tells me that users of python-libjuju for older versions of juju use the python-libjuju release corresponding to their juju version anyway. So we will end up with just client schemas for 3.3.6, 3.4.5, and 3.5.3. |
Actually since 3.1.X is still receiving security updates I guess we should have the 3.1.9 client schema as well. 3.2 is EOL. Is there any value in keeping a schema for 3.2.4? |
…remove-eol-schema #1113 Remove `3.2.X` schemas. Delete `_client*.py` and run `make client`. #### Description Moving towards the goal of having schemas and generated code in python-libjuju only for the latest supported Juju versions (`3.1.9`, `3.3.6`, `3.5.4`, `3.5.3`), and using client only schemas (see #1099), this PR removes schemas for EOL Juju 3.2, and reruns code generations, removing `_client*.py` files and then running `make client`. #### QA Steps CI steps should all continue to pass, except for integration testing which should continue to fail with the usual suspects (see #1108 for a non-exhaustive table of tests that sometimes fail on `main`). #### Notes To hopefully simplify the diffs, this is the first PR in a planned sequence of PRs that will depend on each other. Subsequent PRs will be: 1. replace current schemas with latest release client only schemas (`3.1.9`, `3.3.6`) and regenerate code 2. add client only schema for `3.4.5` and regenerate code 3. add client only schema for `3.5.3` and regenerate code
The schemas output for python-libjuju should not have contained any non-client schemas (see this python-libjuju issue juju/python-libjuju#1099). Switching to only the client schemas reduces the amount of generated code in python-libjuju substantially.
…lace-existing-w-client-only #1160 #### Description Moving towards the goal of having schemas and generated code in `python-libjuju` only for the latest supported Juju versions (`3.1.9`, `3.3.6`, `3.5.4`, `3.5.3`), and using client only schemas (see #1099), this PR replaces the existing `3.1.X` and `3.3.0` schemas with their client-only counterparts. #### QA Steps Tests pass, but is there anything else we should check here?
The schemas output for python-libjuju should not have contained any non-client schemas (see this python-libjuju issue juju/python-libjuju#1099). Switching to only the client schemas reduces the amount of generated code in python-libjuju substantially.
The schemas output for python-libjuju should not have contained any non-client schemas (see this python-libjuju issue juju/python-libjuju#1099). Switching to only the client schemas reduces the amount of generated code in python-libjuju substantially.
The schemas output for python-libjuju should not have contained any non-client schemas (see this python-libjuju issue juju/python-libjuju#1099). Switching to only the client schemas reduces the amount of generated code in python-libjuju substantially.
…build-schema-client-only #18256 The schemas output for python-libjuju should not have contained any non-client schemas -- see python-libjuju issue [#1099](juju/python-libjuju#1099). Switching to only the client schemas reduces the amount of generated code in python-libjuju substantially. python-libjuju now uses client-only schema for the schema files currently checked in (see PR [#1160](juju/python-libjuju#1160)), so it would be nice to land this change for 3.6 to streamline things going forward. ## Checklist <!-- If an item is not applicable, use `~strikethrough~`. --> - [x] ~Code style: imports ordered, good names, simple structure, etc~ - [x] ~Comments saying why design decisions were made~ - [x] ~Go unit tests, with comments saying what you're testing~ - [x] ~[Integration tests](https://github.com/juju/juju/tree/main/tests), with comments saying what you're testing~ - [x] ~[doc.go](https://discourse.charmhub.io/t/readme-in-packages/451) added or updated in changed packages~ ## QA steps <!-- Describe steps to verify that the change works. --> * Move the existing `schema.json` elsewhere. * Run `make rebuild-schema` and verify that a new `schema.json` file has been generated. * Run `make build` and verify that the same contents are generated for the `schema.json`. * Verify that the new `schema.json` contains a subset of the contents of the original (moved) `schema.json`. ## Documentation changes <!-- How it affects user workflow (CLI or API). --> python-libjuju release instructions will be updated to reflect this change. No changes should be needed for juju documentation. ## Links <!-- Link to all relevant specification, documentation, bug, issue or JIRA card. --> python-libjuju issue: juju/python-libjuju#1099 draft PR closed in favour of this PR: #18148
Description
Whilst reviewing the schema outputted from Juju, it's become aware that we also output all controller and agent schema, not just the client schema. This was never the intended case. It should have just been the client schema.
Although the methods are there, it shouldn't be possible to interact with the methods using a user. Instead, you would require the right tag and permissions to do so.
With that in mind, it should be possible to drop the amount of Python code generated for all the facades. This might be something that @dimaqq might want to look into doing.
You would have to generate the schema with the additional flag
-facade-group=client
.https://github.com/juju/juju/blob/1eadc941cf64c3a0652583c8e65d870e7cccf111/Makefile#L494-L504
Urgency
Casually reporting
Python-libjuju version
current
Juju version
3.6.0
Reproduce / Test
The text was updated successfully, but these errors were encountered: