diff options
author | Dan Timoney <dtimoney@att.com> | 2019-11-01 20:23:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-11-01 20:23:09 +0000 |
commit | f68617405e85856cadac9266deb27323ad77c611 (patch) | |
tree | 493b6b9dd9e469bcf9aff224dd038fe0f51b619b /ms/command-executor/src/main/python/utils.py | |
parent | adf43b13681ec31ed1faa24815499a34b7de629f (diff) | |
parent | adf475f6ad5b821f9985f6df28968c9ce68443ac (diff) |
Merge "Improve Remote Python Executor error handling and" into elalto
Diffstat (limited to 'ms/command-executor/src/main/python/utils.py')
-rw-r--r-- | ms/command-executor/src/main/python/utils.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ms/command-executor/src/main/python/utils.py b/ms/command-executor/src/main/python/utils.py index dc5d0089f..a3748eb17 100644 --- a/ms/command-executor/src/main/python/utils.py +++ b/ms/command-executor/src/main/python/utils.py @@ -16,6 +16,7 @@ from google.protobuf.timestamp_pb2 import Timestamp import proto.CommandExecutor_pb2 as CommandExecutor_pb2 +import json def get_blueprint_id(request): blueprint_name = request.identifiers.blueprintName @@ -23,7 +24,7 @@ def get_blueprint_id(request): return blueprint_name + '/' + blueprint_version -def build_response(request, results, is_success=True): +def build_response(request, log_results, payload_return, is_success=False): if is_success: status = CommandExecutor_pb2.SUCCESS else: @@ -31,5 +32,9 @@ def build_response(request, results, is_success=True): timestamp = Timestamp() timestamp.GetCurrentTime() - return CommandExecutor_pb2.ExecutionOutput(requestId=request.requestId, response=results, status=status, - timestamp=timestamp) + + if 'cds_return_code' in payload_return: + payload_return.pop('cds_return_code') + payload_str = json.dumps(payload_return) + return CommandExecutor_pb2.ExecutionOutput(requestId=request.requestId, response=log_results, status=status, + payload=payload_str, timestamp=timestamp) |