netplan apply crashes if ovs service is masked

Bug #1955480 reported by George Shuklin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Netplan
New
Undecided
Unassigned

Bug Description

If OVS is installed but masked `netplan apply` crashes even if there is no OVS-related configuration present.

Steps to reproduce:
1. apt-get install openvswitch-common openvswitch-switch
2. systemctl mask ovs-vswitchd.service ovsdb-server.service
3. netplan apply.

Expected behavior: work normal

Actual behavior:

netplan apply
ovs-vsctl: unix:/var/run/openvswitch/db.sock: database connection failed (No such file or directory)
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 310, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 59, in run
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 310, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 165, 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 371, in process_ovs_cleanup
    apply_ovs_cleanup(config_manager, ovs_old, ovs_current)
  File "/usr/share/netplan/netplan/cli/ovs.py", line 138, in apply_ovs_cleanup
    out = subprocess.check_output([OPENVSWITCH_OVS_VSCTL, '--columns=name,external-ids',
  File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/ovs-vsctl', '--columns=name,external-ids', '-f', 'csv', '-d', 'bare', '--no-headings', 'list', 'Port']' returned non-zero exit status 1.

Ubuntu version: 20.04

description: updated
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.