Remove vestigial swift_temp_url_key

The swift-temp-url-key key on the image-service relation seems never to
be consumed (see the ImageService context(s)). It appears to be
vestigial and causes problems like Bug#1804023.

As it is never consumed, this change removes it.

Closes-Bug: #1804023

Change-Id: I2cc19c550ebb1de09e66de8685d507f7db9e0f24
This commit is contained in:
David Ames 2018-11-27 09:28:32 -08:00
parent 9ddaa45565
commit 178d2701d6
2 changed files with 0 additions and 51 deletions

View File

@ -49,7 +49,6 @@ from glance_utils import (
HAPROXY_CONF,
ceph_config_file,
setup_ipv6,
swift_temp_url_key,
assess_status,
reinstall_paste_ini,
is_api_ready,
@ -235,13 +234,6 @@ def image_service_joined(relation_id=None):
juju_log("%s: image-service_joined: To peer glance-api-server=%s" %
(CHARM, relation_data['glance-api-server']))
if ('object-store' in CONFIGS.complete_contexts() and
'identity-service' in CONFIGS.complete_contexts()):
relation_data.update({
'swift-temp-url-key': swift_temp_url_key(),
'swift-container': 'glance'
})
relation_set(relation_id=relation_id, **relation_data)

View File

@ -45,7 +45,6 @@ from charmhelpers.core.host import (
CompareHostReleases,
lsb_release,
mkdir,
pwgen,
service_stop,
service_start,
)
@ -433,48 +432,6 @@ def check_optional_relations(configs):
return "unknown", ""
def swift_temp_url_key():
"""Generate a temp URL key, post it to Swift and return its value.
If it is already posted, the current value of the key will be returned.
"""
import requests
keystone_ctxt = context.IdentityServiceContext(service='glance',
service_user='glance')()
if not keystone_ctxt:
log('Missing identity-service relation. Skipping generation of '
'swift temporary url key.')
return
auth_url = '%s://%s:%s/v2.0/' % (keystone_ctxt['service_protocol'],
keystone_ctxt['service_host'],
keystone_ctxt['service_port'])
from swiftclient import client
from swiftclient import exceptions
@retry_on_exception(15, base_delay=10,
exc_type=(exceptions.ClientException,
requests.exceptions.ConnectionError))
def connect_and_post():
log('Connecting swift client...')
swift_connection = client.Connection(
authurl=auth_url, user='glance',
key=keystone_ctxt['admin_password'],
tenant_name=keystone_ctxt['admin_tenant_name'],
auth_version='2.0')
account_stats = swift_connection.head_account()
if 'x-account-meta-temp-url-key' in account_stats:
log("Temp URL key was already posted.")
return account_stats['x-account-meta-temp-url-key']
temp_url_key = pwgen(length=64)
swift_connection.post_account(headers={'x-account-meta-temp-url-key':
temp_url_key})
return temp_url_key
return connect_and_post()
def assess_status(configs):
"""Assess status of current unit
Decides what the state of the unit should be based on the current