mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
Qu1003 (#621)
* use new peeringdb client (1.0.0) for pdb_load_data sync (#599) * drop django-mobi for lack of py3/dj2 support (#492) remove django-forms-bootstrap for lack of py3/dj2 support (#492) * black formatted * django2.2 and py3 upgrade (#492) * drop ixlans (#21) ui and api changes * drop local_asn (#168) * org search (#193) * phone number validation (#50) * implement help text tooltips (#228) * Mark own ASN as transit-free (#394) * py3 fix for `pdb_migrate_ixlans` command when writing migration report * pdb_migrate_ixlans: properly handle py3 Runtime error if ixlan dict changes during iteration * set rest DEFAULT_SCHEMA_CLASS to coreapi to fix swagger apidocs fix migration 0027 missing from facsimile manifest * fix swagger doc strings * fix tests that were broken from api doc fixes * fix UniqueFieldValidator for netixlan ipaddress validation that broke during django/drf upgrade * fix org merge tool layout issues * travis config * update pipfile and lock * black formatting * update travis dist * beta mode banner (#411) * add beta banner template (#411) * automatically scheduled sync may not always be on, add a flag that lets us reflect that state in the beta banner message clean up beta banner implementation (#411) * add tests for beta banner (#411)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import re
|
||||
|
||||
import requests
|
||||
import ipaddress
|
||||
@@ -143,7 +144,7 @@ class Importer(object):
|
||||
vlan_list_found = True
|
||||
if len(vlans) == 2:
|
||||
# if vlans[0].get("vlan_id") == vlans[1].get("vlan_id"):
|
||||
keys = vlans[0].keys() + vlans[1].keys()
|
||||
keys = list(vlans[0].keys()) + list(vlans[1].keys())
|
||||
if keys.count("ipv4") == 1 and keys.count("ipv6") == 1:
|
||||
vlans[0].update(**vlans[1])
|
||||
conn["vlan_list"] = [vlans[0]]
|
||||
@@ -419,11 +420,15 @@ class Importer(object):
|
||||
try:
|
||||
if ipv4_addr:
|
||||
self.ipaddresses.append(
|
||||
"{}-{}".format(asn, ipaddress.ip_address(unicode(ipv4_addr)))
|
||||
"{}-{}".format(
|
||||
asn, ipaddress.ip_address(u"{}".format(ipv4_addr))
|
||||
)
|
||||
)
|
||||
if ipv6_addr:
|
||||
self.ipaddresses.append(
|
||||
"{}-{}".format(asn, ipaddress.ip_address(unicode(ipv6_addr)))
|
||||
"{}-{}".format(
|
||||
asn, ipaddress.ip_address(u"{}".format(ipv6_addr))
|
||||
)
|
||||
)
|
||||
except (ipaddress.AddressValueError, ValueError) as exc:
|
||||
self.log_error(
|
||||
@@ -552,8 +557,8 @@ class Importer(object):
|
||||
peer.update(
|
||||
{
|
||||
"net_id": netixlan.network_id,
|
||||
"ipaddr4": u"{}".format(netixlan.ipaddr4 or ""),
|
||||
"ipaddr6": u"{}".format(netixlan.ipaddr6 or ""),
|
||||
"ipaddr4": "{}".format(netixlan.ipaddr4 or ""),
|
||||
"ipaddr6": "{}".format(netixlan.ipaddr6 or ""),
|
||||
"speed": netixlan.speed,
|
||||
"is_rs_peer": netixlan.is_rs_peer,
|
||||
}
|
||||
@@ -562,18 +567,18 @@ class Importer(object):
|
||||
if netixlan.id:
|
||||
self.archive_info[netixlan.id] = {
|
||||
"action": action,
|
||||
"reason": u"{}".format(reason),
|
||||
"reason": "{}".format(reason),
|
||||
}
|
||||
|
||||
self.log["data"].append(
|
||||
{"peer": peer, "action": action, "reason": u"{}".format(reason),}
|
||||
{"peer": peer, "action": action, "reason": "{}".format(reason),}
|
||||
)
|
||||
|
||||
def log_error(self, error, save=False):
|
||||
"""
|
||||
Append error to the attempt log
|
||||
"""
|
||||
self.log["errors"].append(u"{}".format(error))
|
||||
self.log["errors"].append("{}".format(error))
|
||||
if save:
|
||||
self.save_log()
|
||||
|
||||
@@ -670,12 +675,12 @@ class PostMortem(object):
|
||||
return
|
||||
|
||||
if data.get("ipaddr4"):
|
||||
ipaddr4 = u"{}".format(data.get("ipaddr4"))
|
||||
ipaddr4 = "{}".format(data.get("ipaddr4"))
|
||||
else:
|
||||
ipaddr4 = None
|
||||
|
||||
if data.get("ipaddr6"):
|
||||
ipaddr6 = u"{}".format(data.get("ipaddr6"))
|
||||
ipaddr6 = "{}".format(data.get("ipaddr6"))
|
||||
else:
|
||||
ipaddr6 = None
|
||||
|
||||
|
Reference in New Issue
Block a user