Comment 10 for bug 2041727

Revision history for this message
Patric Hansen (phansen2002) wrote :

This is perhaps a more elegant patch:

--- a/cli/ovs.py
+++ b/cli/ovs.py
@@ -120,17 +120,17 @@
 def apply_ovs_cleanup(config_manager, ovs_old, ovs_current): # pragma: nocover (covered in autopkgtest)
     """
     Query OpenVSwitch state through 'ovs-vsctl' and filter for netplan=true
     tagged ports/bonds and bridges. Delete interfaces which are not defined
     in the current configuration.
     Also filter for individual settings tagged netplan/<column>[/<key]=value
     in external-ids and clear them if they have been set by netplan.
     """
- if not systemctl_is_active(OPENVSWITCH_OVSDB_SERVER_UNIT):
+ if os.path.isfile(OPENVSWITCH_OVS_VSCTL) and os.access(OPENVSWITCH_OVS_VSCTL, os.X_OK) and not systemctl_is_active(OPENVSWITCH_OVSDB_SERVER_UNIT):
         raise OvsDbServerNotRunning('{} is not running'.format(OPENVSWITCH_OVSDB_SERVER_UNIT))

     config_manager.parse()
     ovs_ifaces = set()
     for i in config_manager.all_defs.keys():
         if (is_ovs_interface(i, config_manager.all_defs)):
             ovs_ifaces.add(i)