Fix py3 compatibility

- In python3 subprocess returns <class 'bytes'> type,
  in python2 this was <type 'str'>. Add universal_newlines
  argument to subprocess.Popen() call to ensure we get a
  string.
- Fix the divide behavior in python3 where the result number is a float,
  by retyping float to an int as it is represented in python2.
- Use six.moves.configparser to provide python3 compatibility.
  As ConfigParser in python 2 has been renamed to configparser in python 3.
- Fix print statements to use the proper python syntax.

Testing:
- Build the package with required changed.
- Build new ISO and ran the default playbook.

Story: 2006796
Task: 42293

Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: Iedc368456b937262b321ff298dab5fcb57df688b
(cherry picked from commit 0b059ab1cb)
This commit is contained in:
Charles Short
2021-04-16 14:35:17 -04:00
parent 1bdb08ec8c
commit 2cbbe0d9fd
6 changed files with 16 additions and 17 deletions

View File

@@ -119,7 +119,7 @@
password = keyring.get_password("CGCS", "admin")
if not password:
raise Exception("Local registry password not found.")
print dict(username='admin', password=str(password))
print(dict(username='admin', password=str(password)))
shell: "{{ script_content }}"
args:
executable: /usr/bin/python