Added function to find location of a given repository on the xCAT MN.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9382 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2011-04-22 15:58:37 +00:00
parent 58e27df477
commit 74ca2c8566

View File

@ -47,7 +47,8 @@ sub process_request {
'monls' => \&web_monls,
'discover' => \&web_discover,
'updatevpd' => \&web_updatevpd,
'createimage' => \&web_createimage
'createimage' => \&web_createimage,
'queryrepoloc' => \&web_queryrepoloc
);
#check whether the request is authorized or not
@ -493,6 +494,37 @@ sub web_gangliacheck() {
return;
}
sub web_queryrepoloc() {
my ( $request, $callback, $sub_req ) = @_;
# Get repository type
my $os = xCAT::Utils->osver();
# Get repository name
my $name = $request->{arg}->[1];
# Get location of repository
my $loc;
if ($os =~ /rh/) {
# Red Hat
$loc = `cat /etc/yum.repos.d/$name.repo | grep "baseurl"`;
} elsif ($os =~ /sles11/) {
# SUSE
$loc = `cat /etc/zypp/repos.d/$name.repo | grep "baseurl"`;
} else {
$loc = '';
}
$loc =~ s/baseurl=//g;
# Trim right and left
$loc =~ s/\s*$//;
$loc =~ s/^\s*//;
$callback->( { info => $loc } );
return;
}
sub web_rmcmonStart {
my ( $request, $callback, $sub_req ) = @_;
my $nodeRange = $request->{arg}->[1];