From c7c0c5d707c7d4a679d71a0e2a853a049aa589f1 Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Wed, 10 Mar 2021 09:59:00 +0100 Subject: [PATCH] Enforce TRIPLEO_MINOR_UPDATE to be a string at all times It can happen that TRIPLEO_MINOR_UPDATE gets interpreted as a boolean and not as a string. This has the consequence that python when calling subprocess.run() will call os.fsencode() on the boolean variable and we can get the following error: "error": "Traceback (most recent call last):\n File \"/tmp/ansible_tripleo_diff_exec_payload__m7cmu0z/ansible_tripleo_diff_exec_payload.zip/ansible/modules/tripleo_diff_exec.py\", line 123, in run\n File \"/ usr/lib64/python3.6/subprocess.py\", line 423, in run\n with Popen(*popenargs, **kwargs) as process:\n File \"/usr/lib64/python3.6/subprocess.py\", line 729, in __init__\n restore_signals, start_new_session )\n File \"/usr/lib64/python3.6/subprocess.py\", line 1275, in _execute_child\n env_list.append(k + b'=' + os.fsencode(v))\n File \"/usr/lib64/python3.6/os.py\", line 800, in fsencode\n filename = fspath(f ilename) # Does type-checking of `filename`.\nTypeError: expected str, bytes or os.PathLike object, not bool\n", "invocation": { "module_args": { "command": "/var/lib/container-config-scripts/pacemaker_restart_bundle.sh cinder_volume openstack-cinder-volume openstack-cinder-volume Started", "environment": { "TRIPLEO_MINOR_UPDATE": true }, Let's force it to be a string so we can never hit this. Tested on the provided reproducer. Change-Id: Ia4caa36a6edd865b3e1dcdf9254c7f183b64faaf Closes-Bug: #1918111 (cherry picked from commit bdd2cfe2dfab6b7cd203211ba2adfb71a0aee27d) --- tripleo_ansible/roles/tripleo_ha_wrapper/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tripleo_ansible/roles/tripleo_ha_wrapper/tasks/main.yml b/tripleo_ansible/roles/tripleo_ha_wrapper/tasks/main.yml index 086bdd450..77e24651c 100644 --- a/tripleo_ansible/roles/tripleo_ha_wrapper/tasks/main.yml +++ b/tripleo_ansible/roles/tripleo_ha_wrapper/tasks/main.yml @@ -65,4 +65,4 @@ state_file: "{{ tripleo_ha_wrapper_config_basedir }}/{{ tripleo_ha_wrapper_puppet_config_volume }}.md5sum" state_file_suffix: "{{ tripleo_ha_wrapper_config_suffix }}" environment: - TRIPLEO_MINOR_UPDATE: "{{ tripleo_ha_wrapper_minor_update|default('') }}" + TRIPLEO_MINOR_UPDATE: "{{ tripleo_ha_wrapper_minor_update|default('') | string }}"