Fix: Make "pyenv global" command work for all OSs 42/73142/1
authorEric Ball <eball@linuxfoundation.org>
Wed, 21 Aug 2024 00:47:04 +0000 (17:47 -0700)
committerEric Ball <eball@linuxfoundation.org>
Wed, 21 Aug 2024 00:47:04 +0000 (17:47 -0700)
It is unclear why Ubuntu was set to use "system <version>" for the
global python version. While this command does not cause an error,
it effectively sets the global version to the system version, which
is not what it's supposed to accomplish.

In order to set the version to "<version>", we need to remove
"system" from the command. This makes the command for CentOS and
Ubuntu identical, so decision code has also been removed.

Change-Id: I00a7c6e22c4c7be3ec230b755aa3372479d802ac
Signed-off-by: Eric Ball <eball@linuxfoundation.org>
tasks/main.yml

index ca7b6cf..8e257a0 100644 (file)
@@ -81,9 +81,5 @@
       when:
         - (ansible_distribution == 'Ubuntu' and ansible_distribution_version >= '18.04') or
           (ansible_distribution == 'CentOS' and ansible_distribution_major_version >= '8')
-    - name: 'Set the required python 3.x versions using pyenv on Ubuntu'  # noqa no-changed-when
-      ansible.builtin.command: 'pyenv global system {{ pyenv_cmd }}'
-      when: ansible_distribution == 'Ubuntu'
-    - name: 'Set the required python 3.x versions using pyenv on CentOS'  # noqa no-changed-when
+    - name: 'Set the required python 3.x versions using pyenv'  # noqa no-changed-when
       ansible.builtin.command: 'pyenv global {{ pyenv_cmd }}'
-      when: ansible_distribution == 'CentOS'