Lookup plugin py_pkgs breaks when there are empty yml files

Bug #1464673 reported by git-harry
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack-Ansible
Fix Released
Medium
Kevin Carter
Kilo
Fix Released
Medium
Jesse Pretorius
Trunk
Fix Released
Medium
Kevin Carter

Bug Description

PLAY [Build new repo packages for a given release] ****************************

TASK: [Create a build report for all known packages within a release] *********
fatal: [test1-node3_repo_container-c2f6e2d1] => lookup_plugin.py_pkgs(../) returned "'NoneType' object has no attribute 'items'" error "Traceback (most recent call last):
  File "/opt/rpc-openstack/os-ansible-deployment/playbooks/plugins/lookups/py_pkgs.py", line 222, in run
    local_path=_abs_path(str(term))
  File "/opt/rpc-openstack/os-ansible-deployment/playbooks/plugins/lookups/py_pkgs.py", line 62, in __init__
    self._process_files(ext=('yaml', 'yml'))
  File "/opt/rpc-openstack/os-ansible-deployment/playbooks/plugins/lookups/py_pkgs.py", line 177, in _process_files
    for key, values in loaded_config.items():
AttributeError: 'NoneType' object has no attribute 'items'
"

This was caused because I was testing a new role that had empty yml files. The role had been created using ansible-galaxy init and so there was a vars/main.yml and defaults/main.yml file in the role. No vars had been added to the role and so parsing them for yaml returned None.

I think this bug raises two issues:

1. the plugin cannot deal with empty yaml files.
2. the plugin contains no debug lines when the verbose flag is used.

Changed in openstack-ansible:
status: New → Confirmed
importance: Undecided → Medium
milestone: none → 11.0.3
Changed in openstack-ansible:
assignee: nobody → Kevin Carter (kevin-carter)
milestone: 11.0.3 → 11.0.4
status: Confirmed → In Progress
Changed in openstack-ansible:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to os-ansible-deployment (kilo)

Fix proposed to branch: kilo
Review: https://review.openstack.org/193457

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to os-ansible-deployment (kilo)

Reviewed: https://review.openstack.org/193457
Committed: https://git.openstack.org/cgit/stackforge/os-ansible-deployment/commit/?id=bd90cf10fadf964fa6d8ecaa3f3a99148390c4b3
Submitter: Jenkins
Branch: kilo

commit bd90cf10fadf964fa6d8ecaa3f3a99148390c4b3
Author: kevin <email address hidden>
Date: Wed Jun 17 20:22:35 2015 -0500

    Fixed empty yaml load

    This change fixes the py_pkgs plugin so that if the plugin loads an empty file
    or if there is an exception raised when loading the contents of a yaml file
    the item will be skipped and no bad data will be passed onto the rest of the
    plugin.

    Change-Id: Ica3af42d95e7f3140e437e388b25f41bc14db47f
    Closes-Bug: #1464673
    (cherry picked from commit 1132f99b477211ed2b287ce6ee8718abf3434579)

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/openstack-ansible 11.2.11

This issue was fixed in the openstack/openstack-ansible 11.2.11 release.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/openstack-ansible 11.2.12

This issue was fixed in the openstack/openstack-ansible 11.2.12 release.

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/openstack-ansible 11.2.14

This issue was fixed in the openstack/openstack-ansible 11.2.14 release.

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.