[BlueOnyx:10726] Re: Error in behavior of vHost aliases

Greg Kuhnert gkuhnert at compassnetworks.com.au
Tue Jun 5 02:52:08 -05 2012


Hi William.

On 6/4/2012 12:44 PM, William Thackrey wrote:
> If we enter a new web alias or change the web alias in the BlueOnyx Virtual Site::Services::Web page, the vHost file (i.e site1) in /etc/httpd/conf/vhosts is written correctly.  However, if we clear the Web Server Aliases field, the vSite file does not get re-writen to reflect the change.  That is, a "null" entry in the field should clear the aliases in the vHost file.  It does not.  The previous entries remain.  Deleting or renaming the vHost file causes it to be written correctly.

I replicated what you were doing. In the log file, 99% of the logs are 
identical... There are some differences when you add an alias compared 
to deleting an alias.

*Add an alias*
Jun  5 06:57:00 node2 cced(smd)[x]: client 6:[y]: SET  98 "webAliases" 
"=" "&x.com&" "webAliasRedirects" "=" "1"
Jun  5 06:57:00 node2 cced(smd)[x]: client 
6:handlers/base/vsite/change_net_info.pl: SET  104 fqdn = 
"www2.compassnetworks.com.au" webAliases = "&x.com&" ipaddr = 
"203.26.211.122"
Jun  5 06:57:00 node2 cced(smd)[x]: client 
6:handlers/base/vsite/change_net_info.pl: SET succeeded

*Clear alias*
Jun  5 06:57:00 node2 cced(smd)[x]: client 6:[y]: SET  98 "webAliases" 
"=" "" "webAliasRedirects" "=" "1"

change_net_info.pl is the trigger to update the alias file for a vsite. 
The line below is from this file:

*_change_net_info.pl_: if ($vsite_new->{ipaddr} || $vsite_new->{fqdn} || 
$vsite_new->{webAliases})*

This IF statement appears to be our smoking smoking gun. What is this IF 
statement actually doing? $vsite_new is an object that contains only 
CHANGED fields. If we change an IP address, the new address will be in 
$vsite_new->{ipaddr}. If this field is not changed, that will be empty. 
Same goes for FQDN. Both of those fields are mandatory, so they will 
never be empty. However, webAliases is optional. When we clear that 
field, it will be an empty value. This if statement thinks nothing has 
changed requiring an update to the alias file whenever we clear the alias.

*Solution:*
I had a look at the triggers for this handler. There are three variables 
in the associated conf file.

    /# handle configuration of various things
    Vsite.fqdn      perl:base/vsite/change_net_info.pl      CONFIGURE
    Vsite.ipaddr    perl:base/vsite/change_net_info.pl      CONFIGURE
    Vsite.webAliases        perl:base/vsite/change_net_info.pl     
    CONFIGURE
    /

If the handler is only triggered whenever we update fqdn, ipaddr, or 
webAliases .... we can just comment out that if statement totally... 
because one of those things will change each and every time that handler 
runs. I've tested this on my box and it looks good to me.

Michael... Are you happy with that fix? The only issue would be if we 
add other triggers to that handler in future other than the three above.

Regards,
Greg.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.blueonyx.it/pipermail/blueonyx/attachments/20120605/e31dc4fe/attachment.html>


More information about the Blueonyx mailing list