def update_resolvconf(nameservers=None):
    try:
        if os.getenv('NOVA_AGENT_RESOLVCONF') == 'off':
            logging.info("'resolvconf' has been turned off for system Env")

        if os.path.islink(RESOLV_CONF_FILE):
            logging.info("%s is already a link" % RESOLV_CONF_FILE)
        else:
            # getting config files and symlinks as per required
            _prepare_resolvconf_config(nameservers)

        # updating the resolv.conf as per dns-nameservers
        if subprocess.call(["resolvconf", "-u"]) == 0:
            logging.info("'resolvconf' completed")
            return True

        return _update_if_resolvconf_in_path()

    except Exception, e:
        logging.info("'resolvconf' not configured.\nError: %s" % repr(e))
        os.rename(RESOLV_CONF_FILE, RESOLVCONF_CONF_FILE)
        return False
dataset/ETHPy150Open rackerlabs/openstack-guest-agents-unix/commands/network.py/update_resolvconf/original