Bug 1458824

Summary: "openstack complete" no longer returns bash completion functions
Product: Red Hat OpenStack Reporter: Chris Janiszewski <cjanisze>
Component: python-openstackclientAssignee: Julie Pichon <jpichon>
Status: CLOSED EOL QA Contact: Shai Revivo <srevivo>
Severity: medium Docs Contact:
Priority: medium    
Version: 11.0 (Ocata)CC: apevec, beth.white, cjanisze, lhh, srevivo
Target Milestone: ---Keywords: Triaged, ZStream
Target Release: 11.0 (Ocata)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-22 12:32:20 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 Chris Janiszewski 2017-06-05 14:43:56 UTC
Description of problem:
"openstack complete" no longer returns bash completion functions in RH OSP11. It still works on OSP10

Version-Release number of selected component (if applicable):
OSP11

How reproducible:
Every time



Steps to Reproduce:
1. Log on to undercloud as stack
2. source stackrc
3. openstack complete

Actual results:
[stack@undercloud ~]$ openstack complete
'endpoint'


Expected results:
[stack@chrisj-undercloud ~]$ openstack complete
_openstack()
{
  local cur prev words
  COMPREPLY=()
  _get_comp_words_by_ref -n : cur prev words

  # Command data:
  cmds='acl action address aggregate alarm alarm-history alarming availability backup baremetal ca catalog category claim class-schema command complete compute configuration console container cron dataprocessing deployment dns ec2 endpoint environment extension flavor floating help host hypervisor image ip keypair limits messaging metric module network object orchestration overcloud package pool port project ptr queue quota recordset resource role router secret security server service snapshot software stack static-action subnet subscription task tld token undercloud usage user volume workbook workflow zone'
  cmds_acl='delete get submit user'
  cmds_acl_delete='-h --help'
  cmds_acl_get='-h --help -f --format -c --column --max-width --noindent --quote'
  cmds_acl_submit='-h --help -f --format -c --column --max-width --noindent --quote --user -u --project-access --no-project-access --operation-type -o'
  cmds_acl_user='add remove'
  cmds_acl_user_add='-h --help -f --format -c --column --max-width --noindent --quote --user -u --project-access --no-project-access --operation-type -o'
  cmds_acl_user_remove='-h --help -f --format -c --column --max-width --noindent --quote --user -u --project-access --no-project-access --operation-type -o'
  cmds_action='definition execution'
......
and the rest of it

Additional info:

Comment 3 Julie Pichon 2018-01-25 16:00:44 UTC
From what I can tell, this is resolved. It works in an OSP12 environment, and popping up an OSP11 VM it looks to be fine there as well:

$ openstack complete
_openstack()
{
  local cur prev words
  COMPREPLY=()
  _get_comp_words_by_ref -n : cur prev words

  # Command data:
  cmds='access acl action address aggregate alarm alarm-history alarming availability backup bgpvpn ca catalog command complete compute configuration consistency console consumer container credential cron database dataprocessing dns domain [...]

I tried with both Keystone v2.0 and v3 in case it's somehow related, but no differences it worked in both cases.

These are the package versions on the system:
python-openstackclient-3.8.1-1.el7ost.noarch
python-cliff-2.4.0-1.el7ost.noarch
python-cmd2-0.6.8-8.el7ost.noarch

Based on this, could you confirm if this is still a problem for you? If so, could you include the following information?

1. Package versions for the 3 rpms mentioned above
2. Full output/stack trace when running the command with --debug ($ openstack --debug complete)

Thank you.

Comment 4 Chris Janiszewski 2018-02-05 15:03:56 UTC
I have noticed it is working on OSP12. Unfortunately it still seems to be broken for me on OSP11 with latest GA RPMs.

[stack@osp11-undercloud ~]$ rpm -qa | grep python-openstackclient
python-openstackclient-3.8.1-1.el7ost.noarch
[stack@osp11-undercloud ~]$ rpm -qa | grep python-cliff
python-cliff-2.4.0-1.el7ost.noarch
[stack@osp11-undercloud ~]$ rpm -qa | grep python-cmd2
python-cmd2-0.6.8-8.el7ost.noarch
[stack@osp11-undercloud ~]$ openstack --debug complete 
START with options: [u'--debug', u'complete']
options: Namespace(access_key='', access_secret='***', access_token='***', access_token_endpoint='', access_token_type='', aodh_endpoint='', auth_type='password', auth_url='https://172.31.8.10:13000/v2.0', cacert=None, cert='', client_id='', client_secret='***', cloud='', code='', consumer_key='', consumer_secret='***', debug=True, default_domain='default', default_domain_id='', default_domain_name='', deferred_help=False, discovery_endpoint='', domain_id='', domain_name='', endpoint='', glare_url='', identity_provider='', identity_provider_url='', insecure=None, inspector_api_version='1', inspector_url=None, interface='', key='', log_file=None, murano_packages_service='murano', murano_url='', old_profile=None, openid_scope='', os_alarming_api_version='2', os_application_catalog_api_version='1', os_baremetal_api_version='1.15', os_beta_command=False, os_compute_api_version='', os_container_infra_api_version='1', os_data_processing_api_version='1.1', os_data_processing_url='', os_database_api_version='1', os_dns_api_version='2', os_identity_api_version='', os_image_api_version='', os_key_manager_api_version='1', os_metrics_api_version='1', os_network_api_version='', os_object_api_version='', os_orchestration_api_version='1', os_project_id=None, os_project_name=None, os_queues_api_version='2', os_tripleoclient_api_version='1', os_volume_api_version='', os_workflow_api_version='2', passcode='', password='***', profile=None, project_domain_id='', project_domain_name='', project_id='', project_name='admin', protocol='', redirect_uri='', region_name='', roles='', timing=False, token='***', trust_id='', url='', user='', user_domain_id='', user_domain_name='', user_id='', username='admin', verbose_level=3, verify=None)
Auth plugin password selected
auth_config_hook(): {'auth_type': 'password', 'beta_command': False, 'tripleoclient_api_version': '1', u'compute_api_version': u'2', 'key': None, u'database_api_version': '1', 'metrics_api_version': '1', 'data_processing_api_version': '1.1', 'inspector_api_version': '1', 'auth_url': 'https://172.31.8.10:13000/v2.0', u'network_api_version': u'2', u'message': u'', u'image_format': u'qcow2', 'networks': [], u'image_api_version': u'2', 'verify': True, u'dns_api_version': '2', u'object_store_api_version': u'1', 'username': 'admin', u'container_infra_api_version': '1', 'verbose_level': 3, 'region_name': '', 'api_timeout': None, u'baremetal_api_version': '1.15', 'queues_api_version': '2', 'auth': {'project_name': 'admin'}, 'default_domain': 'default', u'container_api_version': u'1', u'image_api_use_tasks': False, u'floating_ip_source': u'neutron', u'orchestration_api_version': '1', 'timing': False, 'password': '***', u'application_catalog_api_version': '1', 'murano_packages_service': 'murano', 'cacert': None, u'key_manager_api_version': '1', u'metering_api_version': u'2', 'deferred_help': False, u'identity_api_version': u'2.0', 'workflow_api_version': '2', u'volume_api_version': u'2', 'cert': None, u'secgroup_source': u'neutron', u'status': u'active', 'alarming_api_version': '2', 'debug': True, u'interface': None, u'disable_vendor_agent': {}}
defaults: {u'auth_type': 'password', u'status': u'active', u'compute_api_version': u'2', 'key': None, u'database_api_version': u'1.0', 'api_timeout': None, u'baremetal_api_version': u'1', u'image_api_version': u'2', u'container_infra_api_version': u'1', u'metering_api_version': u'2', u'image_api_use_tasks': False, u'floating_ip_source': u'neutron', u'orchestration_api_version': u'1', 'cacert': None, u'network_api_version': u'2', u'message': u'', u'image_format': u'qcow2', u'application_catalog_api_version': u'1', u'key_manager_api_version': u'v1', 'verify': True, u'identity_api_version': u'2.0', u'volume_api_version': u'2', 'cert': None, u'secgroup_source': u'neutron', u'container_api_version': u'1', u'dns_api_version': u'2', u'object_store_api_version': u'1', u'interface': None, u'disable_vendor_agent': {}}
cloud cfg: {'auth_type': 'password', 'beta_command': False, 'tripleoclient_api_version': '1', u'compute_api_version': u'2', 'key': None, u'database_api_version': '1', 'metrics_api_version': '1', 'data_processing_api_version': '1.1', 'inspector_api_version': '1', 'auth_url': 'https://172.31.8.10:13000/v2.0', u'network_api_version': u'2', u'message': u'', u'image_format': u'qcow2', 'networks': [], u'image_api_version': u'2', 'verify': True, u'dns_api_version': '2', u'object_store_api_version': u'1', 'username': 'admin', u'container_infra_api_version': '1', 'verbose_level': 3, 'region_name': '', 'api_timeout': None, u'baremetal_api_version': '1.15', 'queues_api_version': '2', 'auth': {'project_name': 'admin'}, 'default_domain': 'default', u'container_api_version': u'1', u'image_api_use_tasks': False, u'floating_ip_source': u'neutron', u'orchestration_api_version': '1', 'timing': False, 'password': '***', u'application_catalog_api_version': '1', 'murano_packages_service': 'murano', 'cacert': None, u'key_manager_api_version': '1', u'metering_api_version': u'2', 'deferred_help': False, u'identity_api_version': u'2.0', 'workflow_api_version': '2', u'volume_api_version': u'2', 'cert': None, u'secgroup_source': u'neutron', u'status': u'active', 'alarming_api_version': '2', 'debug': True, u'interface': None, u'disable_vendor_agent': {}}
compute API version 2, cmd group openstack.compute.v2
network API version 2, cmd group openstack.network.v2
image API version 2, cmd group openstack.image.v2
volume API version 2, cmd group openstack.volume.v2
identity API version 2.0, cmd group openstack.identity.v2
object_store API version 1, cmd group openstack.object_store.v1
orchestration API version 1, cmd group openstack.orchestration.v1
messaging API version 2, cmd group openstack.messaging.v2
alarming API version 2, cmd group openstack.alarming.v2
metric API version 1, cmd group openstack.metric.v1
dns API version 2, cmd group openstack.dns.v2
key_manager API version 1, cmd group openstack.key_manager.v1
container_infra API version 1, cmd group openstack.container_infra.v1
baremetal API version 1.15, cmd group openstack.baremetal.v1
baremetal_introspection API version 1, cmd group openstack.baremetal_introspection.v1
database API version 1, cmd group openstack.database.v1
application_catalog API version 1, cmd group openstack.application_catalog.v1
data_processing API version 1.1, cmd group openstack.data_processing.v1
neutronclient API version 2, cmd group openstack.neutronclient.v2
workflow_engine API version 2, cmd group openstack.workflow_engine.v2
tripleoclient API version 1, cmd group openstack.tripleoclient.v1
Auth plugin password selected
auth_config_hook(): {'auth_type': 'password', 'beta_command': False, 'tripleoclient_api_version': '1', u'compute_api_version': u'2', 'key': None, u'database_api_version': '1', 'metrics_api_version': '1', 'data_processing_api_version': '1.1', 'inspector_api_version': '1', 'auth_url': 'https://172.31.8.10:13000/v2.0', u'network_api_version': u'2', u'message': u'', u'image_format': u'qcow2', 'networks': [], u'image_api_version': u'2', 'verify': True, u'dns_api_version': '2', u'object_store_api_version': u'1', 'username': 'admin', u'container_infra_api_version': '1', 'verbose_level': 3, 'region_name': '', 'api_timeout': None, u'baremetal_api_version': '1.15', 'queues_api_version': '2', 'auth': {'project_name': 'admin'}, 'default_domain': 'default', u'container_api_version': u'1', u'image_api_use_tasks': False, u'floating_ip_source': u'neutron', u'orchestration_api_version': '1', 'timing': False, 'password': '***', u'application_catalog_api_version': '1', 'murano_packages_service': 'murano', 'cacert': None, u'key_manager_api_version': '1', u'metering_api_version': u'2', 'deferred_help': False, u'identity_api_version': u'2.0', 'workflow_api_version': '2', u'volume_api_version': u'2', 'cert': None, u'secgroup_source': u'neutron', u'status': u'active', 'alarming_api_version': '2', 'debug': True, u'interface': None, u'disable_vendor_agent': {}}
Auth plugin password selected
auth_config_hook(): {'auth_type': 'password', 'beta_command': False, 'tripleoclient_api_version': '1', u'compute_api_version': u'2', 'key': None, u'database_api_version': '1', 'metrics_api_version': '1', 'data_processing_api_version': '1.1', 'inspector_api_version': '1', 'auth_url': 'https://172.31.8.10:13000/v2.0', u'network_api_version': u'2', u'message': u'', u'image_format': u'qcow2', 'networks': [], u'image_api_version': u'2', 'verify': True, u'dns_api_version': '2', u'object_store_api_version': u'1', 'username': 'admin', u'container_infra_api_version': '1', 'verbose_level': 3, 'region_name': '', 'api_timeout': None, u'baremetal_api_version': '1.15', 'queues_api_version': '2', 'auth': {'url': 'x', 'token': '***', 'project_name': 'admin'}, 'default_domain': 'default', u'container_api_version': u'1', u'image_api_use_tasks': False, u'floating_ip_source': u'neutron', u'orchestration_api_version': '1', 'timing': False, 'password': '***', u'application_catalog_api_version': '1', 'murano_packages_service': 'murano', 'cacert': None, u'key_manager_api_version': '1', u'metering_api_version': u'2', 'deferred_help': False, u'identity_api_version': u'2.0', 'workflow_api_version': '2', u'volume_api_version': u'2', 'cert': None, u'secgroup_source': u'neutron', u'status': u'active', 'alarming_api_version': '2', 'debug': True, u'interface': None, u'disable_vendor_agent': {}}
Deferring keystone exception: __init__() got an unexpected keyword argument 'url'
command: None -> cliff.complete.CompleteCommand
Auth plugin password selected
auth_config_hook(): {'auth_type': 'password', 'beta_command': False, 'tripleoclient_api_version': '1', u'compute_api_version': u'2', 'key': None, u'database_api_version': '1', 'metrics_api_version': '1', 'data_processing_api_version': '1.1', 'inspector_api_version': '1', 'auth_url': 'https://172.31.8.10:13000/v2.0', u'network_api_version': u'2', u'message': u'', u'image_format': u'qcow2', 'networks': [], u'image_api_version': u'2', 'verify': True, u'dns_api_version': '2', u'object_store_api_version': u'1', 'username': 'admin', u'container_infra_api_version': '1', 'verbose_level': 3, 'region_name': '', 'api_timeout': None, u'baremetal_api_version': '1.15', 'queues_api_version': '2', 'auth': {'url': 'x', 'token': '***', 'project_name': 'admin'}, 'default_domain': 'default', u'container_api_version': u'1', u'image_api_use_tasks': False, u'floating_ip_source': u'neutron', u'orchestration_api_version': '1', 'timing': False, 'password': '***', u'application_catalog_api_version': '1', 'murano_packages_service': 'murano', 'cacert': None, u'key_manager_api_version': '1', u'metering_api_version': u'2', 'deferred_help': False, u'identity_api_version': u'2.0', 'workflow_api_version': '2', u'volume_api_version': u'2', 'cert': None, u'secgroup_source': u'neutron', u'status': u'active', 'alarming_api_version': '2', 'debug': True, u'interface': None, u'disable_vendor_agent': {}}
Deferring keystone exception: __init__() got an unexpected keyword argument 'url'
get_parser(openstack ip floating list)
common parser: ArgumentParser(prog='openstack ip floating list', usage=None, description=u'List floating IP(s)', version=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)
__init__() got an unexpected keyword argument 'url'
Traceback (most recent call last):
  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/cliff/command.py", line 90, in run
    return self.take_action(parsed_args) or 0
  File "/usr/lib/python2.7/site-packages/cliff/complete.py", line 217, in take_action
    dicto.add_command(command, self.get_actions(command))
  File "/usr/lib/python2.7/site-packages/cliff/complete.py", line 201, in get_actions
    cmd_parser = cmd.get_parser(full_name)
  File "/usr/lib/python2.7/site-packages/openstackclient/network/common.py", line 146, in get_parser
    if self.app.client_manager.is_network_endpoint_enabled():
  File "/usr/lib/python2.7/site-packages/openstackclient/common/clientmanager.py", line 90, in is_network_endpoint_enabled
    return self.is_service_available('network') is not False
  File "/usr/lib/python2.7/site-packages/osc_lib/clientmanager.py", line 222, in is_service_available
    if self.auth_ref:
  File "/usr/lib/python2.7/site-packages/osc_lib/clientmanager.py", line 213, in auth_ref
    self.setup_auth()
  File "/usr/lib/python2.7/site-packages/openstackclient/common/clientmanager.py", line 78, in setup_auth
    self._cli_options.config,
  File "/usr/lib/python2.7/site-packages/openstackclient/common/client_config.py", line 110, in load_auth_plugin
    auth_plugin = loader.load_from_options(**config['auth'])
  File "/usr/lib/python2.7/site-packages/keystoneauth1/loading/base.py", line 164, in load_from_options
    return self.create_plugin(**kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/loading/base.py", line 125, in create_plugin
    return self.plugin_class(**kwargs)
  File "/usr/lib/python2.7/site-packages/positional/__init__.py", line 101, in inner
    return wrapped(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/identity/generic/password.py", line 35, in __init__
    super(Password, self).__init__(auth_url=auth_url, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'url'
clean_up CompleteCommand: __init__() got an unexpected keyword argument 'url'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/osc_lib/shell.py", line 135, 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 180, 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/cliff/command.py", line 90, in run
    return self.take_action(parsed_args) or 0
  File "/usr/lib/python2.7/site-packages/cliff/complete.py", line 217, in take_action
    dicto.add_command(command, self.get_actions(command))
  File "/usr/lib/python2.7/site-packages/cliff/complete.py", line 201, in get_actions
    cmd_parser = cmd.get_parser(full_name)
  File "/usr/lib/python2.7/site-packages/openstackclient/network/common.py", line 146, in get_parser
    if self.app.client_manager.is_network_endpoint_enabled():
  File "/usr/lib/python2.7/site-packages/openstackclient/common/clientmanager.py", line 90, in is_network_endpoint_enabled
    return self.is_service_available('network') is not False
  File "/usr/lib/python2.7/site-packages/osc_lib/clientmanager.py", line 222, in is_service_available
    if self.auth_ref:
  File "/usr/lib/python2.7/site-packages/osc_lib/clientmanager.py", line 213, in auth_ref
    self.setup_auth()
  File "/usr/lib/python2.7/site-packages/openstackclient/common/clientmanager.py", line 78, in setup_auth
    self._cli_options.config,
  File "/usr/lib/python2.7/site-packages/openstackclient/common/client_config.py", line 110, in load_auth_plugin
    auth_plugin = loader.load_from_options(**config['auth'])
  File "/usr/lib/python2.7/site-packages/keystoneauth1/loading/base.py", line 164, in load_from_options
    return self.create_plugin(**kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/loading/base.py", line 125, in create_plugin
    return self.plugin_class(**kwargs)
  File "/usr/lib/python2.7/site-packages/positional/__init__.py", line 101, in inner
    return wrapped(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/keystoneauth1/identity/generic/password.py", line 35, in __init__
    super(Password, self).__init__(auth_url=auth_url, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'url'

END return value: 1

Comment 5 Julie Pichon 2018-02-05 16:55:40 UTC
Thanks for the reply and including version info and debug trace. The error now looks like a different one though:
- In comment 0: 'endpoint'
- In comment 4: TypeError: __init__() got an unexpected keyword argument 'url'

How was the environment set up or upgraded in order to use the latest OSP11 RPMs?
If it was updated, was every RPM updated or only the 3 I mentioned? I notice this is on an undercloud, was the update done using the "openstack undercloud upgrade" to avoid potential conflicts etc?

Is it possible some packages were installed or updated via pip? (If you're not sure I think you should be able to check by installing python-pip and attaching the output of "pip freeze").

In addition, could you also provide version info for python-osc-lib and python-keystoneauth1? (For reference, I have python-keystoneauth1-2.18.0-1.el7ost and python-keystoneauth1-2.18.0-1.el7ost on the VM set up with the latest OSP11 puddle).

I'll adjust the flags on the bug, since we've at least confirmed this also works for you in OSP10 and OSP12 and the problems appear limited to OSP11.

Comment 6 Julie Pichon 2018-02-05 17:00:31 UTC
Also, is this an issue only with "openstack complete" or with other "openstack" commands as well?

Comment 8 Chris Janiszewski 2018-02-05 18:02:42 UTC
- official RH repos (public facing) have been used for upgrade
- no pip installation
- upgrade was done with 'yum -y update'
- I followed up with openstack undercloud upgrade but no change in behavior
- all RPMs have been upgraded not just one mentioned
- other openstack commands still work fine as far as I can see.
- python-osc-lib-1.3.0-1.el7ost.noarch
- python-keystoneauth1-2.18.0-1.el7ost.noarch

Comment 9 Scott Lewis 2018-06-22 12:32:20 UTC
OSP11 is now retired, see details at https://access.redhat.com/errata/product/191/ver=11/rhel---7/x86_64/RHBA-2018:1828