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

added get_relation_data in Unit #700

Closed
wants to merge 1 commit into from

Conversation

PietroPasotti
Copy link

This PR adds to Unit a get_relation_data(endpoint:str, related_endpoint:str, remote:str) method that returns 'raw' RelationData objects.

Fixes #699
Fixes #644
(somewhat) Fixes charmed-kubernetes/pytest-operator#81

It would be nice, as a next step, to add a shortcut to access this data via the Relation object.

Note: this is untested code. Will finalize after a green light that this is indeed a good addition

@jujubot
Copy link
Contributor

jujubot commented Aug 3, 2022

Can one of the admins verify this patch?

8 similar comments
@jujubot
Copy link
Contributor

jujubot commented Aug 3, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 3, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 3, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 3, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 3, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 3, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 3, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 3, 2022

Can one of the admins verify this patch?

@cderici
Copy link
Contributor

cderici commented Aug 3, 2022

Thanks for the PR @PietroPasotti , I'll review this when you mark it as Ready for review (i.e. when it's not a draft) 👍

This will need a test as well to be approved. Also, I don't see how this fixes the #644 , are you adding more functionality? If you aren't, then feel free to remove that line (so that the issue won't close automatically when we land this), I have that one in my todo list anyways.

Thanks again!

@sed-i
Copy link
Contributor

sed-i commented Jan 3, 2023

This is a great addition @PietroPasotti.
I spotted this PR after I came across your get_relation_data helper.

Would this work for peer data as well?

Currently I'm using

rc, stdout, stderr = await ops_test.run("juju", "show-unit", "app/0", "--format=json")
data = json.loads(stdout)
peer_data = next(filter(lambda d: d['endpoint'] == 'replicas', data["app/0"]["relation-info"]))

@jujubot
Copy link
Contributor

jujubot commented Jan 3, 2023

Thanks for opening a pull request! Please follow the instructions here to ensure your pull request is ready for review. Then, a maintainer will review your patch.

@hpidcock @anvial @juanmanuel-tirado

1 similar comment
@jujubot
Copy link
Contributor

jujubot commented Jan 3, 2023

Thanks for opening a pull request! Please follow the instructions here to ensure your pull request is ready for review. Then, a maintainer will review your patch.

@hpidcock @anvial @juanmanuel-tirado

@PietroPasotti
Copy link
Author

This is a great addition @PietroPasotti. I spotted this PR after I came across your get_relation_data helper.

Would this work for peer data as well?

Currently I'm using

rc, stdout, stderr = await ops_test.run("juju", "show-unit", "app/0", "--format=json")
data = json.loads(stdout)
peer_data = next(filter(lambda d: d['endpoint'] == 'replicas', data["app/0"]["relation-info"]))

Ugh, had forgotten this was even here. I think peer data requires a little addition. I have it working in jhack, that's where this code originally came from. Putting it again in my todo list

@github-actions
Copy link

This PR is marked as incomplete because it has been open 30 days with no activity. Please remove incomplete label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the state/incomplete need more information label Jul 30, 2023
@github-actions
Copy link

github-actions bot commented Aug 5, 2023

This PR was closed because it has been stalled for 10 days with no activity.

@github-actions github-actions bot closed this Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state/incomplete need more information
Projects
None yet
4 participants