def _update_resolvconf_base(nameservers):
    if nameservers != None:
        nameservers = [dns % "nameserver %s" for dns in nameservers]
    elif os.path.isfile('/etc/network/interfaces'):
        fyl = open('/etc/network/interfaces', 'r')
        dat = fyl.readlines()
        fyl.close()

        nameservers = []
        for line in dat:
            entry = re.findall(r'\s*dns-nameservers.*', line)
            if entry != []:
                nameservers.extend(entry[0].split()[1:])

        nameservers = list(set(nameservers))
        nameservers = ["nameserver %s" % dns for dns in nameservers]
    else:
        raise CustomErrorResolvConfBase("Error while updating resolvconf base"
                                        "config file with nameservers.")

    basedir, _ = os.path.split(RESOLVCONF_BASE)
    _mkdir_p(basedir)
    fyl = open(RESOLVCONF_BASE, 'w')
    fyl.write("\n".join(nameservers))
    fyl.close()
    logging.info("'resolvconf' base config updated with %s" % nameservers)
dataset/ETHPy150Open rackerlabs/openstack-guest-agents-unix/commands/network.py/_update_resolvconf_base/swapped operands of `%`