Skip to content
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

Basic Ansible Typing System #441

Open
wants to merge 8 commits into
base: devel
Choose a base branch
from
Open

Basic Ansible Typing System #441

wants to merge 8 commits into from

Conversation

matburt
Copy link
Member

@matburt matburt commented Apr 7, 2020

Based on some work peter did to put an object structure around some basic ansible things.

Peter Sprygada added 8 commits December 5, 2019 12:39
This commit adds a new typing system to ansible-runner that allows
for programmatically buiding playbook and inventory objects.  The added
objects for playbook and inventory allow developers to construct a
playbook and/or inventory using native Python constructs instead of
having to create them out-of-band.  Once created the objects can be
serialized to JSON and injected directly to ansible-runner for
execution.

This commit also updates Pipefil with missing developer packages and
adds python coverage reporting to tox.

Signed-off-by: Peter Sprygada <[email protected]>
This commit removes some helper functions that are not needed for this
commit as they are causing unit test failures.  The helper functions
will be resubmitted when they are needed.

Signed-off-by: Peter Sprygada <[email protected]>
This commit switches over to using ensure_str as the type conversion
function

Signed-off-by: Peter Sprygada <[email protected]>
This commit addresses a situation where vars where assigned directly to
the child object instead of the vars attribute.  Vars are now properly
serialized and deserialized to the vars attribute.

Signed-off-by: Peter Sprygada <[email protected]>
This commit adds usage examples for how to use ```Playbook``` and
```Inventory``` objects in Python code to construct objects that can
serialized to valid Ansible playbooks and inventory files.

Signed-off-by: Peter Sprygada <[email protected]>
Thsi commit adds a new usage example that demonstrates how the
`Inventory` and `Playbook` objects can be used as input the the `run()`
method for executing playbooks.

Signed-off-by: Peter Sprygada <[email protected]>
This commit now handles mutually exclusive checks during serialization
instead of at set.  Before this change, mutually exclusive item checks
would be missed when attributes where not scalar values.  This change
allows adds a new attribute property `mutually_exclusive_priority` that
allows an object to set the relative priority of an attribute within a
mutually exclusive group.

Signed-off-by: Peter Sprygada <[email protected]>
This commit refactors the mutually_exclusive_with property to
mutually_exclusive_group to better relay its function.  The property can
be used to setup a group of attributes where by at most one attribute is
used to serialize the data structure.

Signed-off-by: Peter Sprygada <[email protected]>
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.

1 participant