| @@ 63-86 (lines=24) @@ | ||
| 60 | Severity = numbers.Real |
|
| 61 | ||
| 62 | ||
| 63 | def _check_command_status(xml: str) -> bool: |
|
| 64 | """Check gmp response |
|
| 65 | ||
| 66 | Look into the gmp response and check for the status in the root element |
|
| 67 | ||
| 68 | Arguments: |
|
| 69 | xml: XML-Source |
|
| 70 | ||
| 71 | Returns: |
|
| 72 | True if valid, otherwise False |
|
| 73 | """ |
|
| 74 | ||
| 75 | if xml == 0 or xml is None: |
|
| 76 | logger.error("XML Command is empty") |
|
| 77 | return False |
|
| 78 | ||
| 79 | try: |
|
| 80 | root = etree.XML(xml, parser=create_parser()) |
|
| 81 | status = root.attrib["status"] |
|
| 82 | return status is not None and status[0] == "2" |
|
| 83 | ||
| 84 | except etree.Error as e: |
|
| 85 | logger.error("etree.XML(xml): %s", e) |
|
| 86 | return False |
|
| 87 | ||
| 88 | ||
| 89 | def _to_bool(value: bool) -> str: |
|
| @@ 52-75 (lines=24) @@ | ||
| 49 | Severity = numbers.Real |
|
| 50 | ||
| 51 | ||
| 52 | def _check_command_status(xml: str) -> bool: |
|
| 53 | """Check gmp response |
|
| 54 | ||
| 55 | Look into the gmp response and check for the status in the root element |
|
| 56 | ||
| 57 | Arguments: |
|
| 58 | xml: XML-Source |
|
| 59 | ||
| 60 | Returns: |
|
| 61 | True if valid, otherwise False |
|
| 62 | """ |
|
| 63 | ||
| 64 | if xml == 0 or xml is None: |
|
| 65 | logger.error("XML Command is empty") |
|
| 66 | return False |
|
| 67 | ||
| 68 | try: |
|
| 69 | root = etree.XML(xml, parser=create_parser()) |
|
| 70 | status = root.attrib["status"] |
|
| 71 | return status is not None and status[0] == "2" |
|
| 72 | ||
| 73 | except etree.Error as e: |
|
| 74 | logger.error("etree.XML(xml): %s", e) |
|
| 75 | return False |
|
| 76 | ||
| 77 | ||
| 78 | def _to_bool(value: bool) -> str: |
|