Update cleanup cfg parameter to a more appropriate name

The current cfg cleanup_on_error is a bit of a misnomer, since cleanup
is not always dependent on there being an error.

This commit updates the cleanup cfg parameter to better reflect when
cleanup actually happens - cleanup_on_exit

Change-Id: I984e4b660705be8afa50a1e8605102832fd802dd
This commit is contained in:
Oded Le'Sage 2019-08-20 10:13:08 -05:00
parent 873772fa7f
commit 242992bf9a
8 changed files with 24 additions and 30 deletions

View File

@ -1,7 +1,7 @@
usage: shaker-all-in-one [-h] [--agent-join-timeout AGENT_JOIN_TIMEOUT]
[--agent-loss-timeout AGENT_LOSS_TIMEOUT]
[--artifacts-dir ARTIFACTS_DIR] [--book BOOK]
[--cleanup] [--cleanup-on-error] [--config-dir DIR]
[--cleanup] [--cleanup-on-exit] [--config-dir DIR]
[--config-file PATH]
[--custom-user-opts CUSTOM_USER_OPTS] [--debug]
[--dns-nameservers DNS_NAMESERVERS]
@ -16,7 +16,7 @@ usage: shaker-all-in-one [-h] [--agent-join-timeout AGENT_JOIN_TIMEOUT]
[--log-date-format DATE_FORMAT] [--log-dir LOG_DIR]
[--log-file PATH] [--matrix MATRIX]
[--no-report-on-error] [--nocleanup]
[--nocleanup-on-error] [--nodebug]
[--nocleanup-on-exit] [--nodebug]
[--nono-report-on-error] [--noos-insecure]
[--nouse-journal] [--nouse-json] [--nouse-syslog]
[--nowatch-log-file] [--os-auth-url <auth-url>]
@ -60,8 +60,7 @@ optional arguments:
--book BOOK Generate report in ReST format and store it into the
specified folder, defaults to env[SHAKER_BOOK].
--cleanup Cleanup the image and the flavor.
--cleanup-on-error Clean up the heat-stack upon any error occurred during
scenario execution.
--cleanup-on-exit Clean up the heat-stack when exiting execution.
--config-dir DIR Path to a config directory to pull `*.conf` files
from. This file set is sorted, so as to provide a
predictable parse order if individual options are
@ -152,7 +151,7 @@ optional arguments:
overridden all combinations are tested
--no-report-on-error Do not generate report for failed scenarios
--nocleanup The inverse of --cleanup
--nocleanup-on-error The inverse of --cleanup-on-error
--nocleanup-on-exit The inverse of --cleanup-on-exit
--nodebug The inverse of --debug
--nono-report-on-error
The inverse of --no-report-on-error

View File

@ -1,11 +1,11 @@
usage: shaker-cleanup [-h] [--cleanup] [--cleanup-on-error] [--config-dir DIR]
usage: shaker-cleanup [-h] [--cleanup] [--cleanup-on-exit] [--config-dir DIR]
[--config-file PATH] [--debug]
[--dns-nameservers DNS_NAMESERVERS]
[--external-net EXTERNAL_NET]
[--flavor-name FLAVOR_NAME] [--image-name IMAGE_NAME]
[--log-config-append PATH]
[--log-date-format DATE_FORMAT] [--log-dir LOG_DIR]
[--log-file PATH] [--nocleanup] [--nocleanup-on-error]
[--log-file PATH] [--nocleanup] [--nocleanup-on-exit]
[--nodebug] [--noos-insecure] [--nouse-journal]
[--nouse-json] [--nouse-syslog] [--nowatch-log-file]
[--os-auth-url <auth-url>] [--os-cacert <auth-cacert>]
@ -28,8 +28,7 @@ usage: shaker-cleanup [-h] [--cleanup] [--cleanup-on-error] [--config-dir DIR]
optional arguments:
-h, --help show this help message and exit
--cleanup Cleanup the image and the flavor.
--cleanup-on-error Clean up the heat-stack upon any error occurred during
scenario execution.
--cleanup-on-exit Clean up the heat-stack when exiting execution.
--config-dir DIR Path to a config directory to pull `*.conf` files
from. This file set is sorted, so as to provide a
predictable parse order if individual options are
@ -80,7 +79,7 @@ optional arguments:
defined by use_stderr. This option is ignored if
log_config_append is set.
--nocleanup The inverse of --cleanup
--nocleanup-on-error The inverse of --cleanup-on-error
--nocleanup-on-exit The inverse of --cleanup-on-exit
--nodebug The inverse of --debug
--noos-insecure The inverse of --os-insecure
--nouse-journal The inverse of --use-journal

View File

@ -1,4 +1,4 @@
usage: shaker-image-builder [-h] [--cleanup-on-error] [--config-dir DIR]
usage: shaker-image-builder [-h] [--cleanup-on-exit] [--config-dir DIR]
[--config-file PATH] [--debug]
[--dns-nameservers DNS_NAMESERVERS]
[--external-net EXTERNAL_NET]
@ -13,7 +13,7 @@ usage: shaker-image-builder [-h] [--cleanup-on-error] [--config-dir DIR]
[--log-config-append PATH]
[--log-date-format DATE_FORMAT]
[--log-dir LOG_DIR] [--log-file PATH]
[--nocleanup-on-error] [--nodebug]
[--nocleanup-on-exit] [--nodebug]
[--noos-insecure] [--nouse-journal] [--nouse-json]
[--nouse-syslog] [--nowatch-log-file]
[--os-auth-url <auth-url>]
@ -36,8 +36,7 @@ usage: shaker-image-builder [-h] [--cleanup-on-error] [--config-dir DIR]
optional arguments:
-h, --help show this help message and exit
--cleanup-on-error Clean up the heat-stack upon any error occurred during
scenario execution.
--cleanup-on-exit Clean up the heat-stack when exiting execution.
--config-dir DIR Path to a config directory to pull `*.conf` files
from. This file set is sorted, so as to provide a
predictable parse order if individual options are
@ -112,7 +111,7 @@ optional arguments:
If no default is set, logging will go to stderr as
defined by use_stderr. This option is ignored if
log_config_append is set.
--nocleanup-on-error The inverse of --cleanup-on-error
--nocleanup-on-exit The inverse of --cleanup-on-exit
--nodebug The inverse of --debug
--noos-insecure The inverse of --os-insecure
--nouse-journal The inverse of --use-journal

View File

@ -1,14 +1,14 @@
usage: shaker [-h] [--agent-join-timeout AGENT_JOIN_TIMEOUT]
[--agent-loss-timeout AGENT_LOSS_TIMEOUT]
[--artifacts-dir ARTIFACTS_DIR] [--book BOOK]
[--cleanup-on-error] [--config-dir DIR] [--config-file PATH]
[--cleanup-on-exit] [--config-dir DIR] [--config-file PATH]
[--custom-user-opts CUSTOM_USER_OPTS] [--debug]
[--dns-nameservers DNS_NAMESERVERS]
[--external-net EXTERNAL_NET] [--flavor-name FLAVOR_NAME]
[--image-name IMAGE_NAME] [--log-config-append PATH]
[--log-date-format DATE_FORMAT] [--log-dir LOG_DIR]
[--log-file PATH] [--matrix MATRIX] [--no-report-on-error]
[--nocleanup-on-error] [--nodebug] [--nono-report-on-error]
[--nocleanup-on-exit] [--nodebug] [--nono-report-on-error]
[--noos-insecure] [--nouse-journal] [--nouse-json]
[--nouse-syslog] [--nowatch-log-file] [--os-auth-url <auth-url>]
[--os-cacert <auth-cacert>]
@ -46,8 +46,7 @@ optional arguments:
to env[SHAKER_ARTIFACTS_DIR].
--book BOOK Generate report in ReST format and store it into the
specified folder, defaults to env[SHAKER_BOOK].
--cleanup-on-error Clean up the heat-stack upon any error occurred during
scenario execution.
--cleanup-on-exit Clean up the heat-stack when exiting execution.
--config-dir DIR Path to a config directory to pull `*.conf` files
from. This file set is sorted, so as to provide a
predictable parse order if individual options are
@ -112,7 +111,7 @@ optional arguments:
iperf.eenet.ee]}". When several parameters are
overridden all combinations are tested
--no-report-on-error Do not generate report for failed scenarios
--nocleanup-on-error The inverse of --cleanup-on-error
--nocleanup-on-exit The inverse of --cleanup-on-exit
--nodebug The inverse of --debug
--nono-report-on-error
The inverse of --no-report-on-error

View File

@ -241,9 +241,8 @@
# name, etc will be ignored when reusing an existing stack. (string value)
#reuse_stack_name = <None>
# Clean up the heat-stack upon any error occurred during scenario execution.
# (boolean value)
#cleanup_on_error = true
# Clean up the heat-stack when exiting execution. (boolean value)
#cleanup_on_exit = true
# Comma-separated list of scenarios to play. Each entity can be a file name or
# one of aliases: "misc/instance_metadata", "openstack/cross_az/full_l2",

View File

@ -174,10 +174,9 @@ OPENSTACK_OPTS = [
'specific scenario. Also certain configs e.g. '
'image-name, flavor-name, stack-name, etc will be '
'ignored when reusing an existing stack.'),
cfg.BoolOpt('cleanup-on-error',
default=(utils.env('SHAKER_CLEANUP_ON_ERROR') or True),
help='Clean up the heat-stack upon any error occurred during '
'scenario execution.'),
cfg.BoolOpt('cleanup-on-exit',
default=(utils.env('SHAKER_CLEANUP_ON_EXIT') or True),
help='Clean up the heat-stack when exiting execution.'),
]
SERVER_AGENT_OPTS = [

View File

@ -454,7 +454,7 @@ class Deployment(object):
def cleanup(self):
# cleanup the test stack first since it could be referencing resources
# in a support stack, and it was the last stack created.
if self.stack_id is not None and cfg.CONF.cleanup_on_error:
if self.stack_id is not None and cfg.CONF.cleanup_on_exit:
LOG.debug('Cleaning up the test stack: %s with id: %s',
self.stack_name, self.stack_id)
heat.wait_stack_deletion(self.openstack_client.heat, self.stack_id)
@ -464,7 +464,7 @@ class Deployment(object):
# Only stacks tracked during the run are deleted. e.g. if a support
# stack already existed, the current run doesn't "own" it so it
# won't be cleaned up.
if len(self.support_stacks) > 0 and cfg.CONF.cleanup_on_error:
if len(self.support_stacks) > 0 and cfg.CONF.cleanup_on_exit:
for stack in reversed(self.support_stacks):
LOG.debug('Cleaning up the support stack: %s with id: %s',
stack.name, stack.id)

View File

@ -108,7 +108,7 @@ def build_image_with_heat(openstack_client, image_name, flavor_name,
LOG.error(error_msg)
LOG.exception(e)
finally:
if stack_id and cfg.CONF.cleanup_on_error:
if stack_id and cfg.CONF.cleanup_on_exit:
LOG.debug('Cleaning up the stack: %s', stack_id)
openstack_client.heat.stacks.delete(stack_id)