Skip to content

Document returning False in test=True mode - #42576

Merged
rallytime merged 1 commit into
saltstack:developfrom
lyft:allow-returning-false-in-test-mode
Aug 15, 2017
Merged

rallytime merged 1 commit into
saltstack:developfrom
lyft:allow-returning-false-in-test-mode

Conversation

@aneeshusa

Copy link
Copy Markdown
Contributor

Currently, in test mode states always return None even on failure.
This masks failed states in highstate output,
which instead just look like they are going to make changes.

In some cases states can determine if they will fail even on a dry run,
e.g., if an API call to a service to determine the state of a
resource fails due to invalid credentials or a missing parameter.

In these cases, allow returning a result of False even in dry runs
to enable catching more errors at testing time.

What does this PR do?

Document an extension to State module best practices

What issues does this PR fix or reference?

#42553

Previous Behavior

States always return None in test=True mode

New Behavior

States can return False on failure in test=True mode

Tests written?

No

Please review Salt's Contributing Guide for best practices.

Currently, in test mode states always return None even on failure.
This masks failed states in highstate output,
which instead just look like they are going to make changes.

In some cases states can determine if they will fail even on a dry run,
e.g., if an API call to a service to determine the state of a
resource fails due to invalid credentials or a missing parameter.

In these cases, allow returning a result of False even in dry runs
to enable catching more errors at testing time.
@ghost

ghost commented Jul 26, 2017

Copy link
Copy Markdown

@aneeshusa, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jfindlay, @thatch45 and @whiteinge to be potential reviewers.

@whiteinge
whiteinge self-requested a review July 27, 2017 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants