fix: Fallback to check the interface state, specifically freebsd benefits
of this.
This commit is contained in:
parent
e4f89dcdc6
commit
4943536a14
@ -21,6 +21,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import cloudinit.util as util
|
import cloudinit.util as util
|
||||||
|
import re
|
||||||
|
|
||||||
from prettytable import PrettyTable
|
from prettytable import PrettyTable
|
||||||
|
|
||||||
@ -34,13 +35,17 @@ def netdev_info(empty=""):
|
|||||||
continue
|
continue
|
||||||
if line[0] not in ("\t", " "):
|
if line[0] not in ("\t", " "):
|
||||||
curdev = line.split()[0]
|
curdev = line.split()[0]
|
||||||
# TODO: up/down detection fails on FreeBSD
|
|
||||||
devs[curdev] = {"up": False}
|
devs[curdev] = {"up": False}
|
||||||
for field in fields:
|
for field in fields:
|
||||||
devs[curdev][field] = ""
|
devs[curdev][field] = ""
|
||||||
toks = line.lower().strip().split()
|
toks = line.lower().strip().split()
|
||||||
if toks[0] == "up":
|
if toks[0] == "up":
|
||||||
devs[curdev]['up'] = True
|
devs[curdev]['up'] = True
|
||||||
|
# If the output of ifconfig doesn't contain the required info in the
|
||||||
|
# obvious place, use a regex filter to be sure.
|
||||||
|
elif len(toks) > 1:
|
||||||
|
if re.search("flags=\d+<up,", toks[1]):
|
||||||
|
devs[curdev]['up'] = True
|
||||||
|
|
||||||
fieldpost = ""
|
fieldpost = ""
|
||||||
if toks[0] == "inet6":
|
if toks[0] == "inet6":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user