diff --git a/roles/tobiko-ensure-python3/files/get_python_info.py b/roles/tobiko-ensure-python3/files/get_python_info.py index 1ad07af46..413baeb78 100644 --- a/roles/tobiko-ensure-python3/files/get_python_info.py +++ b/roles/tobiko-ensure-python3/files/get_python_info.py @@ -50,7 +50,8 @@ def main(): info = {'version': version, 'executable': sys.executable, 'executables': executables} - output = json.dumps(info, indent=4, sort_keys=True) + output = json.dumps(info) + assert output.startswith('{') print(output) diff --git a/roles/tobiko-ensure-python3/tasks/install.yaml b/roles/tobiko-ensure-python3/tasks/install.yaml index c969ad0a9..a77cc6c40 100644 --- a/roles/tobiko-ensure-python3/tasks/install.yaml +++ b/roles/tobiko-ensure-python3/tasks/install.yaml @@ -34,14 +34,17 @@ cmd: get_python_info.py --base --quiet executable: '{{ get_python_exe.stdout_lines | first }}' register: get_python_info - changed_when: no + changed_when: false - name: "set python_info['{{ python_command }}'] fact" set_fact: python_info: > {{ python_info | combine({python_command: - (get_python_info.stdout | from_json)}) }} + (item | from_json)}) }} + loop: '{{ get_python_info.stdout_lines }}' + when: item.startswith('{') + failed_when: (python_info | length) == 0 - name: "upgrade '{{ python_command }}' packages to the latest versions"