mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
Avoid doing an OPTIONS call unless we know it is a related type we export
This commit is contained in:
parent
14b5f63bd8
commit
f7825aefeb
@ -93,14 +93,19 @@ class ApiV2(base.Base):
|
||||
continue
|
||||
|
||||
rel = related_endpoint._create()
|
||||
is_relation = rel.__class__.__name__ in EXPORTABLE_RELATIONS
|
||||
is_dependent = rel.__class__.__name__ in EXPORTABLE_DEPENDENT_OBJECTS
|
||||
if not (is_relation or is_dependent):
|
||||
continue
|
||||
|
||||
related_options = utils.get_post_fields(related_endpoint, self._cache)
|
||||
if related_options is None: # This is a read-only endpoint.
|
||||
continue
|
||||
is_attach = 'id' in related_options # This is not a create-only endpoint.
|
||||
|
||||
if rel.__class__.__name__ in EXPORTABLE_RELATIONS and is_attach:
|
||||
if is_relation and is_attach:
|
||||
by_natural_key = True
|
||||
elif rel.__class__.__name__ in EXPORTABLE_DEPENDENT_OBJECTS:
|
||||
elif is_dependent:
|
||||
by_natural_key = False
|
||||
else:
|
||||
continue
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
from awxkit.api.resources import resources
|
||||
import awxkit.exceptions as exc
|
||||
|
||||
from . import base
|
||||
from . import page
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user