← Back to team overview

cf-charmers team mailing list archive

[Merge] lp:~johnsca/charms/trusty/cf-webadmin/trunk into lp:~cf-charmers/charms/trusty/cf-webadmin/trunk

 

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

Requested reviews:
  Cloud Foundry Charmers (cf-charmers)

For more details, see:
https://code.launchpad.net/~johnsca/charms/trusty/cf-webadmin/trunk/+merge/240308

Change and bug fixes to make deploy stable on trunk, matching changes to cloudfoundry charm
-- 
https://code.launchpad.net/~johnsca/charms/trusty/cf-webadmin/trunk/+merge/240308
Your team Cloud Foundry Charmers is requested to review the proposed merge of lp:~johnsca/charms/trusty/cf-webadmin/trunk into lp:~cf-charmers/charms/trusty/cf-webadmin/trunk.
=== modified file 'README.md'
--- README.md	2014-10-30 15:21:55 +0000
+++ README.md	2014-10-31 16:57:53 +0000
@@ -25,15 +25,15 @@
   cfwa:nats nats:nats
   cfwa:orchestrator cloudfoundry:orchestrator
   cfwa:db mysql:db
-  cfwa:cc-db cc:cc-db
+  cfwa:ccdb cc:ccdb
   cfwa:uaa uaa:uaa
-  cfwa:uaa-db uaa:uaa-db
+  cfwa:uaadb uaa:uaadb
   ```
 
 You can use the following bash onliner to do this:
 
   ```
-  for i in nats " nats" " cloudfoundry" ":db mysql" ":cc-db cc" ":uaa uaa:uaa" ":uaa-db uaa:uaa-db"; do juju add-relation cfwa$i;
+  for i in nats " nats" " cloudfoundry" ":db mysql" ":ccdb cc" ":uaa uaa:uaa" ":uaadb uaa:uaadb"; do juju add-relation cfwa$i;
   ```
 
 A canned copy of the oneliner lives in helpers.sh in the charm source:

=== modified file 'helpers.sh'
--- helpers.sh	2014-10-28 18:04:11 +0000
+++ helpers.sh	2014-10-31 16:57:53 +0000
@@ -1,6 +1,11 @@
 function do-relate(){
-    for i in nats uaa:uaa cc uaa:uaa-db mysql cloudfoundry;
+    service="$1"
+    if [ -z "$service" ]; then
+        echo "You must specify a service"
+        return
+    fi
+    for i in " nats" " cloudfoundry" ":db mysql" ":ccdb cc" ":uaa uaa:uaa" ":uaadb uaa:uaadb";
     do
-        juju add-relation $1 $i;
+        juju add-relation $service$i;
     done
 }

=== modified file 'hooks/actions.py'
--- hooks/actions.py	2014-10-28 22:14:59 +0000
+++ hooks/actions.py	2014-10-31 16:57:53 +0000
@@ -19,6 +19,7 @@
 
 
 def setup_uaac_client(service_name):
+    log('Configuring admin user via UAA')
     uaactx = contexts.UAARelation()
     orchctx = contexts.OrchestratorRelation()
     secretctx = contexts.StoredContext(utils.secrets_file, {
@@ -60,6 +61,7 @@
 def render_webadmin_config(service_name,
                            source=path("/opt/admin-ui/config/default.yml"),
                            dest=path('/etc/cf-webadmin.yml')):
+    log('Configuring admin-ui service')
     secretctx = contexts.StoredContext(utils.secrets_file, {})
     orchctx = contexts.OrchestratorRelation()
     ccdbctx = contexts.CloudControllerDBRelation()

=== added file 'hooks/admin-web-relation-changed'
--- hooks/admin-web-relation-changed	1970-01-01 00:00:00 +0000
+++ hooks/admin-web-relation-changed	2014-10-31 16:57:53 +0000
@@ -0,0 +1,3 @@
+#!/usr/bin/python
+import services
+services.manage()

=== removed file 'hooks/cc-db-relation-changed'
--- hooks/cc-db-relation-changed	2014-10-23 22:27:49 +0000
+++ hooks/cc-db-relation-changed	1970-01-01 00:00:00 +0000
@@ -1,3 +0,0 @@
-#!/usr/bin/python
-import services
-services.manage()

=== added file 'hooks/ccdb-relation-changed'
--- hooks/ccdb-relation-changed	1970-01-01 00:00:00 +0000
+++ hooks/ccdb-relation-changed	2014-10-31 16:57:53 +0000
@@ -0,0 +1,3 @@
+#!/usr/bin/python
+import services
+services.manage()

=== modified file 'hooks/services.py'
--- hooks/services.py	2014-10-27 19:34:22 +0000
+++ hooks/services.py	2014-10-31 16:57:53 +0000
@@ -3,6 +3,7 @@
 from charmhelpers.core import hookenv
 from charmhelpers.core.services import helpers
 from charmhelpers.core.services.base import ServiceManager
+from cloudfoundry.contexts import RelationContext
 from cloudfoundry.contexts import CloudControllerDBRelation
 from cloudfoundry.contexts import MysqlRelation
 from cloudfoundry.contexts import NatsRelation
@@ -13,13 +14,37 @@
 import actions
 
 
+class HttpRelation(RelationContext):
+    """
+    Relation context for the `http` interface.
+
+    :param str name: Override the relation :attr:`name`, since it can vary from charm to charm
+    :param list additional_required_keys: Extend the list of :attr:`required_keys`
+    """
+    name = 'website'
+    interface = 'http'
+    required_keys = ['host', 'port']
+    port = 80
+
+    def __init__(self, port=None):
+        super(HttpRelation, self).__init__()
+        if port is not None:
+            self.port = port
+
+    def provide_data(self):
+        return {
+            'host': hookenv.unit_get('private-address'),
+            'port': self.port,
+        }
+
+
 def manage():
     manager = ServiceManager([
         {
             'service': 'cf-webadmin',
-            'ports': [8070],  # ports to after start
+            'ports': [8070],  # ports to open after start
             'provided_data': [
-                #helpers.HttpRelation()
+                HttpRelation(port=8070)
             ],
             'required_data': [
                 OrchestratorRelation(),

=== modified file 'hooks/setup.py'
--- hooks/setup.py	2014-10-24 19:38:07 +0000
+++ hooks/setup.py	2014-10-31 16:57:53 +0000
@@ -10,7 +10,7 @@
     from charmhelpers import fetch
     fetch.apt_install(fetch.filter_installed_packages(['bzr']))
 
-    cflib = 'bzr+http://bazaar.launchpad.net/~johnsca/charms/trusty/cloudfoundry/webadmin#egg=cloudfoundry'
+    cflib = 'bzr+http://bazaar.launchpad.net/~cf-charmers/charms/trusty/cloudfoundry/trunk#egg=cloudfoundry'
     subprocess.check_call(['pip', 'install', '-e', cflib])
     subprocess.check_call(['pip', 'install', 'path.py'])
 

=== added file 'hooks/uaadb-relation-changed'
--- hooks/uaadb-relation-changed	1970-01-01 00:00:00 +0000
+++ hooks/uaadb-relation-changed	2014-10-31 16:57:53 +0000
@@ -0,0 +1,3 @@
+#!/usr/bin/python
+import services
+services.manage()

=== modified file 'metadata.yaml'
--- metadata.yaml	2014-10-24 16:24:19 +0000
+++ metadata.yaml	2014-10-31 16:57:53 +0000
@@ -18,9 +18,9 @@
     interface: orchestrator
   uaa:
     interface: uaa
-  uaa-db:
-    interface: uaa-db
+  uaadb:
+    interface: mysql
   nats:
     interface: nats
-  cc-db:
-    interface: controller-db
+  ccdb:
+    interface: mysql


Follow ups