Bug 1766843

Summary: Empty resource_registry breaks updates and deployments
Product: Red Hat OpenStack Reporter: ldenny
Component: python-tripleoclientAssignee: Alex Schultz <aschultz>
Status: CLOSED ERRATA QA Contact: Sasha Smolyak <ssmolyak>
Severity: medium Docs Contact:
Priority: medium    
Version: 13.0 (Queens)CC: akaris, aschultz, bshephar, hbrock, jbuchta, jslagle, mburns
Target Milestone: ---Keywords: Triaged, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: python-tripleoclient-9.3.1-5.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-10 11:22:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description ldenny 2019-10-30 04:37:31 UTC
Description of problem:
When an environment file with an empty resource_registry section is passed to the overcloud deploy command it errors during check_file_for_enabled_service function and returns a trace back


Version-Release number of selected component (if applicable): 
python-tripleoclient-9.2.7-11


How reproducible: 
Every time, easily.


Steps to Reproduce:
1.Create an environment file with the following content:
[stack@undercloud-0 ~]$ cat network-extras.yaml
# ---------------------------------------------------------------------------
# Custom network extras script
# ---------------------------------------------------------------------------
resource_registry:
     # OS::TripleO::NodeExtraConfigPost: extraconfig/post_deploy/default.yaml

2.Include the file in the deploy command with -e

3.Run the overcloud deploy command

Actual results:
2019-10-28 20:59:02.431 18217 ERROR osc_lib.shell [  admin] Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/osc_lib/shell.py", line 134, in run
    ret_val = super(OpenStackShell, self).run(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 279, in run
    result = self.run_subcommand(remainder)
  File "/usr/lib/python2.7/site-packages/osc_lib/shell.py", line 169, in run_subcommand
    ret_value = super(OpenStackShell, self).run_subcommand(argv)
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 400, in run_subcommand
    result = cmd.run(parsed_args)
  File "/usr/lib/python2.7/site-packages/tripleoclient/command.py", line 25, in run
    super(Command, self).run(parsed_args)
  File "/usr/lib/python2.7/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python2.7/site-packages/cliff/command.py", line 184, in run
    return_code = self.take_action(parsed_args) or 0
  File "/usr/lib/python2.7/site-packages/tripleoclient/v1/overcloud_update.py", line 77, in take_action
    parsed_args.environment_files)
  File "/usr/lib/python2.7/site-packages/tripleoclient/utils.py", line 1059, in check_deprecated_service_is_enabled
    check_file_for_enabled_service(env_file)
  File "/usr/lib/python2.7/site-packages/tripleoclient/utils.py", line 1042, in check_file_for_enabled_service
    service in content["resource_registry"]):
TypeError: argument of type 'NoneType' is not iterable


Expected results:
If we can't handle files like this then we should return an error rather then a trace back. Something like "The following environment file has an empty resource_registry section: %s"

Additional info:

Comment 2 Alex Schultz 2019-10-31 14:47:14 UTC
This was fixed in train. https://review.opendev.org/#/c/666895/ We can backport it when we have time.

Comment 3 Brendan Shephard 2019-11-04 21:28:52 UTC
(In reply to Alex Schultz from comment #2)
> This was fixed in train. https://review.opendev.org/#/c/666895/ We can
> backport it when we have time.

Thanks Alex. We'll look into it for you and submit some changes for review.

Comment 4 Brendan Shephard 2019-11-05 00:24:22 UTC
Looks like you already did it actually: https://review.opendev.org/#/c/692430/

Nice. Thanks, greatly appreciated.

Comment 7 errata-xmlrpc 2020-03-10 11:22:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:0760