from json import load
import logging


def read_drive_properties(path_name):
    """
    Reads drive properties from json formatted file.
    Takes (str) path_name as argument.
    Returns (dict) with (bool) status, (str) msg, (dict) conf
    """
    try:
        with open(path_name) as json_file:
            conf = load(json_file)
            return {"status": True, "msg": f"Read from file: {path_name}", "conf": conf}
    except (IOError, ValueError, EOFError, TypeError) as error:
        logging.error(str(error))
        return {"status": False, "msg": str(error)}
    except:
        logging.error("Could not read file: %s", path_name)
        return {"status": False, "msg": f"Could not read file: {path_name}"}