change one typo in sles.pm, and also make the code tidy

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5893 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
mxi1 2010-04-27 11:57:04 +00:00
parent f19057cdeb
commit b5a12e4824
2 changed files with 8 additions and 23 deletions

View File

@ -1239,9 +1239,7 @@ sub setupNFSTree {
my $nfsdirectory = $2;
if($nfsserver eq $sip) { # on the service node
if (-d $nfsdirectory) {
# nothing to do
} else {
unless (-d $nfsdirectory) {
if (-e $nfsdirectory) {
unlink $nfsdirectory;
}
@ -1261,9 +1259,7 @@ sub setupNFSTree {
$callback->({data=>["now $nfsdirectory is exported!"]});
$cmd = "cat /etc/exports";
@entries = xCAT::Utils->runcmd($cmd, 0);
if(my $entry = grep /\Q$nfsdirectory\E/, @entries) {
# nothing to do
}else {
unless (my $entry = grep /\Q$nfsdirectory\E/, @entries) {
# if no entry in /etc/exports, one entry with default options will be added
$cmd = qq{echo "$nfsdirectory *(rw,no_root_squash,sync,no_subtree_check)" >> /etc/exports};
xCAT::Utils->runcmd($cmd, 0);
@ -1284,9 +1280,7 @@ sub setupStatemnt {
my $nfsdirectory = $2;
if($sip eq inet_ntoa(inet_aton($nfsserver))) {
if (-d $nfsdirectory) {
# nothing to do
} else {
unless (-d $nfsdirectory) {
if (-e $nfsdirectory) {
unlink $nfsdirectory;
}
@ -1306,9 +1300,7 @@ sub setupStatemnt {
$cmd = "cat /etc/exports";
@entries = xCAT::Utils->runcmd($cmd, 0);
if(my $entry = grep /\Q$nfsdirectory\E/, @entries) {
if ($entry =~ m/rw/) {
# nothing to do
} else {
unless ($entry =~ m/rw/) {
$callback->({data => ["The $nfsdirectory should be with rw option in /etc/exports"]});
}
} else {

View File

@ -1163,9 +1163,7 @@ sub setupNFSTree {
if($nfsserver eq $sip) { # on the service node
if (-d $nfsdirectory) {
#nothing to do
} else {
unless (-d $nfsdirectory) {
if (-e $nfsdirectory) {
unlink $nfsdirectory;
}
@ -1185,9 +1183,7 @@ sub setupNFSTree {
$callback->({data=>["now $nfsdirectory is exported!"]});
$cmd = "cat /etc/exports";
@entries = xCAT::Utils->runcmd($cmd, 0);
if(my $entry = grep /\Q$nfsdirectory\E/, @entries) {
# nothing to do
} else {
unless (my $entry = grep /\Q$nfsdirectory\E/, @entries) {
#if there's no entry in /etc/exports, one with default option is added
$cmd = qq{echo "$nfsdirectory *(rw,no_root_squash,sync,no_subtree_check)" >> /etc/exports};
xCAT::Utils->runcmd($cmd, 0);
@ -1207,9 +1203,7 @@ sub setupStatemnt {
my $nfsserver = $1;
my $nfsdirectory = $2;
if($sip eq inet_ntoa(inet_aton($nfsserver))) {
if (-d $nfsdirectory) {
# nothing to do
} else {
unless (-d $nfsdirectory) {
if (-e $nfsdirectory) {
unlink $nfsdirectory;
}
@ -1229,8 +1223,7 @@ sub setupStatemnt {
$cmd = "cat /etc/exports";
@entries = xCAT::Utils->runcmd($cmd, 0);
if(my $entry = grep /\Q$nfsdirectory\E/, @entries) {
if ($entry =~ m/rw/) {
}esle {
unless ($entry =~ m/rw/) {
$callback->({data=>["The $nfsdirectory should be with rw option in /etc/exports"]});
}
}else {