Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Skip test without failing if docker-latest is not installed #320

@mike-nguyen

Description

@mike-nguyen

The docker test has been failing in a couple of streams because docker-latest is intentionally removed. Ideally the test should be skipped and not report a failure, however Ansible is not very straight forward.

I found meta: end_play that can conditionally end the play without failing. The caveat is that that it needs to be run in every play. In the docker test there is only two or three test so its not that bad. Any thoughts on this?

Before:

PLAY [Docker - Setup] **********************************************************

TASK [setup] *******************************************************************
ok: [rhelah]

TASK [Check for docker-latest package if running against docker-latest] ********
changed: [rhelah] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result"}
 [WARNING]: Consider using yum, dnf or zypper module rather than running rpm


TASK [Fail if docker latest is not installed] **********************************
fatal: [rhelah]: FAILED! => {
    "changed": false, 
    "failed": true
}

MSG:
---
This test is not valid because docker-latest is not installed
---
PLAY RECAP *********************************************************************
rhelah                     : ok=2    changed=1    unreachable=0    failed=1   

After:

PLAY [Docker - Setup] **********************************************************

TASK [setup] *******************************************************************
ok: [rhelah]

TASK [Check for docker-latest package if running against docker-latest] ********
changed: [rhelah] => {"censored": "the output has been hidden due to the fact that 'no_log: true' was specified for this result"}
 [WARNING]: Consider using yum, dnf or zypper module rather than running rpm


TASK [set not_installed] *******************************************************
ok: [rhelah] => {
    "ansible_facts": {
        "not_installed": true
    }, 
    "changed": false
}

PLAY [Docker - Functional Tests] ***********************************************

TASK [setup] *******************************************************************
ok: [rhelah]

PLAY [Docker - Cleanup] ********************************************************

TASK [setup] *******************************************************************
ok: [rhelah]

PLAY RECAP *********************************************************************
rhelah                     : ok=5    changed=1    unreachable=0    failed=0   

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions