Viewing The Cid; Getting The Sgid; Sample Api Script - Red Hat NETWORK 3.2 - PROVISIONING Reference Manual

Hide thumbs Also See for NETWORK 3.2 - PROVISIONING:
Table of Contents

Advertisement

106
B.4. Viewing the cid
Like servers, channels have their own IDs. This value, the cid, is a required parameter for some meth-
ods, including set_base_channel and set_child_channels. Also like the sid, the cid can be obtained
through the RHN website. Just click on the name of a channel and view the end of the URL, some-
thing like, "details.pxt?cid=54".
B.5. Getting the sgid
System groups join servers and channels in having their own IDs. This value, the sgid, is a required
parameter for the set_group_membership method, for instance. Like the sid and cid, the sgid can
be obtained through the RHN website. Just click on the name of a system group and view the end
of the URL, something like, "details.pxt?sgid=334958". Note that the member parameter within the
set_group_membership method requires only yes or no as input to make the association.
B.6. Sample API Script
The following sample script depicts how an RHN API client should be constructed. Review the com-
ments and links for a full discussion of the calls made.
#!/usr/bin/perl -w
use strict;
use Frontier::Client;
use Data::Dumper;
############################################################################
# This is a sample script for use of the experimental RHN Management APIs. #
# The API is currently available using XMLRPC only, which is described in
# depth at:
#
# http://www.xmlrpc.com/
#
# We use the Frontier modules, available from:
#
# http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?dist=Frontier-RPC
#
############################################################################
############################################################################
#
Defining an XMLRPC session.
############################################################################
# Define the host first.
my $HOST = 'satellite.server.yourdomain.com';
# Now we create the client object that will be used throughout the session.
my $client = new Frontier::Client(url => "http://$HOST/rpc/api");
# Next, we execute a login call, which returns a session identifier that will
# be passed in all subsequent calls.
#
#
http://$HOST/rpc/api/auth/login/
my $session = $client->call('auth.login', 'username', 'password');
This will be the FQDN of your satellite system.
The syntax of this call is described at:
Appendix B. RHN API Access
#
#
#
#
#
#
#
#
#
#

Advertisement

Table of Contents
loading

Table of Contents