Commit 51c872d
cli: Fix failure with "set-name" and "bridges" (#221)
The code path when a config has set-name as well as bridges doesn't seem to work at present, failure below. This change seems to fix it.
Config:
```
network:
version: 2
# renderer: networkd
# networkd doesn't handle ethernet well...
renderer: NetworkManager
ethernets:
devnet:
renderer: networkd
match:
name: enx00aa11223344
enx00bb11223344:
addresses: [ 10.20.0.1/24 ]
renderer: networkd
wlan:
match:
macaddress: 00:99:11:22:33:44
set-name: "wlan0"
bridges:
# ... and NetworkManager doesn't handle bridges well
renderer: networkd
br0:
addresses: [ "10.9.0.1/16" ]
interfaces: [ "devnet" ]
```
Failure:
```
netplan try
Traceback (most recent call last):
File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 84, in command_try
NetplanApply().command_apply(run_generate=True, sync=True, exit_on_error=False)
File "/usr/share/netplan/netplan/cli/commands/apply.py", line 191, in command_apply
changes = NetplanApply.process_link_changes(devices, config_manager)
File "/usr/share/netplan/netplan/cli/commands/apply.py", line 281, in process_link_changes
if NetplanApply.is_composite_member(composite_interfaces, phy):
File "/usr/share/netplan/netplan/cli/commands/apply.py", line 252, in is_composite_member
members = settings.get('interfaces', [])
AttributeError: 'str' object has no attribute 'get'
```
COMMITS:
* cli: Fix handling "set-name" with composites
* tests: add CLI unittests
Co-authored-by: Lukas Märdian <[email protected]>1 parent 7844058 commit 51c872d
2 files changed
+44
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
| 254 | + | |
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments