summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevan Franchini <twitch153@gentoo.org>2013-12-09 20:27:15 -0500
committerDevan Franchini <twitch153@gentoo.org>2014-01-24 22:13:03 -0500
commit50a697831e324edc8a2a50d31fa22729f3241e07 (patch)
treee638b9bf099b9eb487129716b227323e485b834f
parentWebappConfig/db.py: Removes printing of 'action' when calling prune_database(). (diff)
downloadwebapp-config-50a697831e324edc8a2a50d31fa22729f3241e07.tar.gz
webapp-config-50a697831e324edc8a2a50d31fa22729f3241e07.tar.bz2
webapp-config-50a697831e324edc8a2a50d31fa22729f3241e07.zip
WebappConfig/config.py: Prevents overwriting config variables.
When setting vhost_subdomain_# variables in /etc/vhosts/webapp-config they have a possibility of being overwritten by the split_hostname() function. To see this happen you should set vhost_subdomain_1 to a value and try and use it as a variable in your config file. This will then get overwritten by your vhost_hostname. This commit will prevent that from occuring while also having the get() method ignore the inexistence of a vhost_subdomain_# variable in your config file, due to the fact that if the variable does exist it will be used, and if the variable does not exist then it will get overwritten by a piece of vhost_hostname that is separated by the "." delimiter. X-Gentoo-Bug: 300250 X-Gentoo-Bug-URL: https://bugs.gentoo.org/300250 X-Gentoo-Bug: 349491 X-Gentoo-Bug-URL: https://bugs.gentoo.org/349491
-rw-r--r--WebappConfig/config.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/WebappConfig/config.py b/WebappConfig/config.py
index 9ade0b6..e251ca6 100644
--- a/WebappConfig/config.py
+++ b/WebappConfig/config.py
@@ -75,6 +75,8 @@ class BashConfigParser(configparser_ConfigParser):
'ures.'
if self.error_action == 0:
OUT.die(error)
+ elif self.error_action == 1 and re.search('^vhost_subdomain_\d+', option):
+ pass
elif self.error_action == 1:
OUT.warn(error)
return ''
@@ -994,7 +996,8 @@ class Config:
j = len(subdomains)
for i in subdomains:
- self.config.set('USER', 'vhost_subdomain_' + str(j), i)
+ if not self.config.get('USER', 'vhost_subdomain_' + str(j)):
+ self.config.set('USER', 'vhost_subdomain_' + str(j), i)
OUT.debug('Storing subdomain name', 8)