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

backup_plan: fix usage for advanced_backup_settings param #2110

Closed
1 task done
mandar242 opened this issue May 23, 2024 · 3 comments · Fixed by #2124
Closed
1 task done

backup_plan: fix usage for advanced_backup_settings param #2110

mandar242 opened this issue May 23, 2024 · 3 comments · Fixed by #2124
Assignees
Labels
jira needs_info This issue requires further information. Please answer any outstanding questions

Comments

@mandar242
Copy link
Contributor

mandar242 commented May 23, 2024

Summary

The module amazon.aws.backup_plan does not provide example of usage advanced_backup_settings and advanced_backup_settings.backup_options param.
Also looking at the argspec for the option, not sure if it will work as expected because it's expecting a dict but I what actually gets passed is a string.

https://github.com/ansible-collections/amazon.aws/blob/main/plugins/modules/backup_plan.py#L151-L156
https://github.com/ansible-collections/amazon.aws/blob/main/plugins/modules/backup_plan.py#L383-L393

Issue Type

Bug Report

Component Name

backup_plan

Ansible Version

$ ansible --version

ansible [core 2.15.5]

Collection Versions

$ ansible-galaxy collection list
amazon.aws 9.0.0-dev0a

AWS SDK versions

$ pip show boto boto3 botocore
Name: boto3
Version: 1.28.15
---
Name: botocore
Version: 1.31.54

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

---
- name: Example for amazon.aws.backup_plan
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Create a backup plan
      amazon.aws.backup_plan:
        state: present
        backup_plan_name: my-test-backup-plan1
        advanced_backup_settings:
          - resource_type: EC2
            backup_options: {"WindowsVSS": "enabled"}
        tags:
          TagKey1: TagValue1
          TagKey2: TagValue2
        rules:
          - rule_name: present
            target_backup_vault_name: my-test-vault
            schedule_expression: 'cron(0 5 ? * * *)'
            lifecycle:
              move_to_cold_storage_after_days: 1
              delete_after_days: 91
            recovery_point_tags:
              Key1: Value1
              Key2: Value2
            copy_actions:
              - destination_backup_vault_arn: arn:aws:backup:us-west-2:123456789:backup-vault:my-test-vault
                lifecycle:
                  move_to_cold_storage_after_days: 1
                  delete_after_days: 91
      register: create_result

Create a backup_plan using the option similar to above

Expected Results

The usage of param is advanced_backup_settings verified and fixed if required.

Actual Results

Code of Conduct

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

Hello @mandar242 , what leads you to believe that a string is being passed for backup_options? Could you kindly provide a reference? From my observations, everything appears to be functioning as intended. Here's the value of the create parameters passed to the create_backup_plan CLI.

{'BackupPlan': {'AdvancedBackupSettings': [{'BackupOptions': {'Windowsvss': 'enabled'}, 'ResourceType': 'EC2'}], 'BackupPlanName': 'elasticcopy', 'Rules': [{'CompletionWindowMinutes': 1440, 'EnableContinuousBackup': False, 'RuleName': 'daily', 'ScheduleExpression': 'cron(0 5 ? * * *)', 'StartWindowMinutes': 60, 'TargetBackupVaultName': 'vault1'}]}}

@GomathiselviS GomathiselviS added the needs_info This issue requires further information. Please answer any outstanding questions label Jun 4, 2024
@mandar242
Copy link
Contributor Author

Hello @mandar242 , what leads you to believe that a string is being passed for backup_options? Could you kindly provide a reference? From my observations, everything appears to be functioning as intended. Here's the value of the create parameters passed to the create_backup_plan CLI.

{'BackupPlan': {'AdvancedBackupSettings': [{'BackupOptions': {'Windowsvss': 'enabled'}, 'ResourceType': 'EC2'}], 'BackupPlanName': 'elasticcopy', 'Rules': [{'CompletionWindowMinutes': 1440, 'EnableContinuousBackup': False, 'RuleName': 'daily', 'ScheduleExpression': 'cron(0 5 ? * * *)', 'StartWindowMinutes': 60, 'TargetBackupVaultName': 'vault1'}]}}

Hi @GomathiselviS , I could be missing something about the param backup_options being passed as a string.
however there are a couple of things that could be improved.

  1. The way backup_options is defined in argspec, is the only module that defines it like choices=[{"WindowsVSS": "enabled"}, {"WindowsVSS": "disabled"}], whereas all other modules make use of suboptions. To ensure consistency, I feel we should modify the way it is written currently and changed to use suboptions instead.
  2. The current definition is causing error with docs rendering
    Update return block of Backup modules #2106 (comment)
  3. There is no example that showcases usage of advanced_backup_settings and advanced_backup_settings.backup_options

@GomathiselviS
Copy link
Collaborator

Hello @mandar242 , what leads you to believe that a string is being passed for backup_options? Could you kindly provide a reference? From my observations, everything appears to be functioning as intended. Here's the value of the create parameters passed to the create_backup_plan CLI.
{'BackupPlan': {'AdvancedBackupSettings': [{'BackupOptions': {'Windowsvss': 'enabled'}, 'ResourceType': 'EC2'}], 'BackupPlanName': 'elasticcopy', 'Rules': [{'CompletionWindowMinutes': 1440, 'EnableContinuousBackup': False, 'RuleName': 'daily', 'ScheduleExpression': 'cron(0 5 ? * * *)', 'StartWindowMinutes': 60, 'TargetBackupVaultName': 'vault1'}]}}

Hi @GomathiselviS , I could be missing something about the param backup_options being passed as a string. however there are a couple of things that could be improved.

  1. The way backup_options is defined in argspec, is the only module that defines it like choices=[{"WindowsVSS": "enabled"}, {"WindowsVSS": "disabled"}], whereas all other modules make use of suboptions. To ensure consistency, I feel we should modify the way it is written currently and changed to use suboptions instead.
  2. The current definition is causing error with docs rendering
    Update return block of Backup modules #2106 (comment)
  3. There is no example that showcases usage of advanced_backup_settings and advanced_backup_settings.backup_options

I will create a PR to update the examples and argspec.

softwarefactory-project-zuul bot pushed a commit that referenced this issue Jun 6, 2024
…ttings parameter (#2124)

backup_plan: modify args spec and add examples for advanced_backup_settings parameter

Fixes #2110
This PR

adds an example to showcase the usage of advanced_backup_settings parameter
adds option in args spec and suboption in module doc

SUMMARY


ISSUE TYPE


Docs Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
Reviewed-by: Bikouo Aubin
Reviewed-by: Helen Bailey <[email protected]>
patchback bot pushed a commit that referenced this issue Jun 6, 2024
…ttings parameter (#2124)

backup_plan: modify args spec and add examples for advanced_backup_settings parameter

Fixes #2110
This PR

adds an example to showcase the usage of advanced_backup_settings parameter
adds option in args spec and suboption in module doc

SUMMARY

ISSUE TYPE

Docs Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
Reviewed-by: Bikouo Aubin
Reviewed-by: Helen Bailey <[email protected]>
(cherry picked from commit 7c1d8aa)
patchback bot pushed a commit that referenced this issue Jun 6, 2024
…ttings parameter (#2124)

backup_plan: modify args spec and add examples for advanced_backup_settings parameter

Fixes #2110
This PR

adds an example to showcase the usage of advanced_backup_settings parameter
adds option in args spec and suboption in module doc

SUMMARY

ISSUE TYPE

Docs Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
Reviewed-by: Bikouo Aubin
Reviewed-by: Helen Bailey <[email protected]>
(cherry picked from commit 7c1d8aa)
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this issue Jun 26, 2024
…ttings parameter (ansible-collections#2124)

backup_plan: modify args spec and add examples for advanced_backup_settings parameter

Fixes ansible-collections#2110
This PR

adds an example to showcase the usage of advanced_backup_settings parameter
adds option in args spec and suboption in module doc

SUMMARY


ISSUE TYPE


Docs Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
Reviewed-by: Bikouo Aubin
Reviewed-by: Helen Bailey <[email protected]>
softwarefactory-project-zuul bot pushed a commit that referenced this issue Jun 27, 2024
…ttings parameter (#2124) (#2129)

This is a backport of PR #2124 as merged into main (7c1d8aa).
Fixes #2110
This PR

adds an example to showcase the usage of advanced_backup_settings parameter
adds option in args spec and suboption in module doc

SUMMARY


ISSUE TYPE


Docs Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
softwarefactory-project-zuul bot pushed a commit that referenced this issue Jul 18, 2024
…ttings parameter (#2124) (#2128)

This is a backport of PR #2124 as merged into main (7c1d8aa).
Fixes #2110
This PR

adds an example to showcase the usage of advanced_backup_settings parameter
adds option in args spec and suboption in module doc

SUMMARY


ISSUE TYPE


Docs Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira needs_info This issue requires further information. Please answer any outstanding questions
Projects
None yet
2 participants