New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Temporary #31677
Temporary #31677
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,11 +252,38 @@ def __init__(self, message="", obj=None, show_content=True, suppress_extended_er | |
suppress_extended_error=suppress_extended_error, orig_exc=orig_exc) | ||
|
||
|
||
class AnsibleActionSkip(AnsibleRuntimeError): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We decided that we don't like using exceptions as flow control. But we don't need to fix this now. We will add comments here that say that other people shouldn't copy this pattern. We are going to change the action plugins that are using this to use a context manager to manager their temp directory as a replacement for this in the near future (2.6, probably) and revert the definition of these exceptions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is done. |
||
# These Exceptions are temporary, using them as flow control until we can get a better solution. | ||
# DO NOT USE as they will probably be removed soon. | ||
class AnsibleAction(AnsibleRuntimeError): | ||
''' Base Exception for Action plugin flow control ''' | ||
|
||
def __init__(self, message="", obj=None, show_content=True, suppress_extended_error=False, orig_exc=None, result=None): | ||
|
||
super(AnsibleAction, self).__init__(message=message, obj=obj, show_content=show_content, | ||
suppress_extended_error=suppress_extended_error, orig_exc=orig_exc) | ||
if result is None: | ||
self.result = {} | ||
else: | ||
self.result = result | ||
|
||
|
||
class AnsibleActionSkip(AnsibleAction): | ||
''' an action runtime skip''' | ||
pass | ||
|
||
def __init__(self, message="", obj=None, show_content=True, suppress_extended_error=False, orig_exc=None, result=None): | ||
super(AnsibleActionSkip, self).__init__(message=message, obj=obj, show_content=show_content, | ||
suppress_extended_error=suppress_extended_error, orig_exc=orig_exc, result=result) | ||
self.result.update({'skipped': True, 'msg': message}) | ||
|
||
|
||
class AnsibleActionFail(AnsibleRuntimeError): | ||
class AnsibleActionFail(AnsibleAction): | ||
''' an action runtime failure''' | ||
def __init__(self, message="", obj=None, show_content=True, suppress_extended_error=False, orig_exc=None, result=None): | ||
super(AnsibleActionFail, self).__init__(message=message, obj=obj, show_content=show_content, | ||
suppress_extended_error=suppress_extended_error, orig_exc=orig_exc, result=result) | ||
self.result.update({'failed': True, 'msg': message}) | ||
|
||
|
||
class AnsibleActionDone(AnsibleAction): | ||
''' an action runtime early exit''' | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not belong in shell. Not unless we move fixup_perms2() into shell.