-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle src & backup properly when module alias is used (#83)
Handle src & backup properly when module alias is used Reviewed-by: https://github.com/apps/ansible-zuul
- Loading branch information
1 parent
30baa30
commit fc55b82
Showing
5 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
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 junos_config work when module alias is used (https://github.com/ansible-collections/junipernetworks.junos/pull/83). |
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
16 changes: 16 additions & 0 deletions
16
tests/integration/targets/junos_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 redirection test cases | ||
find: | ||
paths: '{{ role_path }}/tests/redirection/' | ||
patterns: '{{ testcase }}.yaml' | ||
connection: local | ||
register: test_cases | ||
|
||
- name: set test_items | ||
set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" | ||
|
||
- name: run test case (connection=ansible.netcommon.netconf) | ||
include: '{{ test_case_to_run }} ansible_connection=ansible.netcommon.netconf' | ||
with_items: '{{ test_items }}' | ||
loop_control: | ||
loop_var: test_case_to_run |
51 changes: 51 additions & 0 deletions
51
tests/integration/targets/junos_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,51 @@ | ||
--- | ||
- debug: msg="START redirection/netconf/shortname.yaml on connection={{ ansible_connection }}" | ||
|
||
- name: setup | ||
junipernetworks.junos.config: | ||
lines: | ||
- delete interfaces lo0 | ||
provider: '{{ netconf }}' | ||
|
||
- name: Use src with module alias | ||
register: result | ||
junipernetworks.junos.config: | ||
src: basic/config.j2 | ||
provider: '{{ netconf }}' | ||
|
||
- assert: | ||
that: | ||
# make sure that the template content was read and not the path | ||
- result.changed == true | ||
|
||
- name: teardown | ||
register: result | ||
junipernetworks.junos.config: | ||
lines: | ||
- delete interfaces lo0 | ||
provider: '{{ netconf }}' | ||
|
||
- name: use module alias to take configuration backup | ||
register: result | ||
junipernetworks.junos.config: | ||
backup: true | ||
backup_options: | ||
filename: backup_with_alias.cfg | ||
dir_path: '{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}' | ||
provider: '{{ netconf }}' | ||
|
||
- 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/netconf/shortname.yaml on connection={{ ansible_connection }}" |