too many changed_when: false

Bug #1640144 reported by Jean-Philippe Evrard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack-Ansible
Fix Released
Wishlist
Jimmy McCrory

Bug Description

In our playbooks and role, we have many occurrences of changed_when: false, which is often use for convenience (not triggering handlers, override shell scripts default "changed" behavior).

I'd be happy to see these "changed_when" lines changed to:
- (If the changed_when tasks are used in a "read-only" manner:) maybe a facts or a different way to do the tasks that are using the registered value of the changed_when task.
- (If the changed_when tasks are used in a "read-write" manner:) maybe introduce more tasks to really check the expected results of the tasks, and either introduce a new module/action for handling state changes (if any).

We currently don't test idempotency, but it's could be part of our testing improvements of this cycle.

It seems a lower priority than the failed_when: false, imo.

Changed in openstack-ansible:
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-ansible-galera_client (master)

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

Changed in openstack-ansible:
assignee: nobody → Jimmy McCrory (jimmy-mccrory)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ansible-galera_client (master)

Reviewed: https://review.openstack.org/433860
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-galera_client/commit/?id=22b7d9c761be7ec677351f519ff33b27e17ad64f
Submitter: Jenkins
Branch: master

commit 22b7d9c761be7ec677351f519ff33b27e17ad64f
Author: Jimmy McCrory <email address hidden>
Date: Tue Feb 14 10:57:09 2017 -0800

    Replace grep and which commands with find module

    For improved idempotence within the role, replace the use of `grep` and
    `which` through the 'command' module with the 'find' module.
    changed_when and failed_when statements around these tasks can be
    removed.

    Partial-Bug: 1640134
    Partial-Bug: 1640144
    Change-Id: Iebbcd52f673dba657117ac21ef1fa809bf344521

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-ansible-haproxy_server (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ansible-haproxy_server (master)

Reviewed: https://review.openstack.org/455793
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-haproxy_server/commit/?id=49da8afb897ad62add3b91fcfae83b221ae59169
Submitter: Jenkins
Branch: master

commit 49da8afb897ad62add3b91fcfae83b221ae59169
Author: Jimmy McCrory <email address hidden>
Date: Tue Apr 11 10:40:05 2017 -0700

    Improve role idempotency

    Add a 'creates' argument to the task installing HATop so that the task
    is skipped if it's already installed. Remove 'changed_when' from slurp
    tasks. Break the 'Test for log directory or link' shell task into a
    couple tasks which use the stat and file module. Remove 'changed_when'
    from slurp tasks. Also enable the idempotence test for the gate.

    Partial-Bug: 1640144
    Change-Id: Id7fe24c9c1ae416abab69d4f42b65c9594805e10

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-ansible-haproxy_server (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/463012

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-ansible-haproxy_server (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/463020

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ansible-haproxy_server (stable/ocata)

Reviewed: https://review.openstack.org/463012
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-haproxy_server/commit/?id=1b4ad445c454a24182395f2141cdd569300bb6cb
Submitter: Jenkins
Branch: stable/ocata

commit 1b4ad445c454a24182395f2141cdd569300bb6cb
Author: Jimmy McCrory <email address hidden>
Date: Tue Apr 11 10:40:05 2017 -0700

    Improve role idempotency

    Add a 'creates' argument to the task installing HATop so that the task
    is skipped if it's already installed. Remove 'changed_when' from slurp
    tasks. Break the 'Test for log directory or link' shell task into a
    couple tasks which use the stat and file module. Remove 'changed_when'
    from slurp tasks. Also enable the idempotence test for the gate.

    Partial-Bug: 1640144
    Change-Id: Id7fe24c9c1ae416abab69d4f42b65c9594805e10
    (cherry picked from commit 49da8afb897ad62add3b91fcfae83b221ae59169)

tags: added: in-stable-ocata
tags: added: in-stable-newton
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ansible-haproxy_server (stable/newton)

Reviewed: https://review.openstack.org/463020
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-haproxy_server/commit/?id=b29a72f8244d3b9d0f9655d465173493a5a61174
Submitter: Jenkins
Branch: stable/newton

commit b29a72f8244d3b9d0f9655d465173493a5a61174
Author: Jimmy McCrory <email address hidden>
Date: Tue Apr 11 10:40:05 2017 -0700

    Improve role idempotency

    Add a 'creates' argument to the task installing HATop so that the task
    is skipped if it's already installed. Remove 'changed_when' from slurp
    tasks. Break the 'Test for log directory or link' shell task into a
    couple tasks which use the stat and file module. Remove 'changed_when'
    from slurp tasks. Also enable the idempotence test for the gate.

    Partial-Bug: 1640144
    Change-Id: Id7fe24c9c1ae416abab69d4f42b65c9594805e10
    (cherry picked from commit 49da8afb897ad62add3b91fcfae83b221ae59169)

Changed in openstack-ansible:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.