mirror of
https://github.com/ansible/awx.git
synced 2026-03-24 20:35:02 -02:30
Fix pep8 error, remove redundant var assignment
This commit is contained in:
@@ -114,12 +114,15 @@ class TowerAPIModule(TowerModule):
|
|||||||
try:
|
try:
|
||||||
query_params['or__id'] = int(name_or_id)
|
query_params['or__id'] = int(name_or_id)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# If we got a value error than we didn't have an integer so we can just pass and fall down to the fail
|
# If we get a value error, then we didn't have an integer so we can just pass and fall down to the fail
|
||||||
pass
|
pass
|
||||||
|
|
||||||
response = self.get_endpoint(endpoint, **{'data': query_params})
|
response = self.get_endpoint(endpoint, **{'data': query_params})
|
||||||
if response['status_code'] != 200:
|
if response['status_code'] != 200:
|
||||||
self.fail_json(msg="Failed to query endpoint {0} for {1} {2} ({3}), see results".format(endpoint, name_field, name_or_id, response['status_code']), resuls=response)
|
self.fail_json(
|
||||||
|
msg="Failed to query endpoint {0} for {1} {2} ({3}), see results".format(endpoint, name_field, name_or_id, response['status_code']),
|
||||||
|
resuls=response
|
||||||
|
)
|
||||||
|
|
||||||
if response['json']['count'] == 1:
|
if response['json']['count'] == 1:
|
||||||
return response['json']['results'][0]
|
return response['json']['results'][0]
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ def main():
|
|||||||
resource_data = {}
|
resource_data = {}
|
||||||
for param in resource_param_keys:
|
for param in resource_param_keys:
|
||||||
endpoint = module.param_to_endpoint(param)
|
endpoint = module.param_to_endpoint(param)
|
||||||
name_field = 'username' if param == 'user' else 'name'
|
|
||||||
|
|
||||||
resource_name = params.get(param)
|
resource_name = params.get(param)
|
||||||
if resource_name:
|
if resource_name:
|
||||||
|
|||||||
Reference in New Issue
Block a user