Skip to content

Commit

Permalink
Fix install O2 on subcloud failed
Browse files Browse the repository at this point in the history
The O2 application installation on a subcloud will fail because the
default region name is "RegionOne," while the subcloud has a different
region name.

This commit adds an environment variable that allows the user to set the
region name, replacing the default one.

Test Cases:

1. Successfully installed the O2 application on the subcloud.
2. Successfully installed the O2 application on the central cloud.

Issue-ID: INF-467

Change-Id: I893680b8c2519667b1784b751950ea8a3f14cbce
Signed-off-by: Zhang Rong(Jon) <[email protected]>
  • Loading branch information
jonrzhang committed Jun 20, 2024
1 parent 6e18a1c commit d526dad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions charts/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ spec:
value: {{ .Values.ocloud.OS_PASSWORD }}
- name: OS_USERNAME
value: {{ .Values.ocloud.OS_USERNAME }}
- name: OS_REGION_NAME
value: {{ .Values.ocloud.OS_REGION_NAME }}
- name: PYTHONDONTWRITEBYTECODE
value: "1"
- name: REDIS_HOST
Expand Down
1 change: 1 addition & 0 deletions charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ ocloud:
OS_AUTH_URL: ""
OS_USERNAME: ""
OS_PASSWORD: ""
OS_REGION_NAME: "RegionOne"
K8S_KUBECONFIG: ""
API_HOST_EXTERNAL_FLOATING: ""
HELM_USER_PASSWD: "St8rlingX*"
8 changes: 7 additions & 1 deletion o2common/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ def get_api_url():
return f"https://{host}:{port}"


def get_region_name():
region_name = os.environ.get("OS_REGION_NAME", "RegionOne")
return region_name


def get_stx_url():
try:
return get_stx_client_args()["auth_url"]
Expand Down Expand Up @@ -150,7 +155,8 @@ def is_ipv6(address):
return False


def get_stx_access_info(region_name="RegionOne", subcloud_hostname: str = "",
def get_stx_access_info(region_name=get_region_name(),
subcloud_hostname: str = "",
sub_is_https: bool = False):
try:
client_args = get_stx_client_args()
Expand Down

0 comments on commit d526dad

Please sign in to comment.