From d268e7e7f73a25bc7d0b232415fccd1abdcad839 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Mon, 7 Mar 2016 13:21:36 -0500 Subject: [PATCH] apol: more logging for the status bar --- setoolsgui/apol/dta.py | 14 ++++++++------ setoolsgui/apol/infoflow.py | 14 ++++++++------ setoolsgui/apol/mlsrulequery.py | 9 ++++++--- setoolsgui/apol/rbacrulequery.py | 3 +++ setoolsgui/apol/terulequery.py | 3 +++ setoolsgui/apol/userquery.py | 1 + 6 files changed, 29 insertions(+), 15 deletions(-) diff --git a/setoolsgui/apol/dta.py b/setoolsgui/apol/dta.py index e11170a..36756ec 100644 --- a/setoolsgui/apol/dta.py +++ b/setoolsgui/apol/dta.py @@ -146,7 +146,8 @@ class DomainTransitionAnalysisTab(SEToolsWidget, QScrollArea): # Source criteria # def set_source_error(self, error_text): - self.source.setToolTip(error_text) + self.log.error("Source domain error: {0}".format(error_text)) + self.source.setToolTip("Error: {0}".format(error_text)) self.source.setPalette(self.error_palette) def clear_source_error(self): @@ -162,13 +163,14 @@ class DomainTransitionAnalysisTab(SEToolsWidget, QScrollArea): else: self.query.source = None except Exception as ex: - self.set_source_error("Error: " + str(ex)) + self.set_source_error(ex) # # Target criteria # def set_target_error(self, error_text): - self.target.setToolTip(error_text) + self.log.error("Target domain error: {0}".format(error_text)) + self.target.setToolTip("Error: {0}".format(error_text)) self.target.setPalette(self.error_palette) def clear_target_error(self): @@ -184,7 +186,7 @@ class DomainTransitionAnalysisTab(SEToolsWidget, QScrollArea): else: self.query.target = None except Exception as ex: - self.set_target_error("Error: " + str(ex)) + self.set_target_error(ex) # # Options @@ -204,11 +206,11 @@ class DomainTransitionAnalysisTab(SEToolsWidget, QScrollArea): # right now there is only one button. fail = False if self.source.isEnabled() and not self.query.source: - self.set_source_error("Error: a source domain is required") + self.set_source_error("A source domain is required") fail = True if self.target.isEnabled() and not self.query.target: - self.set_target_error("Error: a target domain is required.") + self.set_target_error("A target domain is required.") fail = True if fail: diff --git a/setoolsgui/apol/infoflow.py b/setoolsgui/apol/infoflow.py index 840f079..5fe7b1d 100644 --- a/setoolsgui/apol/infoflow.py +++ b/setoolsgui/apol/infoflow.py @@ -132,7 +132,8 @@ class InfoFlowAnalysisTab(SEToolsWidget, QScrollArea): # Source criteria # def set_source_error(self, error_text): - self.source.setToolTip(error_text) + self.log.error("Source type error: {0}".format(error_text)) + self.source.setToolTip("Error: {0}".format(error_text)) self.source.setPalette(self.error_palette) def clear_source_error(self): @@ -148,13 +149,14 @@ class InfoFlowAnalysisTab(SEToolsWidget, QScrollArea): else: self.query.source = None except Exception as ex: - self.set_source_error("Error: " + str(ex)) + self.set_source_error(ex) # # Target criteria # def set_target_error(self, error_text): - self.target.setToolTip(error_text) + self.log.error("Target type error: {0}".format(error_text)) + self.target.setToolTip("Error: {0}".format(error_text)) self.target.setPalette(self.error_palette) def clear_target_error(self): @@ -170,7 +172,7 @@ class InfoFlowAnalysisTab(SEToolsWidget, QScrollArea): else: self.query.target = None except Exception as ex: - self.set_target_error("Error: " + str(ex)) + self.set_target_error(ex) # # Options @@ -190,11 +192,11 @@ class InfoFlowAnalysisTab(SEToolsWidget, QScrollArea): # right now there is only one button. fail = False if self.source.isEnabled() and not self.query.source: - self.set_source_error("Error: a source type is required") + self.set_source_error("A source type is required") fail = True if self.target.isEnabled() and not self.query.target: - self.set_target_error("Error: a target type is required.") + self.set_target_error("A target type is required.") fail = True if fail: diff --git a/setoolsgui/apol/mlsrulequery.py b/setoolsgui/apol/mlsrulequery.py index 8fae22d..184e9e2 100644 --- a/setoolsgui/apol/mlsrulequery.py +++ b/setoolsgui/apol/mlsrulequery.py @@ -148,7 +148,8 @@ class MLSRuleQueryTab(SEToolsWidget, QScrollArea): try: self.query.source = self.source.text() except Exception as ex: - self.source.setToolTip("Error: " + str(ex)) + self.log.error("Source type/attribute error: {0}".format(ex)) + self.source.setToolTip("Error: {0}".format(ex)) self.source.setPalette(self.error_palette) def set_source_regex(self, state): @@ -169,7 +170,8 @@ class MLSRuleQueryTab(SEToolsWidget, QScrollArea): try: self.query.target = self.target.text() except Exception as ex: - self.target.setToolTip("Error: " + str(ex)) + self.log.error("Target type/attribute error: {0}".format(ex)) + self.target.setToolTip("Error: {0}".format(ex)) self.target.setPalette(self.error_palette) def set_target_regex(self, state): @@ -204,7 +206,8 @@ class MLSRuleQueryTab(SEToolsWidget, QScrollArea): try: self.query.default = self.default_range.text() except Exception as ex: - self.default_range.setToolTip("Error: " + str(ex)) + self.log.error("Default range error: {0}".format(ex)) + self.default_range.setToolTip("Error: {0}".format(ex)) self.default_range.setPalette(self.error_palette) # diff --git a/setoolsgui/apol/rbacrulequery.py b/setoolsgui/apol/rbacrulequery.py index 5fe0c1a..e1023a2 100644 --- a/setoolsgui/apol/rbacrulequery.py +++ b/setoolsgui/apol/rbacrulequery.py @@ -161,6 +161,7 @@ class RBACRuleQueryTab(SEToolsWidget, QScrollArea): try: self.query.source = self.source.text() except Exception as ex: + self.log.error("Source role error: {0}".format(ex)) self.source.setToolTip("Error: " + str(ex)) self.source.setPalette(self.error_palette) @@ -182,6 +183,7 @@ class RBACRuleQueryTab(SEToolsWidget, QScrollArea): try: self.query.target = self.target.text() except Exception as ex: + self.log.error("Target type/role error: {0}".format(ex)) self.target.setToolTip("Error: " + str(ex)) self.target.setPalette(self.error_palette) @@ -219,6 +221,7 @@ class RBACRuleQueryTab(SEToolsWidget, QScrollArea): try: self.query.default = self.default_role.text() except Exception as ex: + self.log.error("Default role error: {0}".format(ex)) self.default_role.setToolTip("Error: " + str(ex)) self.default_role.setPalette(self.error_palette) diff --git a/setoolsgui/apol/terulequery.py b/setoolsgui/apol/terulequery.py index 1694bec..415f4ad 100644 --- a/setoolsgui/apol/terulequery.py +++ b/setoolsgui/apol/terulequery.py @@ -176,6 +176,7 @@ class TERuleQueryTab(SEToolsWidget, QScrollArea): try: self.query.source = self.source.text() except Exception as ex: + self.log.error("Source type/attribute error: {0}".format(ex)) self.source.setToolTip("Error: " + str(ex)) self.source.setPalette(self.error_palette) @@ -197,6 +198,7 @@ class TERuleQueryTab(SEToolsWidget, QScrollArea): try: self.query.target = self.target.text() except Exception as ex: + self.log.error("Target type/attribute error: {0}".format(ex)) self.target.setToolTip("Error: " + str(ex)) self.target.setPalette(self.error_palette) @@ -249,6 +251,7 @@ class TERuleQueryTab(SEToolsWidget, QScrollArea): try: self.query.default = self.default_type.text() except Exception as ex: + self.log.error("Default type error: {0}".format(ex)) self.default_type.setToolTip("Error: " + str(ex)) self.default_type.setPalette(self.error_palette) diff --git a/setoolsgui/apol/userquery.py b/setoolsgui/apol/userquery.py index 698edaa..bb27b2c 100644 --- a/setoolsgui/apol/userquery.py +++ b/setoolsgui/apol/userquery.py @@ -142,6 +142,7 @@ class UserQueryTab(SEToolsWidget, QScrollArea): try: self.query.name = self.name.text() except Exception as ex: + self.log.error("User name error: {0}".format(ex)) self.name.setToolTip("Error: " + str(ex)) self.name.setPalette(self.error_palette)