Fix for bug #3391658, by Renan Guerra <renan.nannetti@gmail.com>
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10286 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
6c43dae75d
commit
3fc059acb4
@ -4909,6 +4909,19 @@ sub osver
|
||||
$ver =~ tr/\.//;
|
||||
$ver =~ s/[^0-9]*([0-9]+).*/$1/;
|
||||
}
|
||||
elsif (-f "/etc/lsb-release")#ubuntu
|
||||
{
|
||||
|
||||
$os = "ubuntu";
|
||||
open($relfile,"<","/etc/lsb-release");
|
||||
my @text = <$relfile>;
|
||||
close($relfile);
|
||||
foreach (@text){
|
||||
if ( $_ =~ /DISTRIB_RELEASE=(\S+)/ ) {
|
||||
$ver = $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
$os = "$os" . "$ver";
|
||||
return ($os);
|
||||
}
|
||||
|
@ -643,7 +643,13 @@ sub setup_DHCP
|
||||
${"xCAT_plugin::" . $modname . "::"}{process_request}
|
||||
->($cmdref, \&xCAT::Client::handle_response);
|
||||
|
||||
my $rc = xCAT::Utils->startService("dhcpd");
|
||||
|
||||
my $distro = xCAT::Utils->osver();
|
||||
my $serv = "dhcpd";
|
||||
if ( $distro =~ /ubuntu*/ ){
|
||||
$serv = "dhcp3-server";
|
||||
}
|
||||
my $rc = xCAT::Utils->startService($serv);
|
||||
if ($rc != 0)
|
||||
{
|
||||
return 1;
|
||||
@ -732,8 +738,14 @@ sub setup_DNS
|
||||
system("$XCATROOT/sbin/makenamed.conf");
|
||||
|
||||
# turn DNS on
|
||||
|
||||
my $rc = xCAT::Utils->startService("named");
|
||||
|
||||
my $distro = xCAT::Utils->osver();
|
||||
my $serv = "named";
|
||||
if ( $distro =~ /ubuntu*/ ){
|
||||
$serv = "bind9";
|
||||
}
|
||||
|
||||
my $rc = xCAT::Utils->startService($serv);
|
||||
if ($rc != 0)
|
||||
{
|
||||
return 1;
|
||||
|
@ -14,9 +14,15 @@ use Fcntl qw/:flock/;
|
||||
#This is a rewrite of DNS management using nsupdate rather than direct zone mangling
|
||||
|
||||
my $callback;
|
||||
my $service="named";
|
||||
my $distro = xCAT::Utils->osver();
|
||||
|
||||
|
||||
my $service="named";
|
||||
# is this ubuntu ?
|
||||
if ( $distro =~ /ubuntu*/ ){
|
||||
$service = "bind9";
|
||||
}
|
||||
|
||||
sub handled_commands
|
||||
{
|
||||
return {"makedns" => "site:dnshandler"};
|
||||
@ -461,7 +467,7 @@ sub process_request {
|
||||
}
|
||||
else
|
||||
{
|
||||
system("/sbin/service $service stop"); #named may otherwise hold on to stale journal filehandles
|
||||
system("service $service stop"); #named may otherwise hold on to stale journal filehandles
|
||||
}
|
||||
my $conf = get_conf();
|
||||
unlink $conf;
|
||||
@ -486,8 +492,8 @@ sub process_request {
|
||||
}
|
||||
else
|
||||
{
|
||||
system("/sbin/service $service stop");
|
||||
system("/sbin/service $service start");
|
||||
system("service $service stop");
|
||||
system("service $service start");
|
||||
}
|
||||
xCAT::SvrUtils::sendmsg("Restarting named complete", $callback);
|
||||
}
|
||||
@ -526,7 +532,11 @@ sub get_zonesdir {
|
||||
|
||||
sub get_conf {
|
||||
my $conf="/etc/named.conf";
|
||||
|
||||
# is this ubuntu ?
|
||||
if ( $distro =~ /ubuntu*/ ){
|
||||
$conf="/etc/bind/named.conf";
|
||||
}
|
||||
|
||||
my $sitetab = xCAT::Table->new('site');
|
||||
|
||||
unless ($sitetab)
|
||||
@ -571,7 +581,11 @@ sub get_dbdir {
|
||||
# Temp fix for bugzilla 73119
|
||||
chown(scalar(getpwnam('root')),scalar(getgrnam('named')),"/var/lib/named");
|
||||
return "/var/lib/named/";
|
||||
} else {
|
||||
}
|
||||
elsif (-d "/var/lib/bind") {
|
||||
return "/var/lib/bind/";
|
||||
}
|
||||
else {
|
||||
mkpath "/var/named/";
|
||||
chown(scalar(getpwnam('named')),scalar(getgrnam('named')),"/var/named");
|
||||
return "/var/named/";
|
||||
|
@ -7,6 +7,11 @@ if [ -f /etc/SuSE-release ]; then
|
||||
DIRECTORY=/var/lib/named
|
||||
fi
|
||||
FILE=/etc/named.conf
|
||||
|
||||
if [ -f /etc/lsb-release ]; then
|
||||
FILE=/etc/bind/named.conf
|
||||
fi
|
||||
|
||||
#unalias cp
|
||||
if [ -f $FILE ]; then
|
||||
cp -f $FILE ${FILE}.ORIG
|
||||
|
Loading…
Reference in New Issue
Block a user