Ensure that temp_url registration transient issues are handled in the charm.
This commit is contained in:
commit
a85c77154a
|
@ -244,9 +244,6 @@ def register_configs():
|
||||||
return configs
|
return configs
|
||||||
|
|
||||||
|
|
||||||
# NOTE(jamespage): Retry deals with sync issues during one-shot HA deploys.
|
|
||||||
# mysql might be restarting or suchlike.
|
|
||||||
@retry_on_exception(5, base_delay=3, exc_type=subprocess.CalledProcessError)
|
|
||||||
def determine_packages():
|
def determine_packages():
|
||||||
packages = set(PACKAGES)
|
packages = set(PACKAGES)
|
||||||
|
|
||||||
|
@ -257,6 +254,9 @@ def determine_packages():
|
||||||
return sorted(packages)
|
return sorted(packages)
|
||||||
|
|
||||||
|
|
||||||
|
# NOTE(jamespage): Retry deals with sync issues during one-shot HA deploys.
|
||||||
|
# mysql might be restarting or suchlike.
|
||||||
|
@retry_on_exception(5, base_delay=3, exc_type=subprocess.CalledProcessError)
|
||||||
def migrate_database():
|
def migrate_database():
|
||||||
'''Runs glance-manage to initialize a new database
|
'''Runs glance-manage to initialize a new database
|
||||||
or migrate existing
|
or migrate existing
|
||||||
|
@ -484,19 +484,29 @@ def swift_temp_url_key():
|
||||||
keystone_ctxt['service_host'],
|
keystone_ctxt['service_host'],
|
||||||
keystone_ctxt['service_port'])
|
keystone_ctxt['service_port'])
|
||||||
from swiftclient import client
|
from swiftclient import client
|
||||||
swift_connection = client.Connection(
|
from swiftclient import exceptions
|
||||||
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()
|
@retry_on_exception(15, base_delay=10,
|
||||||
if 'x-account-meta-temp-url-key' in account_stats:
|
exc_type=exceptions.ClientException)
|
||||||
log("Temp URL key was already posted.")
|
def connect_and_post():
|
||||||
return account_stats['x-account-meta-temp-url-key']
|
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')
|
||||||
|
|
||||||
temp_url_key = pwgen(length=64)
|
account_stats = swift_connection.head_account()
|
||||||
swift_connection.post_account(headers={'x-account-meta-temp-url-key':
|
if 'x-account-meta-temp-url-key' in account_stats:
|
||||||
temp_url_key})
|
log("Temp URL key was already posted.")
|
||||||
return temp_url_key
|
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 is_paused(status_get=status_get):
|
def is_paused(status_get=status_get):
|
||||||
|
|
Loading…
Reference in New Issue