From a47bd1c48aa0f6df354d8f5bf7707a65c24f054d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <joerg.sachse@slub-dresden.de> Date: Tue, 15 Oct 2024 15:07:42 +0200 Subject: [PATCH] fix: install MediaArea packages only from official MediaArea repo --- .gitlab-ci.yml | 2 +- molecule/resources/playbooks/verify.yml | 36 ++++++++++++++++++- .../configure_package_repositories.yml | 3 +- tasks/rosetta/install_mediaconch.yml | 18 ++++++++-- tasks/rosetta/install_packages.yml | 6 ++-- 5 files changed, 55 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 40da83a..ac3f6e2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,4 +45,4 @@ test-job: - molecule create --scenario-name ${SCENARIO} - molecule converge --scenario-name ${SCENARIO} - molecule idempotence --scenario-name ${SCENARIO} - # - molecule verify --scenario-name ${SCENARIO} + - molecule verify --scenario-name ${SCENARIO} diff --git a/molecule/resources/playbooks/verify.yml b/molecule/resources/playbooks/verify.yml index a5cfa75..75b4ec4 100644 --- a/molecule/resources/playbooks/verify.yml +++ b/molecule/resources/playbooks/verify.yml @@ -1,5 +1,5 @@ --- -# This is an example playbook to execute Ansible tests. +# This is a playbook to execute Ansible tests. - name: Verify hosts: all @@ -8,3 +8,37 @@ - name: Example assertion ansible.builtin.assert: that: true + +- name: Run Rosetta-specific tests. + hosts: 'vm-rosapp-mol' + gather_facts: true + tasks: + - name: Get list of installed MediaArea packages. + ansible.builtin.command: + cmd: "dnf list mediaconch mediainfo libmediainfo libzen" + register: mediaconch_repo + changed_when: false + - name: > + Test if the MediaArea packages are installed from their own repository. + ansible.builtin.assert: + that: "'@MediaArea' in mediaconch_repo.stdout" + success_msg: > + The string '@MediaArea' was found in the list of installed MediaArea + packages, so we can assume that at least one of them was installed + from the official MediaArea repository. + fail_msg: > + The string '@MediaArea' was NOT found in the list of installed + MediaArea packages, so they are probably installed from another + source, quite possibly EPEL. These will probably not work without + RHEL 8. + + - name: Call mediaconch to see if it runs without errors. + ansible.builtin.command: + cmd: "mediaconch -h" + register: mediaconch_output + changed_when: false + - name: Parse mediaconch output. + ansible.builtin.assert: + that: "'MediaConch Command Line Interface' in mediaconch_output.stdout" + success_msg: MediaConch runs as expected. + fail_msg: MediaConch couldn't be run without errors. diff --git a/tasks/rosetta/configure_package_repositories.yml b/tasks/rosetta/configure_package_repositories.yml index 622ed52..9ae19a7 100644 --- a/tasks/rosetta/configure_package_repositories.yml +++ b/tasks/rosetta/configure_package_repositories.yml @@ -1,9 +1,10 @@ --- - name: add MediaArea repository ansible.builtin.dnf: - name: "https://mediaarea.net/repo/rpm/releases/repo-MediaArea-1.0-24.noarch.rpm" + name: "https://mediaarea.net/repo/rpm/releases/repo-MediaArea-1.0-25.noarch.rpm" state: latest disable_gpg_check: true + tags: [mediaconch] - name: enable powertools repository (part of EPEL) community.general.dnf_config_manager: diff --git a/tasks/rosetta/install_mediaconch.yml b/tasks/rosetta/install_mediaconch.yml index 93fadba..9c25c0f 100644 --- a/tasks/rosetta/install_mediaconch.yml +++ b/tasks/rosetta/install_mediaconch.yml @@ -1,12 +1,24 @@ --- -- name: install MediaConch - ansible.builtin.yum: +- name: install Ansible prerequisites + ansible.builtin.dnf: name: [ - "mediaconch", "git", "libxslt", ] state: latest + +- name: install MediaConch + ansible.builtin.dnf: + name: [ + "mediaconch", + "mediainfo", + "libmediainfo", + "libzen", + ] + enablerepo: "MediaArea" + disablerepo: "epel" + update_cache: true + state: latest - name: check MediaConch symlink ansible.builtin.stat: diff --git a/tasks/rosetta/install_packages.yml b/tasks/rosetta/install_packages.yml index 832f2e2..385ffc0 100644 --- a/tasks/rosetta/install_packages.yml +++ b/tasks/rosetta/install_packages.yml @@ -1,11 +1,9 @@ --- - name: install packages for plugins, TA, analysis - ansible.builtin.yum: + ansible.builtin.dnf: name: [ 'libtiff', - 'mediaconch', - 'mediainfo', 'perl-Image-ExifTool', 'slubarchiv-xml-catalog', ] - state: latest + state: latest \ No newline at end of file -- GitLab