← Back to team overview

cf-charmers team mailing list archive

[Merge] lp:~johnsca/charms/trusty/cf-cloud-controller/hm9k into lp:~cf-charmers/charms/trusty/cf-cloud-controller/trunk

 

Cory Johns has proposed merging lp:~johnsca/charms/trusty/cf-cloud-controller/hm9k into lp:~cf-charmers/charms/trusty/cf-cloud-controller/trunk.

Requested reviews:
  Cloud Foundry Charmers (cf-charmers)

For more details, see:
https://code.launchpad.net/~johnsca/charms/trusty/cf-cloud-controller/hm9k/+merge/221771

Changes to the provided interface for HM9000



https://codereview.appspot.com/105770043/

-- 
https://code.launchpad.net/~johnsca/charms/trusty/cf-cloud-controller/hm9k/+merge/221771
Your team Cloud Foundry Charmers is requested to review the proposed merge of lp:~johnsca/charms/trusty/cf-cloud-controller/hm9k into lp:~cf-charmers/charms/trusty/cf-cloud-controller/trunk.
=== added file 'hooks/cc-relation-changed'
--- hooks/cc-relation-changed	1970-01-01 00:00:00 +0000
+++ hooks/cc-relation-changed	2014-06-02 17:50:06 +0000
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+# vim: et ai ts=4 sw=4:
+from charmhelpers.core import hookenv
+import config
+
+hookenv.relation_set(
+    hostname=config.API_CONTEXT['api']['hostname'],
+    port=config.API_CONTEXT['api']['port'],
+    user=config.API_CONTEXT['api']['user'],
+    password=config.API_CONTEXT['api']['password'],
+)

=== modified file 'hooks/config.py'
--- hooks/config.py	2014-05-29 17:25:49 +0000
+++ hooks/config.py	2014-06-02 17:50:06 +0000
@@ -41,12 +41,22 @@
     hookenv.log("Finished db:migrate", hookenv.DEBUG)
 
 
+API_CONTEXT = contexts.StoredContext('api_credentials.yml', {
+    'api': {
+        'hostname': hookenv.unit_get('private-address').encode('utf-8'),
+        'port': 9022,
+        'user': host.pwgen(7),
+        'password': host.pwgen(7),
+    }})
+
+
 SERVICES = [
     {
         'service': 'cf-cloudcontroller',
         'required_data': [contexts.NatsRelation(),
                           contexts.RouterRelation(),
-                          contexts.MysqlRelation()],
+                          contexts.MysqlRelation(),
+                          API_CONTEXT],
         'data_ready': [
             services.template(source='cf-cloudcontroller.conf',
                               target='/etc/init/cf-cloudcontroller.conf'),

=== modified file 'metadata.yaml'
--- metadata.yaml	2014-05-15 16:40:34 +0000
+++ metadata.yaml	2014-06-02 17:50:06 +0000
@@ -10,7 +10,7 @@
   - misc
 subordinate: false
 provides:
-  provides-relation:
+  cc:
     interface: cf-cloud-controller
 requires:
   nats:
@@ -20,4 +20,3 @@
   db:
     interface: mysql
     optional: true
-   

=== modified file 'templates/cloud_controller.yml'
--- templates/cloud_controller.yml	2014-05-16 02:59:59 +0000
+++ templates/cloud_controller.yml	2014-06-02 17:50:06 +0000
@@ -21,8 +21,8 @@
 bootstrap_admin_email: admin@my-org
 
 bulk_api:
-  auth_user: bulk_api
-  auth_password: "Password"
+  auth_user: {{api['user']}}
+  auth_password: "{{api['password']}}"
 
 nginx:
   use_nginx: false


References