Skip to content

Commit

Permalink
Fix: Fix molecule test errors for latest ansible
Browse files Browse the repository at this point in the history
This include:
* Use MOLECULE_PLATFORM_NAME rather than MOLECULE_DISTRO to run tests
  per distro.
* Remove "warn" arg from command actions, as it is no longer
  supported.
* Replace generic "package" with "yum" and "apt".
* Specify ansible.builtin.command for action using a register. There
  was an error caused by a missing field from the registered output
  otherwise.
* Fix list concat formatting for package list in vars/.
* Add gpg to package list. Some docker images do not come with it
  included, which was causing failures.

Issue: RELENG-5129
Change-Id: I0a665f11f6f592ed2fe1ec2875a6db9e758e91cf
Signed-off-by: Eric Ball <eball@linuxfoundation.org>
  • Loading branch information
eb-oss committed Feb 7, 2024
1 parent 806d5b2 commit ea90828
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gerrit-verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
env:
PY_COLORS: "1"
ANSIBLE_FORCE_COLOR: "1"
MOLECULE_DISTRO: ${{ matrix.distro }}
MOLECULE_PLATFORM_NAME: ${{ matrix.distro }}

vote:
if: ${{ always() }}
Expand Down
2 changes: 0 additions & 2 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@

- name: Lock mock-core-configs version$
command: yum versionlock mock
args:
warn: false
when:
- ansible_os_family == 'RedHat' and ansible_distribution_major_version == "7"
become: true
Expand Down
8 changes: 3 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
become: true

- name: Install LF Recommended Tools on RedHat
package:
yum:
name: "{{ lf_recommended_tools_packages }}"
state: present
when: ansible_os_family == 'RedHat'
become: true

- name: Install LF Recommended Tools on Debian
# Note: apt module requires state: 'fixed' not in dnf or yum modules
package:
apt:
name: "{{ lf_recommended_tools_packages }}"
state: fixed
when: ansible_os_family == 'Debian'
Expand Down Expand Up @@ -94,9 +94,7 @@
tags: ["skip_ansible_lint"]

- name: Ensure Node.js AppStream module is disabled (CentOS 8+).
command: yum module disable -y nodejs
args:
warn: false
ansible.builtin.command: yum module disable -y nodejs
register: module_disable
changed_when: "'Nothing to do.' not in module_disable.stdout"
when: ansible_distribution_major_version | int >= 8
Expand Down
3 changes: 2 additions & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
lf_recommended_tools_packages: "{{ lf_recommended_tools_packages_common }} + {{ lf_recommended_tools_packages_distro }}"
lf_recommended_tools_packages: "{{ lf_recommended_tools_packages_common + lf_recommended_tools_packages_distro }}"
lf_recommended_tools_packages_common:
- ant
- crudini
Expand All @@ -8,6 +8,7 @@ lf_recommended_tools_packages_common:
- dstat
- facter
- git
- gpg
- graphviz
- jq
- sshpass
Expand Down

0 comments on commit ea90828

Please sign in to comment.