1 |
commit: 50a697831e324edc8a2a50d31fa22729f3241e07 |
2 |
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Dec 10 01:27:15 2013 +0000 |
4 |
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 25 03:13:03 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;h=50a69783 |
7 |
|
8 |
WebappConfig/config.py: Prevents overwriting config variables. |
9 |
|
10 |
When setting vhost_subdomain_# variables in /etc/vhosts/webapp-config |
11 |
they have a possibility of being overwritten by the split_hostname() |
12 |
function. To see this happen you should set vhost_subdomain_1 to a |
13 |
value and try and use it as a variable in your config file. This will |
14 |
then get overwritten by your vhost_hostname. This commit will prevent |
15 |
that from occuring while also having the get() method ignore the |
16 |
inexistence of a vhost_subdomain_# variable in your config file, |
17 |
due to the fact that if the variable does exist it will be used, and |
18 |
if the variable does not exist then it will get overwritten by a |
19 |
piece of vhost_hostname that is separated by the "." delimiter. |
20 |
|
21 |
X-Gentoo-Bug: 300250 |
22 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/300250 |
23 |
X-Gentoo-Bug: 349491 |
24 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/349491 |
25 |
|
26 |
--- |
27 |
WebappConfig/config.py | 5 ++++- |
28 |
1 file changed, 4 insertions(+), 1 deletion(-) |
29 |
|
30 |
diff --git a/WebappConfig/config.py b/WebappConfig/config.py |
31 |
index 9ade0b6..e251ca6 100644 |
32 |
--- a/WebappConfig/config.py |
33 |
+++ b/WebappConfig/config.py |
34 |
@@ -75,6 +75,8 @@ class BashConfigParser(configparser_ConfigParser): |
35 |
'ures.' |
36 |
if self.error_action == 0: |
37 |
OUT.die(error) |
38 |
+ elif self.error_action == 1 and re.search('^vhost_subdomain_\d+', option): |
39 |
+ pass |
40 |
elif self.error_action == 1: |
41 |
OUT.warn(error) |
42 |
return '' |
43 |
@@ -994,7 +996,8 @@ class Config: |
44 |
|
45 |
j = len(subdomains) |
46 |
for i in subdomains: |
47 |
- self.config.set('USER', 'vhost_subdomain_' + str(j), i) |
48 |
+ if not self.config.get('USER', 'vhost_subdomain_' + str(j)): |
49 |
+ self.config.set('USER', 'vhost_subdomain_' + str(j), i) |
50 |
|
51 |
OUT.debug('Storing subdomain name', 8) |