Merge lp:~doanac/charms/precise/ubuntu-ci-services-itself/rabbitmq-worker-conf into lp:~canonical-ci-engineering/charms/precise/ubuntu-ci-services-itself/rabbitmq-worker

Proposed by Andy Doan
Status: Merged
Merged at revision: 11
Proposed branch: lp:~doanac/charms/precise/ubuntu-ci-services-itself/rabbitmq-worker-conf
Merge into: lp:~canonical-ci-engineering/charms/precise/ubuntu-ci-services-itself/rabbitmq-worker
Diff against target: 40 lines (+13/-0)
2 files modified
config.yaml (+7/-0)
hooks/hooks.py (+6/-0)
To merge this branch: bzr merge lp:~doanac/charms/precise/ubuntu-ci-services-itself/rabbitmq-worker-conf
Reviewer Review Type Date Requested Status
Paul Larson Approve
Francis Ginther Pending
Canonical CI Engineering Pending
Review via email: mp+203266@code.launchpad.net

Description of the change

This adds the ability to specify a config file that the charm will store under the root of the unit's source directory

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) wrote :

I played with this by deploying the branch-source-builder from our trunk with a small change like:

=== modified file 'juju-deployer/branch-source-builder.yaml'
--- juju-deployer/branch-source-builder.yaml 2013-12-19 17:11:55 +0000
+++ juju-deployer/branch-source-builder.yaml 2014-01-26 21:46:10 +0000
@@ -20,6 +20,7 @@
             options:
                 branch: lp:ubuntu-ci-services-itself
                 main: ./branch-source-builder/run_worker
+ unit-config: include-base64://configs/unit_config.yaml
         bsb-rabbit:
             branch: lp:~canonical-ci-engineering/charms/precise/ubuntu-ci-services-itself/rabbitmq-server
             charm: rabbitmq

I think this is what you guys were wanting, right?

This is config format agnostic which is probably useful. I did YAML locally, but the charm doesn't care.

Revision history for this message
Paul Larson (pwlars) wrote :

Yes, and I think the idea was to have just a single config file with all the auth data any of them care about (right now, I think it's just cloud and lp). Looks fine to me, except we'll need to just write that file and stick it in the other branch.
+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2014-01-24 21:10:26 +0000
3+++ config.yaml 2014-01-26 22:04:39 +0000
4@@ -18,6 +18,13 @@
5 main:
6 type: string
7 description: "The worker script to run as a service. Can include paths relative to local bzr directory"
8+ unit-config:
9+ type: string
10+ description: |
11+ base64 encoded string to hold configuration information for the unit.
12+ The contents will be written to a file named
13+ <install_root>/<unit>/unit_config
14+ where <unit> is the location the branch is extracted to.
15
16 uid:
17 type: string
18
19=== modified file 'hooks/hooks.py'
20--- hooks/hooks.py 2014-01-24 21:10:26 +0000
21+++ hooks/hooks.py 2014-01-26 22:04:39 +0000
22@@ -1,5 +1,6 @@
23 #!/usr/bin/env python
24
25+import base64
26 import os
27 import json
28 import subprocess
29@@ -73,6 +74,11 @@
30 args.append(_service_dir(config))
31 subprocess.check_call(args)
32
33+ unit_config = config.get('unit-config')
34+ if unit_config:
35+ with open(os.path.join(_service_dir(config), 'unit_config'), 'w') as f:
36+ f.write(base64.b64decode(unit_config))
37+
38
39 def _create_upstart(config):
40 template = textwrap.dedent('''

Subscribers

People subscribed via source and target branches