ispman/lib/ISPMan ApacheMan.pm,1.46,1.47

[email protected]
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/lib/ISPMan
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10530/lib/ISPMan

Modified Files:
	ApacheMan.pm 
Log Message:
fixed vhost A record generation (single webhost)
added logic for apacheVhostsVIP (multiple webhosts)

Index: ApacheMan.pm
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/ISPMan/ApacheMan.pm,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- ApacheMan.pm	1 Feb 2004 15:20:11 -0000	1.46
+++ ApacheMan.pm	1 Feb 2004 23:37:04 -0000	1.47
@@ -342,16 +342,44 @@
    # write data to LDAP
    if (! $self->addNewEntryWithData($dn, $data)){ return 0};
 	
-   for (@$webhosts){
-	   
-       # add new A-record for webhost
-       # NOTICE: for multiple webhosts this will create multiple a-records which
-       #         will act as simple round-robin loadbalancing.
-       #         Change them manually for proper hardware loadbalancing!
-       $self->addVhostDNSRecord($r->param("ispmanDomain"), $r->param("ispmanVhostName"), $self->getHostIp($_));
+   # add new A-record for webhost(s)
+   if ($#$webhosts==0){
+       
+       # only single webhost is defined
+       # (ispmanVhostIpAddress overrides webhost ip)
+       my $ip=(($r->param("ispmanVhostIpAddress") eq "*") ? 
+	       $self->getHostIp(@$webhosts[0]) : $r->param("ispmanVhostIpAddress"));
+       $self->addVhostDNSRecord($r->param("ispmanDomain"),
+				$r->param("ispmanVhostName"),
+				$ip);
+   } else {
 
-       # add process fro vhost creation
-       $self->addProcessToHost($r->param("ispmanDomain"), $_, "AddVirtualHost", $r->param("ispmanVhostName"));
+       # multiple webhosts are defined
+       # (apacheVhostsVIP overrides webhost ips)
+
+       if ($self->getConf("apacheVhostsVIP")=~/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/){
+	   $self->addVhostDNSRecord($r->param("ispmanDomain"),
+				    $r->param("ispmanVhostName"),
+				    $self->getConf("apacheVhostsVIP"));
+       } else {
+
+	   # this will create multiple a-records which
+	   # will act as simple round-robin loadbalancing.
+	   # Change them manually for proper hardware loadbalancing!
+	   for (@$webhosts){
+	       $self->addVhostDNSRecord($r->param("ispmanDomain"),
+					$r->param("ispmanVhostName"),
+					$self->getHostIp($_));
+	   }
+       }
+
+       # add process for each webhost
+       for (@$webhosts){
+	   $self->addProcessToHost($r->param("ispmanDomain"),
+				   $_,
+				   "AddVirtualHost",
+				   $r->param("ispmanVhostName"));
+       }
    }
 
    # add process for vhost directory creation



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.