When you create a
custom task script, it is good practice to create a corresponding rollback
script. The rollback script undoes whatever change was made in the custom task
script. For example, if the custom task creates a resource, the rollback script
should remove the resource.
Of course, many
rollback scenarios require information about the state of the system before the
custom task was executed. The
library contains a
ChangeTracker API to enable you to reverse the effects
of a custom task. Using the
ChangeTracker API, you create an
UndoableResource object that collects state information
before creating a resource. During rollback, the
UndoableResource uses this information to restore the
resource to its previous state.
The ChangeTracker API contains two methods to enable rolling back of modification and deletion of a resource, respectively:
For an example of how to use the ChangeTracker API to create a rollback script, see the
Cisco UCS Director
CloupiaScript Cookbook available at the following URL: http://www.cisco.com/c/en/us/support/servers-unified-computing/ucs-director/products-programming-reference-guides-list.html.