diff options
author | Ryan Harper <ryan.harper@canonical.com> | 2017-04-27 20:01:38 +0000 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-06-12 12:46:11 -0400 |
commit | a01ffd65492e2882408aa18972ff80021eee624a (patch) | |
tree | cd28ce795f4a02106851f2ba5654f4e7f1d56bd0 | |
parent | 67bab5bb804e2346673430868935f6bbcdb88f13 (diff) | |
download | vyos-cloud-init-a01ffd65492e2882408aa18972ff80021eee624a.tar.gz vyos-cloud-init-a01ffd65492e2882408aa18972ff80021eee624a.zip |
net: Allow netinfo subprocesses to return 0 or 1.
On systems with selinux enabled, some of the networking commands executed
successfully do not return 0. Allow these commands to return 1 since the
output is valid.
Ultimately we need to get this information in some way so that we can
display it correctly. For now, work around the stack trace when selinux
does not allow us to collect it.
LP: #1686751
-rw-r--r-- | cloudinit/netinfo.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/cloudinit/netinfo.py b/cloudinit/netinfo.py index ed374a36..39c79dee 100644 --- a/cloudinit/netinfo.py +++ b/cloudinit/netinfo.py @@ -20,7 +20,7 @@ LOG = logging.getLogger() def netdev_info(empty=""): fields = ("hwaddr", "addr", "bcast", "mask") - (ifcfg_out, _err) = util.subp(["ifconfig", "-a"]) + (ifcfg_out, _err) = util.subp(["ifconfig", "-a"], rcs=[0, 1]) devs = {} for line in str(ifcfg_out).splitlines(): if len(line) == 0: @@ -85,7 +85,7 @@ def netdev_info(empty=""): def route_info(): - (route_out, _err) = util.subp(["netstat", "-rn"]) + (route_out, _err) = util.subp(["netstat", "-rn"], rcs=[0, 1]) routes = {} routes['ipv4'] = [] @@ -125,7 +125,8 @@ def route_info(): routes['ipv4'].append(entry) try: - (route_out6, _err6) = util.subp(["netstat", "-A", "inet6", "-n"]) + (route_out6, _err6) = util.subp(["netstat", "-A", "inet6", "-n"], + rcs=[0, 1]) except util.ProcessExecutionError: pass else: |