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

[proxmox_template] Fix error while uploading big ISO to Proxmox VE cluster #6757

Conversation

UnderGreen
Copy link
Contributor

@UnderGreen UnderGreen commented Jun 21, 2023

SUMMARY

Fixes #5579.
As per documentation from proxmoxer requests_toolbelt is required to upload large files.

Can't find the exact size of that large file definition, but from my personal testing on Darwin x86_64 it is around 260/261MB. Not sure where it is coming from, so can't explain it.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

proxmox_template

ADDITIONAL INFORMATION

Integration test output with updated module:

❯ ansible-test integration --allow-unsupported --local proxmox_template
Running proxmox_template integration test role

PLAY [testhost] ****************************************************************

TASK [Gathering Facts] *********************************************************
ok: [testhost]

TASK [proxmox_template : Create dummy ISO file] ********************************
changed: [testhost]

TASK [proxmox_template : Delete requests_toolbelt module if it is installed] ***
ok: [testhost]

TASK [proxmox_template : Install latest proxmoxer] *****************************
ok: [testhost]

TASK [proxmox_template : Upload ISO as template to Proxmox VE cluster should fail] ***
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Failed to import the required Python library (requests_toolbelt) on santipov-ltm.internal.salesforce.com's Python /Users/s.antipov/src/ansible/collections/ansible_collections/community/general/.venv/bin/python3.11. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter
fatal: [testhost]: FAILED! => {"changed": false, "msg": "'requests_toolbelt' module is required to upload files larger than 256MB"}
...ignoring

TASK [proxmox_template : assert] ***********************************************
ok: [testhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [proxmox_template : Install old (1.1.2) version of proxmoxer] *************
changed: [testhost]

TASK [proxmox_template : Upload ISO as template to Proxmox VE cluster should be successful] ***
changed: [testhost]

TASK [proxmox_template : assert] ***********************************************
ok: [testhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [proxmox_template : Install latest proxmoxer] *****************************
changed: [testhost]

TASK [proxmox_template : Make smaller dummy file] ******************************
changed: [testhost]

TASK [proxmox_template : Upload ISO as template to Proxmox VE cluster should be successful] ***
changed: [testhost]

TASK [proxmox_template : assert] ***********************************************
ok: [testhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [proxmox_template : Install requests_toolbelt] ****************************
changed: [testhost]

TASK [proxmox_template : Make big dummy file] **********************************
changed: [testhost]

TASK [proxmox_template : Upload ISO as template to Proxmox VE cluster should be successful] ***
changed: [testhost]

TASK [proxmox_template : assert] ***********************************************
ok: [testhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [proxmox_template : Delete ISO file from host] ****************************
changed: [testhost]

PLAY RECAP *********************************************************************
testhost                   : ok=18   changed=10   unreachable=0    failed=0    skipped=0    rescued=0    ignored=1

@ansibullbot

This comment was marked as outdated.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug ci_verified Push fixes to PR branch to re-run CI integration tests/integration module module needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR plugins plugin (any type) tests tests and removed ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jun 21, 2023
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-6 backport-7 Automatically create a backport for the stable-7 branch labels Jun 21, 2023
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

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

One question: was requests_toolbelt already required in the past, i.e. did the module not work when it was around in all situations; or is this a new requirement? If it is a new requirement, this is a breaking change.

(If that's the case, it's probably better to warn about it missing when the size of the file is larger than a certain limit, instead of failing.)

Also I don't see how the toolbelt is being used. Is it used implicitly by proxmoxer or some other code in the module?

@UnderGreen
Copy link
Contributor Author

@felixfontein looks like a problem with the proxmoxer module itself and I can reproduce it using plain proxmoxer. It is started with proxmoxer 1.2.0 and still failing in the master branch. Installing requests_toolbelt somehow resolves it(I am digging into it, but it looks like so far requesting another dependency is the way out).

@UnderGreen
Copy link
Contributor Author

Also I don't see how the toolbelt is being used. Is it used implicitly by proxmoxer or some other code in the module?

Yes, it is used in proxmoxer.

@UnderGreen
Copy link
Contributor Author

@felixfontein I added notes about file size and usage of requests_toolbelt.

@ansibullbot
Copy link
Collaborator

@UnderGreen this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibullbot ansibullbot added merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Jun 28, 2023
@UnderGreen UnderGreen force-pushed the proxmox-template/fix-upload-error branch from c635411 to 4868065 Compare June 28, 2023 02:33
@ansibullbot ansibullbot removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Jun 28, 2023
@felixfontein
Copy link
Collaborator

I killed the config that the bot apparently uses in #6804, so it should no longer push unwanted commits.

Unfortunately it still makes CI fail by adding a failed check... I don't have sufficient privileges to get rid of the bot myself, but I've asked on IRC, hopefully it will be gone soon...

@felixfontein felixfontein force-pushed the proxmox-template/fix-upload-error branch from 1d5368e to 02512ed Compare June 28, 2023 20:44
@felixfontein
Copy link
Collaborator

I've removed the commit; please now ignore the failing pre-commit.ci check :)

@ansibullbot ansibullbot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jun 28, 2023
@webknjaz
Copy link
Member

webknjaz commented Jun 28, 2023

do you know why, very spontaneously, I would say, the pre-commit.ci bot committed for my PR?

I requested the bot app install for the repos with the config having seen people running it in GHA in some subprojects which is inefficient, but didn't take into account that since it didn't run in some CIs the violations might've accumulated over time. I also forgot that by default it commits the changes to PRs. This one is solvable through a configuration change, but the bot would still report the check for as long as the config exists.

The change was sudden, likely because it happened when somebody approved the GH App install which was like a day later after the request.

Unfortunately it still makes CI fail by adding a failed check...

That shouldn't be happening. Sounds like a race condition, or maybe the PR wasn't rebased after that? Looks like it's the latter — the Checks widget says:

It’s 1 commit behind (base commit: c4a2801)

@felixfontein
Copy link
Collaborator

That shouldn't be happening. Sounds like a race condition, or maybe the PR wasn't rebased after that? Looks like it's the latter — the Checks widget says:

It also happened for a new PR (#6808) from main branch. I guess it somehow caches that a project should have a config.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jun 29, 2023
@UnderGreen
Copy link
Contributor Author

@felixfontein any insights on why it is still failing for 2.6?
importlib is in requirements and see in logs it is downloaded(but not installed?).

@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Jun 29, 2023
@UnderGreen
Copy link
Contributor Author

I skip 2.6 Python as it was never supported by proxmoxer library.

@felixfontein felixfontein merged commit 2d6e369 into ansible-collections:main Jul 2, 2023
151 checks passed
@patchback
Copy link

patchback bot commented Jul 2, 2023

Backport to stable-6: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 2d6e369 on top of patchback/backports/stable-6/2d6e369d81441279df812eea495710fc7abad4ad/pr-6757

Backporting merged PR #6757 into main

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/ansible-collections/community.general.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/stable-6/2d6e369d81441279df812eea495710fc7abad4ad/pr-6757 upstream/stable-6
  4. Now, cherry-pick PR [proxmox_template] Fix error while uploading big ISO to Proxmox VE cluster #6757 contents into that branch:
    $ git cherry-pick -x 2d6e369d81441279df812eea495710fc7abad4ad
    If it'll yell at you with something like fatal: Commit 2d6e369d81441279df812eea495710fc7abad4ad is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x 2d6e369d81441279df812eea495710fc7abad4ad
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR [proxmox_template] Fix error while uploading big ISO to Proxmox VE cluster #6757 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/stable-6/2d6e369d81441279df812eea495710fc7abad4ad/pr-6757
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jul 2, 2023
@patchback
Copy link

patchback bot commented Jul 2, 2023

Backport to stable-7: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-7/2d6e369d81441279df812eea495710fc7abad4ad/pr-6757

Backported as #6831

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jul 2, 2023
…uster (#6757)

* [proxmox_template] Fix error while uploading big ISO to Proxmox VE cluster

* Fix pep8 test

* Add changelog fragment

* Add notes about requests_toolbelt

* Check versions and file size

* Fix typo in notes

* Add unit test. Move try inside of each function.

* Fix sanity tests

* Add proxmoxer in requirements file

* Update integration tests

* Add proxmoxer into constraints.txt

* Address review comments

* Don't run tests on 2.6 python

* Disable Python 2.6 tests for other proxmox modules

(cherry picked from commit 2d6e369)
@felixfontein
Copy link
Collaborator

@UnderGreen thanks a lot for your contribution!

felixfontein pushed a commit that referenced this pull request Jul 2, 2023
…hile uploading big ISO to Proxmox VE cluster (#6831)

[proxmox_template] Fix error while uploading big ISO to Proxmox VE cluster (#6757)

* [proxmox_template] Fix error while uploading big ISO to Proxmox VE cluster

* Fix pep8 test

* Add changelog fragment

* Add notes about requests_toolbelt

* Check versions and file size

* Fix typo in notes

* Add unit test. Move try inside of each function.

* Fix sanity tests

* Add proxmoxer in requirements file

* Update integration tests

* Add proxmoxer into constraints.txt

* Address review comments

* Don't run tests on 2.6 python

* Disable Python 2.6 tests for other proxmox modules

(cherry picked from commit 2d6e369)

Co-authored-by: Sergei Antipov <greendayonfire@gmail.com>
@UnderGreen UnderGreen deleted the proxmox-template/fix-upload-error branch July 5, 2023 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7 Automatically create a backport for the stable-7 branch bug This issue/PR relates to a bug integration tests/integration module_utils module_utils module module new_plugin New plugin plugins plugin (any type) tests tests traceback unit tests/unit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

proxmox_template 'Connection aborted.'
4 participants