Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 349491 - app-admin/webapp-config-1.50.16-r1 fails to parse subdomain placeholders in config
Summary: app-admin/webapp-config-1.50.16-r1 fails to parse subdomain placeholders in c...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords:
: 300250 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-23 13:36 UTC by Jochen
Modified: 2013-12-22 08:31 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Build output (build.log,2.54 KB, text/plain)
2010-12-23 13:40 UTC, Jochen
Details
Prevents rewritting of vhost_subdomain_# variables in /etc/vhosts/webapp-config. (0001-config.py-Prevents-overwriting-config-vars.patch,1.34 KB, patch)
2013-06-10 04:31 UTC, Devan Franchini (RETIRED)
Details | Diff
Prevents rewritting of vhost_subdomain_# variables in /etc/vhosts/webapp-config. (0001-config.py-Prevents-overwriting-config-vars.patch,1.40 KB, patch)
2013-06-21 20:47 UTC, Devan Franchini (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jochen 2010-12-23 13:36:28 UTC
On updating a webapp-managed application (like mediawiki), the config line
vhost_root="/var/domains/${vhost_subdomain_2}.${vhost_subdomain_1}/var/www/${vhost_subdomain_3}"
(vhost_config_dir="${vhost_root}/conf")
seems to fail with the attached error message.

Installing a new application with this config seems to work like expected.

Reproducible: Didn't try
Comment 1 Jochen 2010-12-23 13:40:26 UTC
Created attachment 257873 [details]
Build output
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2010-12-23 19:33:34 UTC
 * Fatal error: Bad value substitution:
 * Fatal error: 	section: [USER]
 * Fatal error: 	option : vhost_config_dir
 * Fatal error: 	key    : vhost_subdomain_2
 * Fatal error: 	rawval : \.${vhost_subdomain_1}/var/www/${vhost_subdomain_3}
 * Fatal error: Please note that webapp-config is not written in bash anymore
 * Fatal error: and that you cannot use the bash scripting features.

What if you expanded those variables in the config file to their actual values? The warning seems to indicate that.
Comment 3 Jochen 2010-12-25 22:41:05 UTC
(In reply to comment #2)
>  * Fatal error: Bad value substitution:
>  * Fatal error:        section: [USER]
>  * Fatal error:        option : vhost_config_dir
>  * Fatal error:        key    : vhost_subdomain_2
>  * Fatal error:        rawval :
> \.${vhost_subdomain_1}/var/www/${vhost_subdomain_3}
>  * Fatal error: Please note that webapp-config is not written in bash anymore
>  * Fatal error: and that you cannot use the bash scripting features.
> 
> What if you expanded those variables in the config file to their actual values?
> The warning seems to indicate that.
> 

I put in the values for a existing domain, the line looked like:
vhost_root="/var/domains/example.com/var/www/wiki"
(I hope I undertood you right with that)

Now the update would succeed, but I want to manage more than just one site on one domain :-)
Comment 4 Matija "hook" Šuklje 2012-05-08 22:54:24 UTC
I'm also trying to use webapp-config with that option and get the same issue with other vhost packages.

This is quite annoying.

Here's what the output of e.g. PHPMyAdmin is:

>>> Emerging (1 of 1) dev-db/phpmyadmin-3.5.0
 * phpMyAdmin-3.5.0-all-languages.tar.bz2 RMD160 SHA1 SHA256 size ;-) ...                                                                                                                             [ ok ]
* Fatal error: 
* Fatal error: There is a problem with your configuration file.
* Fatal error: webapp-config tried to read the variable "vhost_root"
* Fatal error: and received the following error:
* Fatal error: 
* Fatal error: Bad value substitution:
* Fatal error:  section: [USER]
* Fatal error:  option : vhost_root
* Fatal error:  key    : vhost_subdomain_2
* Fatal error:  rawval : .${vhost_subdomain_1}/${vhost_subdomain_3}
* Fatal error: 
* Fatal error: Please note that webapp-config is not written in bash anymore
* Fatal error: and that you cannot use the bash scripting features.
* Fatal error(s) - aborting
 * ERROR: dev-db/phpmyadmin-3.5.0 failed (setup phase):
 *   Could not read settings from webapp-config!
 * 
 * Call stack:
 *                 ebuild.sh, line  85:  Called pkg_setup
 *   phpmyadmin-3.5.0.ebuild, line  38:  Called webapp_pkg_setup
 *             webapp.eclass, line 392:  Called webapp_read_config
 *             webapp.eclass, line  60:  Called die
 * The specific snippet of code:
 *              ENVVAR=$(${WEBAPP_CONFIG} --query ${PN} ${PVR}) || die "Could not read settings from webapp-config!"
 * 
 * If you need support, post the output of 'emerge --info =dev-db/phpmyadmin-3.5.0',
 * the complete build log and the output of 'emerge -pqv =dev-db/phpmyadmin-3.5.0'.
 * The complete build log is located at '/var/tmp/portage/dev-db/phpmyadmin-3.5.0/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-db/phpmyadmin-3.5.0/temp/die.env'.
 * S: '/var/tmp/portage/dev-db/phpmyadmin-3.5.0/work/phpMyAdmin-3.5.0-all-languages'
Comment 5 Devan Franchini (RETIRED) gentoo-dev 2013-05-26 03:10:21 UTC
(In reply to Matija "hook" Šuklje from comment #4)
> I'm also trying to use webapp-config with that option and get the same issue
> with other vhost packages.
> 
> This is quite annoying.
> 
> Here's what the output of e.g. PHPMyAdmin is:
> 
> >>> Emerging (1 of 1) dev-db/phpmyadmin-3.5.0
>  * phpMyAdmin-3.5.0-all-languages.tar.bz2 RMD160 SHA1 SHA256 size ;-) ...   
> [ ok ]
> * Fatal error: 
> * Fatal error: There is a problem with your configuration file.
> * Fatal error: webapp-config tried to read the variable "vhost_root"
> * Fatal error: and received the following error:
> * Fatal error: 
> * Fatal error: Bad value substitution:
> * Fatal error:  section: [USER]
> * Fatal error:  option : vhost_root
> * Fatal error:  key    : vhost_subdomain_2
> * Fatal error:  rawval : .${vhost_subdomain_1}/${vhost_subdomain_3}
> * Fatal error: 
> * Fatal error: Please note that webapp-config is not written in bash anymore
> * Fatal error: and that you cannot use the bash scripting features.
> * Fatal error(s) - aborting
>  * ERROR: dev-db/phpmyadmin-3.5.0 failed (setup phase):
>  *   Could not read settings from webapp-config!
>  * 
>  * Call stack:
>  *                 ebuild.sh, line  85:  Called pkg_setup
>  *   phpmyadmin-3.5.0.ebuild, line  38:  Called webapp_pkg_setup
>  *             webapp.eclass, line 392:  Called webapp_read_config
>  *             webapp.eclass, line  60:  Called die
>  * The specific snippet of code:
>  *              ENVVAR=$(${WEBAPP_CONFIG} --query ${PN} ${PVR}) || die
> "Could not read settings from webapp-config!"
>  * 
>  * If you need support, post the output of 'emerge --info
> =dev-db/phpmyadmin-3.5.0',
>  * the complete build log and the output of 'emerge -pqv
> =dev-db/phpmyadmin-3.5.0'.
>  * The complete build log is located at
> '/var/tmp/portage/dev-db/phpmyadmin-3.5.0/temp/build.log'.
>  * The ebuild environment file is located at
> '/var/tmp/portage/dev-db/phpmyadmin-3.5.0/temp/die.env'.
>  * S:
> '/var/tmp/portage/dev-db/phpmyadmin-3.5.0/work/phpMyAdmin-3.5.0-all-
> languages'

So I just want to verify. The reason this is failing is because you are setting vhost_root to /var/www/${vhost_subdomain_2}.${vhost_subdomain_1}/${vhost_subdomain_3} 

I think the problem is that you're using the variable vhost_subdomain_1. If you try using a different numbered vhost_subdomain. For instance:

vhost_subdomain2="foo"
vhost_subdomain3="com"
vhost_subdomain4="bar"

then set vhost_root="/var/www/${vhost_subdomain_2}.${vhost_subdomain_3}/${vhost_subdomain_4}"

and try and and reinstall. This works correctly for me when I set them accordingly without errors.
Comment 6 Devan Franchini (RETIRED) gentoo-dev 2013-05-26 03:14:04 UTC
(In reply to Devan Franchini from comment #5)
> vhost_subdomain2="foo"
> vhost_subdomain3="com"
> vhost_subdomain4="bar"
> 
> then set
> vhost_root="/var/www/${vhost_subdomain_2}.${vhost_subdomain_3}/
> ${vhost_subdomain_4}"

vhost_subdomain_2="foo"
vhost_subdomain_3="com"
vhost_subdomain_4="bar"

Use these variables.
Comment 7 Devan Franchini (RETIRED) gentoo-dev 2013-06-10 04:31:45 UTC
Created attachment 350606 [details, diff]
Prevents rewritting of vhost_subdomain_# variables in /etc/vhosts/webapp-config.

This patch has been created to check to see if vhost_subdomain_# exists in the config file of /etc/vhosts/webapp-config before overwriting it with the split value of vhost_hostname, which is separated by the "." delimiter. This patch should fix the issue presented in bug 349491 as well as bug 300250.
Comment 8 Devan Franchini (RETIRED) gentoo-dev 2013-06-21 20:47:35 UTC
Created attachment 351604 [details, diff]
Prevents rewritting of vhost_subdomain_# variables in /etc/vhosts/webapp-config.

Commit message cleanup.
Comment 9 Devan Franchini (RETIRED) gentoo-dev 2013-06-21 20:51:46 UTC
(In reply to Devan Franchini from comment #7)
> Created attachment 350606 [details, diff] [details, diff]
> Prevents rewritting of vhost_subdomain_# variables in
> /etc/vhosts/webapp-config.
> 
> This patch has been created to check to see if vhost_subdomain_# exists in
> the config file of /etc/vhosts/webapp-config before overwriting it with the
> split value of vhost_hostname, which is separated by the "." delimiter. This
> patch should fix the issue presented in bug 349491 as well as bug 300250.

This patch implements an issue though, it will first check for vhost_subdomain_1 and will warn you that it doesn't exist. This isn't something that will affect your system but the best way to fix this would be to either set vhost_subdomain_1 = "${vhostname}" or just set it as any other variable of your choice. I will talk with blueness to see if we should by default set vhost_subdomain_1 to a value or not.
Comment 10 Anthony Basile gentoo-dev 2013-08-03 13:13:37 UTC
*** Bug 300250 has been marked as a duplicate of this bug. ***
Comment 11 Anthony Basile gentoo-dev 2013-08-03 13:28:43 UTC
(In reply to Devan Franchini from comment #9)
> (In reply to Devan Franchini from comment #7)
> > Created attachment 350606 [details, diff] [details, diff] [details, diff]
> > Prevents rewritting of vhost_subdomain_# variables in
> > /etc/vhosts/webapp-config.
> > 
> > This patch has been created to check to see if vhost_subdomain_# exists in
> > the config file of /etc/vhosts/webapp-config before overwriting it with the
> > split value of vhost_hostname, which is separated by the "." delimiter. This
> > patch should fix the issue presented in bug 349491 as well as bug 300250.
> 
> This patch implements an issue though, it will first check for
> vhost_subdomain_1 and will warn you that it doesn't exist. This isn't
> something that will affect your system but the best way to fix this would be
> to either set vhost_subdomain_1 = "${vhostname}" or just set it as any other
> variable of your choice. I will talk with blueness to see if we should by
> default set vhost_subdomain_1 to a value or not.

not sure what needs to be decided here.
Comment 12 Devan Franchini (RETIRED) gentoo-dev 2013-12-09 06:48:39 UTC
(In reply to Anthony Basile from comment #11)
> 
> not sure what needs to be decided here.
Did we decide what we wanted to do here?
Comment 13 Anthony Basile gentoo-dev 2013-12-09 13:40:37 UTC
(In reply to Devan Franchini from comment #12)
> (In reply to Anthony Basile from comment #11)
> > 
> > not sure what needs to be decided here.
> Did we decide what we wanted to do here?

the best way to fix this would be to either set vhost_subdomain_1 = "${vhostname}"

You can add new features as long as it doesn't break bacwards compat.  So go ahead with this for the next release.
Comment 14 Devan Franchini (RETIRED) gentoo-dev 2013-12-10 00:24:55 UTC
(In reply to Anthony Basile from comment #13)
> (In reply to Devan Franchini from comment #12)
> > (In reply to Anthony Basile from comment #11)
> > > 
> > > not sure what needs to be decided here.
> > Did we decide what we wanted to do here?
> 
> the best way to fix this would be to either set vhost_subdomain_1 =
> "${vhostname}"
> 
> You can add new features as long as it doesn't break bacwards compat.  So go
> ahead with this for the next release.

In order to do this we need to set a default value for vhost_subdomain_1 in the config file in /etc/vhosts/webapp-config, just to make what I was saying in the previous message a little more clear. I just want to confirm that. Should we still do this? If not, I'll try and find some other solution.
Comment 15 Anthony Basile gentoo-dev 2013-12-10 00:26:29 UTC
(In reply to Devan Franchini from comment #14)
> (In reply to Anthony Basile from comment #13)
> > (In reply to Devan Franchini from comment #12)
> > > (In reply to Anthony Basile from comment #11)
> > > > 
> > > > not sure what needs to be decided here.
> > > Did we decide what we wanted to do here?
> > 
> > the best way to fix this would be to either set vhost_subdomain_1 =
> > "${vhostname}"
> > 
> > You can add new features as long as it doesn't break bacwards compat.  So go
> > ahead with this for the next release.
> 
> In order to do this we need to set a default value for vhost_subdomain_1 in
> the config file in /etc/vhosts/webapp-config, just to make what I was saying
> in the previous message a little more clear. I just want to confirm that.
> Should we still do this? If not, I'll try and find some other solution.

yeah why not.  going forward we'll have this new feature as long as it doesn't *need* vhost_subdomain_1 in the config file, but its optional, then we'll retain backwards compatibility with people who just keep their old config.
Comment 16 Devan Franchini (RETIRED) gentoo-dev 2013-12-10 00:30:48 UTC
(In reply to Anthony Basile from comment #15)
> (In reply to Devan Franchini from comment #14)
> > (In reply to Anthony Basile from comment #13)
> > > (In reply to Devan Franchini from comment #12)
> > > > (In reply to Anthony Basile from comment #11)
> > > > > 
> > > > > not sure what needs to be decided here.
> > > > Did we decide what we wanted to do here?
> > > 
> > > the best way to fix this would be to either set vhost_subdomain_1 =
> > > "${vhostname}"
> > > 
> > > You can add new features as long as it doesn't break bacwards compat.  So go
> > > ahead with this for the next release.
> > 
> > In order to do this we need to set a default value for vhost_subdomain_1 in
> > the config file in /etc/vhosts/webapp-config, just to make what I was saying
> > in the previous message a little more clear. I just want to confirm that.
> > Should we still do this? If not, I'll try and find some other solution.
> 
> yeah why not.  going forward we'll have this new feature as long as it
> doesn't *need* vhost_subdomain_1 in the config file, but its optional, then
> we'll retain backwards compatibility with people who just keep their old
> config.

Yeah, webapp-config won't NEED vhost_subdomain_1 set, but it'll warn users if it's not:

* 
* There is a problem with your configuration file or an environment variable.
* webapp-config tried to read the variable "vhost_subdomain_1"
* and received the following error:
* 
* No option 'vhost_subdomain_1' in section: 'USER'

This is what happens with the patch applied and you try and install/uninstall a webapp. It's not necessary to add vhost_subdomain_1 but it will at least let users know it doesn't exist. I mean, I could always try and default vhost_subdomain_1 directly in the code if it isn't found. I'll try that first before we go ahead and change the default config file.
Comment 17 Devan Franchini (RETIRED) gentoo-dev 2013-12-10 00:34:33 UTC
Actually, let me scratch that, that's exactly what the code does. Duh, well. I guess I can change the config file.
Comment 18 Devan Franchini (RETIRED) gentoo-dev 2013-12-10 00:55:54 UTC
(In reply to Devan Franchini from comment #17)
> Actually, let me scratch that, that's exactly what the code does. Duh, well.
> I guess I can change the config file.

I'm conflicted. On one hand I can default vhost_subdomain_1 to vhost_hostname but that doesn't really solve the issue.

For example:

The split_hostname() function in config.py splits the hostname on a "." based delimiter. 

So if we did this in /etc/vhosts/webapp-config:

vhost_hostname="foo.bar.com"

If would attempt to set the vhost_subdomains variables to this:

vhost_subdomain_1="foo"
vhost_subdomain_2="bar"
vhost_subdomain_3="com"

This makes sense for the function, but if users are just trying to hard set the vhost_subdomains anyways I see no point in this feature. BUT, we don't know if every user does it this way or the split method.

A quick fix for the warning though might just be to have webapp-config's get() method ignore a vhost_subdomain's nonexistence and not warn the users since we're going to overwrite it anyways with whatever is in the contents of vhost_hostname with a "." delimiter. 

What's your take on this? I think having the get() method not warn users might be the best solution but I feel hesitant having a function mask some kind of warning, even if we're only using the get() method to check for vhost_subdomain_# once in the entire codebase of webapp-config. I'm leaving more towards masking the warning though.
Comment 19 Devan Franchini (RETIRED) gentoo-dev 2013-12-10 01:12:23 UTC
(In reply to Devan Franchini from comment #18)
> (In reply to Devan Franchini from comment #17)
> > Actually, let me scratch that, that's exactly what the code does. Duh, well.
> > I guess I can change the config file.
> 
> I'm conflicted. On one hand I can default vhost_subdomain_1 to
> vhost_hostname but that doesn't really solve the issue.
> 
> For example:
> 
> The split_hostname() function in config.py splits the hostname on a "."
> based delimiter. 
> 
> So if we did this in /etc/vhosts/webapp-config:
> 
> vhost_hostname="foo.bar.com"
> 
> If would attempt to set the vhost_subdomains variables to this:
> 
> vhost_subdomain_1="foo"
> vhost_subdomain_2="bar"
> vhost_subdomain_3="com"
> 
> This makes sense for the function, but if users are just trying to hard set
> the vhost_subdomains anyways I see no point in this feature. BUT, we don't
> know if every user does it this way or the split method.
> 
> A quick fix for the warning though might just be to have webapp-config's
> get() method ignore a vhost_subdomain's nonexistence and not warn the users
> since we're going to overwrite it anyways with whatever is in the contents
> of vhost_hostname with a "." delimiter. 
> 
> What's your take on this? I think having the get() method not warn users
> might be the best solution but I feel hesitant having a function mask some
> kind of warning, even if we're only using the get() method to check for
> vhost_subdomain_# once in the entire codebase of webapp-config. I'm leaving
> more towards masking the warning though.

Also, as I forgot to mention...the reason setting vhost_subdomain_1 to vhost_hostname isn't the best solution is because if a users does have the split() method then they would get a warning for however many vhost_subdomain_# there are.
Comment 20 Devan Franchini (RETIRED) gentoo-dev 2013-12-10 01:36:22 UTC
I went ahead and committed it to the experimental branch.

I think it should be fine, I explained in my commit message why I believe so:

http://git.overlays.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;h=a9cfa36cae677826fe1fc1bca82a3a603d85ad91