Merge lp://staging/~rharding/charms/precise/charmworld/deploymgr into lp://staging/~juju-jitsu/charms/precise/charmworld/trunk
Proposed by
Richard Harding
Status: | Merged |
---|---|
Merged at revision: | 35 |
Proposed branch: | lp://staging/~rharding/charms/precise/charmworld/deploymgr |
Merge into: | lp://staging/~juju-jitsu/charms/precise/charmworld/trunk |
Diff against target: |
80 lines (+61/-0) 3 files modified
hooks/install (+1/-0) scripts/gen_deploymgr.py (+37/-0) templates/deploymgr.sh (+23/-0) |
To merge this branch: | bzr merge lp://staging/~rharding/charms/precise/charmworld/deploymgr |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju-Jitsu Hackers | Pending | ||
Review via email:
|
Description of the change
Add support for creating a /srv/deploymgr script
- Add a template that has the path filled in.
- Add a python script to generate the deploymgr script from the template
To post a comment you must log in.
Reviewers: mp+145969_ code.launchpad. net,
Message:
Please take a look.
Description:
Add support for creating a /srv/deploymgr script
- Add a template that has the path filled in.
- Add a python script to generate the deploymgr script from the template
https:/ /code.launchpad .net/~rharding/ charms/ precise/ charmworld/ deploymgr/ +merge/ 145969
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/7237063/
Affected files: gen_deploymgr. py deploymgr. sh
A [revision details]
M hooks/install
A scripts/
A templates/
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: <email address hidden>
+New revision: <email address hidden>
Index: hooks/install gen_deploymgr. py
=== modified file 'hooks/install'
--- hooks/install 2013-01-24 17:34:53 +0000
+++ hooks/install 2013-01-31 19:25:09 +0000
@@ -18,3 +18,4 @@
mkdir -p ~ubuntu/var/charms
chown -R ubuntu.ubuntu ~ubuntu/var
cp shhh.py ~ubuntu
+python scripts/
Index: scripts/ gen_deploymgr. py gen_deploymgr. py' gen_deploymgr. py 1970-01-01 00:00:00 +0000 gen_deploymgr. py 2013-01-31 19:25:09 +0000 deploymgr. sh' /charmworld' dirname( dirname( __file_ _))) path(path) : TEMPLATE) as handle: handle. read()) substitute( { writelines( rendered) _OUT, 0755) path(DEPLOYMGR_ OUT)
=== added file 'scripts/
--- scripts/
+++ scripts/
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+from os import chown
+from os import chmod
+from os import makedirs
+from os.path import abspath
+from os.path import dirname
+from os.path import exists
+from string import Template
+
+
+DEPLOYMGR_TEMPLATE = 'templates/
+DEPLOYMGR_OUT = '/srv/deploymgr
+CHARM_DIR = abspath(
+
+
+def prep_output_
+ """Verify that we can write to the output location."""
+ directory = dirname(path)
+ if not exists(directory):
+ makedirs(directory)
+ chown(directory, 1500, 1500)
+ chmod(directory, 0755)
+
+
+def write_deploymgr():
+ with open(DEPLOYMGR_
+ template = Template(
+ rendered = template.
+ 'charm_dir': CHARM_DIR
+ })
+
+ with open(DEPLOYMGR_OUT, 'w') as output:
+ output.
+ chmod(DEPLOYMGR
+
+
+if __name__ == "__main__":
+ prep_output_
+ write_deploymgr()
Index: templates/ deploymgr. sh deploymgr. sh' deploymgr. sh 1970-01-01 00:00:00 +0000 deploymgr. sh 2013-01-31 18:05:32 +0000
=== added file 'templates/
--- templates/
+++ templates/
@@ -0,0 +1,23 @@
+#!/bin/bash
+set -u
+
+# Deployment script for charmworld service
+# Cribbed from lp:~canonical-losas/canonical-marshal/fenchurch
+case $$1 in
+ start)
+ cd $charm_dir && ./hooks/start
+ ;;
+ stop)
+ cd $charm_dir && ./hooks/stop
+ ;;
+ restart)
+ cd $charm_dir && ./hooks/restart
+ ;;
+ install)
+ cd $charm_dir && ./hooks/install
+ ;;
+ *)
+ echo "Unrecognised deployment command"
+ exit 1
+ ;;
+esac