mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
[modules] Fix bad usages of traceback.format_exc()
; doesn't take an error parameter (#21678)
This commit is contained in:
parent
d9e4248c35
commit
26b10eb160
11 changed files with 50 additions and 50 deletions
|
@ -189,7 +189,7 @@ def main():
|
|||
client = boto3_conn(module, conn_type='client', resource='lambda',
|
||||
region=region, endpoint=ec2_url, **aws_connect_kwargs)
|
||||
except (botocore.exceptions.ClientError, botocore.exceptions.ValidationError) as e:
|
||||
module.fail_json(msg="Failure connecting boto3 to AWS", exception=traceback.format_exc(e))
|
||||
module.fail_json(msg="Failure connecting boto3 to AWS", exception=traceback.format_exc())
|
||||
|
||||
invoke_params = {}
|
||||
|
||||
|
@ -230,15 +230,15 @@ def main():
|
|||
module.fail_json(msg="Could not find Lambda to execute. Make sure "
|
||||
"the ARN is correct and your profile has "
|
||||
"permissions to execute this function.",
|
||||
exception=traceback.format_exc(ce))
|
||||
exception=traceback.format_exc())
|
||||
module.fail_json("Client-side error when invoking Lambda, check inputs and specific error",
|
||||
exception=traceback.format_exc(ce))
|
||||
exception=traceback.format_exc())
|
||||
except botocore.exceptions.ParamValidationError as ve:
|
||||
module.fail_json(msg="Parameters to `invoke` failed to validate",
|
||||
exception=traceback.format_exc(ve))
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Unexpected failure while invoking Lambda function",
|
||||
exception=traceback.format_exc(e))
|
||||
exception=traceback.format_exc())
|
||||
|
||||
results ={
|
||||
'logs': '',
|
||||
|
@ -251,13 +251,13 @@ def main():
|
|||
# logs are base64 encoded in the API response
|
||||
results['logs'] = base64.b64decode(response.get('LogResult', ''))
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed while decoding logs", exception=traceback.format_exc(e))
|
||||
module.fail_json(msg="Failed while decoding logs", exception=traceback.format_exc())
|
||||
|
||||
if invoke_params['InvocationType'] == 'RequestResponse':
|
||||
try:
|
||||
results['output'] = json.loads(response['Payload'].read())
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Failed while decoding function return value", exception=traceback.format_exc(e))
|
||||
module.fail_json(msg="Failed while decoding function return value", exception=traceback.format_exc())
|
||||
|
||||
if isinstance(results.get('output'), dict) and any(
|
||||
[results['output'].get('stackTrace'), results['output'].get('errorMessage')]):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue