JiaLiangC commented on PR #3748:
URL: https://github.com/apache/ambari/pull/3748#issuecomment-1694124423

   "Removing the redundant calls that lead to unit test failures
   
   One may ask, why remove conf_file = properties.fileName? This is a potential 
problem found after adding raise NotImplementedError.
   
   Firstly, conf_file is not used subsequently; Secondly, the property 
properties.fileName could only exist after calling properties.load(hfR) in the 
method get_ambari_properties.
   
   Therefore, the acquisition of properties.fileName in the code must ensure 
that properties.load is called beforehand. I checked all the calls, except for 
the deleted one, and in all cases, the method properties.load is indeed called."
   
   ```python
   def get_ambari_properties():
     conf_file = find_properties_file()
   
     # Try to read ambari properties file. It is OK to fail.
     # Return -1 on failure.
     properties = None
     try:
       properties = Properties()
       with open(conf_file) as hfR:
         properties.load(hfR)
     except (Exception), e:
       print_error_msg ('Could not read "%s": %s' % (conf_file, str(e)))
       return -1
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to