summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevan Franchini <twitch153@gentoo.org>2015-05-16 22:26:44 -0400
committerDevan Franchini <twitch153@gentoo.org>2015-06-19 15:51:17 -0400
commit45afbf20372a5466f5704397944acb5f705402fc (patch)
tree6a864b5bacc9367db860df5746057a99cd8e86a4
parentconfig.py: Removes unnecessary .keys() call for option_to_config dict (diff)
downloadwebapp-config-45afbf20372a5466f5704397944acb5f705402fc.tar.gz
webapp-config-45afbf20372a5466f5704397944acb5f705402fc.tar.bz2
webapp-config-45afbf20372a5466f5704397944acb5f705402fc.zip
config.py: Adds optionality to --dir flag
If the --dir flag is not specified with actions that require the dir flag then webapp-config will default to the name of the package as the installation directory.
-rw-r--r--WebappConfig/config.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 06dfc4c..c9c0baf 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -429,8 +429,9 @@ class Config:
'--dir',
nargs = 1,
help = 'Install <application> into DIR under the'
- ' htdocs dir. The default is '
- + self.config.get('USER', 'g_installdir'))
+ ' htdocs dir. Not specifying using this flag'
+ ' will result in defaulting to the package '
+ ' name.')
inst_locs.add_argument('-h',
'--host',
@@ -891,7 +892,6 @@ class Config:
# Map command line options into the configuration
option_to_config = {'host' : 'vhost_hostname',
- 'dir' : 'g_installdir',
'server' : 'vhost_server',
'secure' : 'g_secure',
'user' : 'vhost_config_uid',
@@ -1009,6 +1009,15 @@ class Config:
pvr += argsvr[i]
self.config.set('USER', 'pvr', pvr)
+ if not options['dir'] and self.work != 'list_installs':
+ pn = self.config.get('USER', 'pn')
+ msg = 'Install dir flag not supplied, defaulting to '\
+ '"%(pn)s".' % {'pn': pn}
+
+ OUT.warn(msg)
+ self.config.set('USER', 'g_installdir', pn)
+ self.flag_dir = True
+
# --------------------------------------------------------------------
# Helper functions