Repository: ambari Updated Branches: refs/heads/branch-2.5 868b2a884 -> 383901fde
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/383901fd Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/383901fd Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/383901fd Branch: refs/heads/branch-2.5 Commit: 383901fdec7acd9a0be1c42c97438048f7031272 Parents: 868b2a8 Author: Sumit Mohanty <[email protected]> Authored: Tue Feb 7 15:12:52 2017 -0800 Committer: Sumit Mohanty <[email protected]> Committed: Tue Feb 7 15:15:41 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/383901fd/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/383901fd/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/383901fd/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)
