Merge lp:~james-page/charms/trusty/glance/lp1536241 into lp:~openstack-charmers-archive/charms/trusty/glance/next

Proposed by James Page on 2016-01-21
Status: Rejected
Rejected by: James Page on 2016-01-22
Proposed branch: lp:~james-page/charms/trusty/glance/lp1536241
Merge into: lp:~openstack-charmers-archive/charms/trusty/glance/next
Diff against target: 64 lines (+24/-16)
1 file modified
hooks/glance_utils.py (+24/-16)
To merge this branch: bzr merge lp:~james-page/charms/trusty/glance/lp1536241
Reviewer Review Type Date Requested Status
Ryan Beisner (community) Needs Fixing on 2016-01-21
OpenStack Charmers 2016-01-21 Pending
Review via email: mp+283501@code.launchpad.net

Description of the change

Retry temp_url registration until swift registers its endpoint.

To post a comment you must log in.

charm_lint_check #17856 glance-next for james-page mp283501
    LINT OK: passed

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

charm_unit_test #16688 glance-next for james-page mp283501
    UNIT OK: passed

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

charm_amulet_test #8934 glance-next for james-page mp283501
    AMULET OK: passed

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

Ryan Beisner (1chb1n) wrote :

2016-01-21 18:27:57 INFO identity-service-relation-changed Traceback (most recent call last):
2016-01-21 18:27:57 INFO identity-service-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/identity-service-relation-changed", line 534, in <module>
2016-01-21 18:27:57 INFO identity-service-relation-changed hooks.execute(sys.argv)
2016-01-21 18:27:57 INFO identity-service-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/charmhelpers/core/hookenv.py", line 717, in execute
2016-01-21 18:27:57 INFO identity-service-relation-changed self._hooks[hook_name]()
2016-01-21 18:27:57 INFO identity-service-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/charmhelpers/core/host.py", line 438, in wrapped_f
2016-01-21 18:27:57 INFO identity-service-relation-changed f(*args, **kwargs)
2016-01-21 18:27:57 INFO identity-service-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/identity-service-relation-changed", line 327, in keystone_changed
2016-01-21 18:27:57 INFO identity-service-relation-changed object_store_joined()
2016-01-21 18:27:57 INFO identity-service-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/charmhelpers/core/host.py", line 438, in wrapped_f
2016-01-21 18:27:57 INFO identity-service-relation-changed f(*args, **kwargs)
2016-01-21 18:27:57 INFO identity-service-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/identity-service-relation-changed", line 247, in object_store_joined
2016-01-21 18:27:57 INFO identity-service-relation-changed [image_service_joined(rid) for rid in relation_ids('image-service')]
2016-01-21 18:27:57 INFO identity-service-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/identity-service-relation-changed", line 227, in image_service_joined
2016-01-21 18:27:57 INFO identity-service-relation-changed 'swift-temp-url-key': swift_temp_url_key(),
2016-01-21 18:27:57 INFO identity-service-relation-changed File "/var/lib/juju/agents/unit-glance-0/charm/hooks/glance_utils.py", line 489, in swift_temp_url_key
2016-01-21 18:27:57 INFO identity-service-relation-changed exc_type=client.exceptions.ClientException)
2016-01-21 18:27:57 INFO identity-service-relation-changed AttributeError: 'module' object has no attribute 'exceptions'
2016-01-21 18:27:57 ERROR juju.worker.uniter.operation runhook.go:107 hook "identity-service-relation-changed" failed: exit status 1

review: Needs Fixing
Ryan Beisner (1chb1n) wrote :

FYI, see my piggy-back which includes these changes and resolves the import error.

https://code.launchpad.net/~1chb1n/charms/trusty/glance/next-lp1536241-addl/+merge/283540

Unmerged revisions

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 16:23:21 +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,27 @@
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+
42+ @retry_on_exception(15, base_delay=10,
43+ exc_type=client.exceptions.ClientException)
44+ def connect_and_post():
45+ swift_connection = client.Connection(
46+ authurl=auth_url, user='glance',
47+ key=keystone_ctxt['admin_password'],
48+ tenant_name=keystone_ctxt['admin_tenant_name'],
49+ auth_version='2.0')
50+
51+ account_stats = swift_connection.head_account()
52+ if 'x-account-meta-temp-url-key' in account_stats:
53+ log("Temp URL key was already posted.")
54+ return account_stats['x-account-meta-temp-url-key']
55+
56+ temp_url_key = pwgen(length=64)
57+ swift_connection.post_account(headers={'x-account-meta-temp-url-key':
58+ temp_url_key})
59+ return temp_url_key
60+
61+ return connect_and_post()
62
63
64 def is_paused(status_get=status_get):

Subscribers

People subscribed via source and target branches