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

Cannot do peer data IO during install #1452

Open
PietroPasotti opened this issue Nov 7, 2024 · 1 comment
Open

Cannot do peer data IO during install #1452

PietroPasotti opened this issue Nov 7, 2024 · 1 comment
Labels
feature New feature or request needs design needs more thought or spec testing Related to ops.testing

Comments

@PietroPasotti
Copy link
Contributor

PietroPasotti commented Nov 7, 2024

I learned last week that you cannot read/write to the peer relation databag during install.

See juju bug

See thread in matrix

At the moment there is no good way to test this behaviour since scenario.State doesn't keep track of what events you've seen in the past.
Also, ops doesn't give you nice errors. I have encountered several times a 'permission denied' ModelError caused by attempting IO on peer data during install.
image

Not sure how ops can surface this better though, because ops also doesn't keep track of the event history.

Perhaps we could add a NotAccessible singleton to allow the user to do:

state = State(relations={Relation(remote_app_data=NotAccessible(), local_app_data=NotAccessible())})

to signal that the relation is there, yet the databags can't be written or read.

@tonyandrewmeyer
Copy link
Contributor

Not sure how ops can surface this better though, because ops also doesn't keep track of the event history.

I think we can't. We should document this better, although I'm not sure exactly where. Maybe Relation.data should explain that it's only available after joined and what the consequences of that are for peer relations. If we wanted the error to be more informative I think the only option there would be to have Juju provide something more informative in this case, and have ops (continue to) just pass that through.

Perhaps we could add a NotAccessible singleton to allow the user to do:

state = State(relations={Relation(remote_app_data=NotAccessible(), local_app_data=NotAccessible())})

to signal that the relation is there, yet the databags can't be written or read.

Or maybe Relation should have an attribute controlling this, a bit similar to Container.can_connect, but defaulting to True? For example:

rel = Relation(can_access_data=False, remote_app_data={...})
state = State(relations={relations})

@tonyandrewmeyer tonyandrewmeyer added feature New feature or request needs design needs more thought or spec testing Related to ops.testing labels Nov 11, 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 needs design needs more thought or spec testing Related to ops.testing
Projects
None yet
Development

No branches or pull requests

2 participants