Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-25854 Ambari With Python3 Support
  3. AMBARI-25910

modify Function hasattr from python2 to python3

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7.5
    • None
    • ambari-client
    • Ambari:Ambari-2.7.5

      OS:        OpenEuler-22.03

      Python: Python 3.9.9

    Description

      In python2, hasattr() function catched all attributes lookup exceptions and return False.

      But in python3, it only catch AttributeError and return False, when it comes to other exceptions, the call stack will be bubbled up.

       

      In order to adapt from python2 to python3, I would like to  add a try-catch block and catch all exceptions and return False:

      Attachments

        Activity

          People

            Unassigned Unassigned
            Charming603473 Charming Wu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: