Merge lp:~abentley/charms/precise/charmworld/charm-import-limit into lp:~juju-jitsu/charms/precise/charmworld/trunk

Proposed by Aaron Bentley
Status: Merged
Merged at revision: 55
Proposed branch: lp:~abentley/charms/precise/charmworld/charm-import-limit
Merge into: lp:~juju-jitsu/charms/precise/charmworld/trunk
Diff against target: 103 lines (+26/-9)
6 files modified
config.yaml (+6/-0)
hooks/config-changed (+3/-2)
hooks/install (+3/-1)
hooks/upgrade-charm (+1/-1)
revision (+1/-1)
scripts/write_config.py (+12/-4)
To merge this branch: bzr merge lp:~abentley/charms/precise/charmworld/charm-import-limit
Reviewer Review Type Date Requested Status
Richard Harding (community) Approve
Review via email: mp+152028@code.launchpad.net

Commit message

Implement charm_import_limit config value.

Description of the change

Implement charm_import_limit config variable so that we can reconfigure staging to import all charms.

As a driveby, fix supervisor stop/start to change into the correct directory.

As a driveby, prevent install from deleting the project directory when run from upgrade.

To post a comment you must log in.
Revision history for this message
Richard Harding (rharding) wrote :

would 0 make sense for no limit?

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 2013-01-31 20:03:15 +0000
3+++ config.yaml 2013-03-06 18:34:21 +0000
4@@ -25,3 +25,9 @@
5 juju-myservice-0
6 If you're running multiple environments with the same services in them
7 this allows you to differentiate between them.
8+ charm_import_limit:
9+ default: 110
10+ type: int
11+ description: |
12+ The maximum number of charms to import from Launchpad during ingest.
13+ -1 for no limit.
14
15=== modified file 'hooks/config-changed'
16--- hooks/config-changed 2013-02-21 19:33:09 +0000
17+++ hooks/config-changed 2013-03-06 18:34:21 +0000
18@@ -60,8 +60,9 @@
19 fi
20
21 # Start the supervisor
22-make stop_supervisor
23-make start_supervisor
24+make -C $project_dir stop_supervisor
25+make -C $project_dir start_supervisor
26+
27 interval=`config-get execute-ingest-every`
28 : ${interval:-0}
29
30
31=== modified file 'hooks/install'
32--- hooks/install 2013-02-14 19:25:32 +0000
33+++ hooks/install 2013-03-06 18:34:21 +0000
34@@ -34,4 +34,6 @@
35 install -o charmworld -g charmworld -m 0755 -d $charmworld_home/var/charms
36 $INSTALL scripts/run-write-errors $webops_home
37 python scripts/gen_deploymgr.py
38-maybe_rmtree $project_dir
39+if [ "$UPGRADING" != "1" ]; then
40+ maybe_rmtree $project_dir
41+fi
42
43=== modified file 'hooks/upgrade-charm'
44--- hooks/upgrade-charm 2013-02-14 19:25:32 +0000
45+++ hooks/upgrade-charm 2013-03-06 18:34:21 +0000
46@@ -4,7 +4,7 @@
47 set -x
48
49 hooks/stop || true
50-hooks/install
51+UPGRADING=1 hooks/install
52 maybe_rmtree ~ubuntu/charmworld
53 maybe_rmtree ~ubuntu/var
54 hooks/config-changed
55
56=== modified file 'revision'
57--- revision 2013-03-04 22:06:04 +0000
58+++ revision 2013-03-06 18:34:21 +0000
59@@ -1,1 +1,1 @@
60-28
61+29
62
63=== modified file 'scripts/write_config.py'
64--- scripts/write_config.py 2013-03-04 22:06:04 +0000
65+++ scripts/write_config.py 2013-03-06 18:34:21 +0000
66@@ -6,8 +6,11 @@
67 import subprocess
68 import sys
69
70-from charmsupport.hookenv import related_units
71-from charmsupport.hookenv import relation_ids
72+from charmsupport.hookenv import (
73+ config,
74+ related_units,
75+ relation_ids,
76+)
77
78
79 def read_config(files):
80@@ -16,9 +19,13 @@
81 return new_config
82
83
84-def write_new_config(mongo_url, error_handler, default, override, target):
85+def write_new_config(mongo_url, error_handler, charm_import_limit, default,
86+ override, target):
87 new_config = read_config([default, override])
88 new_config.set('app:main', 'mongo.url', mongo_url)
89+ charm_import_limit = (
90+ str(charm_import_limit) if charm_import_limit >=0 else "")
91+ new_config.set('app:main', 'charm_import_limit', charm_import_limit)
92 handler_class, handler_args = error_handler
93 new_config.set('handler_exc_smtp', 'class', handler_class)
94 new_config.set('handler_exc_smtp', 'args', handler_args)
95@@ -90,7 +97,8 @@
96 def main():
97 if len(sys.argv) < 4:
98 raise UsageError('Usage: %s DEFAULTS OVERRIDES TARGET')
99- write_new_config(get_mongo_url(), get_error_handler(),
100+ charm_import_limit = config()['charm_import_limit']
101+ write_new_config(get_mongo_url(), get_error_handler(), charm_import_limit,
102 default=sys.argv[1], override=sys.argv[2],
103 target=sys.argv[3])
104

Subscribers

People subscribed via source and target branches

to all changes: