import json


def get_manageiq_config_value(module, name):
    """ Gets the current value for the given config option.
    :param module: AnsibleModule making the call
    :param name: ManageIQ config option name
    :return: dict of value of the ManageIQ config option
    """
    returncode, out, err = module.run_command([
        "rails",
        "r",
        "puts Vmdb::Settings.for_resource(MiqServer.my_server)[:%s].to_json" % (name)
    ], cwd=module.params['vmdb_path'])
    if returncode != 0:
        raise Exception("Error getting existing value for ':%s' config: %s" % (name, err))

    return json.loads(out)