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

Add module proxmox_backup_info #9437

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

raoufnezhad
Copy link

@raoufnezhad raoufnezhad commented Dec 28, 2024

SUMMARY

This contribution proposes to add a module called proxmox_backup_info to the Ansible community.general collection. The module would retrieve information about backups in a Proxmox VE cluster, allowing users to query and gather details about existing backups.

ISSUE TYPE
  • New Module/Plugin Pull Request
COMPONENT NAME

proxmox_backup_info

ADDITIONAL INFORMATION

The module would use the Proxmox API to fetch information about backups in the cluster. It would allow users to specify parameters such as the API host, credentials, and optionally filter by VM ID, VM Name, or backup section. The result of the module would be a list of backups with details like backup type, backup id, mode, schedule, next-run time, storage, and associated VM.

The `proxmox_backup_info` module displays information such as backup times, VM name, VM ID, mode, backup type, and backup schedule using the Proxmox Server API.
create test for proxmox_backup_info.py module
@ansibullbot

This comment was marked as outdated.

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added module module needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR new_contributor Help guide this first time contributor new_plugin New plugin plugins plugin (any type) tests tests unit tests/unit labels Dec 28, 2024
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-10 Automatically create a backport for the stable-10 branch labels Dec 28, 2024
Copy link
Collaborator

@russoz russoz left a comment

Choose a reason for hiding this comment

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

hi @raoufnezhad thanks for your contribution!

I see you have adjustments to make for the sanity tests. If I may suggest, give it a try to andebox (by yours truly):

https://pypi.org/project/andebox/

You can run this sanity test easily in your local machine by simply running:

$ andebox test -- sanity --docker default --python 3.10 plugins/modules/your_module.py

I left a couple of other comments below as well. Thanks again!

plugins/modules/proxmox_backup_info.py Outdated Show resolved Hide resolved
Comment on lines 24 to 27
options:
api_user:
description: The user must have access to the proxmox server
required: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use consistent indentation. Here you started with 4 spaces then used 2 in the next level. We have been trying to use 2 at all times, that's not mandatory, but consistency is.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your attention.

Comment on lines 82 to 83
description: The return value provided by proxmox_backup_info.
type: dict
Copy link
Collaborator

Choose a reason for hiding this comment

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

That description does not mean much. Please be either more specific or add notes to the documentation block referring to Proxmox API, and/or the return values provided by proxmoxer.

If the result value is not too big nor complex, please consider declaring contains block with a more finely grained level of details.

@ansibullbot

This comment was marked as outdated.

@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Dec 29, 2024
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.

Thanks for your contribution!

plugins/modules/proxmox_backup_info.py Outdated Show resolved Hide resolved
plugins/modules/proxmox_backup_info.py Outdated Show resolved Hide resolved
plugins/modules/proxmox_backup_info.py Outdated Show resolved Hide resolved
plugins/modules/proxmox_backup_info.py Outdated Show resolved Hide resolved
plugins/modules/proxmox_backup_info.py Outdated Show resolved Hide resolved
plugins/modules/proxmox_backup_info.py Outdated Show resolved Hide resolved
plugins/modules/proxmox_backup_info.py Show resolved Hide resolved
@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Dec 30, 2024
@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Dec 30, 2024
required: false
type: int
backup_section:
description: The backup_section value is true or false. if this be true, this module just return all backup job information.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this option means that if it is set to true, then all backups for this 'section' (whatever that is, I don't know the proxmox terminology) will be listed. If set to false, what is listed depends on the other options.

Is that correct? A description that's closer to the above might be more helpful.

plugins/modules/proxmox_backup_info.py Outdated Show resolved Hide resolved
elements: dict
contains:
bktype:
description: backup type
Copy link
Collaborator

Choose a reason for hiding this comment

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

The descriptions here also need to be full sentences.

Suggested change
description: backup type
description: The type of the backup.

Comment on lines 36 to 39
- The backup_jobs value is true or false.
- If set to true, this module just return all backup jobs information.
- If set to false, what is listed depends on the other options.
required: false
Copy link
Collaborator

Choose a reason for hiding this comment

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

required: false is redundant, please remove it from both here and the argument_spec below.
Also, use semantic markup (such as V()), and boolean parameters may have, by definition, only the values true and false, no need to mention that ;-).

Suggested change
- The backup_jobs value is true or false.
- If set to true, this module just return all backup jobs information.
- If set to false, what is listed depends on the other options.
required: false
- Include backup jobs in the result.
- If V(true), this module just return all backup jobs information.
- If V(false), the result will not include backup jobs.

Or something like that.

Semantic markup is documented in:
https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_documenting.html#semantic-markup-within-module-documentation

@ansibullbot ansibullbot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Dec 31, 2024
@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-10 Automatically create a backport for the stable-10 branch check-before-release PR will be looked at again shortly before release and merged if possible. module module new_contributor Help guide this first time contributor new_plugin New plugin plugins plugin (any type) tests tests unit tests/unit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants