ispman/scripts ldifupdate,1.8,1.9

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

Modified Files:
	ldifupdate 
Log Message:
added check & migration logic for vhost logdir/statdir

Index: ldifupdate
===================================================================
RCS file: /cvsroot/ispman/ispman/scripts/ldifupdate,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ldifupdate	9 Feb 2004 22:08:23 -0000	1.8
+++ ldifupdate	14 Feb 2004 19:46:39 -0000	1.9
@@ -25,11 +25,11 @@
 my $dummyUid = "999999";
 my $dummyGid = "999999";
 my $dummyPassword = "123456";
-my $mode;
+
 
 # private variables
 my ($ldif_in, $ldif_out, $entry, $basedn);
-my (%opts, $dn, $msg, $chng);
+my (%opts, $dn, $msg, $chng, $mode);
 
 
 
@@ -263,15 +263,62 @@
 	    ldif_action("add","userPassword",$dummyPassword);
 	}
 
+	# checking vhost ispmanVhostDocumentRoot
+	my $docroot=$entry->get_value("ispmanVhostDocumentRoot");
+	if ($docroot){
+	    if ($docroot =~ /^$ispmanVhostName\//){
+		$msg.="NOTICE: ispmanVhostDocumentRoot looks like old entry\n";
+		my ($fixeddocroot)=$docroot=~m/^$ispmanVhostName\/(.*)/;
+		$msg.="changing ispmanVhostDocumentRoot: \"$docroot\" -> \"$fixeddocroot\"\n";
+		ldif_action("replace","ispmanVhostDocumentRoot",$fixeddocroot);
+	    }
+	} else {
+	    $msg.="ERROR: ispmanVhostDocumentRoot is missing!\n";
+	}
+	
+	# checking vhost ispmanVhostScriptDir
+	my $scdir=$entry->get_value("ispmanVhostScriptDir");
+	if ($scdir){
+	    if ($scdir =~ /^$ispmanVhostName\//){
+		$msg.="NOTICE: ispmanVhostDocumentRoot looks like old entry\n";
+		my ($fixedscdir)=$scdir=~m/^$ispmanVhostName\/(.*)/;
+		$msg.="changing ispmanVhostScriptDir: \"$scdir\" -> \"$fixedscdir\"\n";
+		ldif_action("replace","ispmanVhostScriptDir",$fixedscdir);
+	    }
+	} else {
+	    $msg.="ERROR: ispmanVhostScriptDir is missing!\n";
+	}
+
 	# checking vhost ispmanVhostLogdir attribute
-	unless ($entry->get_value("ispmanVhostLogdir")){
+	my $logdir=$entry->get_value("ispmanVhostLogdir");
+	if ($logdir){
+	    if ($logdir =~ /^$ispmanVhostName\//){
+		$msg.="NOTICE: ispmanVhostLogdir looks like old entry\n";
+		my ($fixedlogdir)=$logdir=~m/^$ispmanVhostName\/(.*)/;
+		$msg.="changing ispmanVhostLogdir: \"$logdir\" -> \"$fixedlogdir\"\n";
+		ldif_action("replace","ispmanVhostLogdir",$fixedlogdir);
+	    }
+	} else {
 	    $msg.="WARNING: ispmanVhostLogdir is missing!\n";
+	    $msg.="adding ispmanVhostLogdir: \"logs\"\n";
+	    ldif_action("add","ispmanVhostLogdir","logs");
 	}
-
+	
 	# checking vhost ispmanVhostStatdir attribute
-	unless ($entry->get_value("ispmanVhostStatdir")){
+	my $statdir=$entry->get_value("ispmanVhostStatdir");
+	if ($statdir){
+	    if ($statdir =~ /^$ispmanVhostName\//){
+		$msg.="NOTICE: ispmanVhostStatdir looks like old entry\n";
+		my ($fixedstatdir)=$statdir=~m/^$ispmanVhostName\/(.*)/;
+		$msg.="changing ispmanVhostStatdir: \"$statdir\" -> \"$fixedstatdir\"\n";
+		ldif_action("replace","ispmanVhostStatdir",$fixedstatdir);
+	    }
+	} else {
 	    $msg.="WARNING: ispmanVhostStatdir is missing!\n";
+	    $msg.="adding ispmanVhostStatdir: \"stats\"\n";
+	    ldif_action("add","ispmanVhostStatdir","stats");
 	}
+
 	
     } elsif ($oc{'ispmanDomainUser'}){
 	



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
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.