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_snap bug in timeout handling #9260

Open
1 task done
h3po opened this issue Dec 16, 2024 · 4 comments
Open
1 task done

proxmox_snap bug in timeout handling #9260

h3po opened this issue Dec 16, 2024 · 4 comments
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)

Comments

@h3po
Copy link
Contributor

h3po commented Dec 16, 2024

Summary

The code path supposed to return fail_json when the snapshot task runs into a timeout is not reached, resulting in "New-style module did not handle its own exit"

Issue Type

Bug Report

Component Name

proxmox_snap

Ansible Version

ansible [core 2.16.10]
  config file = /home/me/playbooks/ansible.cfg
  configured module search path = ['/home/me/playbooks/plugins/modules']
  ansible python module location = /home/me/playbooks/.venv/lib/python3.11/site-packages/ansible
  ansible collection location = /home/me/playbooks/collections
  executable location = /home/me/playbooks/.venv/bin/ansible
  python version = 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0] (/home/me/playbooks/.venv/bin/python)
  jinja version = 3.1.4
  libyaml = True

Community.general Version

Collection        Version
----------------- -------
community.general 10.0.1

Configuration

No response

OS / Environment

No response

Steps to Reproduce

it is impossible for timeout == 0 to be true in the while timeout loop

def snapshot_create(self, vm, vmid, timeout, snapname, description, vmstate, unbind, retention):
    [...]
    while timeout:
        [...]
        if timeout == 0:
            self.module.fail_json(msg='Reached timeout while waiting for creating VM snapshot. Last line in task before timeout: %s' %
                                    self.proxmox_api.nodes(vm['node']).tasks(taskid).log.get()[:1])


        timeout -= 1
    [...]
    return timeout > 0

Expected Results

The module should return the fail_json with message "Reached timeout" instead of "New-style module did not handle its own exit"

Actual Results

fatal: [target -> localhost]: FAILED! => {                                                                                                                                                                                
    "changed": false                                                                                                            
}                                                                                                                                                                                                                                                               
                                                                                                                                
MSG:                                                                                                                                                                                                                                                            
                                                                                                                                
New-style module did not handle its own exit

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibullbot
Copy link
Collaborator

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module plugins plugin (any type) labels Dec 16, 2024
h3po added a commit to h3po/ansible_collection_community.general that referenced this issue Dec 16, 2024
h3po added a commit to h3po/ansible_collection_community.general that referenced this issue Dec 16, 2024
@h3po
Copy link
Contributor Author

h3po commented Dec 16, 2024

I fixed the logic error, but the fail_msg in this module need some more work imo. the messages currently include raw data like this:

Reached timeout while waiting for creating VM snapshot. Last line in task before timeout: [{'n': 1, 't': "saving VM state and RAM using storage 'hdd_vm'"}]

@russoz
Copy link
Collaborator

russoz commented Dec 17, 2024

Hi @h3po , thanks for reporting and, as it seems, fixing the problem. Could you please submit a Pull Request with the change? Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module module plugins plugin (any type)
Projects
None yet
Development

No branches or pull requests

3 participants