Bugfix for intermediate layer creation at coverage-tool

- Problem corrected when 'remote_workspace' was false in configuration
  json file for input in the intermediate layer python script.
- Changes in merge.py to allow for config and output (intermediate)
  json files used as input for merging.

Change-Id: I2d7ebc8fdff172ab7be14e30de928967a0f453a8
diff --git a/coverage-tool/coverage-reporting/merge.py b/coverage-tool/coverage-reporting/merge.py
index c4a80ad..bb07b10 100755
--- a/coverage-tool/coverage-reporting/merge.py
+++ b/coverage-tool/coverage-reporting/merge.py
@@ -109,6 +109,9 @@
     if file_name in info_files_to_merge:
         print("Error: Duplicated info file '{}'".format(file_name))
         sys.exit(1)
+    if os.stat(file_name).st_size == 0:
+        print("Warning: Empty info file '{}', skipping it".format(file_name))
+        continue
     info_files_to_merge.append(file_name)
     file_group = {"info": file_name, "locations": [], "json": ""}
     info_name = os.path.basename(file_name).split(".")[0]
@@ -132,7 +135,8 @@
         with open(json_name) as json_file:
             json_data = json.load(json_file)
         locations = []
-        for source in json_data["configuration"]["sources"]:
+        parent = json_data.get("parameters", json_data.get("configuration"))
+        for source in parent["sources"]:
             location = source["LOCATION"]
             locations.append((location, source.get("LOCAL", location)))
         file_group["locations"] = locations
@@ -180,7 +184,8 @@
         json_file = options.json_file[j]
         with open(json_file) as f:
             data = json.load(f)
-        for source in data['configuration']['sources']:
+        parent = data.get("parameters", data.get("configuration"))
+        for source in parent['sources']:
             if source not in json_merged_list:
                 json_merged_list.append(source)
         j += 1