diff options
author | Joshua Harlow <jxharlow@godaddy.com> | 2016-09-15 14:46:14 -0700 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-12-02 16:23:38 -0500 |
commit | f6d5dc486776019e0799f95f8d1982be8fba4da5 (patch) | |
tree | 63151c94cfc8a3afca15a2aa791a7b952bcbbc48 /cloudinit/net/cmdline.py | |
parent | 3ac34f5325edf7f1212cd0b6a3d1cfe2ed45a63b (diff) | |
download | vyos-cloud-init-f6d5dc486776019e0799f95f8d1982be8fba4da5.tar.gz vyos-cloud-init-f6d5dc486776019e0799f95f8d1982be8fba4da5.zip |
Replace usage of sys_netdev_info with read_sys_net
I've seen cases of unable to read from files as
well as the existing os errors so catch io error
and skip by using the smarter read_sys_net instead.
LP: #1625766
Diffstat (limited to 'cloudinit/net/cmdline.py')
-rwxr-xr-x[-rw-r--r--] | cloudinit/net/cmdline.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cloudinit/net/cmdline.py b/cloudinit/net/cmdline.py index cbed908d..a8bf73fb 100644..100755 --- a/cloudinit/net/cmdline.py +++ b/cloudinit/net/cmdline.py @@ -26,7 +26,7 @@ import sys import six from . import get_devicelist -from . import sys_netdev_info +from . import read_sys_net_safe from cloudinit import util @@ -210,7 +210,10 @@ def read_kernel_cmdline_config(files=None, mac_addrs=None, cmdline=None): return None if mac_addrs is None: - mac_addrs = dict((k, sys_netdev_info(k, 'address')) - for k in get_devicelist()) + mac_addrs = {} + for k in get_devicelist(): + mac_addr = read_sys_net_safe(k, 'address') + if mac_addr: + mac_addrs[k] = mac_addr return config_from_klibc_net_cfg(files=files, mac_addrs=mac_addrs) |