(self, json_rep)
If the json comes from a docker call, we need to adjust it to make use
        of it.
If the json comes from a docker call, we need to adjust it to make use
        of it.
If the json comes from a docker call we need to adjust it to make use of it .
def adjust_json_from_docker(self, json_rep):
        """If the json comes from a docker call, we need to adjust it to make use
        of it."""
        try:
            if not isinstance(json_rep[0]["NetworkSettings"]["Ports"], dict):
                raise Exception(
                    "Error parsing docker engine inspection JSON structure, try to specify container engine using '--container-engine' parameter"
                )
        except (KeyError, TypeError):
            # "Ports" not specified in given json file
            pass

        try:
            for item in json_rep[0]["Mounts"]:
                item["source"] = item["Source"]
                if item["Mode"] == "rw":
                    item["options"] = "rw"
                if item["Mode"] == "ro":
                    item["options"] = "ro"
        except (KeyError, TypeError):
            # "Mounts" not specified in given json file
            pass
def adjust_json_from_docker ( self , json_rep ) : try : if not isinstance ( json_rep [ 0 ] [ "NetworkSettings" ] [ "Ports" ] , dict ) : raise Exception ( "Error parsing docker engine inspection JSON structure, try to specify container engine using '--container-engine' parameter" ) except ( KeyError , TypeError ) : # "Ports" not specified in given json file pass try : for item in json_rep [ 0 ] [ "Mounts" ] : item [ "source" ] = item [ "Source" ] if item [ "Mode" ] == "rw" : item [ "options" ] = "rw" if item [ "Mode" ] == "ro" : item [ "options" ] = "ro" except ( KeyError , TypeError ) : # "Mounts" not specified in given json file pass