From b91d50b07b26041fa2205600cc8c7e95a10b870a Mon Sep 17 00:00:00 2001 From: Ramesh Nachimuthu Date: Fri, 16 Sep 2016 17:20:16 +0530 Subject: check perf data exists before processing We may not have performance data for a given period of time. So in this case perf statistics returned by sadf will be None. We should make sure that it not None before further processing the perf data. Change-Id: If311035ae76403b356e51f0fe50f5ffddec9d18b Bug-Url: https://bugzilla.redhat.com/1328191 Signed-off-by: Ramesh Nachimuthu Reviewed-on: http://review.gluster.org/15526 Reviewed-by: Sahina Bose --- plugins/network.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/network.py b/plugins/network.py index 920cee3..c449357 100755 --- a/plugins/network.py +++ b/plugins/network.py @@ -121,9 +121,16 @@ def main(): try: stat = sadf.getLatestStat(sadf.sadfExecCmd(_sadfNetCommand), args.interval) - (rc, msg) = _getStatMessage(stat, all=args.all, - includes=args.include, - excludes=args.exclude) + + if stat: + (rc, msg) = _getStatMessage(stat, all=args.all, + includes=args.include, + excludes=args.exclude) + else: + logging.error("unable to get network status for the given " + "interval: %s" % args.interval) + (rc, msg) = utils.PluginStatusCode.UNKNOWN, "UNKNOWN" + print msg sys.exit(rc) except (sadf.SadfCmdExecFailedException, -- cgit