sysview-py 0.4.5__tar.gz → 0.4.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sysview-py
3
- Version: 0.4.5
3
+ Version: 0.4.7
4
4
  Summary: Add your description here
5
5
  Author: Michael Wilson
6
6
  Author-email: Michael Wilson <mw@1wilson.org>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sysview-py"
3
- version = "0.4.5"
3
+ version = "0.4.7"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -95,7 +95,7 @@ class SysviewDB:
95
95
  if last_changed_item is not None:
96
96
  report_id = last_changed_item[0]
97
97
  raw_item = last_changed_item[1]
98
- last_changed_item = ReportItem(raw_item, report_id=report_id)
98
+ last_changed_item = ReportItem(raw_item, report_id=report_id, is_history_item=True)
99
99
  last_changed_item.parse()
100
100
  sql = f"SELECT date FROM reports WHERE rowid = '{last_changed_item.report_id}'"
101
101
  report_date = datetime.datetime.fromtimestamp(
@@ -76,7 +76,8 @@ class ReportItem:
76
76
  host=None,
77
77
  report_type=None,
78
78
  report_id=None,
79
- is_only_item=False
79
+ is_only_item=False,
80
+ is_history_item=False
80
81
  ):
81
82
  self.raw_item = raw_item
82
83
  self.command = command
@@ -88,6 +89,7 @@ class ReportItem:
88
89
  self.report_id = report_id
89
90
  self.host = host
90
91
  self.is_only_item = is_only_item
92
+ self.is_history_item = is_history_item
91
93
 
92
94
  def __repr__(self):
93
95
  return f"ReportItem(command={self.command}, status={self.status})"
@@ -117,7 +119,7 @@ class ReportItem:
117
119
  def status(self):
118
120
  status = self._status
119
121
  threshold = timedelta(days=1)
120
- if self.date is not None:
122
+ if self.date is not None and not self.is_history_item:
121
123
  age = datetime.now() - self.date
122
124
  if age > threshold:
123
125
  status = "UNKNOWN"
@@ -205,8 +207,9 @@ class Report:
205
207
  if line.startswith("Hostname:") and item_pointer == 0:
206
208
  self.hostname = line.split(":")[1].strip()
207
209
  elif line.startswith("Date:") and item_pointer == 0:
210
+ pass
208
211
  raw_date = line.replace("Date:", "").strip()
209
- self.date = datetime.strptime(raw_date, "%a %b %d %X %Z %Y")
212
+ #self.date = datetime.strptime(raw_date, "%a %b %d %X %Z %Y")
210
213
  elif line.startswith("Type:") and item_pointer == 0:
211
214
  self.type = "".join(line.split(":")[1].strip())
212
215
  elif item_pointer > 0 and line != "---":
File without changes