Skip to content
Permalink
Browse files

7792 FIX mssql_instance: Fixed parsing invalid lines containing DB co…

…nnection errors

Change-Id: I425b2da9ef950c7814da8849394599ae1b50cd97
  • Loading branch information
si-23 committed Jun 12, 2019
1 parent b3f201f commit 61c500f9636b3a1bac6644c368e21b398a6dabb9
@@ -0,0 +1,10 @@
Title: mssql_instance: Fixed parsing invalid lines containing DB connection errors
Level: 1
Component: checks
Compatible: compat
Edition: cre
Version: 1.7.0i1
Date: 1560342641
Class: fix


@@ -66,7 +66,9 @@ def _parse_prod_version(entry):
def parse_mssql_instance(info):
parsed = {}
for line in info:
if line[0].startswith("ERROR:"):
if line[0].startswith("ERROR:") or len(line) < 2 or line[1] not in [
"config", "state", "details"
]:
continue
elif line[0][:6] == "MSSQL_":
# Remove the MSSQL_ prefix from the ID for this check
@@ -0,0 +1,33 @@
# -*- encoding: utf-8
# yapf: disable


checkname = u'mssql_instance'


info = [[u'MSSQL_MSSQLSERVER', u'config', u'10.50.6000.34', u'Standard Edition', u''],
[u'MSSQL_ABC', u'config', u'10.50.6000.34', u'Standard Edition', u''],
[u'MSSQL_ABCDEV', u'config', u'10.50.6000.34', u'Standard Edition', u''],
[u'MSSQL_MSSQLSERVER', u'state', u'1', u''],
[u'MSSQL_ABC', u'state', u'1', u''],
[u'MSSQL_ABCDEV',
u'state',
u'0',
u'[DBNETLIB][ConnectionOpen (Connect()).]SQL Server existiert nicht oder Zugriff verweigert.'],
[u'Hier kommt eine laaaangre Fehlermeldung'],
[u'die sich ueber mehrere Zeilen ersteckt']]


discovery = {'': [(u'ABC', {}), (u'ABCDEV', {}), (u'MSSQLSERVER', {})]}


checks = {'': [(u'ABC', {}, [(0, u'Version: 10.50.6000.34 - Standard Edition', [])]),
(u'ABCDEV',
{},
[(2,
u'Failed to connect to database ([DBNETLIB][ConnectionOpen (Connect()).]SQL Server existiert nicht oder Zugriff verweigert.)',
[]),
(0, u'Version: 10.50.6000.34 - Standard Edition', [])]),
(u'MSSQLSERVER',
{},
[(0, u'Version: 10.50.6000.34 - Standard Edition', [])])]}

0 comments on commit 61c500f

Please sign in to comment.
You can’t perform that action at this time.