diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-25 12:49:26 +0000 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-25 12:49:26 +0000 |
commit | 836ef48234c573a002f9d67667710caccc7e24e7 (patch) | |
tree | 8ee294867e245726ee0962fc4c1da4de304e7b43 | |
parent | 483ef192b927db868d89b0014a441bc256a8d6f6 (diff) | |
download | morph-836ef48234c573a002f9d67667710caccc7e24e7.tar.gz |
Default bundle-server and cache-server based on trove-host.
This causes bundle-server and cache-server to be defaulted to
appropriate Trove related URLs unless overridden in the configs.
Reviewed-By: Lars Wirzenius <lars.wirzenius@codethink.co.uk>
-rwxr-xr-x | morphlib/app.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index b25cd42c..30efb215 100755 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -58,7 +58,7 @@ class Morph(cliapp.Application): 'show no output unless there is an error') self.settings.string(['trove-host'], 'hostname of Trove instance', - metavar='HOST', + metavar='TROVEHOST', default=defaults['trove-host']) self.settings.string_list(['trove-prefix'], 'define URL prefix aliases stored ' @@ -82,11 +82,15 @@ class Morph(cliapp.Application): 'replaced', default=defaults['repo-alias']) self.settings.string(['bundle-server'], - 'base URL to download bundles', + 'base URL to download bundles. ' + 'If not provided, defaults to ' + 'http://TROVEHOST/bundles/', metavar='URL', default=None) self.settings.string(['cache-server'], - 'HTTP URL of the morph cache server to use', + 'HTTP URL of the morph cache server to use. ' + 'If not provided, defaults to ' + 'http://TROVEHOST:8080/', metavar='URL', default=None) self.settings.string(['cachedir'], @@ -185,6 +189,12 @@ class Morph(cliapp.Application): # treat settings['repo-alias'] as the sole source of prefixes for git # URL expansion. self.settings['repo-alias'] = morphlib.util.combine_aliases(self) + if self.settings['cache-server'] is None: + self.settings['cache-server'] = 'http://%s:8080/' % ( + self.settings['trove-host']) + if self.settings['bundle-server'] is None: + self.settings['bundle-server'] = 'http://%s/bundles/' % ( + self.settings['trove-host']) if 'MORPH_DUMP_PROCESSED_CONFIG' in os.environ: self.settings.dump_config(sys.stdout) sys.exit(0) |