Merge lp:~gandelman-a/charms/precise/glance/swift_redux into lp:~charmers/charms/precise/glance/trunk

Proposed by Adam Gandelman
Status: Merged
Merged at revision: 26
Proposed branch: lp:~gandelman-a/charms/precise/glance/swift_redux
Merge into: lp:~charmers/charms/precise/glance/trunk
Diff against target: 93 lines (+36/-12)
3 files modified
hooks/glance-relations (+34/-10)
metadata.yaml (+1/-1)
revision (+1/-1)
To merge this branch: bzr merge lp:~gandelman-a/charms/precise/glance/swift_redux
Reviewer Review Type Date Requested Status
James Page Approve
Review via email: mp+140059@code.launchpad.net

Description of the change

Update object-store relations for swift integration. This stuff wasn't touched since the Diablo days

To post a comment you must log in.
27. By Adam Gandelman

metadata.yaml: Update object-store interface to match new scheme.

Revision history for this message
James Page (james-page) wrote :

The swift changes are just fine; however the charm could really do with a README!

I won't block on that but it would be great to see one soon.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/glance-relations'
2--- hooks/glance-relations 2012-11-20 12:34:27 +0000
3+++ hooks/glance-relations 2012-12-18 20:01:24 +0000
4@@ -98,20 +98,40 @@
5 relation-set glance-api-server="$bind_host:$bind_port"
6 }
7
8-function object-store_changed {
9- URL=`relation-get url`
10- USER=`relation-get user`
11- PASSWORD=`relation-get password`
12- [[ -z $URL ]] || [[ -z $USER ]] || [[ -z $PASSWORD ]] && \
13- echo "URL||USER||PASSWORD not set, peer not ready?" && exit 0
14+function object-store_joined {
15+ local relids="$(relation-ids identity-service)"
16+ [[ -z "$relids" ]] && \
17+ juju-log "$CHARM: Deferring swift store configuration until " \
18+ "an identity-service relation exists." && exit 0
19+
20 set_or_update default_store swift api
21- set_or_update swift_store_user system:$USER api
22- set_or_update swift_store_key $PASSWORD api
23- set_or_update swift_store_auth_address $URL api
24 set_or_update swift_store_create_container_on_put true api
25+
26+ for relid in $relids ; do
27+ local unit=$(relation-list -r $relid)
28+ local svc_tenant=$(relation-get -r $relid service_tenant $unit)
29+ local svc_username=$(relation-get -r $relid service_username $unit)
30+ local svc_password=$(relation-get -r $relid service_password $unit)
31+ local auth_host=$(relation-get -r $relid private-address $unit)
32+ local port=$(relation-get -r $relid service_port $unit)
33+ local auth_url=""
34+
35+ [[ -n "$auth_host" ]] && [[ -n "$port" ]] &&
36+ auth_url="http://$auth_host:$port/v2.0/"
37+
38+ [[ -n "$svc_tenant" ]] && [[ -n "$svc_username" ]] &&
39+ set_or_update swift_store_user "$svc_tenant:$svc_username" api
40+ [[ -n "$svc_password" ]] &&
41+ set_or_update swift_store_key "$svc_password" api
42+ [[ -n "$auth_url" ]] &&
43+ set_or_update swift_store_auth_address "$auth_url" api
44+ done
45 service_ctl glance-api restart
46 }
47
48+function object-store_changed {
49+ exit 0
50+}
51
52 function ceph_joined {
53 mkdir -p /etc/ceph
54@@ -217,6 +237,10 @@
55 set_or_update "admin_password" "$service_password" $i
56 done
57 service_ctl all restart
58+
59+ # Configure any object-store / swift relations now that we have an
60+ # identity-service
61+ object-store_joined
62 }
63
64 function config_changed() {
65@@ -243,7 +267,7 @@
66 "shared-db-relation-changed") db_changed;;
67 "image-service-relation-joined") image-service_joined ;;
68 "image-service-relation-changed") exit 0 ;;
69- "object-store-relation-joined") exit 0 ;;
70+ "object-store-relation-joined") object-store_joined ;;
71 "object-store-relation-changed") object-store_changed ;;
72 "identity-service-relation-joined") keystone_joined ;;
73 "identity-service-relation-changed") keystone_changed ;;
74
75=== modified file 'metadata.yaml'
76--- metadata.yaml 2012-10-11 15:14:23 +0000
77+++ metadata.yaml 2012-12-18 20:01:24 +0000
78@@ -14,7 +14,7 @@
79 shared-db:
80 interface: mysql-shared
81 object-store:
82- interface: swift
83+ interface: swift-proxy
84 identity-service:
85 interface: keystone
86 ceph:
87
88=== modified file 'revision'
89--- revision 2012-10-25 15:37:36 +0000
90+++ revision 2012-12-18 20:01:24 +0000
91@@ -1,1 +1,1 @@
92-72
93+75

Subscribers

People subscribed via source and target branches