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

fix: machine scp & ssh #1020

Merged
merged 16 commits into from
Mar 5, 2024
Merged

fix: machine scp & ssh #1020

merged 16 commits into from
Mar 5, 2024

Conversation

yanksyoon
Copy link
Contributor

@yanksyoon yanksyoon commented Feb 1, 2024

Description

This is a follow-up PR to #1016 , which contains cherry-picked commits without type imports.

Fİxes #997

QA Steps

<Commands / tests / steps to run to verify that the change works:>

tox -e py3 -- tests/unit/...
tox -e integration -- tests/integration/test_machine.py

All CI tests need to pass.

<Please note that most likely an additional test will be required by the reviewers for any change that's not a one liner to land.>

Notes & Discussion

<Additional notes for the reviewers if needed. Please delete section if not applicable.>

@jujubot
Copy link
Contributor

jujubot commented Feb 1, 2024

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

1 similar comment
@jujubot
Copy link
Contributor

jujubot commented Feb 1, 2024

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

Copy link
Contributor

@cderici cderici left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this ❤️ with just a couple changes in the tests and then we can land this 👍

tests/integration/test_machine.py Outdated Show resolved Hide resolved
tests/integration/test_machine.py Outdated Show resolved Hide resolved
async def test_machine_ssh():
async with base.CleanModel() as model:
machine: Machine = await model.add_machine()
out = await machine.ssh("echo hello world!")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same redundancy here, see the test_ssh test in integration/test_unit.py, unit.ssh is just a wrapper around the machine.ssh.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added wait_for_active parameter here - this should no longer be redundant :)

@cderici
Copy link
Contributor

cderici commented Feb 7, 2024

Hi @yanksyoon, just pinging for this to let you know we're planning on making a release soon, so I'd love to roll this in if it's ready as well 👍

@yanksyoon
Copy link
Contributor Author

@cderici Sorry! I was on my break, i'll get on this asap!

@cderici
Copy link
Contributor

cderici commented Feb 21, 2024

@cderici Sorry! I was on my break, i'll get on this asap!

@yanksyoon np, hope you had a good break!

Feel free to ping me whenever this is ready for review again 👍

@yanksyoon yanksyoon requested a review from cderici February 22, 2024 14:13
@yanksyoon
Copy link
Contributor Author

@cderici The tests seem to have failed due to changes in how juju handles old charm-store (cs:) urls. Looking into it!

Copy link
Contributor

@cderici cderici left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the CI failures are unrelated to this change. This can land.

One final request though, the wait_for_active should be an opt-in feature, so let's have False as the default value, as this would currently block any code that uses this without this parameter if the machine is not ready. Granted, it would be weird for them to rely on failure, but still, I'd steer away from changing default semantics on this. Hope this makes sense.

Thanks for working on this! <3

@yanksyoon
Copy link
Contributor Author

@cderici Changed! Thanks for the review! :D

@yanksyoon yanksyoon requested a review from cderici March 4, 2024 11:36
There's a bit of a gap between the time that the machine is assigned
an IP and the ssh service is up and listening, which creates a race
for the ssh command (i.e. we may run the ssh command after the machine
gets the IP but before the ssh service is up). So we retry a couple of
times to mitigate that effect until either the ssh command succeeds,
or we run out of attempts (i.e. something else is going on).
@cderici
Copy link
Contributor

cderici commented Mar 4, 2024

@yanksyoon looks like the test_machine_ssh was failing in the CI, indicating a race that happened between the time the machine gets the IP and the ssh service to be up and running, so I just added a retry to get around that. I'll approve and land this after the tests run 👍 thanks again for working on this!

In a real world scenario, this will work in the first iteration (maybe
the second after 2sec backoff), however the github workers are
particularly slow so extending this to make the tests pass.
@cderici
Copy link
Contributor

cderici commented Mar 5, 2024

/build

@cderici
Copy link
Contributor

cderici commented Mar 5, 2024

/build

@cderici
Copy link
Contributor

cderici commented Mar 5, 2024

/build

@cderici
Copy link
Contributor

cderici commented Mar 5, 2024

/merge

@jujubot jujubot merged commit 959d7f0 into juju:master Mar 5, 2024
7 of 9 checks passed
@Aflynn50 Aflynn50 mentioned this pull request Mar 25, 2024
jujubot added a commit that referenced this pull request Mar 27, 2024
#1037

## What's Changed

* Add build test and update issue template by @cderici in #1030
* fix: machine scp & ssh by @yanksyoon in #1020
* Bugfix none type on master by @Aflynn50 in #1036
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.

3 participants