]> git.ipfire.org Git - people/ms/network.git/commitdiff
bridge: Don't throw an assertion error when a device does not exist.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Sep 2012 20:05:22 +0000 (20:05 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 6 Sep 2012 20:05:22 +0000 (20:05 +0000)
If a device was supposed to be in a bridge did not exist,
the bridge method threw an assertion error.

functions.bridge

index edf54be96800da84dcfe4c96c7e64a6d1267c53b..b4f41c1f4d48c51dd466962cf8289a416991ac28 100644 (file)
@@ -27,7 +27,11 @@ function bridge_attach_device() {
        assert isset device
 
        assert device_exists ${bridge}
-       assert device_exists ${device}
+
+       if ! device_exists ${device}; then
+               log WARN "Could not attach '${device}' to '${bridge}' becase device does not exist."
+               return ${EXIT_ERROR}
+       fi
 
        # If device is already attached, exit silently
        if listmatch ${device} $(bridge_get_members ${bridge}); then