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

Possible solution for unit run inconsistencies #711

Closed
wants to merge 1 commit into from

Conversation

addyess
Copy link
Contributor

@addyess addyess commented Aug 12, 2022

#707

I agree there's inconsistency from the juju api response there. Since action.wait() ultimately just fills out the results dict more, what we we add some decode logic to the Action object to handle the various facades?

Action could have an attribute that returned an object like subprocess.CompletedProcess[https://docs.python.org/3/library/subprocess.html#subprocess.CompletedProcess]

users of the unit.run class could do this:

    response = await unit.run(cmd)
    response.completed.check_returncode()  # raises a known exception for non-zero return codes
    stdout = response.completed.stdout

juju#707

I agree there's inconsistency from the juju api response there.  Since `action.wait()` ultimately just fills out the `results` dict more, what we we add some decode logic to the `Action` object to handle the various facades?  

Action could have an attribute that returned an object like `subprocess.CompletedProcess`[https://docs.python.org/3/library/subprocess.html#subprocess.CompletedProcess] 

users of the unit.run class could do this:

```python
    response = await unit.run(cmd)
    response.completed.check_returncode()  # raises a known exception for non-zero return codes
    stdout = response.completed.stdout
```
@jujubot
Copy link
Contributor

jujubot commented Aug 12, 2022

Can one of the admins verify this patch?

8 similar comments
@jujubot
Copy link
Contributor

jujubot commented Aug 12, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 12, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 12, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 12, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 12, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 12, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 12, 2022

Can one of the admins verify this patch?

@jujubot
Copy link
Contributor

jujubot commented Aug 12, 2022

Can one of the admins verify this patch?

@addyess addyess closed this Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants