Add timeout parameter to dump_devinfo (#1381)

This commit is contained in:
Steven B. 2024-12-16 12:48:27 +00:00 committed by GitHub
parent e9109447a7
commit 62345be916
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -233,6 +233,12 @@ async def handle_device(
type=bool,
help="Set flag if the device encryption uses https.",
)
@click.option(
"--timeout",
required=False,
default=15,
help="Timeout for queries.",
)
@click.option("--port", help="Port override", type=int)
async def cli(
host,
@ -250,6 +256,7 @@ async def cli(
device_family,
login_version,
port,
timeout,
):
"""Generate devinfo files for devices.
@ -280,6 +287,7 @@ async def cli(
connection_type=connection_type,
port_override=port,
credentials=credentials,
timeout=timeout,
)
device = await Device.connect(config=dc)
await handle_device(
@ -301,6 +309,7 @@ async def cli(
port_override=port,
credentials=credentials,
connection_type=ctype,
timeout=timeout,
)
if protocol := get_protocol(config):
await handle_device(basedir, autosave, protocol, batch_size=batch_size)
@ -315,6 +324,7 @@ async def cli(
credentials=credentials,
port=port,
discovery_timeout=discovery_timeout,
timeout=timeout,
on_discovered_raw=capture_raw,
)
discovery_info = raw_discovery[device.host]
@ -336,6 +346,7 @@ async def cli(
target=target,
credentials=credentials,
discovery_timeout=discovery_timeout,
timeout=timeout,
on_discovered_raw=capture_raw,
)
click.echo(f"Detected {len(devices)} devices")