Commit 809fd88b authored by Ryan Jackson's avatar Ryan Jackson

Make dhcpd_makeconf restart subboss dhcp servers

When installing and/or restarting a new dhcpd.conf, make sure that
we run the subboss_dhcpd_makeconf script on subbosses as well.

I thought I pushed this before, but apparently I stashed it
and never applied it again.  Oops. :-(
parent c16ced23
......@@ -57,6 +57,9 @@ my %singlectlnet = ();
my $template = $DHCPD_TEMPLATE;
my $outfile = "/tmp/dhcpd_makeconf.$$";
my $OUT = *STDOUT;
my %subboss_dhcp_servers;
sub RestartSubbossDhcp($$);
#
# Parse command arguments. Once we return from getopts, all that should
......@@ -175,6 +178,7 @@ while (my %row = $query_result->fetchhash()) {
$tftp_subbosses{$node_id} = $row{"IP"};
} elsif ($row{"service"} eq 'dhcp') {
$dhcp_subbosses{$node_id} = $row{"IP"};
$subboss_dhcp_servers{$row{"subboss_id"}} = 1;
} elsif ($row{"service"} eq 'bootinfo') {
$bootinfo_subbosses{$node_id} = $row{"IP"};
}
......@@ -365,6 +369,11 @@ if ($install) {
fatal("Could not kill(TERM) process $dpid (dhcpd): $!");
}
}
for my $subboss (keys %subboss_dhcp_servers) {
RestartSubbossDhcp($subboss, $restart);
}
TBScriptUnlock();
}
exit(0);
......@@ -382,3 +391,17 @@ sub fatal {
" $msg\n");
}
sub RestartSubbossDhcp($$)
{
my ($subboss, $restart) = @_;
my $cmd = "ssh $subboss @prefix@/bin/subboss_dhcpd_makeconf";
$cmd .= " -r" if ($restart);
print "Restarting dhcpd on subboss $subboss\n";
if (system($cmd)) {
print STDERR "Failed to restart dhcpd on $subboss\n";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment