add getTablesAllRowAttribs
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@13806 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
df3f6b7ffb
commit
e680150395
@ -58,6 +58,7 @@ sub handled_commands
|
||||
getNodesAttribs => "tabutils",
|
||||
getTablesAllNodeAttribs => "tabutils",
|
||||
getTablesNodesAttribs => "tabutils",
|
||||
getTablesAllRowAttribs => "tabutils",
|
||||
setNodesAttribs => "tabutils",
|
||||
delEntries => "tabutils",
|
||||
getAttribs => "tabutils",
|
||||
@ -165,6 +166,10 @@ sub process_request
|
||||
{
|
||||
return getTablesNodesAttribs($request,$callback);
|
||||
}
|
||||
elsif ($command eq "getTablesAllRowAttribs")
|
||||
{
|
||||
return getTablesAllRowAttribs($request,$callback);
|
||||
}
|
||||
elsif ($command eq "setNodesAttribs")
|
||||
{
|
||||
return setNodesAttribs($request,$callback);
|
||||
@ -2568,6 +2573,100 @@ sub getTablesNodesAttribs
|
||||
$cb->(\%rsp);
|
||||
return;
|
||||
}
|
||||
# getTablesALLRowAttribs
|
||||
# Read all the rows from the input non-Node key'd
|
||||
# tables and get the input attributes
|
||||
# or get ALL attributes, if the word ALL is used.
|
||||
#<xcatrequest>
|
||||
#<clienttype>PCM</clienttype>
|
||||
#<command>getTablesALLRowAttribs</command>
|
||||
#<table>
|
||||
#<tablename>osimage</tablename>
|
||||
#<attr>imagename</attr>
|
||||
#<attr>synclists</attr>
|
||||
#</table>
|
||||
#<table>
|
||||
#<tablename>linuximage</tablename>
|
||||
#<attr>ALL</attr>
|
||||
#</table>
|
||||
# .
|
||||
# .
|
||||
# .
|
||||
#</xcatrequest>
|
||||
#
|
||||
#<xcatresponse>
|
||||
#<table>
|
||||
#<tablename>osimage</tablename>
|
||||
#<row>
|
||||
#<synclists>value1</synclists>
|
||||
#</row>
|
||||
#<row>
|
||||
#.
|
||||
#.
|
||||
#</row>
|
||||
#</table>
|
||||
#<table>
|
||||
#<tablename>linuximage</tablename>
|
||||
#<row>
|
||||
#<imagename>value</imagename>
|
||||
#<template>value</template>
|
||||
#.
|
||||
#.
|
||||
#</row>
|
||||
#<row>
|
||||
#.
|
||||
#.
|
||||
#</row>
|
||||
#</table>
|
||||
#</xcatresponse>
|
||||
#.
|
||||
#.
|
||||
#
|
||||
sub getTablesAllRowAttribs
|
||||
{
|
||||
my $request = shift;
|
||||
my $cb = shift;
|
||||
my $command = $request->{command}->[0];
|
||||
my %rsp;
|
||||
|
||||
# process each table in the request
|
||||
my $tables = $request->{table};
|
||||
foreach my $tabhash (@$tables) {
|
||||
|
||||
my $tablename = $tabhash->{tablename}->[0];
|
||||
my $attr = $tabhash->{attr};
|
||||
my @attrs=@$attr;
|
||||
my $tab=xCAT::Table->new($tablename);
|
||||
my %noderecs;
|
||||
# build the table name record
|
||||
@{$noderecs{table}->[0]->{tablename}} = $tablename;
|
||||
# if request for ALL attributes
|
||||
if (grep (/ALL/,@attrs)) { # read the schema and build array of all attrs
|
||||
@attrs=();
|
||||
my $schema = xCAT::Table->getTableSchema($tablename);
|
||||
my $desc = $schema->{descriptions};
|
||||
foreach my $c (@{$schema->{cols}}) {
|
||||
# my $space = (length($c)<7 ? "\t\t" : "\t");
|
||||
push @attrs, $c;
|
||||
}
|
||||
}
|
||||
# read all the attributes in this table
|
||||
my @recs = $tab->getAllAttribs(@attrs);
|
||||
my %tblrecs;
|
||||
foreach my $rec (@recs) {
|
||||
my %datseg=();
|
||||
foreach my $key (keys %$rec) {
|
||||
$datseg{$key} = $rec->{$key};
|
||||
}
|
||||
push @{$tblrecs{table}->[0]->{row}}, \%datseg;
|
||||
}
|
||||
push @{$rsp{"table"}}, @{$tblrecs{table}};
|
||||
} # end of all table processing
|
||||
# for checkin XML created
|
||||
# my $xmlrec=XMLout(\%rsp,RootName=>'xcatresponse',NoAttr=>1,KeyAttr=>[]);
|
||||
$cb->(\%rsp);
|
||||
return;
|
||||
}
|
||||
#
|
||||
# setNodesAttribs
|
||||
# Sets Nodes attributes for noderange for each of the tables supplied
|
||||
|
Loading…
Reference in New Issue
Block a user