ssh_known_hosts tasks fail in check mode

Bug #1817765 reported by Oliver Walsh on 2019-02-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Medium
Oliver Walsh

Bug Description

As the tempfile step is skipped in check mode, the resulting path is undefined. e.g:

(undercloud) [stack@undercloud ~]$ ansible-playbook --check foo.yaml
 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost
does not match 'all'

PLAY [localhost] ****************************************************************************************

TASK [Gathering Facts] **********************************************************************************
ok: [localhost]

TASK [Create temporary file for ssh_known_hosts] ********************************************************
skipping: [localhost]

TASK [Create a temporary copy of ssh_known_hosts] *******************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'path'\n\nThe error appears to have been in '/home/stack/foo.yaml': line 13, column 11, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n register: ssh_known_hosts_tmp\n - name: Create a temporary copy of ssh_known_hosts\n ^ here\n"}
 to retry, use: --limit @/home/stack/foo.retry

PLAY RECAP **********************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1

The entire block of tasks should be skipped in check mode.

Oliver Walsh (owalsh) on 2019-02-26
Changed in tripleo:
milestone: none → stein-3
importance: Undecided → Medium

Fix proposed to branch: master
Review: https://review.openstack.org/639402

Changed in tripleo:
status: New → In Progress

Reviewed: https://review.openstack.org/639402
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=6f538dc820f0a0117c33b933fc21d0d8406d5638
Submitter: Zuul
Branch: master

commit 6f538dc820f0a0117c33b933fc21d0d8406d5638
Author: Oliver Walsh <email address hidden>
Date: Tue Feb 26 17:51:15 2019 +0000

    Skip ssh_known_hosts tasks in check mode

    The tempfile task is skipped in check mode so we need to skip all tasks to
    avoid referencing the undefined temp file path.

    Change-Id: I87a4b40387cabed86e04efa64ddc19f117693589
    Closes-Bug: 1817765

Changed in tripleo:
status: In Progress → Fix Released

Reviewed: https://review.openstack.org/639695
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=f965b037b718d8839d4ff25275b2dd60416d66b7
Submitter: Zuul
Branch: stable/rocky

commit f965b037b718d8839d4ff25275b2dd60416d66b7
Author: Oliver Walsh <email address hidden>
Date: Tue Feb 26 17:51:15 2019 +0000

    Skip ssh_known_hosts tasks in check mode

    The tempfile task is skipped in check mode so we need to skip all tasks to
    avoid referencing the undefined temp file path.

    Change-Id: I87a4b40387cabed86e04efa64ddc19f117693589
    Closes-Bug: 1817765
    (cherry picked from commit 6f538dc820f0a0117c33b933fc21d0d8406d5638)

tags: added: in-stable-rocky

This issue was fixed in the openstack/tripleo-common 10.5.0 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers