Bug 2120149

Summary: Environment variable name is inconsistent between stackrc and overcloudrc, OS_CLOUD and OS_CLOUDNAME
Product: Red Hat OpenStack Reporter: yatanaka
Component: openstack-tripleo-commonAssignee: Takashi Kajinami <tkajinam>
Status: CLOSED ERRATA QA Contact: David Rosenfeld <drosenfe>
Severity: low Docs Contact:
Priority: low    
Version: 17.0 (Wallaby)CC: cjeanner, hbrock, jschluet, jslagle, mburns, ramishra, slinaber, tkajinam
Target Milestone: z1Keywords: Triaged
Target Release: 17.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: openstack-tripleo-common-15.4.1-0.20221122090255.51f6577.el9ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-01-25 12:28:51 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 yatanaka 2022-08-22 01:25:48 UTC
Description of problem:

stackrc defines `OS_CLOUD`.
~~~
[stack@undercloud ~]$ cat stackrc 
# Clear any old environment that may conflict.
for key in $( set | awk -F= '/^OS_/ {print $1}' ); do unset "${key}" ; done
export OS_CLOUD=undercloud
# Add OS_CLOUDNAME to PS1
if [ -z "${CLOUDPROMPT_ENABLED:-}" ]; then
    export PS1=${PS1:-""}
    export PS1=\${OS_CLOUD:+"(\$OS_CLOUD)"}\ $PS1
    export CLOUDPROMPT_ENABLED=1
fi
~~~

On the otherhand, overcloudrc defines `OS_CLOUDNAME`
~~~
 [stack@undercloud ~]$ cat overcloudrc
# Clear any old environment that may conflict.
for key in $( set | awk '{FS="="}  /^OS_/ {print $1}' ); do unset $key ; done
  :
export OS_CLOUDNAME=overcloud
  :

# Add OS_CLOUDNAME to PS1
if [ -z "${CLOUDPROMPT_ENABLED:-}" ]; then
    export PS1=${PS1:-""}
    export PS1=\${OS_CLOUDNAME:+"(\$OS_CLOUDNAME)"}\ $PS1
    export CLOUDPROMPT_ENABLED=1
fi
~~~

This difference causes lack of bash prompt display as below.

< soruce stackrc ==> overcloudrc >
~~~
[stack@undercloud ~]$ source stackrc
(undercloud) [stack@undercloud ~]$ source overcloudrc
 [stack@undercloud ~]$ 
~~~

< source overcloudrc ==> stackrc>
~~~
[stack@undercloud ~]$ source overcloudrc
(overcloud) [stack@undercloud ~]$ source stackrc 
 [stack@undercloud ~]$ 
~~~

I think both should be "OS_CLOUDNAME", not "OS_CLOUD", because we used "OS_CLOUDNAME" in RHOSP 16.



Version-Release number of selected component (if applicable):
RHOSP 17.0 beta


How reproducible:
Install undercloud and then deploy overcloud.


Actual results:
stackrc defines OS_CLOUD, but overcloudrc defines OS_CLOUDNAME.


Expected results:
Both stackrc and overcloudrc define OS_CLOUDNAME.

Comment 1 Takashi Kajinami 2022-08-22 04:16:01 UTC
This looks like a regression caused by https://review.opendev.org/c/openstack/tripleo-heat-templates/+/795203 .

AS is mentioned we should use OS_CLOUDNAME consistently so that switching from overcloudrc to stackrc works.

Comment 14 errata-xmlrpc 2023-01-25 12:28:51 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 (Red Hat OpenStack Platform 17.0.1 bug fix and enhancement advisory), 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-2023:0271