mirror of
https://github.com/ansible/awx.git
synced 2026-02-20 04:30:05 -03:30
Avoid doing an OPTIONS call unless we know it is a related type we export
This commit is contained in:
@@ -93,14 +93,19 @@ class ApiV2(base.Base):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
rel = related_endpoint._create()
|
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)
|
related_options = utils.get_post_fields(related_endpoint, self._cache)
|
||||||
if related_options is None: # This is a read-only endpoint.
|
if related_options is None: # This is a read-only endpoint.
|
||||||
continue
|
continue
|
||||||
is_attach = 'id' in related_options # This is not a create-only endpoint.
|
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
|
by_natural_key = True
|
||||||
elif rel.__class__.__name__ in EXPORTABLE_DEPENDENT_OBJECTS:
|
elif is_dependent:
|
||||||
by_natural_key = False
|
by_natural_key = False
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from awxkit.api.resources import resources
|
from awxkit.api.resources import resources
|
||||||
import awxkit.exceptions as exc
|
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
from . import page
|
from . import page
|
||||||
|
|||||||
Reference in New Issue
Block a user