summaryrefslogtreecommitdiff
path: root/cloudinit/netinfo.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2017-04-27 20:01:38 +0000
committerScott Moser <smoser@brickies.net>2017-06-12 12:46:11 -0400
commita01ffd65492e2882408aa18972ff80021eee624a (patch)
treecd28ce795f4a02106851f2ba5654f4e7f1d56bd0 /cloudinit/netinfo.py
parent67bab5bb804e2346673430868935f6bbcdb88f13 (diff)
downloadvyos-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
Diffstat (limited to 'cloudinit/netinfo.py')
-rw-r--r--cloudinit/netinfo.py7
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: