Every task triggered using the web interface is registered as action – after a while this list is growing rapidly. I’m not very familiar with the database design of the software suites mentioned above but I think it’s basically a good idea to clean this up sometimes.
I was unable to find a button for this in the web interface – but a very good documented API for many programming languages (e.g. Perl, Python and Ruby): [click me!]
So I read the API and wrote a little Python script for this: arsa (archive spacewalk actions).
The script can be downloaded at no charge on GitHub: [click me!]
Notes and examples
By default the scripts prompts for login credentials to the management server (default: localhost). If you need to automate this you can use the following shell variables:
- SATELLITE_LOGIN – username
- SATELLITE_PASSWORD – appropriate password
Another possibility is to create a file containing the username (first line) and the password (second line) and hand it to the script (parameter -a / –authfile). The file needs to have permissions 0600.
See above for some examples.
Listing all completed actions (login credentials are prompted):
$ ./arsa.py -l Username: mylogin Password: things I'd like to clean (completed): ------------------------------------- action #1494 ('Remote Command on mymachine.localdomain.loc.')
Removing all completed and archived actions (login credentials are provided by shell variables):
$ SATELLITE_LOGIN=mylogin SATELLITE_PASSWORD=mypass ./arsa.py -r Archving action #1494 ('Remote Command on mymachine.localdomain.loc.')... Deleting action #1494 ('Remote Command on mymachine.localdomain.loc.')... Deleting action #1493 ('Remote Command on myothermachine.localdomain.loc.')...
The internal help lists additional parameters:
$ ./arsa.py -h Usage: arsa.py [options] arsa.py is used to archive completed actions and remove archived actions on Spacewalk, Red Hat Satellite and SUSE Manager. Login credentials are assigned using the following shell variables: SATELLITE_LOGIN username SATELLITE_PASSWORD password It is also possible to create an authfile (permissions 0600) for usage with this script. The first line needs to contain the username, the second line should consist of the appropriate password. If you're not defining variables or an authfile you will be prompted to enter your login information. Checkout the GitHub page for updates: https://github.com/stdevel/arsa Options: --version show program's version number and exit -h, --help show this help message and exit -a FILE, --authfile=FILE defines an auth file to use instead of shell variables -s SERVER, --server=SERVER defines the server to use -q, --quiet don't print status messages to stdout -d, --debug enable debugging outputs -r, --remove archives completed actions and removes all archived actions -l, --list-only only lists actions that would be archived
Feedback is welcome! 🙂