An error occurred: 'str' object has no attribute 'get'

Bug #1904633 reported by iaroslavscript
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Netplan
Fix Released
Undecided
Unassigned

Bug Description

# WHAT

**netplan try** crashes while processing yaml file. The same yaml was successfully tested (no errors) at Ubuntu 19.10.

# HOW TO REPRODUCE

```
user@pc:/# cat /etc/netplan/01-network-manager-all.yaml
# MANAGED BY ANSIBLE
network:
  version: 2

  ethernets:
    renderer: networkd
    eno2:
      optional: true
      addresses:
        - 192.168.5.15/24

  vlans:
    renderer: networkd
    vlan4:
      id: 4
      link: eno2
      optional: true
      addresses:
        - 192.168.4.15/24
      nameservers:
        addresses:
          - 8.8.8.8
          - 8.8.4.4

  wifis:
    renderer: NetworkManager

root@pc:/# netplan try

An error occurred: 'str' object has no attribute 'get'

Reverting.
Traceback (most recent call last):
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 83, 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 154, in command_apply
    NetplanApply.process_ovs_cleanup(config_manager, old_files_ovs, restart_ovs, exit_on_error)
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 324, in process_ovs_cleanup
    apply_ovs_cleanup(config_manager, ovs_old, ovs_current)
  File "/usr/share/netplan/netplan/cli/ovs.py", line 119, in apply_ovs_cleanup
    if (is_ovs_interface(i, config_manager.interfaces)):
  File "/usr/share/netplan/netplan/cli/ovs.py", line 102, in is_ovs_interface
    if interfaces[iface].get('openvswitch') is not None:
AttributeError: 'str' object has no attribute 'get'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/sbin/netplan", line 23, in <module>
    netplan.main()
  File "/usr/share/netplan/netplan/cli/core.py", line 50, in main
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 211, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 66, in run
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 211, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 94, in command_try
    self.revert()
  File "/usr/share/netplan/netplan/cli/commands/try_command.py", line 117, in revert
    NetplanApply().command_apply(run_generate=False, sync=True, exit_on_error=False)
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 154, in command_apply
    NetplanApply.process_ovs_cleanup(config_manager, old_files_ovs, restart_ovs, exit_on_error)
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 324, in process_ovs_cleanup
    apply_ovs_cleanup(config_manager, ovs_old, ovs_current)
  File "/usr/share/netplan/netplan/cli/ovs.py", line 119, in apply_ovs_cleanup
    if (is_ovs_interface(i, config_manager.interfaces)):
  File "/usr/share/netplan/netplan/cli/ovs.py", line 102, in is_ovs_interface
    if interfaces[iface].get('openvswitch') is not None:
AttributeError: 'str' object has no attribute 'get'
root@pc:/#

```

# SYSTEM INFO

```
Ubuntu 20.10
Linux kupc 5.8.0-29-generic #31-Ubuntu SMP Fri Nov 6 12:37:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

libnetplan0/groovy,now 0.100-0ubuntu5 amd64 [installed,automatic]
netplan.io/groovy,now 0.100-0ubuntu5 amd64 [installed,automatic]
```

Related branches

Revision history for this message
iaroslavscript (iaroslavscript) wrote :

Bellow is a minimal reproducible config.

```
root@pc:/# cat /etc/netplan/01-network-manager-all.yaml
network:
  version: 2
  wifis:
    renderer: NetworkManager
```

Revision history for this message
iaroslavscript (iaroslavscript) wrote :
Lukas Märdian (slyon)
Changed in netplan:
status: New → Confirmed
Lukas Märdian (slyon)
Changed in netplan:
status: Confirmed → Fix Committed
Lukas Märdian (slyon)
Changed in netplan:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.