xens / ripeinator

Manipulate RIPE-database objects through RIPE REST-API
Apache License 2.0
15 stars 7 forks source link

json_to_yaml: fix keys for route/route6 objects #201

Open caguiclajmg opened 1 year ago

caguiclajmg commented 1 year ago

The YAML output may be incomplete due to inetnum/inet6num objects overwriting route/route6 objects, and vice versa, in the output object due to them having the same keys.

This change appends the origin ASN in the key for route/route6 objects, this behavior is already present in the RIPE update functions; this just pulls that in for json_to_yaml.

caguiclajmg commented 1 year ago

This seems to break everything else (e.g. ripe_create, ripe_update) since those do the concatenation inline using the origin attribute.

The answer seems to be passing a modified key to https://github.com/xens/ripeinator/blob/b0ad9f9d5949d8d016e0fc460fc044ec1f5088b1/ripe.py#L319-L327 and https://github.com/xens/ripeinator/blob/b0ad9f9d5949d8d016e0fc460fc044ec1f5088b1/ripe.py#L332-L334

caguiclajmg commented 1 year ago

Fixed by stripping the AS number from the key for route/route6 objects before passing to ripe_ functions since those do their own handling.