cf-charmers team mailing list archive
-
cf-charmers team
-
Mailing list archive
-
Message #00562
[Merge] lp:~johnsca/charms/trusty/cloudfoundry/trunk-webadmin into lp:~cf-charmers/charms/trusty/cloudfoundry/trunk
Cory Johns has proposed merging lp:~johnsca/charms/trusty/cloudfoundry/trunk-webadmin into lp:~cf-charmers/charms/trusty/cloudfoundry/trunk.
Requested reviews:
Cloud Foundry Charmers (cf-charmers)
For more details, see:
https://code.launchpad.net/~johnsca/charms/trusty/cloudfoundry/trunk-webadmin/+merge/240033
Adds UAADBRelation and fixes UAARelation interface, for connecting the cf-webadmin to trunk.
This will require re-generating all of the dependent charms.
--
https://code.launchpad.net/~johnsca/charms/trusty/cloudfoundry/trunk-webadmin/+merge/240033
Your team Cloud Foundry Charmers is requested to review the proposed merge of lp:~johnsca/charms/trusty/cloudfoundry/trunk-webadmin into lp:~cf-charmers/charms/trusty/cloudfoundry/trunk.
=== modified file 'cloudfoundry/contexts.py'
--- cloudfoundry/contexts.py 2014-10-27 19:48:56 +0000
+++ cloudfoundry/contexts.py 2014-10-29 18:29:23 +0000
@@ -1,5 +1,6 @@
import os
import yaml
+import time
from charmhelpers.core import host
from charmhelpers.core import hookenv
@@ -31,6 +32,12 @@
rid=rid, unit=unit))
return list(units)
+ def get_first(self, key):
+ return self[self.name][0][key]
+
+ def get_all(self, key):
+ return [u[key] for u in self[self.name]]
+
class StoredContext(dict):
"""
@@ -114,7 +121,7 @@
class UAARelation(RelationContext):
name = 'uaa'
- interface = 'http'
+ interface = 'uaa'
required_keys = ['login_client_secret', 'admin_client_secret', 'cc_client_secret', 'cc_token_secret',
'service_broker_client_secret', 'servicesmgmt_client_secret', 'port']
port = 8081
@@ -168,6 +175,19 @@
}
+class UAADBRelation(RelationContext):
+ name = 'uaa-db'
+ interface = 'uaa-db'
+ required_keys = MysqlRelation.required_keys
+
+ @classmethod
+ def send_data(cls, job_name):
+ # using send_data instead of provide_data to delay it until data_ready
+ data = MysqlRelation()['db'][0]
+ for rid in hookenv.relation_ids(cls.name):
+ hookenv.relation_set(rid, data)
+
+
class LoginRelation(RelationContext):
name = 'login'
interface = 'http'
@@ -370,6 +390,7 @@
@classmethod
def send_data(cls, job_name):
# using send_data instead of provide_data to delay it until data_ready
+ time.sleep(120) # hack to ensure migrations are done :(
data = MysqlRelation()['db'][0]
for rid in hookenv.relation_ids(cls.name):
hookenv.relation_set(rid, data)
=== modified file 'cloudfoundry/services.py'
--- cloudfoundry/services.py 2014-09-25 15:23:46 +0000
+++ cloudfoundry/services.py 2014-10-29 18:29:23 +0000
@@ -271,11 +271,14 @@
'jobs': [
{'job_name': 'uaa',
'mapping': {'db': mapper.uaadb},
- 'provided_data': [contexts.UAARelation],
+ 'provided_data': [contexts.UAARelation,
+ contexts.UAADBRelation],
'required_data': [contexts.MysqlRelation,
contexts.NatsRelation,
- contexts.UAARelation.remote_view]
- }
+ contexts.UAARelation.remote_view],
+ 'data_ready': [
+ contexts.UAADBRelation.send_data,
+ ]},
]
},
Follow ups