Merge lp:~1chb1n/charms/trusty/glance/next-lp1536241-addl into lp:~openstack-charmers-archive/charms/trusty/glance/next

Proposed by Ryan Beisner
Status: Merged
Merged at revision: 164
Proposed branch: lp:~1chb1n/charms/trusty/glance/next-lp1536241-addl
Merge into: lp:~openstack-charmers-archive/charms/trusty/glance/next
Diff against target: 66 lines (+26/-16)
1 file modified
hooks/glance_utils.py (+26/-16)
To merge this branch: bzr merge lp:~1chb1n/charms/trusty/glance/next-lp1536241-addl
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+283540@code.launchpad.net

Commit message

Retry temp_url registration until swift registers its endpoint.

Description of the change

In the interest of time, pulled the following and resolved the import error, proposed against glance/next:
https://code.launchpad.net/~james-page/charms/trusty/glance/lp1536241/+merge/283501

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #17862 glance-next for 1chb1n mp283540
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/17862/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #16693 glance-next for 1chb1n mp283540
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/16693/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8940 glance-next for 1chb1n mp283540
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/8940/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/glance_utils.py'
--- hooks/glance_utils.py 2016-01-13 14:31:40 +0000
+++ hooks/glance_utils.py 2016-01-21 19:26:07 +0000
@@ -244,9 +244,6 @@
244 return configs244 return configs
245245
246246
247# NOTE(jamespage): Retry deals with sync issues during one-shot HA deploys.
248# mysql might be restarting or suchlike.
249@retry_on_exception(5, base_delay=3, exc_type=subprocess.CalledProcessError)
250def determine_packages():247def determine_packages():
251 packages = set(PACKAGES)248 packages = set(PACKAGES)
252249
@@ -257,6 +254,9 @@
257 return sorted(packages)254 return sorted(packages)
258255
259256
257# NOTE(jamespage): Retry deals with sync issues during one-shot HA deploys.
258# mysql might be restarting or suchlike.
259@retry_on_exception(5, base_delay=3, exc_type=subprocess.CalledProcessError)
260def migrate_database():260def migrate_database():
261 '''Runs glance-manage to initialize a new database261 '''Runs glance-manage to initialize a new database
262 or migrate existing262 or migrate existing
@@ -484,19 +484,29 @@
484 keystone_ctxt['service_host'],484 keystone_ctxt['service_host'],
485 keystone_ctxt['service_port'])485 keystone_ctxt['service_port'])
486 from swiftclient import client486 from swiftclient import client
487 swift_connection = client.Connection(487 from swiftclient import exceptions
488 authurl=auth_url, user='glance', key=keystone_ctxt['admin_password'],488
489 tenant_name=keystone_ctxt['admin_tenant_name'], auth_version='2.0')489 @retry_on_exception(15, base_delay=10,
490490 exc_type=exceptions.ClientException)
491 account_stats = swift_connection.head_account()491 def connect_and_post():
492 if 'x-account-meta-temp-url-key' in account_stats:492 log('Connecting swift client...')
493 log("Temp URL key was already posted.")493 swift_connection = client.Connection(
494 return account_stats['x-account-meta-temp-url-key']494 authurl=auth_url, user='glance',
495495 key=keystone_ctxt['admin_password'],
496 temp_url_key = pwgen(length=64)496 tenant_name=keystone_ctxt['admin_tenant_name'],
497 swift_connection.post_account(headers={'x-account-meta-temp-url-key':497 auth_version='2.0')
498 temp_url_key})498
499 return temp_url_key499 account_stats = swift_connection.head_account()
500 if 'x-account-meta-temp-url-key' in account_stats:
501 log("Temp URL key was already posted.")
502 return account_stats['x-account-meta-temp-url-key']
503
504 temp_url_key = pwgen(length=64)
505 swift_connection.post_account(headers={'x-account-meta-temp-url-key':
506 temp_url_key})
507 return temp_url_key
508
509 return connect_and_post()
500510
501511
502def is_paused(status_get=status_get):512def is_paused(status_get=status_get):

Subscribers

People subscribed via source and target branches