199
Appendix B. RHN API Access
In an effort to provide customers with added flexibility, RHN makes an application programming
interface (API) available. This interface can be found by clicking
Help
at the top-right corner of
the RHN website, then clicking
API
in the left navigation bar. Or you may go directly to:
https://
rhn.redhat.com/rpc/api/
. Use this URL for your XMLRPC server and your browser.
The RHN API is based upon XML-RPC, which allows distinct pieces of software on disparate systems
to make remote procedure calls using XML over HTTP. For this reason, any calls you make are
expected to meet the constraints of XML-RPC. You can find out more at
http://www.xmlrpc.com/
.
This section bypasses a list of available methods and classes in favor of tips for using the API
efficiently. These include steps for determining required values and a sample script that makes some
of the calls.
B.1. Using the auth Class and Getting the Session
It is worth noting that you will almost invariably use the auth class first. This class offers a single
method, login. Use this to establish an RHN session. It requires values for three parameters:
username, password, and duration. The first two come directly from your RHN account, while the third
is the length of time the session should last in seconds, typically 1200. It returns a session string than
can be used in all other methods.
B.2. Obtaining the system_id
Many of the methods require a value for the
system_id
parameter. This is the unique
alphanumeric value assigned to each system when registered to RHN. It can be found within
the
/etc/sysconfig/rhn/systemid
file on each machine. In addition, you may use the
download_system_id
method within the system class to obtain the value.
B.3. Determining the sid
Several methods require a value for the
sid
, or server ID, parameter. Note that this is different from
the
system_id
. You may determine the
sid
of a machine in two different ways. First, you can log
into the RHN website, click the name of a system, and view the
sid
at the end of the URL in the
location bar. It follows the "=" symbol and is part of a string that resembles the following: "index.pxt?
sid=1003486534". Second, you may use the
list_user_systems
method within the system class to
obtain a list of systems available to the user that contains the associated
sid
s.
B.4. Viewing the cid
Like servers, channels have their own IDs. This value, the
cid
, is a required parameter for some
methods, 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. It follows the "=" symbol, as part of a string that resembles the following: "details.pxt?cid=54".
B.5. Getting the sgid
System groups also have 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. It
Содержание NETWORK SATELLITE 5.2 - CHANNEL MANAGEMENT
Страница 1: ...Red Hat Network Satellite 5 2 Reference Guide Red Hat Network Satellite ...
Страница 2: ...Reference Guide Red Hat Network Satellite 5 2 Reference Guide Red Hat Network Satellite Edition 5 2 ...
Страница 10: ...x ...
Страница 30: ...Chapter 2 Red Hat Update Agent 18 Figure 2 11 Available Package Updates ...
Страница 46: ...34 ...
Страница 68: ...56 ...
Страница 162: ...150 ...
Страница 174: ...162 ...
Страница 186: ...174 ...
Страница 259: ...247 Appendix D Revision History Revision History Revision 1 0 ...
Страница 260: ...248 ...
Страница 268: ...256 ...