mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
Add alias for group children of groups
This commit is contained in:
parent
d102b06474
commit
703345e9d8
@ -53,6 +53,8 @@ options:
|
||||
required: False
|
||||
type: list
|
||||
elements: str
|
||||
aliases:
|
||||
- groups
|
||||
state:
|
||||
description:
|
||||
- Desired state of the resource.
|
||||
@ -98,7 +100,7 @@ def main():
|
||||
inventory=dict(required=True),
|
||||
variables=dict(type='dict', required=False),
|
||||
hosts=dict(type='list', elements='str'),
|
||||
children=dict(type='list', elements='str'),
|
||||
children=dict(type='list', elements='str', aliases=['groups']),
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
)
|
||||
|
||||
|
||||
@ -77,6 +77,23 @@ def test_associate_on_create(run_module, admin_user, organization):
|
||||
assert set(group.children.all()) == set([child])
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_children_alias_of_groups(run_module, admin_user, organization):
|
||||
inv = Inventory.objects.create(name='test-inv', organization=organization)
|
||||
group = Group.objects.create(name='Test Group', inventory=inv)
|
||||
child = Group.objects.create(inventory=inv, name='child_group')
|
||||
result = run_module('tower_group', dict(
|
||||
name='Test Group',
|
||||
inventory='test-inv',
|
||||
groups=[child.name],
|
||||
state='present'
|
||||
), admin_user)
|
||||
assert not result.get('failed', False), result.get('msg', result)
|
||||
assert result['changed'] is True
|
||||
|
||||
assert set(group.children.all()) == set([child])
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_tower_group_idempotent(run_module, admin_user):
|
||||
# https://github.com/ansible/ansible/issues/46803
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user