Bug 1865900 - openstack overcloud delete fails on the inventory fetching from heat
Summary: openstack overcloud delete fails on the inventory fetching from heat
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-tripleoclient
Version: 16.1 (Train)
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: z4
: 16.1 (Train on RHEL 8.2)
Assignee: Dave Wilde
QA Contact: Jeremy Agee
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-04 13:31 UTC by Alex Schultz
Modified: 2021-02-08 11:58 UTC (History)
7 users (show)

Fixed In Version: python-tripleoclient-12.3.2-1.20200904073413.3d8e33f.el8ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-08 11:58:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
overcloud_delete_debug.log (25.51 KB, text/plain)
2020-08-04 13:31 UTC, Alex Schultz
no flags Details


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 746602 0 None MERGED [train-only] Add ipa config check to _cleanup_ipa 2021-02-09 21:22:27 UTC

Description Alex Schultz 2020-08-04 13:31:53 UTC
Created attachment 1710334 [details]
overcloud_delete_debug.log

Description of problem:
If a stack fails to create, the `openstack overcloud delete overcloud` command may fail while trying to generate the inventory.  

Failed to generate inventory: Unexpected error while running command.
Command: /usr/bin/tripleo-ansible-inventory --stack overcloud --ansible_ssh_user tripleo-admin --undercloud-connection ssh --undercloud-key-file /var/lib/mistral/.ssh/tripleo-admin-rsa --static-yaml-inventory /home/cloud-user/tripleo-ansible-inventory.yaml
Exit code: 1
Stdout: ''
Stderr: "Error creating static inventory: argument of type 'NoneType' is not iterable\n"
sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.24.2', 35076), raddr=('192.168.24.2', 13000)>


Version-Release number of selected component (if applicable):
$ rpm -qa | grep tripleo
openstack-tripleo-common-containers-11.3.3-0.20200611110656.f7715be.el8ost.noarch
openstack-tripleo-image-elements-10.6.2-0.20200528043425.7dc0fa1.el8ost.noarch
openstack-tripleo-validations-11.3.2-0.20200611115252.08f469d.el8ost.noarch
openstack-tripleo-heat-templates-11.3.2-0.20200616081530.396affd.el8ost.noarch
ansible-tripleo-ipa-0.2.1-0.20200611104546.c22fc8d.el8ost.noarch
ansible-tripleo-ipsec-9.2.1-0.20200311073016.0c8693c.el8ost.noarch
tripleo-ansible-0.5.1-0.20200611113656.34b8fcc.el8ost.noarch
python3-tripleoclient-heat-installer-12.3.2-0.20200615103427.6f877f6.el8ost.noarch
openstack-tripleo-puppet-elements-11.2.2-0.20200527003426.226ce95.el8ost.noarch
python3-tripleoclient-12.3.2-0.20200615103427.6f877f6.el8ost.noarch
puppet-tripleo-11.5.0-0.20200616033427.8ff1c6a.el8ost.noarch
python3-tripleo-common-11.3.3-0.20200611110656.f7715be.el8ost.noarch
openstack-tripleo-common-11.3.3-0.20200611110656.f7715be.el8ost.noarch
ansible-role-tripleo-modify-image-1.2.1-0.20200527233426.bc21900.el8ost.noarch

How reproducible:


Steps to Reproduce:
1. have an overcloud fail to create (state: DPELOYED_FAILED)
2. Attempt to delete the overcloud via `openstack overcloud delete overcloud`


Actual results:
Cannot use the overcloud delete command

Expected results:
Delete should still occur or the inventory generation should not be used.


Additional info:
You can workaround the delete by using:
- openstack stack delete overcloud
- openstack overcloud plan delete overcloud

Comment 1 Alex Schultz 2020-08-04 13:37:54 UTC
This looks like it fails while trying to cleanup the ipa stuff. In this case I don't even have IPA deployed. This should likely be an optional thing where we print a warning if this fails.

Comment 2 Alex Schultz 2020-08-04 13:44:23 UTC
`openstack overcloud delete -s overcloud` will skip this as well.

Comment 3 Lance Bragstad 2020-08-12 21:46:39 UTC
Based on the attached log [0], it looks like this fails because the inventory doesn't exist, but we call get_tripleo_ansible_inventory [1].

I think this is specific to train since we moved all that cleanup into a playbook in later releases [2].


[0] 
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/osc_lib/shell.py", line 136, in run 
    ret_val = super(OpenStackShell, self).run(argv)
  File "/usr/lib/python3.6/site-packages/cliff/app.py", line 281, in run 
    result = self.run_subcommand(remainder)
  File "/usr/lib/python3.6/site-packages/osc_lib/shell.py", line 176, in run_subcommand
    ret_value = super(OpenStackShell, self).run_subcommand(argv)
  File "/usr/lib/python3.6/site-packages/cliff/app.py", line 401, in run_subcommand
    result = cmd.run(parsed_args)
  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 185, in run 
    return_code = self.take_action(parsed_args) or 0
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_delete.py", line 165, in take_action
    self._cleanup_ipa(parsed_args.stack)
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_delete.py", line 113, in _cleanup_ipa
    return_inventory_file_path=True)
  File "/usr/lib/python3.6/site-packages/tripleoclient/utils.py", line 1128, in get_tripleo_ansible_inventory
    raise exceptions.InvalidConfiguration(message)
tripleoclient.exceptions.InvalidConfiguration: Failed to generate inventory: Unexpected error while running command.
Command: /usr/bin/tripleo-ansible-inventory --stack overcloud --ansible_ssh_user tripleo-admin --undercloud-connection ssh --undercloud-key-file /var/lib/mistral/.ssh/tripleo-admin-rsa --static-yaml-inventory /home/cloud-user/tripleo-ansible-inventory.yaml                                                                                              
Exit code: 1
Stdout: ''
Stderr: "Error creating static inventory: argument of type 'NoneType' is not iterable\n"

[1] https://opendev.org/openstack/python-tripleoclient/src/branch/stable/train/tripleoclient/v1/overcloud_delete.py#L112-L113
[2] https://opendev.org/openstack/python-tripleoclient/src/branch/master/tripleoclient/v2/overcloud_delete.py#L78

Comment 5 Dave Wilde 2020-08-17 20:58:58 UTC
I've proposed a patch for Train[1] that should eliminate the need to pass -s on non TLS-e environments.

[1]: https://review.opendev.org/#/c/746602/

Comment 13 Lon Hohberger 2021-02-08 11:58:03 UTC
According to our records, this should be resolved by python-tripleoclient-12.3.2-1.20200914164930.el8ost.  This build is available now.


Note You need to log in before you can comment on or make changes to this bug.