Module: check_mk
Branch: master
Commit: b9484493bfcca550d63458dddac937bc6c748375
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b9484493bfcca5…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Thu Jul 24 17:28:31 2014 +0200
641 FIX windows inventory: moved encoding from checks to windows agent plugin
---
.werks/641 | 8 ++++++++
ChangeLog | 1 +
agents/windows/plugins/mk_inventory.ps1 | 3 ++-
inventory/win_bios | 1 -
inventory/win_disks | 1 -
inventory/win_os | 2 +-
inventory/win_reg_uninstall | 8 ++++----
inventory/win_system | 1 -
inventory/win_video | 1 -
inventory/win_wmi_software | 6 +++---
10 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/.werks/641 b/.werks/641
new file mode 100644
index 0000000..f33c864
--- /dev/null
+++ b/.werks/641
@@ -0,0 +1,8 @@
+Title: windows inventory: moved encoding from checks to windows agent plugin
+Level: 1
+Component: inv
+Version: 1.2.5i5
+Date: 1406210953
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 68f6b22..aa916c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -125,6 +125,7 @@
* 0167 FIX: mk_inventory.linux: Changed field separator from pipe to tab...
* 1005 FIX: Fix exception when using pretty-print output format
* 0946 FIX: hw/sw inventory: fixed display bug for byte fields with the value 0...
+ * 0641 FIX: windows inventory: moved encoding from checks to windows agent plugin
1.2.5i4:
diff --git a/agents/windows/plugins/mk_inventory.ps1
b/agents/windows/plugins/mk_inventory.ps1
index 8d33bb7..1bb89b0 100644
--- a/agents/windows/plugins/mk_inventory.ps1
+++ b/agents/windows/plugins/mk_inventory.ps1
@@ -1,3 +1,4 @@
+[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$name = (Get-Item env:\Computername).Value
$separator = "|"
# filename for timestamp
@@ -14,7 +15,7 @@ If (Test-Path $timestamp){
# exit if timestamp to young
if ( $filedate -gt $earlier ) { exit }
}
-
# create new timestamp file
+# create new timestamp file
New-Item $timestamp -type file -force | Out-Null
# calculate unix timestamp
diff --git a/inventory/win_bios b/inventory/win_bios
index 2840260..c48f50d 100644
--- a/inventory/win_bios
+++ b/inventory/win_bios
@@ -44,7 +44,6 @@ def inv_win_bios(info):
for varname, value in info:
varname = re.sub(" *","", varname)
value = re.sub("^ ", "", value)
- value = value.decode("cp437")
if varname == "BIOSVersion":
bios_version = value
elif varname == "SMBIOSBIOSVersion":
diff --git a/inventory/win_disks b/inventory/win_disks
index d19e431..e056500 100644
--- a/inventory/win_disks
+++ b/inventory/win_disks
@@ -63,7 +63,6 @@ def inv_win_disks(info):
for varname, value in info:
varname = re.sub(" *","", varname)
value = re.sub("^ ", "", value)
- value = value.decode("cp437")
if varname == "Manufacturer":
array["vendor"] = value
elif varname == "InterfaceType":
diff --git a/inventory/win_os b/inventory/win_os
index 0d0a6ab..37c4439 100644
--- a/inventory/win_os
+++ b/inventory/win_os
@@ -32,7 +32,7 @@ def inv_win_os(info):
node = inv_tree("software.os.")
line = info[0]
if len(line) == 6:
- node["name"] = line[1].decode("cp437")
+ node["name"] = line[1]
node["kernel_version"] = line[2]
if line[3] == "64-Bit":
node["arch"] = "x86_64"
diff --git a/inventory/win_reg_uninstall b/inventory/win_reg_uninstall
index 78fe197..022d85d 100644
--- a/inventory/win_reg_uninstall
+++ b/inventory/win_reg_uninstall
@@ -37,10 +37,10 @@ def inv_win_reg_uninstall(info):
install_date = int(time.mktime(time.strptime(date, "%Y%m%d")))
entry = {
- "name" : pacname.decode("cp437"),
- "version" : version.decode("cp437"),
- "vendor" : publisher.decode("cp437"),
- "summary" : display_name.decode("cp437"),
+ "name" : pacname,
+ "version" : version,
+ "vendor" : publisher,
+ "summary" : display_name,
"install_date" : install_date,
"size" : estimated_size,
"package_type" : "reg_uninstall",
diff --git a/inventory/win_system b/inventory/win_system
index b00f7fb..5c232d1 100644
--- a/inventory/win_system
+++ b/inventory/win_system
@@ -40,7 +40,6 @@ def inv_win_system(info):
for varname, value in info:
varname = re.sub(" *","", varname)
value = re.sub("^ ", "", value)
- value = value.decode("cp437")
if varname == "SerialNumber":
node["serial"] = value
elif varname == "Manufacturer":
diff --git a/inventory/win_video b/inventory/win_video
index 5238a33..4eebf19 100644
--- a/inventory/win_video
+++ b/inventory/win_video
@@ -42,7 +42,6 @@ def inv_win_video(info):
for varname, value in info:
varname = re.sub(" *","", varname)
value = re.sub("^ ", "", value)
- value = value.decode("cp437")
if varname == "Name":
array["name"] = value
elif varname == "DriverVersion":
diff --git a/inventory/win_wmi_software b/inventory/win_wmi_software
index aa7cc76..496321f 100644
--- a/inventory/win_wmi_software
+++ b/inventory/win_wmi_software
@@ -44,9 +44,9 @@ def inv_win_wmi_software(info):
install_date = int(time.mktime(time.strptime(dat, "%Y%m%d")))
entry = {
- "name" : pacname.decode("cp437"),
- "version" : version.decode("cp437"),
- "vendor" : vendor.decode("cp437"),
+ "name" : pacname,
+ "version" : version,
+ "vendor" : vendor,
"install_date" : install_date,
"package_type" : "wmi",
}