Bug 2071765

Summary: osc.bash_completion ends with garbage
Product: Red Hat OpenStack Reporter: François Rigault <frigo>
Component: python-tripleoclientAssignee: Rabi Mishra <ramishra>
Status: CLOSED ERRATA QA Contact: David Rosenfeld <drosenfe>
Severity: low Docs Contact:
Priority: low    
Version: 16.2 (Train)CC: apevec, astupnik, erpeters, hbrock, jpichon, jpretori, jschluet, jslagle, jveiraca, lhh, mburns, ramishra, rbruzzon, riramos, shtiwari, tarcher, tkajinam
Target Milestone: z4Keywords: Triaged
Target Release: 16.2 (Train on RHEL 8.4)Flags: frigo: needinfo-
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-tripleoclient-12.6.1-2.20220725105244.8cc1d6d.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-07 19:22:17 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 François Rigault 2022-04-04 18:18:00 UTC
Description of problem:
upgraded my OSP 16.2 stack
now each time I ssh to the director I get:
-bash: 2022-04-04: command not found

Version-Release number of selected component (if applicable):
python3-openstackclient-4.0.2-2.20220111042153.54bf2c0.el8ost.noarch

How reproducible:
all the time

Steps to Reproduce:
1. sudo dnf reinstall python3-openstackclient4.0.2-2.20220111042153.54bf2c0.el8ost.noarch
2. tail /etc/bash_completion.d/osc.bash_completion
3. see garbage

Actual results:
$ tail /etc/bash_completion.d/osc.bash_completion

  if [ -z "${completed}" ] ; then
    COMPREPLY=( $( compgen -f -- "$cur" ) $( compgen -d -- "$cur" ) )
  else
    COMPREPLY=( $(compgen -W "${completed}" -- ${cur}) )
  fi
  return 0
}
complete -F _openstack openstack
2022-04-04 20:08:04.813 645220 INFO osc_lib.shell [-] END return value: 0


Expected results:
/etc/bash_completion.d/osc.bash_completion should not contain garbage

Additional info:
package spec reads: 

%post -n python%{pyver}-%{sname}
mkdir -p /etc/bash_completion.d
openstack complete | sed -n '/_openstack/,$p' > /etc/bash_completion.d/osc.bash_completion



however I read
$ openstack complete 2>/dev/null | tail

  if [ -z "${completed}" ] ; then
    COMPREPLY=( $( compgen -f -- "$cur" ) $( compgen -d -- "$cur" ) )
  else
    COMPREPLY=( $(compgen -W "${completed}" -- ${cur}) )
  fi
  return 0
}
complete -F _openstack openstack
2022-04-04 20:17:22.149 666022 INFO osc_lib.shell [-] END return value: 0

there is one line there to remove.

Comment 1 Rabi Mishra 2022-04-05 04:58:17 UTC
I don't see that with a fresh installation with same openstackclient version. May be it's left behind for you from before?


[stack@undercloud-0 ~]$ rpm -qa | grep python3-openstackclient
python3-openstackclient-4.0.2-2.20220111042153.54bf2c0.el8ost.noarch
[stack@undercloud-0 ~]$ tail /etc/bash_completion.d/osc.bash_completion
  done

  if [ -z "${completed}" ] ; then
    COMPREPLY=( $( compgen -f -- "$cur" ) $( compgen -d -- "$cur" ) )
  else
    COMPREPLY=( $(compgen -W "${completed}" -- ${cur}) )
  fi
  return 0
}
complete -F _openstack openstack

Comment 2 François Rigault 2022-04-05 15:29:41 UTC
Sorry I missed your comment
hmmm I have different stacks,and they all have this issue (running "openstack complete" always end with an INFO log). Going to check if I can track what is adding the log. Maybe I have "INFO" logs coming from somewhere

Comment 3 François Rigault 2022-04-05 16:28:34 UTC
so it comes from tripleoclient (python3-tripleoclient-12.6.1-2.20220114104841.el8ost.noarch) it seems.
under /usr/lib/python3.6/site-packages/tripleoclient/v1 there are a couple of files setting the logging, like overcloud_external_update.py:

    CONF = cfg.CONF
    logging.register_options(CONF)
    logging.setup(CONF, '')

commenting these 3 lines in files:

 overcloud_update.py
 overcloud_upgrade.py
 overcloud_admin.py
 overcloud_external_update.py
 overcloud_external_upgrade.py
 tripleo_upgrade.py

removes the INFO message.

Could you check if you reproduce after installing python3-tripleoclient? Thanks

Comment 4 François Rigault 2022-04-09 07:47:34 UTC
so this is the sequence that breaks it:

1- install python3-openstackclient
2- install python3-tripleoclient
3- reinstall or update python3-openstackclient

Comment 5 Rabi Mishra 2022-04-19 09:23:26 UTC
OK, I suspect

Comment 6 Rabi Mishra 2022-04-25 13:21:55 UTC
*** Bug 2076667 has been marked as a duplicate of this bug. ***

Comment 21 errata-xmlrpc 2022-12-07 19:22:17 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 (Release of components for Red Hat OpenStack Platform 16.2.4), 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-2022:8794