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

Add AnsibleVariable to entities #1220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -9146,6 +9146,47 @@ def sync(self, synchronous=True, timeout=None, **kwargs):
return _handle_response(response, self._server_config, synchronous, timeout)


class AnsibleVariable(
Entity,
EntityCreateMixin,
EntityReadMixin,
EntityDeleteMixin,
EntitySearchMixin,
EntityUpdateMixin,
):
"""A representation of a Ansible Variable entity."""

def __init__(self, server_config=None, **kwargs):
self._fields = {
'variable': entity_fields.StringField(required=True),
'ansible_role_id': entity_fields.IntegerField(required=True),
'default_value': entity_fields.StringField(),
'override_value_order': entity_fields.StringField(),
'description': entity_fields.StringField(),
'validator_type': entity_fields.ListField(),
'validator_rule': entity_fields.StringField(),
'variable_type': entity_fields.StringField(
default='string',
choices=(
'string',
'boolean',
'integer',
'real',
'array',
'hash',
'yaml',
'json',
),
),
'merge_overrides': entity_fields.BooleanField(),
'merge_default': entity_fields.BooleanField(),
'avoid_duplicates': entity_fields.BooleanField(),
'override': entity_fields.BooleanField(),
}
self._meta = {'api_path': 'ansible/api/ansible_variables'}
super().__init__(server_config=server_config, **kwargs)


class TablePreferences(
Entity,
EntityCreateMixin,
Expand Down
1 change: 1 addition & 0 deletions tests/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def test_init_succeeds(self):
entities.ActivationKey,
entities.AlternateContentSource,
entities.AnsibleRoles,
entities.AnsibleVariable,
entities.AnsiblePlaybooks,
entities.Architecture,
entities.ArfReport,
Expand Down
Loading