Not too long ago, in his blog ‘Three-O-Three is out!‘ my colleague Joe Werner talked about the flashy news in SUSE Manager 3.0.3. One highlight that indeed is around for a while in SUSE Manager, but recently also has been added to our documentation (well – the “wasn’t documented, wasn’t done” motto is a common one in healthcare settings, but also somehow well-known in IT …), is the spacecmd utility.
spacecmd provides a command-line interface for systems management. It is written in Python and uses the XML-RPC API provided by the server. You can manage nearly all aspects of SUSE Manager via spacecmd – means you can use it to perform most of the actions that you would usually perform using your web interface. These actions include managing systems, software channels, configuration channels, activation keys, and users. The spacecmd interface is available for SUSE Manager, Satellite and Spacewalk servers.
Even if spacecmd works out of the box with SUSE Manager, there is one thing you should be aware of: some of the most current features might be excluded from the traditional spacecmd command-line tool. To gain access to the latest feature additions just call ‘api api.getApiCallList’ from within spacecmd to list all currently available API commands formatted in JSON. After having received the list, you can then call these commands directly.
What is really cool is that spacecmd has two modes: interactive and single command. This means you can execute spacecmd as an interactive shell by running it without a command. But it can also run a single command by passing the command and the required arguments on the command line.
spacecmd is easy to use. To receive a list of all actions that are available, just enter the command ‘spacecmd help’. And if you need help for a particular command, just run ‘spacecmd — <command> –help’ – and TATATA you’ll get the answer.
To give you at least a “soupçon” of an idea what comprehensive options spacecmd offers, let’s take a closer look at one single area – activation keys. With spacecmd, you can:
- Create new activation keys
- List all existing activation keys
- Check the difference between two activation keys
- Enable, delete, clone, disable, and show details of an existing activation key
- Add child channels, configuration channels, available entitlements, existing groups, and a description to an activation key
- Enable and disable configuration channel deployment for an existing activation key
- Export activation key(s) to a JSON formatted file and import activation key(s) from JSON file(s)
- List the base channel, child channels, configuration channels, entitlements, groups and packages associated with and systems registered with an activation key
- Remove child channels, configuration channels, entitlements, groups or packages from an activation key
- Set the base channel for an activation key
- Set the ranked order of configuration channels
- Set the contact method to use for systems registered with a specific key
- Set a specific key as the universal default
- Set the usage limit of an activation key, which can be a number or ‘unlimited’
So, in short, and once again – what can spacecmd do for you?
- With spacecmd, you can manage almost all aspects of SUSE Manager. This really means that, via the spacecmd command line, you can execute nearly all commands that you usually perform via your WebUI. (Long live the command line !)
- You can access and use spacecmd as an interactive shell.
- Or you can pass single commands to spacecmd – without entering the interactive shell. This is an excellent option for shell scripts.
- In interactive mode, the tool supports tab completion for all commands, which is very helpful if you are looking for a method whose name you can’t quite remember.
- For finding specific systems, you have advanced search methods available. This removes the need to create system groups (well – nevertheless groups are still recommended!).
In case you want to dive deeper or check out spacecmd yourself, just have a look at the SUSE Manager documentation (thanks to Joseph and Karl for their excellent work!!).
… and now HAVE A LOT OF FUN!
Disclaimer: The text at hand has not been reviewed by a native speaker. If you find typos or language mistakes, please send them to me (firstname.lastname@example.org) – or if you like them, just keep them and feed them :-).