Skip to content

Commit

Permalink
fix(netbox): add hostname to ip
Browse files Browse the repository at this point in the history
  • Loading branch information
rwxd committed Feb 22, 2024
1 parent 9b88b94 commit dcba656
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions ipams/netbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def query_ip(self, ip: Union[IPv4Address, IPv6Address]) -> NetBoxIPTable:
vrf=q_ip.vrf.name if q_ip.vrf else '',
tenant=q_ip.tenant.name if q_ip.tenant else '',
address=str(q_ip.address),
hostname=str(q_ip.dns_name),
description=str(q_ip.description),
link=f"{self.url.rstrip('/')}/ipam/ip-addresses/{q_ip.id}/",
)
Expand Down
5 changes: 3 additions & 2 deletions ipams/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ def __init__(self, name: str, *args, **kwargs):
self.title = name
self.add_column('Address', justify='left', style='magenta', no_wrap=True)
self.add_column('Tenant', justify='left', style='magenta')
self.add_column('Hostname', justify='left', style='magenta', no_wrap=True)
self.add_column('VRF', justify='left', style='magenta')
self.add_column('Description', justify='left', style='green')
self.add_column('Link', justify='left', style='green')

def add_row(self, vrf: str, tenant: str, address: str, description: str, link: str):
super().add_row(address, tenant, vrf, description, link)
def add_row(self, vrf: str, tenant: str, address: str, hostname: str, description: str, link: str):
super().add_row(address, hostname, tenant, vrf, description, link)


class NetBoxHostTable(DefaultNetBoxTable):
Expand Down

0 comments on commit dcba656

Please sign in to comment.