From bf83dc8a870627f4191bc2057fba115a83e6ec08 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 15 Aug 2019 17:08:33 -0500 Subject: [PATCH] Update jobs resolving runtime issues The requiurements in tests needs the python package netaddr to wrap and filter IP addresses, while this package is assumed to be installed when ansible is installed via the package manager, these assumptions are not true when installing using pip, like we do in test. This change ensures that the netaddr package is part of the test environment. An update has been made to allow the tripleo_container_stop role to pass one of its tests. The shell command to stop containers was prefixing the container name which would result in a failure to stop the given container name in a production environment. Test packages have been added to the tripleo_ptp molecule tests. These packages are being added so that we can ensure the test container images are created with everything assumed to be installed on a running system. Change-Id: If704272fb44cff35e7093c5f91ff1b48fd20a91e Signed-off-by: Kevin Carter --- molecule-requirements.txt | 1 + .../tasks/tripleo_container_stop.yaml | 8 ++++++-- .../roles/tripleo-ptp/molecule/ntp_stop/molecule.yml | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/molecule-requirements.txt b/molecule-requirements.txt index d7d403ba8..a81d2496c 100644 --- a/molecule-requirements.txt +++ b/molecule-requirements.txt @@ -8,6 +8,7 @@ pytest-html pytest-xdist mock molecule>=2.22rc1 +netaddr # this is required for the docs build jobs sphinx diff --git a/tripleo_ansible/roles/tripleo-container-stop/tasks/tripleo_container_stop.yaml b/tripleo_ansible/roles/tripleo-container-stop/tasks/tripleo_container_stop.yaml index 1e7b8214f..b79c9de0e 100644 --- a/tripleo_ansible/roles/tripleo-container-stop/tasks/tripleo_container_stop.yaml +++ b/tripleo_ansible/roles/tripleo-container-stop/tasks/tripleo_container_stop.yaml @@ -1,14 +1,18 @@ --- - name: Make sure the container {{ container }} is stopped even if container_cli do not match become: true - shell: | + shell: |- # We need to make sure that containers are stopped # as we might have different CLIs to interact with # them. I.e the container_cli might be setted to be podman # but we might have the containers running with docker. set -eu if command -v podman && podman exec {{ container }} /bin/true; then - systemctl stop tripleo_{{ container }}.service + if systemctl status {{ container }}.service; then + systemctl stop {{ container }}.service + else + podman kill {{ container }} + fi fi if type docker &> /dev/null && docker exec {{ container }} /bin/true; then docker stop {{ container }} diff --git a/tripleo_ansible/roles/tripleo-ptp/molecule/ntp_stop/molecule.yml b/tripleo_ansible/roles/tripleo-ptp/molecule/ntp_stop/molecule.yml index a750b2b65..4bf9e2613 100644 --- a/tripleo_ansible/roles/tripleo-ptp/molecule/ntp_stop/molecule.yml +++ b/tripleo_ansible/roles/tripleo-ptp/molecule/ntp_stop/molecule.yml @@ -9,7 +9,7 @@ platforms: hostname: centos7 image: centos:7 dockerfile: Dockerfile - pkg_extras: python-setuptools ntp + pkg_extras: python-setuptools ntp cronie rsyslog easy_install: - pip environment: &env @@ -29,7 +29,7 @@ platforms: hostname: fedora28 image: fedora:28 dockerfile: Dockerfile - pkg_extras: python*-setuptools ntp + pkg_extras: python*-setuptools ntp cronie rsyslog environment: http_proxy: "{{ lookup('env', 'http_proxy') }}" https_proxy: "{{ lookup('env', 'https_proxy') }}"