Module: check_mk
Branch: master
Commit: f35cd8409744914bb15eaa4aa21df13b7cda9c0d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f35cd840974491…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Mar 19 16:13:44 2018 +0100
5776 FIX win_reg_uninstall: Fixed transposed month and day fields of dates which caused
'Inventory failed: unconverted data remains'
Change-Id: Ifbc96ab68ed1186d71a63ec0a5ea0ed4d7b7d514
---
.werks/5776 | 11 +++++++++++
inventory/win_reg_uninstall | 28 ++++++++++++++++++----------
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/.werks/5776 b/.werks/5776
new file mode 100644
index 0000000..16ffb4f
--- /dev/null
+++ b/.werks/5776
@@ -0,0 +1,11 @@
+Title: win_reg_uninstall: Fixed transposed month and day fields of dates which caused
'Inventory failed: unconverted data remains'
+Level: 1
+Component: inv
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i4
+Date: 1521472345
+
+
diff --git a/inventory/win_reg_uninstall b/inventory/win_reg_uninstall
index a8d3c0f..90c7904 100644
--- a/inventory/win_reg_uninstall
+++ b/inventory/win_reg_uninstall
@@ -31,25 +31,33 @@
def inv_win_reg_uninstall(info):
paclist = inv_tree_list("software.packages:")
for line in info:
- if len(line) == 7:
+ if len(line) == 7:
display_name, publisher, path, pacname, version, estimated_size, date = line
- language = ""
- elif len(line) == 8:
+ language = ""
+ elif len(line) == 8:
display_name, publisher, path, pacname, version, estimated_size, date,
language = line
- else:
- continue
+ else:
+ continue
install_date = None
if re.match("^20\d{6}", date):
- install_date = int(time.mktime(time.strptime(date, "%Y%m%d")))
+ # Dates look like '20160930', but we saw also dates like
'20132804'
+ # which have transposed month and day fields.
+ try:
+ install_date = int(time.mktime(time.strptime(date, "%Y%m%d")))
+ except ValueError:
+ try:
+ install_date = int(time.mktime(time.strptime(date,
"%Y%d%m")))
+ except ValueError:
+ pass
size = saveint(estimated_size)
if size == 0:
size = None
- if pacname.startswith("{"):
- pacname = display_name
- if pacname == "":
- continue
+ if pacname.startswith("{"):
+ pacname = display_name
+ if pacname == "":
+ continue
entry = {
"name" : pacname,