Skip to content

Commit

Permalink
Add AnsibleVariable to entities
Browse files Browse the repository at this point in the history
  • Loading branch information
dosas committed Nov 14, 2024
1 parent 05b2bb2 commit e66be96
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
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

0 comments on commit e66be96

Please sign in to comment.