← Back to team overview

cf-charmers team mailing list archive

Changes to the provided interface for HM9000 (issue 105770043)

 

Reviewers: mp+221771_code.launchpad.net,

Message:
Please take a look.

Description:
Changes to the provided interface for HM9000



https://code.launchpad.net/~johnsca/charms/trusty/cf-cloud-controller/hm9k/+merge/221771

(do not edit description out of merge proposal)


Please review this at https://codereview.appspot.com/105770043/

Affected files (+27, -5 lines):
   A [revision details]
   A hooks/cc-relation-changed
   M hooks/config.py
   M metadata.yaml
   M templates/cloud_controller.yml


Index: [revision details]
=== added file '[revision details]'
--- [revision details]	2012-01-01 00:00:00 +0000
+++ [revision details]	2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: cory.johns@xxxxxxxxxxxxx-20140529172549-7z4hgq8avmexdtb8
+New revision: cory.johns@xxxxxxxxxxxxx-20140602160635-9h4cnnwhagkwwqel

Index: metadata.yaml
=== modified file 'metadata.yaml'
--- metadata.yaml	2014-05-15 16:40:34 +0000
+++ metadata.yaml	2014-06-02 15:28:01 +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
-


Index: hooks/cc-relation-changed
=== added file 'hooks/cc-relation-changed'
--- hooks/cc-relation-changed	1970-01-01 00:00:00 +0000
+++ hooks/cc-relation-changed	2014-06-02 15:28:01 +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'],
+)


Index: hooks/config.py
=== modified file 'hooks/config.py'
--- hooks/config.py	2014-05-29 17:25:49 +0000
+++ hooks/config.py	2014-06-02 15:28:01 +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'),


Index: templates/cloud_controller.yml
=== modified file 'templates/cloud_controller.yml'
--- templates/cloud_controller.yml	2014-05-16 02:59:59 +0000
+++ templates/cloud_controller.yml	2014-06-02 16:06:35 +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





-- 
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.


References