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

Add the ability to populate State from metadata #1454

Open
tonyandrewmeyer opened this issue Nov 12, 2024 · 0 comments
Open

Add the ability to populate State from metadata #1454

tonyandrewmeyer opened this issue Nov 12, 2024 · 0 comments
Labels
feature New feature or request investigate Needs further investigation - do we want to do this? testing Related to ops.testing

Comments

@tonyandrewmeyer
Copy link
Contributor

The State could have some default components based on the Context metadata, or perhaps there could be a fill_from_context method or similar.

For example, this could add:

  • A Container for each container in the metadata (although you'd probably want to be able to specify whether can_connect should be True or False, or it seems like there might be a lot of awkward dataclasses.replace afterwards)
  • config that's the same as the defaults in the metadata
  • A default Network (there's essentially always a Juju network, right?)
  • A Storage for each storage in the metadata (to the minimum side of the multiple value if provided)
  • A StoredState for each ops.StoredState attribute on the Context's charm class (not perfect since these can exist elsewhere, particularly in libs, but maybe a useful base?)

I don't think it could have relations (even if we do make it possible to have data-inaccessible relations, e.g. #1452) since there's a practical difference between a relation existing (from the point of view of the unit) and not existing, wider than just the data being available.

I don't think it could include resources, even though they're in the metadata and always (?) available, because it doesn't seem like there's any way to have a sensible default location for the content.

See this Matrix discussion for more background.

@tonyandrewmeyer tonyandrewmeyer added feature New feature or request testing Related to ops.testing investigate Needs further investigation - do we want to do this? labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request investigate Needs further investigation - do we want to do this? testing Related to ops.testing
Projects
None yet
Development

No branches or pull requests

1 participant