added logEventsToTealDatabase to Util.pm
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8724 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
fed836b7a1
commit
d6e1fde72c
@ -4398,6 +4398,47 @@ sub logEventsToDatabase
|
||||
return (0, "");
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 logEventsToTealDatabase
|
||||
Logs the given events info to the TEAL's 'x_tealeventlog' database
|
||||
Arguments:
|
||||
arrayref -- A pointer to an array. Each element is a hash that contains an events.
|
||||
Returns:
|
||||
(ret code, error message)
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub logEventsToTealDatabase
|
||||
{
|
||||
my $pEvents = shift;
|
||||
if (($pEvents) && ($pEvents =~ /xCAT::Utils/))
|
||||
{
|
||||
$pEvents = shift;
|
||||
}
|
||||
|
||||
if (($pEvents) && (@$pEvents > 0))
|
||||
{
|
||||
my $currtime;
|
||||
my $tab = xCAT::Table->new("x_tealeventlog", -create => 1, -autocommit => 0);
|
||||
if (!$tab)
|
||||
{
|
||||
return (1, "The x_tealeventlog table cannot be opened.");
|
||||
}
|
||||
|
||||
foreach my $event (@$pEvents)
|
||||
{
|
||||
my @ret = $tab->setAttribs(undef, $event);
|
||||
if (@ret > 1) { return (1, $ret[1]); }
|
||||
}
|
||||
$tab->commit;
|
||||
}
|
||||
|
||||
return (0, "");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 StartService
|
||||
|
Loading…
Reference in New Issue
Block a user