-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interfaces_file - improvements (#3328)
* pythonific!! no camel cases, bitte * simplified iface attributes parsing * some improvements, passing tests * simplified set_interface_option() * further simplifications * remove unreachable stmt * pythonified a file open * added changelog fragment * adjustment per PR * PR: fixed the auto- case * PR: added testcase and chglog frag for the misleading change report * extra line removed * integration is not destructive (cherry picked from commit 7aae8d5)
- Loading branch information
Showing
6 changed files
with
123 additions
and
105 deletions.
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,4 @@ | ||
bugfixes: | ||
- interfaces_file - no longer reporting change when none happened (https://github.com/ansible-collections/community.general/pull/3328). | ||
minor_changes: | ||
- interfaces_file - minor refactor (https://github.com/ansible-collections/community.general/pull/3328). |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
shippable/posix/group2 |
7 changes: 7 additions & 0 deletions
7
tests/integration/targets/interfaces_file/files/interfaces_ff
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,7 @@ | ||
iface eno1 inet static | ||
address 1.2.3.4 | ||
netmask 255.255.255.0 | ||
gateway 1.2.3.1 | ||
up route add -net 1.2.3.4 netmask 255.255.255.0 gw 1.2.3.1 eno1 | ||
up ip addr add 4.3.2.1/32 dev eno1 | ||
down ip addr add 4.3.2.1/32 dev eno1 |
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,33 @@ | ||
--- | ||
- name: | ||
set_fact: | ||
interfaces_testfile: '{{ output_dir }}/interfaces' | ||
|
||
- name: Copy interfaces file | ||
copy: | ||
src: 'files/interfaces_ff' | ||
dest: '{{ interfaces_testfile }}' | ||
|
||
- name: Change IP address to 1.2.3.5 | ||
community.general.interfaces_file: | ||
dest: "{{ interfaces_testfile }}" | ||
iface: eno1 | ||
option: address | ||
value: 1.2.3.5 | ||
register: ifile_1 | ||
|
||
- assert: | ||
that: | ||
- ifile_1 is changed | ||
|
||
- name: Change IP address to 1.2.3.5 again | ||
community.general.interfaces_file: | ||
dest: "{{ interfaces_testfile }}" | ||
iface: eno1 | ||
option: address | ||
value: 1.2.3.5 | ||
register: ifile_2 | ||
|
||
- assert: | ||
that: | ||
- ifile_2 is not changed |
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