Module: check_mk
Branch: master
Commit: fbe98be1ec50fdacf9f2b3dd5ffddb846f57942a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fbe98be1ec50fd…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed May 9 09:06:18 2018 +0200
Move error handling where it belongs.
Change-Id: I63dd079a744ad1fc86a1595572dc9e17b73426bc
---
cmk/ec/main.py | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index a51188b..d76eb0c 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -3175,8 +3175,6 @@ class Query(object):
class QueryGET(Query):
- _allowed_tables = set(["events", "history", "rules",
"status"])
-
def _from_raw_query(self, status_server):
super(QueryGET, self)._from_raw_query(status_server)
self._parse_table(status_server)
@@ -3184,11 +3182,6 @@ class QueryGET(Query):
def _parse_table(self, status_server):
self.table_name = self.method_arg
-
- if self.table_name not in self._allowed_tables:
- raise MKClientError("Invalid table: %s (allowed are: %s)" %
- (self.table_name, ",
".join(self._allowed_tables)))
-
self.table = status_server.table(self.table_name)
def _parse_header_lines(self):
@@ -3524,7 +3517,15 @@ class StatusServer(ECServerThread):
self.open_tcp_socket()
def table(self, name):
- return getattr(self, "table_%s" % name)
+ if name == "events":
+ return self.table_events
+ if name == "history":
+ return self.table_history
+ if name == "rules":
+ return self.table_rules
+ if name == "status":
+ return self.table_status
+ raise MKClientError("Invalid table: %s (allowed are: events, history, rules,
status)" % name)
def open_unix_socket(self):
path = self.settings.paths.unix_socket.value