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

[WIP] safer task results #32480

Open
wants to merge 4 commits into
base: devel
from

Conversation

Projects
None yet
5 participants
@bcoca
Member

bcoca commented Nov 2, 2017

SUMMARY

Pass scaled down objects with needed data, but w/o methods

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

task result

ANSIBLE VERSION
2.5

@bcoca bcoca force-pushed the bcoca:safer_tr branch to 2a3bf6f Nov 2, 2017

@ansible ansible deleted a comment from ansibot Nov 2, 2017

@ansibot ansibot removed the ci_verified label Nov 2, 2017

@ansibot

This comment has been minimized.

Contributor

ansibot commented Nov 2, 2017

The test ansible-test sanity --test pep8 [?] failed with the following error:

lib/ansible/utils/helpers.py:51:5: E731 do not assign a lambda expression, use a def

click here for bot help

@ansibot

This comment has been minimized.

Contributor

ansibot commented Nov 2, 2017

The test ansible-test sanity --test pep8 [?] failed with the following error:

lib/ansible/utils/helpers.py:35:1: E302 expected 2 blank lines, found 1

click here for bot help

@alikins

This comment has been minimized.

Contributor

alikins commented Nov 2, 2017

What is this trying to fix?

Does TaskResult need to return the same class types?
Seems like task_executor should be able to return data objects instead of the
full classes (more or less a DTO...). Is something later type checking?

Task/Host classes seem like they should be responsible for providing
a copy of just their data. Ideally they would be using it internally (Task has-a TaskModel, etc).

class Chameleon(object):

This comment has been minimized.

@alikins

alikins Nov 2, 2017

Contributor

These (Chameleon, data_object_shim) are kind of unusual classes and method. So the comments/commit msgs need to explain why they are needed and how they accomplish that and why normal approaches are not applicable.

@bcoca

This comment has been minimized.

Member

bcoca commented Nov 2, 2017

I'm trying to avoid having callbacks influence play behaviour, currently they can alter the actual play objects in ways that user would not be able to easily audit, those behaviors should be apparent in playbook itself. This also can be a security issue once callbacks are easier to install, it is better to have the locks in the engine than the callbacks themselves.

As for class types, this is due to some checks in callbacks, not sure if we can/should support that though, i'm still trying to figure out the happy medium.

That is what taskresult itself does, but I was looking for 'shorter' approach than having to create 'data only' shims for every class.

@ansibot

This comment has been minimized.

Contributor

ansibot commented Nov 2, 2017

The test ansible-test sanity --test pep8 [?] failed with the following errors:

lib/ansible/utils/helpers.py:35:1: E302 expected 2 blank lines, found 1
lib/ansible/utils/helpers.py:72:5: E265 block comment should start with '# '

click here for bot help

@gundalow gundalow added the ci_verified label Nov 3, 2017

@abadger

This comment has been minimized.

Member

abadger commented Nov 6, 2017

I've been thinking about this and I'm no longer sure that we should do this because it is a backwards incompatible change. In our tree we only use callbacks for display but 3rd parties could be using those objects to make changes or other introspection that needs the original objects. We need to decide if this is something we feel we can break backwards compatibility on immediately or if we should take a different strategy.

@bcoca bcoca changed the title from safer task results to [WIP] safer task results Nov 8, 2017

@ansibot ansibot added the WIP label Nov 8, 2017

@ansibot ansibot added the stale_ci label Nov 16, 2017

@ansibot ansibot added bug and removed bugfix_pull_request labels Mar 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment