Bug 1952017 - [OSP16.1] UseTLSTransportForNbd check can fail with TypeError: 'NoneType' object is not subscriptable
Summary: [OSP16.1] UseTLSTransportForNbd check can fail with TypeError: 'NoneType' obj...
Keywords:
Status: ON_QA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: python-tripleoclient
Version: 16.1 (Train)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: z7
: 16.1 (Train on RHEL 8.2)
Assignee: David Vallee Delisle
QA Contact: David Rosenfeld
URL:
Whiteboard:
Depends On:
Blocks: 1953425
TreeView+ depends on / blocked
 
Reported: 2021-04-21 10:55 UTC by Ollie Walsh
Modified: 2021-10-21 19:36 UTC (History)
9 users (show)

Fixed In Version: python-tripleoclient-12.3.2-1.20210503153259.ae58329.el8ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1953425 (view as bug list)
Environment:
Last Closed:
Target Upstream Version: Train


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 787363 0 None MERGED [train-only] Trap empty role data 2021-04-26 05:47:58 UTC

Description Ollie Walsh 2021-04-21 10:55:41 UTC
If the initial deployment fails in heat the next run fails with:

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 185, in run
    return_code = self.take_action(parsed_args) or 0
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py", line 1022, in take_action
    self._update_parameters(parsed_args, stack)
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py", line 123, in _update_parameters                                                                                                     
    if nbd_tls_key in roledata[key]['config_settings']:
TypeError: 'NoneType' object is not subscriptable
'NoneType' object is not subscriptable

Deleting the stack and redeploying works.

Comment 2 Jeffrey Terrill 2021-05-20 17:47:47 UTC
(In reply to Ollie Walsh from comment #0)
> If the initial deployment fails in heat the next run fails with:
> 
> 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 185, in run
>     return_code = self.take_action(parsed_args) or 0
>   File
> "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py",
> line 1022, in take_action
>     self._update_parameters(parsed_args, stack)
>   File
> "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py",
> line 123, in _update_parameters                                             
> 
>     if nbd_tls_key in roledata[key]['config_settings']:
> TypeError: 'NoneType' object is not subscriptable
> 'NoneType' object is not subscriptable
> 
> Deleting the stack and redeploying works.

I hit this bug in a recent deployment but deleting the stack ("openstack stack delete" on director) and redeploying resulted in the same error.

Comment 3 Ollie Walsh 2021-05-20 20:44:57 UTC
(In reply to Jeffrey Terrill from comment #2)
> (In reply to Ollie Walsh from comment #0)
> > If the initial deployment fails in heat the next run fails with:
> > 
> > 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 185, in run
> >     return_code = self.take_action(parsed_args) or 0
> >   File
> > "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py",
> > line 1022, in take_action
> >     self._update_parameters(parsed_args, stack)
> >   File
> > "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py",
> > line 123, in _update_parameters                                             
> > 
> >     if nbd_tls_key in roledata[key]['config_settings']:
> > TypeError: 'NoneType' object is not subscriptable
> > 'NoneType' object is not subscriptable
> > 
> > Deleting the stack and redeploying works.
> 
> I hit this bug in a recent deployment but deleting the stack ("openstack
> stack delete" on director) and redeploying resulted in the same error.

I meant deleting the overcloud works ("openstack overcloud delete overcloud")

Comment 4 Ollie Walsh 2021-05-20 20:52:24 UTC
(In reply to Ollie Walsh from comment #3)
> (In reply to Jeffrey Terrill from comment #2)
> > (In reply to Ollie Walsh from comment #0)
> > > If the initial deployment fails in heat the next run fails with:
> > > 
> > > 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 185, in run
> > >     return_code = self.take_action(parsed_args) or 0
> > >   File
> > > "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py",
> > > line 1022, in take_action
> > >     self._update_parameters(parsed_args, stack)
> > >   File
> > > "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py",
> > > line 123, in _update_parameters                                             
> > > 
> > >     if nbd_tls_key in roledata[key]['config_settings']:
> > > TypeError: 'NoneType' object is not subscriptable
> > > 'NoneType' object is not subscriptable
> > > 
> > > Deleting the stack and redeploying works.
> > 
> > I hit this bug in a recent deployment but deleting the stack ("openstack
> > stack delete" on director) and redeploying resulted in the same error.
> 
> I meant deleting the overcloud works ("openstack overcloud delete overcloud")

Although deleting the heat stack should be sufficient.

When you you hit this bug did you compare the traceback? It's only the same bug if the it failed at /usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py line 123.

Comment 5 Jeffrey Terrill 2021-05-24 19:11:20 UTC
Re-tried today and this was the traceback:

    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 185, in run
        return_code = self.take_action(parsed_args) or 0
      File "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py", line 1022, in take_action
        self._update_parameters(parsed_args, stack)
      File "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py", line 123, in _update_parameters
        if nbd_tls_key in roledata[key]['config_settings']:
    TypeError: 'NoneType' object is not subscriptable
    'NoneType' object is not subscriptable
    END return value: 1

Comment 6 Ollie Walsh 2021-05-24 20:41:20 UTC
What exactly did you do to reproduce this?

If the overcloud stack does not exist then that code block should not be reachable:

 103         if stack_is_new:
 104             new_stack_args = (
 105                 ('NovaComputeLibvirtType', 'libvirt_type'),
 106             )
 107             param_args = param_args + new_stack_args
 108         else:
 109             globalcfg = utils.get_stack_output_item(stack, 'GlobalConfig')
 110 
 111             # verif if tls was enabled in previous deploy run
 112             if globalcfg and 'use_tls_for_nbd' in globalcfg:
 113                 nbd_tls = globalcfg['use_tls_for_nbd']
 114                 self.log.debug("use_tls_for_nbd=%s" % nbd_tls)
 115                 parameters['UseTLSTransportForNbd'] = nbd_tls
 116             else:
 117                 # in case of an update use_tls_for_nbd global config key
 118                 # won't exist, check the nbd_tls hiera key from the roledata.
 119                 roledata = utils.get_stack_output_item(stack, 'RoleData')
 120                 if roledata:
 121                     nbd_tls_key = 'nova::compute::libvirt::qemu::nbd_tls'
 122                     for key in roledata:
 123                         if nbd_tls_key in roledata[key]['config_settings']:

Comment 7 Jeffrey Terrill 2021-05-25 14:01:19 UTC
Deleted the overcloud stack:

(undercloud) [stack@c0-stage-director ~]$ openstack overcloud delete c0-stage
Are you sure you want to delete this overcloud [y/N]? y
Undeploying stack c0-stage...
/usr/lib/python3.6/site-packages/websocket/_http.py:161: ResourceWarning: unclosed <socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 51230)>
  sock = socket.socket(family, socktype, proto)
Waiting for messages on queue 'tripleo' with no timeout.

Deleting plan c0-stage...
/usr/lib/python3.6/site-packages/websocket/_http.py:161: ResourceWarning: unclosed <socket.socket fd=7, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 54050)>
  sock = socket.socket(family, socktype, proto)
Success.




Then re-ran the overcloud deployment:

    START with options: overcloud deploy --stack c0-stage --timeout 100 --deployed-server --disable-validations --overcloud-ssh-user stack --overcloud-ssh-key ~/.ssh/id_rsa --verbose --answers-file answers.yaml -n
 network_data.yaml -r roles_data.yaml --stack-only
    command: overcloud deploy -> tripleoclient.v1.overcloud_deploy.DeployOvercloud (auth=True)
    Using auth plugin: password
    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 185, in run
        return_code = self.take_action(parsed_args) or 0
      File "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py", line 1022, in take_action
        self._update_parameters(parsed_args, stack)
      File "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_deploy.py", line 123, in _update_parameters
        if nbd_tls_key in roledata[key]['config_settings']:
    TypeError: 'NoneType' object is not subscriptable
    'NoneType' object is not subscriptable


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