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
=== modified file 'config.yaml'
--- config.yaml 2013-01-31 20:03:15 +0000
+++ config.yaml 2013-03-06 18:34:21 +0000
@@ -25,3 +25,9 @@
25 juju-myservice-025 juju-myservice-0
26 If you're running multiple environments with the same services in them26 If you're running multiple environments with the same services in them
27 this allows you to differentiate between them.27 this allows you to differentiate between them.
28 charm_import_limit:
29 default: 110
30 type: int
31 description: |
32 The maximum number of charms to import from Launchpad during ingest.
33 -1 for no limit.
2834
=== modified file 'hooks/config-changed'
--- hooks/config-changed 2013-02-21 19:33:09 +0000
+++ hooks/config-changed 2013-03-06 18:34:21 +0000
@@ -60,8 +60,9 @@
60fi60fi
6161
62# Start the supervisor62# Start the supervisor
63make stop_supervisor63make -C $project_dir stop_supervisor
64make start_supervisor64make -C $project_dir start_supervisor
65
65interval=`config-get execute-ingest-every`66interval=`config-get execute-ingest-every`
66: ${interval:-0}67: ${interval:-0}
6768
6869
=== modified file 'hooks/install'
--- hooks/install 2013-02-14 19:25:32 +0000
+++ hooks/install 2013-03-06 18:34:21 +0000
@@ -34,4 +34,6 @@
34install -o charmworld -g charmworld -m 0755 -d $charmworld_home/var/charms34install -o charmworld -g charmworld -m 0755 -d $charmworld_home/var/charms
35$INSTALL scripts/run-write-errors $webops_home35$INSTALL scripts/run-write-errors $webops_home
36python scripts/gen_deploymgr.py36python scripts/gen_deploymgr.py
37maybe_rmtree $project_dir37if [ "$UPGRADING" != "1" ]; then
38 maybe_rmtree $project_dir
39fi
3840
=== modified file 'hooks/upgrade-charm'
--- hooks/upgrade-charm 2013-02-14 19:25:32 +0000
+++ hooks/upgrade-charm 2013-03-06 18:34:21 +0000
@@ -4,7 +4,7 @@
4set -x4set -x
55
6hooks/stop || true6hooks/stop || true
7hooks/install7UPGRADING=1 hooks/install
8maybe_rmtree ~ubuntu/charmworld8maybe_rmtree ~ubuntu/charmworld
9maybe_rmtree ~ubuntu/var9maybe_rmtree ~ubuntu/var
10hooks/config-changed10hooks/config-changed
1111
=== modified file 'revision'
--- revision 2013-03-04 22:06:04 +0000
+++ revision 2013-03-06 18:34:21 +0000
@@ -1,1 +1,1 @@
128129
22
=== modified file 'scripts/write_config.py'
--- scripts/write_config.py 2013-03-04 22:06:04 +0000
+++ scripts/write_config.py 2013-03-06 18:34:21 +0000
@@ -6,8 +6,11 @@
6import subprocess6import subprocess
7import sys7import sys
88
9from charmsupport.hookenv import related_units9from charmsupport.hookenv import (
10from charmsupport.hookenv import relation_ids10 config,
11 related_units,
12 relation_ids,
13)
1114
1215
13def read_config(files):16def read_config(files):
@@ -16,9 +19,13 @@
16 return new_config19 return new_config
1720
1821
19def write_new_config(mongo_url, error_handler, default, override, target):22def write_new_config(mongo_url, error_handler, charm_import_limit, default,
23 override, target):
20 new_config = read_config([default, override])24 new_config = read_config([default, override])
21 new_config.set('app:main', 'mongo.url', mongo_url)25 new_config.set('app:main', 'mongo.url', mongo_url)
26 charm_import_limit = (
27 str(charm_import_limit) if charm_import_limit >=0 else "")
28 new_config.set('app:main', 'charm_import_limit', charm_import_limit)
22 handler_class, handler_args = error_handler29 handler_class, handler_args = error_handler
23 new_config.set('handler_exc_smtp', 'class', handler_class)30 new_config.set('handler_exc_smtp', 'class', handler_class)
24 new_config.set('handler_exc_smtp', 'args', handler_args)31 new_config.set('handler_exc_smtp', 'args', handler_args)
@@ -90,7 +97,8 @@
90def main():97def main():
91 if len(sys.argv) < 4:98 if len(sys.argv) < 4:
92 raise UsageError('Usage: %s DEFAULTS OVERRIDES TARGET')99 raise UsageError('Usage: %s DEFAULTS OVERRIDES TARGET')
93 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,
94 default=sys.argv[1], override=sys.argv[2],102 default=sys.argv[1], override=sys.argv[2],
95 target=sys.argv[3])103 target=sys.argv[3])
96104

Subscribers

People subscribed via source and target branches

to all changes: