Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-26070

Ambari throws SyntaxWarnings after moving to Python3

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.0.0
    • 3.0.0
    • ambari-agent, ambari-server
    • None

    Description

      The Python project introduced new SyntaxWarnings in Python 3.8 to warn users against using 'is' and 'is not' keywords when comparing string literals, as this is an identity comparison when an equality comparison ('==' and '!=') is more likely the intended logic.

      After this update in the Python project, and moving to Python 3.9 in AMBARI-26000 (see the change here to imply the target python version is 3.9), these SyntaxWarnings are exposed when running any ambari-server script commands, as well as within ambari-agent logs.

      The fix is simply replacing the 'is' and 'is not' keywords with their equality equivalents.

      Attachments

        1. after.png
          52 kB
          William Horn
        2. before.png
          74 kB
          William Horn

        Issue Links

          Activity

            People

              Unassigned Unassigned
              danori William Horn
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1h Original Estimate - 1h
                  1h
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 50m
                  1h 50m