-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Interfaces_file - improvements #3328
Interfaces_file - improvements #3328
Conversation
@felixfontein I have not opened it yet, but I bet it is the sanity import moaning about coverage ;-) UPDATE: Bingo!!!! |
@russoz tests now all pass :) |
@felixfontein @hryamzik just added an integration test for this scenario Felix described - it failed on the old code and worked on the new one ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as far as I can judge.
LGTM |
Backport to stable-3: 💚 backport PR created✅ Backport PR branch: Backported as #3396 🤖 @patchback |
* 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)
* 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) Co-authored-by: Alexei Znamensky <[email protected]>
Regression: The new version repeatedly adds new lines for up/down option. The previous version (ansible 3.0) only added the option if it was not yet present. - name: floating_ip_interface_up_ip 2a01:a:b:c::1/64 dev eth0
interfaces_file:
option: up
iface: eth0
dest: '/etc/network/interfaces.d/50-cloud-init.cfg'
value: 'ip addr add 2a01:a:b:c::1/64 dev eth0'
state: present result: TASK [floating_ip : floating_ip_interface_down_ip 2a01:a:b:c::1/64 dev eth0] ***************************************************
task path: /../roles/floating_ip/tasks/floating_ip.yml:12
changed: [mail01p.example.org] => changed=true
dest: /etc/network/interfaces.d/50-cloud-init.cfg
gid: 0
group: root
ifaces:
eth0:
address: 2a01:d:e:f::1/64
address_family: inet6
down:
- ip addr del 88.1.2.332 dev eth0
- ip addr del 49.1.2.3/32 dev eth0
- ip addr del 2a01:a:b:c::1/64 dev eth0
- ip addr del 2a01:a:b:c::1/64 dev eth0
gateway: fe80::1
method: static
post-up: []
pre-up: []
up:
- ip addr add 88.1.2.332 dev eth0
- ip addr add 49.1.2.3/32 dev eth0
- ip addr add 2a01:a:b:c::1/64 dev eth0
lo:
address_family: inet
down: []
method: loopback
post-up: []
pre-up: []
up: []
invocation:
module_args:
address_family: null
attributes: null
backup: false
dest: /etc/network/interfaces.d/50-cloud-init.cfg
group: null
iface: eth0
mode: null
option: down
owner: null
selevel: null
serole: null
setype: null
seuser: null
state: present
unsafe_writes: false
value: ip addr del 2a01:a:b:c::1/64 dev eth0
mode: '0644'
owner: root
size: 823
state: file
uid: 0 resulting interface file after multiple runs:
|
@russoz ^ |
We also need a test case for this! |
@felixfontein @russoz should I create a separate Ticket for that case? It would be optimal if the update would remove duplicates. At least |
@pgassmann yes please, that would be great |
SUMMARY
General improvements, simplifications and pythonification of the code.
ISSUE TYPE
COMPONENT NAME
plugins/modules/system/interfaces_file.py
tests/unit/plugins/modules/system/interfaces_file/test_interfaces_file.py