106
Appendix B. RHN API Access
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.
This will be the FQDN of your satellite system.
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.
The syntax of this call is described at:
#
#
http://$HOST/rpc/api/auth/login/
my $session = $client->call(’auth.login’, ’username’, ’password’);
Содержание NETWORK 3.2 - PROVISIONING
Страница 1: ...Red Hat Network 3 2 Provisioning Reference Guide...
Страница 6: ......
Страница 16: ...6 Chapter 1 What is Red Hat Network...
Страница 48: ...38 Chapter 3 Red Hat Network Alert Notification Tool...
Страница 106: ...96 Chapter 6 Red Hat Network Registration Client...
Страница 114: ...104 Appendix A Command Line Config Management Tools...
Страница 118: ...108 Appendix B RHN API Access...
Страница 124: ...114 Glossary...