From 836ef48234c573a002f9d67667710caccc7e24e7 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Tue, 25 Sep 2012 12:49:26 +0000 Subject: 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 --- morphlib/app.py | 16 +++++++++++++--- 1 file 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) -- cgit v1.2.1