def _get_netbox_from_row(row): netbox = Netbox(ip=row['ip'], read_only=row['ro'], read_write=row['rw'], snmp_version=1) netbox.room = get_object_or_fail(Room, id=row['roomid']) netbox.organization = get_object_or_fail(Organization, id=row['orgid']) netbox.category = get_object_or_fail(Category, id=row['catid']) netbox.sysname = netbox.ip return netbox
def _get_netbox_from_row(row): netbox = Netbox(ip=row['ip']) netbox.room = get_object_or_fail(Room, id=row['roomid']) netbox.organization = get_object_or_fail(Organization, id=row['orgid']) netbox.category = get_object_or_fail(Category, id=row['catid']) netbox.sysname = netbox.ip master = row.get('master') if master: if is_valid_ip(master, use_socket_lib=True): netbox.master = get_object_or_fail(Netbox, ip=master) else: netbox.master = get_object_or_fail(Netbox, sysname__startswith=master) return netbox