我使用下面的脚本生成自定义勘误报告,我需要在其勘误报告中添加主机名。 脚本:
#!/bin/perl
use Frontier::Client;
my $url = 'http://mysathost.mydomain.com/rpc/api';
my $user = 'user';
my $pass = 'pass';
my $client = new Frontier::Client(url => $url);
my $session = $client->call('auth.login', $user, $pass);
my $c = $client->call('channel.listAllChannels', $session);
my @channels = map { $_->{'label'} } @{$c};
my %found = ();
my $start = $client->date_time(strftime("%Y%m%dT%H:%M:%S", localtime(time() - 604800 )));
my $end = $client->date_time(strftime("%Y%m%dT%H:%M:%S",
localtime(time())));
for (@channels) {
my $e = $client->call('channel.software.listErrata', $session, $_, $start, $end);
for (@{$e}) {
$found{$_->{'advisory_name'}} = $_->{'advisory_name'} . "\t" .
$_->{'advisory_synopsis'} . "\t" . $_->{'update_date'}
unless $found{$_->{'advisory_name'}};
}
}
@errata = values %found;
for (@errata) { print ("$_\n"); }
输出:
RHBA-2013:0558 rpm错误修复更新2/25/13
所以在上面的输出中需要主机名,如
RHBA-2013:0558 rpm错误修复更新2/25/13 Server01.domain.com