Added client error as error and formatted error message in site as alert-warning

This commit is contained in:
Shay Nehmad 2019-04-16 20:18:37 +03:00
parent e4e2948941
commit a38b5cf360
2 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import json import json
from botocore.exceptions import NoCredentialsError from botocore.exceptions import NoCredentialsError, ClientError
from flask import request, jsonify, make_response from flask import request, jsonify, make_response
import flask_restful import flask_restful
@ -32,6 +32,10 @@ class RemoteRun(flask_restful.Resource):
# Probably, role hasn't been defined. # Probably, role hasn't been defined.
resp['error'] = e.message resp['error'] = e.message
return jsonify(resp) return jsonify(resp)
except ClientError as e:
# Probably, role doesn't allow SSM.
resp['error'] = e.message
return jsonify(resp)
return jsonify(resp) return jsonify(resp)
return {} return {}

View File

@ -473,10 +473,10 @@ class RunMonkeyPageComponent extends AuthComponent {
{ {
this.state.isErrorWhileCollectingAwsMachines ? this.state.isErrorWhileCollectingAwsMachines ?
<div style={{'marginTop': '1em'}}> <div style={{'marginTop': '1em'}}>
<p> <p class="alert alert-warning">
Error while collecting AWS machine data. Error message: {this.state.awsMachineCollectionErrorMsg} Error while collecting AWS machine data. Error message: <code>{this.state.awsMachineCollectionErrorMsg}</code><br/>
Are you sure you've set the correct role on your Island AWS machine?<br/>
Are you sure you've set the correct role? Not sure what this is? Not seeing your AWS EC2 instances? <a href="https://github.com/guardicore/monkey/wiki/Monkey-Island:-Running-the-monkey-on-AWS-EC2-instances">Read the documentation</a>! Not sure what this is? <a href="https://github.com/guardicore/monkey/wiki/Monkey-Island:-Running-the-monkey-on-AWS-EC2-instances">Read the documentation</a>!
</p> </p>
</div> </div>
: :