mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
WIP Inclusion of the EE option in the payloads within the Organization and Projects. (#9145)
* add ee option on factories for organizations * add new lines * remove inventory from the options * remove line * remove line from projects * fix the tuple * fix lint problems
This commit is contained in:
parent
fd0c4ec869
commit
8ab7745e3a
@ -39,10 +39,20 @@ class Organization(HasCreate, HasInstanceGroups, HasNotifications, base.Base):
|
||||
"disassociate": True,
|
||||
})
|
||||
|
||||
|
||||
def payload(self, **kwargs):
|
||||
payload = PseudoNamespace(name=kwargs.get('name') or 'Organization - {}'.format(random_title()),
|
||||
description=kwargs.get('description') or random_title(10))
|
||||
|
||||
for fk_field in ('default_environment',):
|
||||
rel_obj = kwargs.get(fk_field)
|
||||
if rel_obj is None:
|
||||
continue
|
||||
elif isinstance(rel_obj, int):
|
||||
payload.update(**{fk_field: int(rel_obj)})
|
||||
elif hasattr(rel_obj, 'id'):
|
||||
payload.update(**{fk_field: rel_obj.id})
|
||||
else:
|
||||
raise AttributeError(f'Related field {fk_field} must be either integer of pkid or object')
|
||||
return payload
|
||||
|
||||
def create_payload(self, name='', description='', **kwargs):
|
||||
|
||||
@ -43,6 +43,16 @@ class Project(HasCopy, HasCreate, HasNotifications, UnifiedJobTemplate):
|
||||
'allow_override')
|
||||
update_payload(payload, fields, kwargs)
|
||||
|
||||
for fk_field in ('execution_environment', 'default_environment'):
|
||||
rel_obj = kwargs.get(fk_field)
|
||||
if rel_obj is None:
|
||||
continue
|
||||
elif isinstance(rel_obj, int):
|
||||
payload.update(**{fk_field: int(rel_obj)})
|
||||
elif hasattr(rel_obj, 'id'):
|
||||
payload.update(**{fk_field: rel_obj.id})
|
||||
else:
|
||||
raise AttributeError(f'Related field {fk_field} must be either integer of pkid or object')
|
||||
return payload
|
||||
|
||||
def create_payload(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user