mueslo / openwrt_hass_devicetracker

Simple OpenWRT package which forwards device connection changes to a HomeAssistant instance
GNU General Public License v3.0
92 stars 31 forks source link

Test that $interface is not null. #18

Closed glogiotatidis closed 5 years ago

glogiotatidis commented 5 years ago

The interface extraction line has always a 0 exit code because of the cut commands.

This creates problems when not matching interfaces come up, such as network.interface.loopback. In this case $interface will be an empty string but the [ $? = 0 ] test will succeed. In turn register_hook is called with empty interface which exits with exit 1.

Adding a test for $interface fixes the problem.

glogiotatidis commented 5 years ago

And btw @mueslo thanks for the tracker ;) :+1:

mueslo commented 5 years ago

Thanks!