Repository: ambari Updated Branches: refs/heads/trunk 63b682608 -> fb4fb888e
AMBARI-19895. Firewall check during ambari-server setup fails on CentOS7 (Attila Doroszlai via smohanty) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fb4fb888 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fb4fb888 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fb4fb888 Branch: refs/heads/trunk Commit: fb4fb888e6345e7ab03ea0e85325c53f1ef560d9 Parents: 63b6826 Author: Sumit Mohanty <[email protected]> Authored: Tue Feb 7 15:12:52 2017 -0800 Committer: Sumit Mohanty <[email protected]> Committed: Tue Feb 7 15:16:21 2017 -0800 ---------------------------------------------------------------------- ambari-common/src/main/python/ambari_commons/firewall.py | 3 +++ .../src/main/python/resource_management/core/logger.py | 4 ++++ .../src/main/python/resource_management/core/shell.py | 6 +++--- 3 files changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/fb4fb888/ambari-common/src/main/python/ambari_commons/firewall.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/ambari_commons/firewall.py b/ambari-common/src/main/python/ambari_commons/firewall.py index 43983ca..0ef4f7a 100644 --- a/ambari-common/src/main/python/ambari_commons/firewall.py +++ b/ambari-common/src/main/python/ambari_commons/firewall.py @@ -126,6 +126,9 @@ class RedHat7FirewallChecks(FirewallChecks): return "%(servcmd)s is-active %(fwl1)s %(fwl2)s" % {"servcmd":self.SERVICE_CMD,"fwl1":"iptables", "fwl2":"firewalld"} def check_result(self): + if self.stdoutdata is None: + return False + for line in self.stdoutdata.split("\n"): if line.strip() == "active": return True http://git-wip-us.apache.org/repos/asf/ambari/blob/fb4fb888/ambari-common/src/main/python/resource_management/core/logger.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/core/logger.py b/ambari-common/src/main/python/resource_management/core/logger.py index b86eff8..d83e61d 100644 --- a/ambari-common/src/main/python/resource_management/core/logger.py +++ b/ambari-common/src/main/python/resource_management/core/logger.py @@ -55,6 +55,10 @@ class Logger: Logger.logger = logger @staticmethod + def isEnabledFor(level): + return Logger.logger is not None and Logger.logger.isEnabledFor(level) + + @staticmethod def exception(text): Logger.logger.exception(Logger.filter_text(text)) http://git-wip-us.apache.org/repos/asf/ambari/blob/fb4fb888/ambari-common/src/main/python/resource_management/core/shell.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/core/shell.py b/ambari-common/src/main/python/resource_management/core/shell.py index f8f056a..5c953da 100644 --- a/ambari-common/src/main/python/resource_management/core/shell.py +++ b/ambari-common/src/main/python/resource_management/core/shell.py @@ -65,9 +65,9 @@ def log_function_call(function): # logouput=None - log in DEBUG level # logouput=not-specified - log in DEBUG level, not counting internal calls if 'logoutput' in function.func_code.co_varnames: - kwargs['logoutput'] = ('logoutput' in kwargs and kwargs['logoutput'] and Logger.logger.isEnabledFor(logging.INFO)) or \ - ('logoutput' in kwargs and kwargs['logoutput']==None and Logger.logger.isEnabledFor(logging.DEBUG)) or \ - (not 'logoutput' in kwargs and not is_internal_call and Logger.logger.isEnabledFor(logging.DEBUG)) + kwargs['logoutput'] = ('logoutput' in kwargs and kwargs['logoutput'] and Logger.isEnabledFor(logging.INFO)) or \ + ('logoutput' in kwargs and kwargs['logoutput']==None and Logger.isEnabledFor(logging.DEBUG)) or \ + (not 'logoutput' in kwargs and not is_internal_call and Logger.isEnabledFor(logging.DEBUG)) result = function(command, **kwargs)
