Bug 2076667

Summary: "-bash: 2022-04-08: command not found" on director after upgrade to 16.2.2
Product: Red Hat OpenStack Reporter: Riccardo Bruzzone <rbruzzon>
Component: openstack-tripleoAssignee: Sergii Golovatiuk <sgolovat>
Status: CLOSED DUPLICATE QA Contact: Jason Grosso <jgrosso>
Severity: low Docs Contact:
Priority: low    
Version: 16.2 (Train)CC: drosenfe, jlarriba, mburns, ramishra
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-25 13:21:55 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 Riccardo Bruzzone 2022-04-19 15:32:26 UTC
Description of problem:
- After upgrading to Red Hat OpenStack 16.2.2, the following message is observed every time an SSH login is opened to the undercloud (Director node):
    - bash: 2022-04-08: command not found

Version-Release number of selected component (if applicable):
- Red Hat OpenStack 16.2.2

How reproducible:
- The problem was observed / confirmed in all Customer environments (production and pro-production).

Steps to Reproduce:
- The problem was observed after performing a Red Hat OpenStack upgrade from 16.1.8 to 16.2.2.

-It can be also reproduced invoking the following sequence of commands [1]:
1.# ssh to the undercloud-0
2.# sudo bash
3.# cd /home/stack
4.# source stackrc
5.# openstack complete | tee /etc/bash_completion.d/osc.bash_completion > /dev/null
6.# the "command not found" can be observed every time a new ssh session or "sudo bash" command is invoked as below highlighted.

   [root@dell-r620-03 ~]# ssh stack@undercloud-0
   Last login: Tue Apr 19 10:48:55 2022 from 172.16.0.1
   -bash: 2022-04-19: command not found
   -bash: 2022-04-19: command not found

   [stack@undercloud-0 ~]$ sudo bash
   bash: 2022-04-19: command not found
   bash: 2022-04-19: command not found
   [root@undercloud-0 stack]#

Actual results:
- A comment has been added to the last row of the osc.bash_completion file as simple workaround:
  from:
   2022-04-08 16:15:22.155 752801 INFO osc_lib.shell [-] END return value: 0
  To:
   #2022-04-08 16:15:22.155 752801 INFO osc_lib.shell [-] END return value: 0

Expected results:
Fix in Red Hat OpenStack 16.2 Z stream

Additional info:

- The error of "-bash: 2022-04-08: command not found" seems to be a side effect of the command: 
# openstack complete | tee /etc/bash_completion.d/osc.bash_completion > /dev/null" 
This command is invoked via TripleO (tripleoclient.yaml) as below highlighted [1]

- As result of the openstack complete command, 
an info event was the last line added to the "osc.bash_completion" file generated via TripleO [2]:
      2022-04-08 16:15:22.155 752801 INFO osc_lib.shell [-] END return value: 0

- The error of "-bash: 2022-04-08: command not found" is detected as result of this last row added incorrectly to the osc.bash_completion file [3].
In the error message, the 2022-04-08 is the date when the tripleoclient.yaml (the openstack complete command) was invoked during the Red Hat OpenStack upgrade.

[1] File: tripleo-common/container-images/tcib/base/tripleoclient/tripleoclient.yaml

with content:

      tcib_actions:
      .....
      - run: openstack complete | tee /etc/bash_completion.d/osc.bash_completion > /dev/null
      .....
          

[2] Last 5 lines generated in /etc/bash_completion.d/osc.bash_completion

    [root@undercloud-0 ~]# tail -n 5  /etc/bash_completion.d/osc.bash_completion
      fi
      return 0
    }
    complete -F _openstack openstack
    2022-04-08 16:15:22.155 752801 INFO osc_lib.shell [-] END return value: 0
    [root@undercloud-0 ~]# 


[3] Last INFO line ("2022-04-08 16:15:22.155 752801 INFO osc_lib.shell [-] END return value: 0") is interpreted as a command when a new SSH session is opened as any user. The error of "-bash: 2022-04-08: command not found" is detected as result of this fact.

    [root@dell-r620-03 ~]# ssh stack@undercloud-0
    .....
    Last login: Tue Apr 19 07:08:25 2022 from 172.16.0.1
    -bash: 2022-04-08: command not found

Comment 2 Rabi Mishra 2022-04-25 13:21:55 UTC

*** This bug has been marked as a duplicate of bug 2071765 ***