Red Hat Training

A Red Hat training course is available for Red Hat Satellite

2.2. Perl Example

This example uses the system.listUserSystems call to retrieve a list of systems a user can access. The example prints the name of each system. The Frontier::Client Perl module is found in the perl-Frontier-RPC RPM file.
#!/usr/bin/perl
use Frontier::Client;

my $HOST = 'satellite.example.com';
my $user = 'username';
my $pass = 'password';

my $client = new Frontier::Client(url => "http://$HOST/rpc/api");
my $session = $client->call('auth.login',$user, $pass);

my $systems = $client->call('system.listUserSystems', $session);
foreach my $system (@$systems) {
   print $system->{'name'}."\n";
}
$client->call('auth.logout', $session);