Package and Network report hotfix

Change-Id: If50def3e350632785eda7277335518fd1cacd42d
Related-PROD: PROD-38972
diff --git a/cfg_checker/reports/reporter.py b/cfg_checker/reports/reporter.py
index 2a38bd2..9cac4f5 100644
--- a/cfg_checker/reports/reporter.py
+++ b/cfg_checker/reports/reporter.py
@@ -235,6 +235,12 @@
             for node, dt in _dict.iteritems():
                 dt[_key] = {}
                 if dt['status'] == DOWN:
+                    dt.pop(_key_r)
+                    continue
+                if not dt[_key_r]:
+                    # no stats collected, put negatives
+                    dt.pop(_key_r)
+                    dt[_key] = {}
                     continue
                 lines = dt[_key_r].splitlines()
                 for line in lines:
@@ -261,6 +267,12 @@
             for node, dt in _dict.iteritems():
                 dt[_key] = {}
                 if dt['status'] == DOWN:
+                    dt.pop(_key_r)
+                    continue
+                if not dt[_key_r]:
+                    # no stats collected, put negatives
+                    dt.pop(_key_r)
+                    dt[_key] = {}
                     continue
                 li = dt[_key_r].split()
                 dt[_key]['total'] = li[1]
@@ -289,6 +301,12 @@
             for node, dt in _dict.iteritems():
                 dt[_key] = {}
                 if dt['status'] == DOWN:
+                    dt.pop(_key_r)
+                    continue
+                if not dt[_key_r]:
+                    # no stats collected, put negatives
+                    dt.pop(_key_r)
+                    dt[_key] = {}
                     continue
                 lines = dt[_key_r].splitlines()
                 for line in lines:
@@ -317,6 +335,12 @@
                 dt = _dict[node]
                 dt[_key] = {}
                 if dt['status'] == DOWN:
+                    dt.pop(_key_r)
+                    continue
+                if not dt[_key_r]:
+                    # no stats collected, put negatives
+                    dt.pop(_key_r)
+                    dt[_key] = {}
                     continue
                 lines = dt[_key_r].splitlines()
                 for line in lines:
@@ -429,17 +453,27 @@
 
         # disk space
         # sample: /dev/vda1 78G 33G 45G 43%
+        _key = "disk"
+        _key_r = "disk_raw"
         salt_master.get_cmd_for_nodes(
             "df -h | sed -n '/^\\/dev/s/ \\+/ /gp' | cut -d\" \" -f 1-5",
             "disk_raw",
             target_dict=data["nodes"]
         )
-        for _data in data["nodes"].itervalues():
-            _data["disk"] = {}
+        for dt in data["nodes"].itervalues():
+            if dt['status'] == DOWN:
+                dt.pop(_key_r)
+                continue
+            if not dt[_key_r]:
+                # no stats collected, put negatives
+                dt.pop(_key_r)
+                dt[_key] = {}
+                continue
+            dt["disk"] = {}
             # show first device row by default
-            _data["disk_max_dev"] = None
-            _d = _data["disk"]
-            _r = _data["disk_raw"]
+            dt["disk_max_dev"] = None
+            _d = dt["disk"]
+            _r = dt["disk_raw"]
             _r = _r.splitlines()
             _max = -1
             for idx in range(0, len(_r)):
@@ -448,7 +482,7 @@
                 _d[_t[0]]['v'] = _t[1:]
                 _chk = int(_t[-1].split('%')[0])
                 if _chk > _max:
-                    _data["disk_max_dev"] = _t[0]
+                    dt["disk_max_dev"] = _t[0]
                     _max = _chk
                 if _chk > _disk_critical:
                     _d[_t[0]]['f'] = "fail"
diff --git a/templates/pkg_versions_html.j2 b/templates/pkg_versions_html.j2
index 736146b..dea3956 100644
--- a/templates/pkg_versions_html.j2
+++ b/templates/pkg_versions_html.j2
@@ -271,7 +271,7 @@
             {% set dat = pkg_dict[pkg_name] %}
                 {% set status_to_show = dat['results'].keys() | get_max %}
                 {% set action_to_show = dat['results'][status_to_show].keys() | get_max %}
-                {% if status_err != status_to_show and status_down !=  status_to_show %}
+                {% if status_err != status_to_show and status_down !=  status_to_show and status_warn != status_to_show %}
                     {% call render_package(pkg_name, dat, status_to_show, action_to_show, id_label) %}
                     {% endcall %}
                 {% endif %}