Is it possible to remove Completed Actions and Failed Actions from the Red Hat Satellite server which are consuming database space?
Environment
- Red Hat Network Satellite 5.5
- Red Hat Satellite 5.6
- Red Hat Satellite 5.7
Issue
- Is it possible to remove
Completed Actions
andFailed Actions
from satellite server webui which are consuming database space? - How can we delete the archived actions from satellite server ?
- Need to remove old Failed actions and Completed Actions
- How do we clean up Completed Actions in Satellite ?
Resolution
-
To delete the
Completed Actions
you need to select them andArchive
it. Once those are archived then go to archived actions tab, select the actions and at the end of the page you have the buttonDelete Actions
which you can use to delete them. -
If there are many actions to be archived or to be deleted then you can also use API methods:
listAllActions
,archiveActions
,listArchivedActions
,deleteActions
which will help archive and delete the actions. -
Sample API code to archive failed, completed actions and then delete the archived actions:
#archive all Failed Actions
failed_list = client.schedule.listFailedActions(key)
action_ids=[]
for action in failed_list:
action_ids.append(action['id'])
archive_result=client.schedule.archiveActions(key,action_ids)
#archive all Completed Actions
completed_list = client.schedule.listCompletedActions(key)
action_ids=[]
for action in completed_list:
action_ids.append(action['id'])
archive_result=client.schedule.archiveActions(key,action_ids)
#delete all Archived Actions
archived_list = client.schedule.listArchivedActions(key)
action_ids=[]
for action in archived_list:
action_ids.append(action['id'])
del_result=client.schedule.deleteActions(key,action_ids)
-
If you are using Satellite v5.5 then ensure that the errata mentioned below or later is applied on the Satellite. This feature request is fulfilled within Red Hat Network Satellite 5.5 in errata RHBA-2013-0583
-
If you are using Red Hat Satellite 5.6, you can apply the workaround below while the errata is not released for bug #1030798.
-
To delete completed actions:
1.) Make sure you have a recent, working backup of the Satellite database. For further information refer to the article https://access.redhat.com/site/solutions/227743.
2.) Stop all other services:
# rhn-satellite stop
# service postgresql start
3.) Log in to the database, and delete the completed actions associated with user 1 in org 1:
# spacewalk-sql -i
rhnschema=# delete from rhnAction where id in
(select id from rhnUserActionOverview
where org_id = 1
and user_id = 1
and action_status_id = 2
and archived = 0);
[This can take a couple minutes to run.]
rhnschema=# quit
4.) Restart services:
# service postgresql stop
# rhn-satellite start
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
4 Comments
The SQL Query for failed actions seems to be:
rhnschema=# delete from rhnAction where id in (select id from rhnUserActionOverview where org_id = 1 and user_id = 1 and action_status_id = 3 and archived = 0);
It would be usefull if one can eliminate the 10000 items limit in the list of actions. This limit is there in both the api-calls and in the web-interface. It is now not possible to easily eliminate the actions older than 2 months because of this limt.
Would
spacewalk-report actions
help you to get IDs of actions you want to delete? Have not tried, but IMO you could be able to delete them via API then.Found a remark that states that one should do it via the system. IE get a list of actions related to the a specified system, and process these. This is not tested by me, but that would be a workable (albeit slower) workaround.