[debian-edu-commits] r80334 - in branches/wheezy/debian-edu-config: debian share/debian-edu-config/tools
pere at alioth.debian.org
pere at alioth.debian.org
Fri Jun 7 13:58:19 UTC 2013
Author: pere
Date: 2013-06-07 13:58:19 +0000 (Fri, 07 Jun 2013)
New Revision: 80334
Modified:
branches/wheezy/debian-edu-config/debian/changelog
branches/wheezy/debian-edu-config/share/debian-edu-config/tools/subnet-change
Log:
* Made subnet-change more complete, teach it how to update
/etc/munin/debian-edu-munin-node.conf.
* Report the files that need a manual update at the end of the
script run, to make the text easier to see.
Modified: branches/wheezy/debian-edu-config/debian/changelog
===================================================================
--- branches/wheezy/debian-edu-config/debian/changelog 2013-06-07 04:47:07 UTC (rev 80333)
+++ branches/wheezy/debian-edu-config/debian/changelog 2013-06-07 13:58:19 UTC (rev 80334)
@@ -8,6 +8,12 @@
- Danish, thanks to Joe Dalton. (Closes: #711185)
- French, thanks to Guilhelm Panaget.
+ [ Petter Reinholdtsen ]
+ * Made subnet-change more complete, teach it how to update
+ /etc/munin/debian-edu-munin-node.conf.
+ * Report the files that need a manual update at the end of the
+ script run, to make the text easier to see.
+
-- Holger Levsen <holger at debian.org> Thu, 30 May 2013 13:46:34 +0200
debian-edu-config (1.705) unstable; urgency=low
Modified: branches/wheezy/debian-edu-config/share/debian-edu-config/tools/subnet-change
===================================================================
--- branches/wheezy/debian-edu-config/share/debian-edu-config/tools/subnet-change 2013-06-07 04:47:07 UTC (rev 80333)
+++ branches/wheezy/debian-edu-config/share/debian-edu-config/tools/subnet-change 2013-06-07 13:58:19 UTC (rev 80334)
@@ -102,16 +102,14 @@
replace_interfaces_ip("/etc/network/interfaces", $oldsubnet, $newsubnet);
replace_ips("/etc/samba/smb-debian-edu.conf", $oldsubnet, $newsubnet);
replace_ips("/etc/squid/squid.conf", $oldsubnet, $newsubnet);
+change_muninnode("/etc/munin/debian-edu-munin-node.conf", $oldsubnet,
+ $newsubnet);
# Not needed on main-server (but on all clients):
# /etc/samba/smb-debian-edu-client.conf
-my @files = qw(/etc/hosts.allow /etc/munin/debian-edu-munin-node.conf);
+my @files = qw(/etc/hosts.allow);
-for my $file (@files) {
- print "info: You also need to edit $file\n";
-}
-
# Make sure bind see all zones in LDAP, also when the zones change
my $dnszoneupdate =
"/usr/share/debian-edu-config/tools/ldap2bind-updatezonelist";
@@ -129,6 +127,10 @@
print "info: Removing generated file $file\n";
}
+for my $file (@files) {
+ print "info: You also need to edit $file\n";
+}
+
print <<EOF;
info: Now you need to reboot to update the IP setup and generate a few files.
@@ -637,3 +639,38 @@
change_ldap_objects($ldapref, '(|(objectclass=ipHost)(objectclass=goServer))',
\&change_gosa_record, \%data);
}
+
+sub change_muninnode {
+ my ($filename, $oldsubnet, $newsubnet) = @_;
+
+ if (open(my $in, "<", $filename) && open(my $out, ">", "$filename.new")) {
+ my $changed = 0;
+ while (my $line = <$in>) {
+ chomp $line;
+ print "$line\n";
+ if ($line =~ m/^allow \^(\d+)\\\.(\d+)\\\.(\d+)\\\.(\d+)\$$/) {
+ my ($a1, $a2, $a3, $a4) = ($1, $2, $3, $4);
+ my $addr = "$a1.$a2.$a3.$a4";
+ my $newaddr =
+ replace_matching_addr($oldsubnet, $newsubnet, $addr);
+ print "$addr $newaddr\n";
+ if ($addr ne $newaddr) {
+ $line = "allow ^" . join('\.', split(/\./, $newaddr))
+ . "\$\n";
+ $changed = 1;
+ }
+ }
+ print $out "$line\n";
+ }
+ close($out);
+ close($in);
+ if ($changed) {
+ print "info: changed $filename\n";
+ rename "$filename.new", $filename;
+ } else {
+ unlink "$filename.new";
+ }
+ } else {
+ print "error: Unable to read from file $filename or write to $filename.new\n";
+ }
+}
More information about the debian-edu-commits
mailing list