SUSE Manager/API

From CoolSolutionsWiki

SUSE Manager Main Page

Using the SUSE Manager XMLRPC API

The API is documented in the SUSE Manager Web UI, just browse to https.//<yourservername>/rhn/apidoc/index.jsp

It is based on XMLRPC and can be used from (almost) every programming language.

https.//<yourservername>/rhn/apidoc/scripts.jsp shows example code for Perl and Python


Using spacecmd

spacecmd is a command line tool to access the API. This is a simple way to explore, prototype, and shell-script API commands.

However, its less detailed than using the XMLRPC API directly !

Run

 spacecmd -u admin -p admin -s yourservername

(replace 'admin' with the respective username and password, and 'yourservername' with the FQDN of your SUSE Manager server)

This will start an interactive spacecmd session and you can use 'help' to explore possible commands.

If you pass it a command, it will run this command and return back to the shell prompt

 > spacecmd -u admin -p admin -s yourservername help
 Documented commands (type help <topic>):
 ========================================
 activationkey_addchildchannels         kickstart_setselinux                 
 activationkey_addconfigchannels        kickstart_updatevariable             
 ...

Finding out-of-date systems

The easiest way to find systems with out-of-date package is

 spacecmd -u admin -p admin report_outofdatesystems

This will list any system for which package updates are available.

A more elaborate way is to iterate through all systems and find their status

 spacecmd -u admin -p admin system_list

and then

 spacecmd -u admin -p admin system_listerrata <system>

for every system

The main difference between 'report_outofdatesystems' and 'system_listerrata' is that the former works on package updates while the latter works on patches. Patches provide additional information about package updates (i.e. if the update contains a security-relevant fix), but are not always available (i.e. for in-house repositories containing only packages).