improve handling of empty resource_registry in env file

Bug #1833743 reported by John Fulton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Low
John Fulton

Bug Description

If a user runs 'openstack overcloud deploy ... -e foo.yaml' where foo.yaml contains only:

$ cat foo.yaml
resource_registry:
$

The deployment will fail with the following:

Exception occured while running the command
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/tripleoclient/command.py", line 32, in run
    super(Command, self).run(parsed_args)
  File "/usr/lib/python3.6/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python3.6/site-packages/cliff/command.py", line 184, in run
    return_code = self.take_action(parsed_args) or 0
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py", line 882, in take_action
    parsed_args.environment_files)
  File "/usr/lib/python3.6/site-packages/tripleoclient/utils.py", line 1773, in check_deprecated_service_is_enabled
    check_file_for_enabled_service(env_file)
  File "/usr/lib/python3.6/site-packages/tripleoclient/utils.py", line 1756, in check_file_for_enabled_service
    service in content["resource_registry"]):
TypeError: argument of type 'NoneType' is not iterable
argument of type 'NoneType' is not iterable

While we could say a user shouldn't pass an empty resource_registry it would also be nice if we could handle it better. Basically if the resource_registry is empty in an env file, just ignore it.

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

Fix proposed to branch: master
Review: https://review.opendev.org/666895

Changed in tripleo:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-tripleoclient (master)

Reviewed: https://review.opendev.org/666895
Committed: https://git.openstack.org/cgit/openstack/python-tripleoclient/commit/?id=96d39dc106ceacb52977d751dc1ef7dc70490070
Submitter: Zuul
Branch: master

commit 96d39dc106ceacb52977d751dc1ef7dc70490070
Author: John Fulton <email address hidden>
Date: Fri Jun 21 13:30:17 2019 -0400

    Improve handling of empty resource_registry

    It's possible that content["resource_registry"] might
    not exist or be iterable so wrap the reference to it
    with a try/except for a KeyError or TypeError and continue
    the deployment without the empty resource_registry instead
    of failing.

    Change-Id: Ic7d88382a0ff15c24800f12ddbf69f13d6804b28
    Closes-Bug: #1833743

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-tripleoclient 12.1.0

This issue was fixed in the openstack/python-tripleoclient 12.1.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-tripleoclient (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/692387

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-tripleoclient (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/692388

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-tripleoclient (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.opendev.org/692430

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-tripleoclient (stable/stein)

Reviewed: https://review.opendev.org/692387
Committed: https://git.openstack.org/cgit/openstack/python-tripleoclient/commit/?id=7cdbcf6e640ed47b8fefcaa66b3420f6d70893c3
Submitter: Zuul
Branch: stable/stein

commit 7cdbcf6e640ed47b8fefcaa66b3420f6d70893c3
Author: John Fulton <email address hidden>
Date: Fri Jun 21 13:30:17 2019 -0400

    Improve handling of empty resource_registry

    It's possible that content["resource_registry"] might
    not exist or be iterable so wrap the reference to it
    with a try/except for a KeyError or TypeError and continue
    the deployment without the empty resource_registry instead
    of failing.

    Change-Id: Ic7d88382a0ff15c24800f12ddbf69f13d6804b28
    Closes-Bug: #1833743
    (cherry picked from commit 96d39dc106ceacb52977d751dc1ef7dc70490070)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-tripleoclient (stable/rocky)

Reviewed: https://review.opendev.org/692388
Committed: https://git.openstack.org/cgit/openstack/python-tripleoclient/commit/?id=7ff0aeb40b7a167c0998e6b376bccb1bf14bf391
Submitter: Zuul
Branch: stable/rocky

commit 7ff0aeb40b7a167c0998e6b376bccb1bf14bf391
Author: John Fulton <email address hidden>
Date: Fri Jun 21 13:30:17 2019 -0400

    Improve handling of empty resource_registry

    It's possible that content["resource_registry"] might
    not exist or be iterable so wrap the reference to it
    with a try/except for a KeyError or TypeError and continue
    the deployment without the empty resource_registry instead
    of failing.

    Change-Id: Ic7d88382a0ff15c24800f12ddbf69f13d6804b28
    Closes-Bug: #1833743
    (cherry picked from commit 96d39dc106ceacb52977d751dc1ef7dc70490070)

tags: added: in-stable-rocky
tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-tripleoclient (stable/queens)

Reviewed: https://review.opendev.org/692430
Committed: https://git.openstack.org/cgit/openstack/python-tripleoclient/commit/?id=dfabb0669f80ecbdaa23bbf4fe98ff23f587d711
Submitter: Zuul
Branch: stable/queens

commit dfabb0669f80ecbdaa23bbf4fe98ff23f587d711
Author: Alex Schultz <email address hidden>
Date: Thu Oct 31 12:54:59 2019 -0600

    Improve handling of empty resource_registry

    It's possible that content["resource_registry"] might
    not exist or be iterable so wrap the reference to it
    with a try/except for a KeyError or TypeError and continue
    the deployment without the empty resource_registry instead
    of failing.

    Change-Id: Ic7d88382a0ff15c24800f12ddbf69f13d6804b28
    Closes-Bug: #1833743
    (cherry picked from commit 96d39dc106ceacb52977d751dc1ef7dc70490070)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-tripleoclient 11.5.2

This issue was fixed in the openstack/python-tripleoclient 11.5.2 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-tripleoclient rocky-eol

This issue was fixed in the openstack/python-tripleoclient rocky-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-tripleoclient queens-eol

This issue was fixed in the openstack/python-tripleoclient queens-eol 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.