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

Proposed by James Page
Status: Rejected
Rejected by: James Page
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
OpenStack Charmers 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.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

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/

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

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/

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

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/

Revision history for this message
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
Revision history for this message
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
=== modified file 'hooks/glance_utils.py'
--- hooks/glance_utils.py 2016-01-13 14:31:40 +0000
+++ hooks/glance_utils.py 2016-01-21 16:23:21 +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,27 @@
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
488 authurl=auth_url, user='glance', key=keystone_ctxt['admin_password'],488 @retry_on_exception(15, base_delay=10,
489 tenant_name=keystone_ctxt['admin_tenant_name'], auth_version='2.0')489 exc_type=client.exceptions.ClientException)
490490 def connect_and_post():
491 account_stats = swift_connection.head_account()491 swift_connection = client.Connection(
492 if 'x-account-meta-temp-url-key' in account_stats:492 authurl=auth_url, user='glance',
493 log("Temp URL key was already posted.")493 key=keystone_ctxt['admin_password'],
494 return account_stats['x-account-meta-temp-url-key']494 tenant_name=keystone_ctxt['admin_tenant_name'],
495495 auth_version='2.0')
496 temp_url_key = pwgen(length=64)496
497 swift_connection.post_account(headers={'x-account-meta-temp-url-key':497 account_stats = swift_connection.head_account()
498 temp_url_key})498 if 'x-account-meta-temp-url-key' in account_stats:
499 return temp_url_key499 log("Temp URL key was already posted.")
500 return account_stats['x-account-meta-temp-url-key']
501
502 temp_url_key = pwgen(length=64)
503 swift_connection.post_account(headers={'x-account-meta-temp-url-key':
504 temp_url_key})
505 return temp_url_key
506
507 return connect_and_post()
500508
501509
502def is_paused(status_get=status_get):510def is_paused(status_get=status_get):

Subscribers

People subscribed via source and target branches