tmsh::stateless¶
Description¶
Modifies the behavior of tmsh::create and tmsh::delete.
When stateless mode is disabled, an attempt to create an object that
already exists in the configuration results in an error, and an
attempt to delete an object that does not exist in the configuration
is an error.
When stateless mode is enabled, an attempt to create an object that
already exists in the configuration does not result in an error, and
an attempt to delete an object that does not exist in the
configuration does not result in an error.
Enabling stateless mode allows scripts to successfully run multiple
times with the same input.
The default value is disabled.
Examples¶
proc script::run {} {
# tmsh::stateless can be used to make the server (mcpd) stateless,
# create and delete operations always succeed regardless of whether
# objects are there or not, it prevents the script from having to do
# this like "if the object is there, modify it, else create it"
# the commands will always succeed (assuming permissions are OK)
tmsh::stateless enabled
tmsh::create /ltm virtual myApp ...
tmsh::delete /ltm virtual myOtherApp ...
tmsh::stateless disabled
# fails if myApp already exists
tmsh::create /ltm virtual myApp ...
# fails if myOtherApp doesn't exist
tmsh::delete /ltm virtual myOtherApp
}