Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mandar242 committed May 15, 2024
1 parent 78fdb98 commit aeb7505
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
5 changes: 2 additions & 3 deletions plugins/modules/backup_plan_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
backup_plan_names:
type: list
elements: str
required: false
description:
- Specifies a list of plan names.
extends_documentation_fragment:
Expand Down Expand Up @@ -122,8 +121,8 @@ def get_backup_plan_detail(client, module):
if backup_plan_names is None:
backup_plan_names = []
backup_plan_list_info = get_all_backup_plans_info(client)["BackupPlansList"]
for mylist in backup_plan_list_info:
backup_plan_names.append(mylist["BackupPlanName"])
for backup_plan in backup_plan_list_info:
backup_plan_names.append(backup_plan["BackupPlanName"])

for name in backup_plan_names:
backup_plan_list.extend(get_plan_details(module, client, name))
Expand Down
31 changes: 30 additions & 1 deletion tests/integration/targets/backup_plan/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,41 @@
- backup_plan_create_result.exists is true
- backup_plan_create_result.changed is false

- name: Create another backup plan
amazon.aws.backup_plan:
backup_plan_name: "{{ backup_plan_name }}-1"
rules:
- rule_name: daily
target_backup_vault_name: "{{ backup_vault_name }}"
tags:
Environment: Test
register: backup_plan_create_result_1

- name: Verify backup plan create result
ansible.builtin.assert:
that:
- backup_plan_create_result_1.exists is true
- backup_plan_create_result_1.changed is true

- name: Get info of all install plans
amazon.aws.backup_plan_info:
register: backup_plan_info_result

- name: Assert that info of all backup plans is fetched
ansible.builtin.assert:
that:
- backup_plan_info_result is not failed
- backup_plan_info_result.backup_plans | length > 1

always:
- name: Delete AWS Backup plan created during this test
amazon.aws.backup_plan:
backup_plan_name: "{{ backup_plan_name }}"
backup_plan_name: "{{ item }}"
state: absent
ignore_errors: true
with_items:
- "{{ backup_plan_name }}"
- "{{ backup_plan_name }}-1"

- name: Delete AWS Backup vault created during this test
amazon.aws.backup_vault:
Expand Down

0 comments on commit aeb7505

Please sign in to comment.