summaryrefslogtreecommitdiff
path: root/ironic/common
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-02-03 17:17:34 +0000
committerGerrit Code Review <review@openstack.org>2022-02-03 17:17:34 +0000
commitc019dc442979e53f08117220036c49f7d6457494 (patch)
tree96b189b9fd211fda778a56733a48ddbb97f0ca16 /ironic/common
parentf20e3b7378c31caf134ecf9306821e3fb483a72d (diff)
parentcde42678b9aafdc3475457f716a7f3af17ae6995 (diff)
downloadironic-c019dc442979e53f08117220036c49f7d6457494.tar.gz
Merge "Make account prefix of Swift confgurable"
Diffstat (limited to 'ironic/common')
-rw-r--r--ironic/common/glance_service/image_service.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ironic/common/glance_service/image_service.py b/ironic/common/glance_service/image_service.py
index 66ac693f8..0a32eaf0a 100644
--- a/ironic/common/glance_service/image_service.py
+++ b/ironic/common/glance_service/image_service.py
@@ -303,15 +303,20 @@ class GlanceImageService(object):
'but it was not found in the service catalog. You must '
'provide "swift_endpoint_url" as a config option.'))
+ swift_account_prefix = CONF.glance.swift_account_prefix
+ if swift_account_prefix and not swift_account_prefix.endswith('_'):
+ swift_account_prefix = '%s_' % swift_account_prefix
+
# Strip /v1/AUTH_%(tenant_id)s, if present
- endpoint_url = re.sub('/v1/AUTH_[^/]+/?$', '', endpoint_url)
+ endpoint_url = re.sub('/v1/%s[^/]+/?$' % swift_account_prefix, '',
+ endpoint_url)
key = CONF.glance.swift_temp_url_key
account = CONF.glance.swift_account
if not account:
swift_session = swift.get_swift_session()
auth_ref = swift_session.auth.get_auth_ref(swift_session)
- account = 'AUTH_%s' % auth_ref.project_id
+ account = '%s%s' % (swift_account_prefix, auth_ref.project_id)
if not key:
swift_api = swift.SwiftAPI()