def _confd_net_file_legacy(interfaces):
    """
    Return data for (sub-)interfaces and routes
    """

    ifaces = set()

    lines = []
    lines.append(_header())
    lines.append("")
    if commands.utils.is_system_command("ip"):
        lines.append('modules="iproute2"')
    else:
        lines.append('modules="ifconfig"')
    lines.append("")
    lines.append("")

    for name, interface in interfaces.iteritems():
        if interface['label']:
            lines.append(interface['label'] % "# Label %s")
        lines.append("config_{0}=(".format(name))

        lines.extend(["  \"{0} netmask {1}\"".format(ip['address'],
                    ip['netmask']) for ip in interface['ip4s'] ])
        lines.extend([ "  \"{0}/{1}\"".format(ip['address'], ip['prefixlen']
                    ) for ip in interface['ip6s'] ])
        lines.append(")")
        lines.append("")

        lines.append("routes_{0}=(".format(name))
        lines.extend([ "  \"{0} netmask {1} gw {2}\"".format(
                        route['network'], route['netmask'], route['gateway']
                    ) for route in interface['routes'] if not
                    route['network'] == '0.0.0.0' and not
                    route['netmask'] == '0.0.0.0' and
                    'gateway4' in interface and not
                    route['gateway'] == interface['gateway4'] ])
        if 'gateway4' in interface and interface['gateway4']:
            lines.append("  \"default via {0}\"".format(interface['gateway4']))
        if 'gateway6' in interface and interface['gateway6']:
            lines.append("  \"default via {0}\"".format(interface['gateway6']))
        lines.append(")")
        lines.append("")

        dns_list = interface['dns']
        if dns_list:
            lines.append("dns_servers_{0}=(".format(name))
            lines.extend([' "{0}"'.format(dns) for dns in dns_list])
            lines.append(")")
            lines.append("")

        ifaces.add(name)

    return "\n".join(lines), ifaces
dataset/ETHPy150Open rackerlabs/openstack-guest-agents-unix/commands/gentoo/network.py/_confd_net_file_legacy/swapped operands of `%`