Bug 2190308 - [OSP 16.2] upload-swift-artifacts not able to properly fetch Swift's internal endpoint url
Summary: [OSP 16.2] upload-swift-artifacts not able to properly fetch Swift's internal...
Keywords:
Status: ON_QA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-tripleo-common
Version: 16.2 (Train)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: z6
: 16.2 (Train on RHEL 8.4)
Assignee: Takashi Kajinami
QA Contact: David Rosenfeld
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-04-27 21:26 UTC by Flavio Piccioni
Modified: 2023-07-27 16:10 UTC (History)
4 users (show)

Fixed In Version: openstack-tripleo-common-11.7.1-2.20230711015219.6371211.el8ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 881766 0 None MERGED Train-only: Make swift internal endpoint detection more robust 2023-05-10 08:19:10 UTC
Red Hat Issue Tracker OSP-24630 0 None None None 2023-04-27 21:28:46 UTC

Description Flavio Piccioni 2023-04-27 21:26:55 UTC
Description of problem:

/usr/bin/upload-swift-artifacts fetches Swift's internal endpoint url by using following syntax:

# This works with newer openstackclient which displays the endpoints in list
SWIFT_INTERNAL_URL=$(openstack endpoint list | grep swift | grep internal | sed -e "s|.*\(http.*\)://\([^/]*\)/.*|\1://\2|" || true)

if [ -z "$SWIFT_INTERNAL_URL" ]; then
    # fallback to old openstack client 'show' which displays all the URLs
    SWIFT_INTERNAL_URL=$(openstack endpoint show swift | grep internalurl | sed -e "s|.*\(http.*\)://\([^/]*\)/.*|\1://\2|")
fi

This will lead to problems (with newer openstackclient which displays the endpoints in list) in case endpoints urls contain "internal" string, like in the example:

(undercloud) [stack@undercloud ~]$ openstack endpoint list | grep swift | grep internal
| 78e4f1f5225a413b92eaf1e589bda3e8 | regionOne | swift            | object-store              | True    | internal  | http://ip:8080/v1/AUTH_%(tenant_id)s                              |
| 87c0880f07b045f1a473e1a1051b30bf | regionOne | swift            | object-store              | True    | public    | https://public.undercloud.internal:13808/v1/AUTH_%(tenant_id)s |



Version-Release number of selected component (if applicable):
RHOSP 16.2
python3-tripleo-common-11.7.1-2.20230308005004.99d0f05.el8ost.noarch


Steps to Reproduce:
1. configure different swift's endpoints containing "internal" string 
2. invoke 'upload-swift-artifacts' (in this specific case customer is running 'upload-puppet module' to install a 3d party tool like TrilioVault)
3. verify the DeployArtifactURLs section in the created /home/stack/.tripleo/environments/puppet-modules-url.yaml

Actual results:
an invalid /home/stack/.tripleo/environments/puppet-modules-url.yaml will be created

Expected results:
/usr/bin/upload-swift-artifacts being able to properly get SWIFT_INTERNAL_URL

Additional info:

maybe this could be a possible workaround:
SWIFT_INTERNAL_URL=$(openstack endpoint list --interface internal --service swift -c URL -f value | sed -e "s|.*\(http.*\)://\([^/]*\)/.*|\1://\2|" || true)


Note You need to log in before you can comment on or make changes to this bug.