mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 16:47:45 -02:30
Deal with lack of permissions
This commit is contained in:
@@ -92,7 +92,7 @@ class ApiV2(base.Base):
|
||||
# Common import/export methods
|
||||
|
||||
def _get_options(self, endpoint):
|
||||
return endpoint.options().json['actions']['POST']
|
||||
return endpoint.options().json['actions'].get('POST', {})
|
||||
|
||||
# Export methods
|
||||
|
||||
@@ -101,6 +101,7 @@ class ApiV2(base.Base):
|
||||
if asset.json.get('managed_by_tower'):
|
||||
return None
|
||||
|
||||
try:
|
||||
fields = {
|
||||
key: asset[key] for key in options
|
||||
if key in asset.json and key not in asset.related
|
||||
@@ -126,6 +127,8 @@ class ApiV2(base.Base):
|
||||
related[k] = [get_natural_key(x) for x in data.results]
|
||||
else:
|
||||
related[k] = data.json
|
||||
except exc.Forbidden:
|
||||
return None
|
||||
|
||||
related_fields = {'related': related} if related else {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user