コード例 #1
0
ファイル: update_router.py プロジェクト: jrha/aquilon
    def render(self, session, fqdn, ip, building, comments, **arguments):
        if fqdn:
            dbdns_rec = ARecord.get_unique(session, fqdn, compel=True)
            ip = dbdns_rec.ip
        if not ip:
            raise ArgumentError("Please specify either --ip or --fqdn.")

        router = RouterAddress.get_unique(session, ip=ip, compel=True)

        if building:
            dbbuilding = Building.get_unique(session, name=building,
                                             compel=True)
            router.location = dbbuilding

        if comments:
            router.comments = comments

        session.flush()
コード例 #2
0
ファイル: update_router.py プロジェクト: ned21/aquilon
    def render(self, session, fqdn, ip, building, comments, **arguments):
        if fqdn:
            dbdns_rec = ARecord.get_unique(session, fqdn, compel=True)
            ip = dbdns_rec.ip
        if not ip:
            raise ArgumentError("Please specify either --ip or --fqdn.")

        router = RouterAddress.get_unique(session, ip=ip, compel=True)

        if building:
            dbbuilding = Building.get_unique(session,
                                             name=building,
                                             compel=True)
            router.location = dbbuilding

        if comments:
            router.comments = comments

        session.flush()
コード例 #3
0
        if params["type"] == "loopback":
            relaxed = True
        else:
            relaxed = False

        for ipstr, label in params["ip"].items():
            ip = IPv4Address(ipstr)

            if ip not in ip_to_iface:
                # Unknown network etc.
                continue

            if ip not in addr_by_ip:
                add_address(iface, ifname, ip, label, relaxed)

    # Check router addresses
    if "router_ips" in data:
        for ipstr in data["router_ips"]:
            ip = IPv4Address(ipstr)
            try:
                dbnetwork = get_net_id_from_ip(session, ip, dbnet_env)
                rtr = RouterAddress.get_unique(session, ip=ip,
                                               network=dbnetwork)
                if not rtr:
                    add_router(ip)
            except NotFoundException:
                warning("Skipping router IP address %s: network not found." %
                        ip)

    return results