ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject ambari git commit: AMBARI-20480. Security status commands fill ambari-agent.log with stack traces (aonishuk)
Date Thu, 16 Mar 2017 13:24:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b5b5ac46a -> 5f530545c


AMBARI-20480. Security status commands fill ambari-agent.log with stack traces (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5f530545
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5f530545
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5f530545

Branch: refs/heads/trunk
Commit: 5f530545c0aa81b6a9409384de82c5a016883256
Parents: b5b5ac4
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Thu Mar 16 15:23:27 2017 +0200
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Thu Mar 16 15:23:27 2017 +0200

----------------------------------------------------------------------
 .../libraries/functions/security_commons.py              | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5f530545/ambari-common/src/main/python/resource_management/libraries/functions/security_commons.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/security_commons.py
b/ambari-common/src/main/python/resource_management/libraries/functions/security_commons.py
index 96d60da..9ceeea7 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/security_commons.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/security_commons.py
@@ -159,8 +159,13 @@ def get_params_from_filesystem(conf_dir, config_files):
   for config_file, file_type in config_files.iteritems():
     file_name, file_ext = os.path.splitext(config_file)
 
+    config_filepath = conf_dir + os.sep + config_file
+
+    if not os.path.isfile(config_filepath):
+      continue
+
     if file_type == FILE_TYPE_XML:
-      configuration = ET.parse(conf_dir + os.sep + config_file)
+      configuration = ET.parse(config_filepath)
       props = configuration.getroot().getchildren()
       config_file_id = file_name if file_name else config_file
       result[config_file_id] = {}
@@ -168,7 +173,7 @@ def get_params_from_filesystem(conf_dir, config_files):
         result[config_file_id].update({prop[0].text: prop[1].text})
 
     elif file_type == FILE_TYPE_PROPERTIES:
-      with open(conf_dir + os.sep + config_file, 'r') as f:
+      with open(config_filepath, 'r') as f:
         config_string = '[root]\n' + f.read()
       ini_fp = StringIO.StringIO(re.sub(r'\\\s*\n', '\\\n ', config_string))
       config = ConfigParser.RawConfigParser()
@@ -184,7 +189,7 @@ def get_params_from_filesystem(conf_dir, config_files):
       section_footer = re.compile('^\}\s*;?\s*$')
       section_name = "root"
       result[file_name] = {}
-      with open(conf_dir + os.sep + config_file, 'r') as f:
+      with open(config_filepath, 'r') as f:
         for line in f:
           if line:
             line = line.strip()


Mime
View raw message