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
1=== modified file 'hooks/glance_utils.py'
2--- hooks/glance_utils.py 2016-01-13 14:31:40 +0000
3+++ hooks/glance_utils.py 2016-01-21 19:26:07 +0000
4@@ -244,9 +244,6 @@
5 return configs
6
7
8-# NOTE(jamespage): Retry deals with sync issues during one-shot HA deploys.
9-# mysql might be restarting or suchlike.
10-@retry_on_exception(5, base_delay=3, exc_type=subprocess.CalledProcessError)
11 def determine_packages():
12 packages = set(PACKAGES)
13
14@@ -257,6 +254,9 @@
15 return sorted(packages)
16
17
18+# NOTE(jamespage): Retry deals with sync issues during one-shot HA deploys.
19+# mysql might be restarting or suchlike.
20+@retry_on_exception(5, base_delay=3, exc_type=subprocess.CalledProcessError)
21 def migrate_database():
22 '''Runs glance-manage to initialize a new database
23 or migrate existing
24@@ -484,19 +484,29 @@
25 keystone_ctxt['service_host'],
26 keystone_ctxt['service_port'])
27 from swiftclient import client
28- swift_connection = client.Connection(
29- authurl=auth_url, user='glance', key=keystone_ctxt['admin_password'],
30- tenant_name=keystone_ctxt['admin_tenant_name'], auth_version='2.0')
31-
32- account_stats = swift_connection.head_account()
33- if 'x-account-meta-temp-url-key' in account_stats:
34- log("Temp URL key was already posted.")
35- return account_stats['x-account-meta-temp-url-key']
36-
37- temp_url_key = pwgen(length=64)
38- swift_connection.post_account(headers={'x-account-meta-temp-url-key':
39- temp_url_key})
40- return temp_url_key
41+ from swiftclient import exceptions
42+
43+ @retry_on_exception(15, base_delay=10,
44+ exc_type=exceptions.ClientException)
45+ def connect_and_post():
46+ log('Connecting swift client...')
47+ swift_connection = client.Connection(
48+ authurl=auth_url, user='glance',
49+ key=keystone_ctxt['admin_password'],
50+ tenant_name=keystone_ctxt['admin_tenant_name'],
51+ auth_version='2.0')
52+
53+ account_stats = swift_connection.head_account()
54+ if 'x-account-meta-temp-url-key' in account_stats:
55+ log("Temp URL key was already posted.")
56+ return account_stats['x-account-meta-temp-url-key']
57+
58+ temp_url_key = pwgen(length=64)
59+ swift_connection.post_account(headers={'x-account-meta-temp-url-key':
60+ temp_url_key})
61+ return temp_url_key
62+
63+ return connect_and_post()
64
65
66 def is_paused(status_get=status_get):

Subscribers

People subscribed via source and target branches