Skip to content
Snippets Groups Projects
Commit 877af3cb authored by Karel van Klink's avatar Karel van Klink :smiley_cat: Committed by JORGE SASIAIN
Browse files

resolve linting errors in netboxcli

parent 40ba3cdb
No related branches found
No related tags found
1 merge request!108NAT-315: Restore ISIS should be optional in migrate iptrunk
This commit is part of merge request !108. Comments created here will be created in the context of that merge request.
"""Utilities that can be used alongside :term:`GSO`."""
...@@ -22,12 +22,12 @@ def convert_to_table(data: list[dict[str, Any]], fields: list[str]) -> pd.DataFr ...@@ -22,12 +22,12 @@ def convert_to_table(data: list[dict[str, Any]], fields: list[str]) -> pd.DataFr
@click.group() @click.group()
def cli() -> None: def cli() -> None:
pass """Instantiate a new :term:`CLI`."""
@cli.group() @cli.group()
def create() -> None: def create() -> None:
pass """Start defining creation commands below."""
@create.command() @create.command()
...@@ -45,7 +45,7 @@ def device(fqdn: str, model: str) -> None: ...@@ -45,7 +45,7 @@ def device(fqdn: str, model: str) -> None:
@click.option("--type", default="10gbase-t", help="Interface type, default is 10GBASE-T") @click.option("--type", default="10gbase-t", help="Interface type, default is 10GBASE-T")
@click.option("--speed", default="1000", help="Interface speed , default is 1000") @click.option("--speed", default="1000", help="Interface speed , default is 1000")
@click.option("--fqdn", help="Device where to create interface") @click.option("--fqdn", help="Device where to create interface")
def interface(name: str, type: str, speed: str, fqdn: str) -> None: def interface(name: str, type: str, speed: str, fqdn: str) -> None: # noqa: A002
"""Create a new interface in Netbox.""" """Create a new interface in Netbox."""
click.echo(f"Creating interface: name={name}, speed={speed}, fqdn={fqdn}") click.echo(f"Creating interface: name={name}, speed={speed}, fqdn={fqdn}")
new_interface = NetboxClient().create_interface(name, type, speed, fqdn) new_interface = NetboxClient().create_interface(name, type, speed, fqdn)
...@@ -103,7 +103,7 @@ create.add_command(device_site) ...@@ -103,7 +103,7 @@ create.add_command(device_site)
# Define list commands here # Define list commands here
@cli.group() @cli.group()
def list() -> None: def list() -> None: # noqa: A001
"""Definitions of all listing commands.""" """Definitions of all listing commands."""
...@@ -126,9 +126,7 @@ def interfaces(fqdn: str, speed: str) -> None: ...@@ -126,9 +126,7 @@ def interfaces(fqdn: str, speed: str) -> None:
"lag", "lag",
"speed", "speed",
] ]
iface_list = [] iface_list = [dict(iface) for iface in interface_list]
for iface in interface_list:
iface_list.append(dict(iface))
table = convert_to_table(iface_list, display_fields) table = convert_to_table(iface_list, display_fields)
click.echo(table) click.echo(table)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment