arsa - archive and remove old Spacewalk/Red Hat Satellite/SUSE Manager actions

If you're maintaining your system landscape with Spacewalk, Red Hat Satellite or SUSE Manager you might also see many old entries while having a look in the action list after a while:

Zahlreiche Spacewalk-Aktionen

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):

1$ ./arsa.py -l
2Username: mylogin
3Password:
4things I'd like to clean (completed):
5-------------------------------------
6action #1494 ('Remote Command on mymachine.localdomain.loc.')

Removing all completed and archived actions (login credentials are provided by shell variables):

1$ SATELLITE_LOGIN=mylogin SATELLITE_PASSWORD=mypass ./arsa.py -r
2Archving action #1494 ('Remote Command on mymachine.localdomain.loc.')...
3Deleting action #1494 ('Remote Command on mymachine.localdomain.loc.')...
4Deleting action #1493 ('Remote Command on myothermachine.localdomain.loc.')...

The internal help lists additional parameters:

 1$ ./arsa.py -h
 2Usage: arsa.py [options]
 3
 4arsa.py is used to archive completed actions and remove archived actions on
 5Spacewalk, Red Hat Satellite and SUSE Manager. Login credentials are assigned
 6using the following shell variables:
 7SATELLITE_LOGIN  username                 SATELLITE_PASSWORD  password
 8It is also possible to create an authfile (permissions 0600) for usage with
 9this script. The first line needs to contain the username, the second line
10should consist of the appropriate password. If you're not defining variables
11or an authfile you will be prompted to enter your login information.
12Checkout the GitHub page for updates: https://github.com/stdevel/arsa
13
14Options:
15  --version             show program's version number and exit
16  -h, --help            show this help message and exit
17  -a FILE, --authfile=FILE
18                        defines an auth file to use instead of shell variables
19  -s SERVER, --server=SERVER
20                        defines the server to use
21  -q, --quiet           don't print status messages to stdout
22  -d, --debug           enable debugging outputs
23  -r, --remove          archives completed actions and removes all archived
24                        actions
25  -l, --list-only       only lists actions that would be archived

Feedback is welcome! 🙂

Translations: