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 download retry when get_url has no status_code. #10613

Conversation

RomainMou
Copy link
Contributor

@RomainMou RomainMou commented Nov 10, 2023

What type of PR is this?
/kind bug

What this PR does / why we need it:
Sometime the return of get_url doesn't have a status_code, so we need to check if it's defined before we check its value to avoid an evaluation error.

Which issue(s) this PR fixes:
Fixes #10494

Special notes for your reviewer:
Should be backported in 2.23, the bug is introduce in the new 2.23.1 version.

Does this PR introduce a user-facing change?:

Fix download retry when get_url has no status_code

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Nov 10, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 10, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @RomainMou. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 10, 2023
@VannTen
Copy link
Contributor

VannTen commented Nov 10, 2023

Probably that's all it needs.
Not sure if I have the rights for that but anyway:
/lgtm

@k8s-ci-robot
Copy link
Contributor

@VannTen: changing LGTM is restricted to collaborators

In response to this:

Probably that's all it needs.
Not sure if I have the rights for that but anyway:
/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@Saigut
Copy link

Saigut commented Nov 13, 2023

Hello, from this code and here, we can see get_url_result will not have all attributes whenget_url failed. So the best way is to check the common attributes get_url_result.failed right?
And the code maybe something like:

    until: "(not get_url_result.failed) and ('OK' in get_url_result.msg or
      'file already exists' in get_url_result.msg or
      get_url_result.status_code == 304)"

@RomainMou
Copy link
Contributor Author

RomainMou commented Nov 13, 2023

I must admit, I don't know why we don't just do something like until: not get_url_result.failed

@VannTen
Copy link
Contributor

VannTen commented Nov 13, 2023

Maybe @sathieu can provide some insights ?
I think it's because there was spurious failures when the http call returned 304

@RomainMou
Copy link
Contributor Author

@sathieu
Copy link
Contributor

sathieu commented Nov 13, 2023

Maybe @sathieu can provide some insights ? I think it's because there was spurious failures when the http call returned 304

Ansible uses If-Modified-Since when the file already exists on disk. If the webserver returns 304 Not Modified with this header, this should be considered a success, and not retried.

It seems that get_url is successful when the status is 304. I think until: not get_url_result.failed is good (at least for my usecase).

@yankay
Copy link
Member

yankay commented Nov 15, 2023

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 15, 2023
@RomainMou
Copy link
Contributor Author

Hello,

Is there anything to do to move forward on this?
Should we try until: not get_url_result.failed?

@jayonlau
Copy link
Contributor

jayonlau commented Jan 4, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 4, 2024
@yankay
Copy link
Member

yankay commented Jan 4, 2024

Thanks @RomainMou

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RomainMou, yankay

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 4, 2024
@k8s-ci-robot k8s-ci-robot merged commit 1a86b4c into kubernetes-sigs:master Jan 4, 2024
63 checks passed
ledroide pushed a commit to ledroide/kubespray that referenced this pull request Jan 9, 2024
…10613)

* Fix download retry when get_url has no status_code.

* Fix until clause in download role.
VannTen pushed a commit to VannTen/kubespray that referenced this pull request Jan 12, 2024
…10613)

* Fix download retry when get_url has no status_code.

* Fix until clause in download role.
VannTen pushed a commit to VannTen/kubespray that referenced this pull request Jan 12, 2024
…10613)

* Fix download retry when get_url has no status_code.

* Fix until clause in download role.
k8s-ci-robot pushed a commit that referenced this pull request Jan 15, 2024
* Fix download retry when get_url has no status_code.

* Fix until clause in download role.

Co-authored-by: Romain <58464216+RomainMou@users.noreply.github.com>
@VannTen VannTen mentioned this pull request Jan 16, 2024
2 tasks
pedro-peter pushed a commit to pedro-peter/kubespray that referenced this pull request May 8, 2024
…10613)

* Fix download retry when get_url has no status_code.

* Fix until clause in download role.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
8 participants