cf-charmers team mailing list archive
-
cf-charmers team
-
Mailing list archive
-
Message #00566
Re: [Merge] lp:~johnsca/charms/trusty/cloudfoundry/trunk-webadmin into lp:~cf-charmers/charms/trusty/cloudfoundry/trunk
Thanks for the feedback and clarification.
Diff comments:
> === 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]
Ahh, misread, thank you for the clarification. The contract is still pretty strange though. You are correct if this were in the collected data space it would be better, but still depends on this point of access being triggered only after we expect the other data to be available (which might not be obvious at a glance either way).
> + 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 :(
Except that their newer (golang?) services don't ever report/play well with monit, but we're still in agreement that there must be a better way :) I still have the goal of testing reconciler with collector and seeing if that provides proper introspection into the cluster.
> 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,
> + ]},
> ]
> },
>
>
--
https://code.launchpad.net/~johnsca/charms/trusty/cloudfoundry/trunk-webadmin/+merge/240033
Your team Cloud Foundry Charmers is subscribed to branch lp:~cf-charmers/charms/trusty/cloudfoundry/trunk.
References