![Lead Image © NASA Lead Image © NASA](/var/ezflow_site/storage/images/archive/2013/17/managing-linux-systems-with-spacewalk/space-walk-nasa.png/98357-1-eng-US/space-walk-nasa.png_medium.png)
Lead Image © NASA
Managing Linux systems with Spacewalk
Ground Control
The Spacewalk management framework has been featured in a previous ADMIN issue [1]; so, in this article, I will depart from the familiar web interface and instead show script-based solutions for handling tasks. The Spacewalk API offers a very comprehensive approach to performing every imaginable task on the server. However, admins do need to design fairly complex script constructs when it comes to handling extensive tasks on the server. The language you use for this purpose is not initially important, as long as it supports XML-RPC calls. What you will mostly find here is Perl and Python scripts.
The spacecmd
tool also relies on the Spacewalk server's XML-RPC-based API, but it abstracts its calls in handy options. The tool is either started in interactive mode and then waits for your instructions, or you can pass all the necessary options in at the command line. Thus, you can use the tool in your own Bash scripts. Some admins prefer to use Bash rather than a mile-long Python or Perl program. In this article, I compare and contrast the two variants.
Spacewalk API
Typically, any script that wants to talk to the Spacewalk API requires a client and a session object. The session object is used for authentication against the server and must be specified for each method call. To avoid the need to specify username and password for accessing the server in every single script, it makes sense to write a module and integrate this into your scripts.
Listing 1 shows an example of such a module for the Perl scripting language. You need to save the module either in the folder with the API scripts or preferably in the directory with your Perl modules. A call to perl -V
shows you where this is. The module requires an