-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make config modules work properly when module alias is used in task (#63
) Make config modules work properly when module alias is used in task Reviewed-by: https://github.com/apps/ansible-zuul
- Loading branch information
1 parent
8c0e7be
commit 9099fbc
Showing
5 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
changelogs/fragments/handle_src_backup_with_module_alias.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
bugfixes: | ||
- Make `src`, `backup` and `backup_options` in iosxr_config work when module alias is used (https://github.com/ansible-collections/cisco.iosxr/pull/63). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
--- | ||
- include: cli.yaml | ||
- include: cli_config.yaml | ||
|
||
- include: redirection.yaml | ||
when: ansible_version.full is version('2.10.0', '>=') |
16 changes: 16 additions & 0 deletions
16
tests/integration/targets/iosxr_config/tasks/redirection.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
- name: collect all redirection cli test cases | ||
find: | ||
paths: '{{ role_path }}/tests/redirection' | ||
patterns: '{{ testcase }}.yaml' | ||
register: shortname_test_cases | ||
delegate_to: localhost | ||
|
||
- name: set test_items for redirection | ||
set_fact: test_items="{{ shortname_test_cases.files | map(attribute='path') | list }}" | ||
|
||
- name: run test case (connection=ansible.netcommon.network_cli) | ||
include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.network_cli' | ||
with_items: '{{ test_items }}' | ||
loop_control: | ||
loop_var: test_case_to_run |
37 changes: 37 additions & 0 deletions
37
tests/integration/targets/iosxr_config/tests/redirection/shortname.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
- debug: msg="START redirection/shortname.yaml on connection={{ ansible_connection }}" | ||
|
||
- name: Use src with module alias | ||
register: result | ||
cisco.iosxr.config: | ||
src: basic/config.j2 | ||
|
||
- assert: | ||
that: | ||
# make sure that the template content was read and not the path | ||
- result.changed == true | ||
- result.updates is defined | ||
|
||
- name: use module alias to take configuration backup | ||
register: result | ||
cisco.iosxr.config: | ||
backup: true | ||
backup_options: | ||
filename: backup_with_alias.cfg | ||
dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' | ||
|
||
- assert: | ||
that: | ||
- result.changed == true | ||
|
||
- name: check if the backup file-4 exist | ||
find: | ||
paths: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup_with_alias.cfg' | ||
register: backup_file | ||
connection: local | ||
|
||
- assert: | ||
that: | ||
- backup_file.files is defined | ||
|
||
- debug: msg="END redirection/shortname.yaml on connection={{ ansible_connection }}" |