Merge lp://qastaging/~lathiat/charms/trusty/glance-simplestreams-sync/trunk into lp://qastaging/charms/trusty/glance-simplestreams-sync

Proposed by Trent Lloyd
Status: Merged
Merged at revision: 70
Proposed branch: lp://qastaging/~lathiat/charms/trusty/glance-simplestreams-sync/trunk
Merge into: lp://qastaging/charms/trusty/glance-simplestreams-sync
Diff against target: 84 lines (+13/-46)
1 file modified
scripts/glance-simplestreams-sync.py (+13/-46)
To merge this branch: bzr merge lp://qastaging/~lathiat/charms/trusty/glance-simplestreams-sync/trunk
Reviewer Review Type Date Requested Status
Данило Шеган (community) Approve
charmers Pending
Review via email: mp+290950@code.qastaging.launchpad.net

Description of the change

Base the product-streams endpoint on swift's endpoint using service_catalog.url_for() instead of generating it manually (LP #1552986)

ceph-radosgw uses a different URL scheme to swift-proxy without the AUTH_$(tenant_id)s part,
this fix will now base the URL on the configured endpoint so that it will work with either
object store and service_catalog.url_for() will replace the dynamic $(tenant_id) part for us

Once working, juju can now find images and tools in a private cloud automatically instead of needing to generate metadata manually.

To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote :

In my tests, this has worked with ceph/ceph deployment of Landscape Autopilot, but failed when swift/iscsi and swift/ceph were used due to Authorization errors.

A glance-simplestreams-sync.log is at http://paste.ubuntu.com/15806629/.

Btw, please respect the PEP-8 as well (80-character line length limit).

review: Needs Fixing
Revision history for this message
Данило Шеган (danilo) wrote :

To expand on the above, the problem seems to be that the keystone catalog has an "admin" tenant ID in the object_store URL (/v1/AUTH_<admin-tenant-id>), whereas the old code had the "services" tenant ID.

However, if I use the more recent API ("openstack endpoint list") and then "openstack endpoint show <object-store-service-id>", I get:

+--------------+-------------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------------+
| adminurl | http://10.44.199.170:8080 |
| enabled | True |
| id | 69ff557520f24f27bf8d04761b5bf350 |
| internalurl | http://10.44.199.170:8080/v1/AUTH_$(tenant_id)s |
| publicurl | http://10.44.199.170:8080/v1/AUTH_$(tenant_id)s |
| region | region1 |
| service_id | e0d9101e28f24bb09cc101e8575c2df7 |
| service_name | swift |
| service_type | object-store |
+--------------+-------------------------------------------------+

What we need to do is to get those internalurl and publicurl values and replace $(tenant_id)s with "services" tenant ID in there. I am looking at how I get at this right now.

Revision history for this message
Trent Lloyd (lathiat) wrote :

According to your log that was the services tenant_id:

"tenant": {"description": "Created by Juju", "enabled": true, "id": "a953d9d28c0d4e9cb014c50d425b7671", "name": "services"}

INFO * 04-13 08:56:17 [PID:9560] * swiftclient * REQ: curl -i http://10.44.199.160:8080/v1/AUTH_a953d9d28c0d4e9cb014c50d425b7671/simplestreams -X PUT -H "Content-Length: 0" -H "X-Auth-Token: b2b261223cc349328a01403b27a2b3c4" -H "X-Container-Read: .r:*,.rlistings"

INFO * 04-13 08:56:17 [PID:9560] * swiftclient * RESP STATUS: 401 Unauthorized

The auth token in use was also for services. Suspect something else is at play. Will test.

Revision history for this message
Данило Шеган (danilo) wrote :

Ok, I was wrong above (too many things going on at once). This branch does work, but might hit a bit of a race with swift setup and thus hit the ClientException as above.

I've worked around that using https://pastebin.canonical.com/154167/ (mostly whitespace fixes, but also adding exception handling to keep the per-minute cronjob if swiftclient.ClientException is caught). In my last run, I haven't hit it, but as I said, it will sometimes happen with automated installs and sometimes not.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches