MT#56017 ngcp-network: don't remove all the list of interfaces on --remove-interface

* pre-commit: don't mess with tests files

Change-Id: I7ef729ccfbbc31bf46e7a046531bb8afbed54b87
mr11.2
ngcp-config 2 years ago
parent ee634d9195
commit 6d91f4232d

@ -18,12 +18,13 @@ repos:
- id: yamlfmt
args: [--mapping, '2', --sequence, '4', --offset, '2', --width, '150']
exclude: |
(?x)^(.yamllint)$
(?x)^(.yamllint|testsuite/.*)$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.26.3
hooks:
- id: yamllint
args: [--format, parsable, --strict]
exclude: ^testsuite/.*
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
hooks:

@ -415,8 +415,8 @@ sub remove_interface {
my $ifaces = $yaml->{hosts}->{$host}->{interfaces};
if ( defined $ifaces ) {
logger("removing interface @$ifaces as requested");
undef @{$ifaces};
logger("removing interface $rem_iface from @$ifaces as requested");
@{$yaml->{hosts}->{$host}->{interfaces}} = grep {$_ ne $rem_iface} @$ifaces;
}
return;
}

@ -0,0 +1,20 @@
---
hosts:
sp1:
interfaces:
- lo
lo:
ip: 127.0.0.1
netmask: 255.255.255.0
type:
- sip_int
- ha_int
- web_ext
- sip_ext
- rtp_ext
- ssh_ext
- mon_ext
role:
- proxy
- lb
- mgmt

@ -148,6 +148,11 @@ ${CMD} --host=$PEER --set-interface=lo --type=sip_int --type=web_ext --type=sip_
assertEqualFiles testfiles/deployment.yml network-config/deployment.yml
# make sure host/interfaces doesn't get cleaned on remove one interface
${CMD} --input-file=network-config/eth42.yml --output-file=testfiles/lo.yml \
--host=sp1 --remove-interface=eth42
assertEqualFiles testfiles/lo.yml network-config/lo.yml
# TAP output
printf "1..%s\n" "${count}"
cat "$OUTPUT"

Loading…
Cancel
Save