Improper use of with_items and with_nested

Bug #1495748 reported by Ian Cordasco
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack-Ansible
Fix Released
Low
Ian Cordasco

Bug Description

When running the swift playbooks today I noticed a lot of skipped tasks which didn't look quite right.

I've pasted some of the output here: http://paste.openstack.org/show/462145/ but also will reproduce in-line for posterity (in case paste.o.o is unreachable):

skipping: [storage03] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'g']) [226/1788]
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u' '])
skipping: [infra03_swift_proxy_container-7cc37406] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'a'])
skipping: [infra01_swift_proxy_container-eb05beac] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'a'])
skipping: [storage03] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'i'])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'}'])
skipping: [storage03] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'o'])
skipping: [infra03_swift_proxy_container-7cc37406] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'g'])
skipping: [infra01_swift_proxy_container-eb05beac] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'g'])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'}'])
skipping: [storage03] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'n'])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u'{'])
skipping: [infra03_swift_proxy_container-7cc37406] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'e'])
skipping: [infra01_swift_proxy_container-eb05beac] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'e'])
skipping: [storage03] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u's'])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u'{'])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u' '])
skipping: [storage03] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u' '])
skipping: [infra03_swift_proxy_container-7cc37406] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'd'])
skipping: [infra01_swift_proxy_container-eb05beac] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'd'])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u's'])
skipping: [storage03] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'}'])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u'w'])
skipping: [infra03_swift_proxy_container-7cc37406] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'_'])
skipping: [infra01_swift_proxy_container-eb05beac] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'_'])
skipping: [storage03] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'}'])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u'i'])
skipping: [storage03] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u'{'])
skipping: [infra01_swift_proxy_container-eb05beac] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'r'])
skipping: [infra03_swift_proxy_container-7cc37406] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'r'])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u'f'])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u't'])
skipping: [storage03] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u'{'])
skipping: [infra01_swift_proxy_container-eb05beac] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'e'])
skipping: [infra03_swift_proxy_container-7cc37406] => (item=[{u'policy': {u'default': True, u'index': 0, u'name': u'gold'}}, u'e'])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u'_'])
skipping: [storage03] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u' '])
skipping: [infra02_swift_proxy_container-b20bb7b1] => (item=[{u'policy': {u'index': 1, u'repl_number': 3, u'depreciated': True, u'name': u'silver'}}, u'm'])

Note that some of the parameters are single letters, underscores, curly braces, etc. When you inspect the task files (https://git.openstack.org/cgit/openstack/openstack-ansible/tree/playbooks/roles/os_swift_sync/tasks/swift_rings_post_distribution_check.yml#n64) you notice that with_nested is passed an incorrect value and it needs to be rewritten.

This led me to reevaluate the usage of with_items and with_nested and I found some very inconsistent uses of it. Many services use

with_items: servicename_apt_packages

but also

with_items:
  - "{{ servicename_pip_packages }}"

When both are lists.

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

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

Changed in openstack-ansible:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on openstack-ansible (master)

Change abandoned by Ian Cordasco (<email address hidden>) on branch: master
Review: https://review.openstack.org/223365

no longer affects: openstack-ansible/kilo
Changed in openstack-ansible:
milestone: none → mitaka-3
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to openstack-ansible (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/270840

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/270870

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

Reviewed: https://review.openstack.org/270870
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible/commit/?id=826f3e2576b2ff6c5008752db0bf6e9417f22068
Submitter: Jenkins
Branch: master

commit 826f3e2576b2ff6c5008752db0bf6e9417f22068
Author: Ian Cordasco <email address hidden>
Date: Thu Jan 21 15:40:05 2016 +0000

    Make all install actions consistently use with_items

    This is primarily a style fix, not a functional one.

    Related-Bug: #1495748
    Change-Id: Ia34e01bced2d0287dab5353f975f36f9323cd205

Revision history for this message
Travis Truman (travis-truman) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on openstack-ansible (master)

Change abandoned by Jesse Pretorius (odyssey4me) (<email address hidden>) on branch: master
Review: https://review.openstack.org/270840
Reason: This has been resolved in https://review.openstack.org/273682

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

Reviewed: https://review.openstack.org/273682
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible/commit/?id=4b0c2232207cfb6613b3ccbc71da89012d715aba
Submitter: Jenkins
Branch: master

commit 4b0c2232207cfb6613b3ccbc71da89012d715aba
Author: Travis Truman <email address hidden>
Date: Thu Jan 28 12:29:05 2016 -0500

    Interpret the swift_managed_regions variable correctly in with_nested loops

    Change-Id: Iccf4a912cf530edc95191e8d171ffb36e5085ee7
    Closes-Bug: 1538738
    Related-Bug: 1495748

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.