Skip to content

Commit

Permalink
Resolve "Felix dies if interface missing" on Alpine
Browse files Browse the repository at this point in the history
Alpine and Ubuntu have slightly different error messages when you
run 'ip link show <non-existent interface>'; respectively

    ip: can't find device 'thisdoesnotexist'
    Device "thisdoesnotexist" does not exist.

We run Felix inside an Alpine container for calico/node, but the
different wording meant Felix didn't recognise the missing
interface as a known error, so raised an exception.  Now we catch
both wordings and handle them correctly.

Fixes #899.
  • Loading branch information
alexwlchan committed Nov 18, 2015
1 parent 573af2f commit c186d50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion calico/felix/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def interface_exists(interface):
futils.check_call(["ip", "link", "list", interface])
return True
except futils.FailedSystemCall as fsc:
if fsc.stderr.count("does not exist") != 0:
if ("does not exist" in fsc.stderr) or \
("can't find device" in fsc.stderr):
return False
else:
# An error other than does not exist; just pass on up
Expand Down

0 comments on commit c186d50

Please sign in to comment.