gnetcli-adapter 2.0.1__tar.gz → 2.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gnetcli_adapter-2.0.1 → gnetcli_adapter-2.0.3}/PKG-INFO +1 -1
- {gnetcli_adapter-2.0.1 → gnetcli_adapter-2.0.3}/src/gnetcli_adapter/gnetcli_adapter.py +16 -8
- {gnetcli_adapter-2.0.1 → gnetcli_adapter-2.0.3}/README.md +0 -0
- {gnetcli_adapter-2.0.1 → gnetcli_adapter-2.0.3}/pyproject.toml +0 -0
- {gnetcli_adapter-2.0.1 → gnetcli_adapter-2.0.3}/src/gnetcli_adapter/__init__.py +0 -0
|
@@ -15,6 +15,7 @@ from annet.connectors import AdapterWithConfig, AdapterWithName
|
|
|
15
15
|
from typing import Dict, List, Any, Optional, Tuple
|
|
16
16
|
from annet.storage import Device
|
|
17
17
|
from gnetclisdk.client import Credentials, Gnetcli, HostParams, QA, File
|
|
18
|
+
from gnetclisdk.exceptions import EOFError
|
|
18
19
|
import gnetclisdk.proto.server_pb2 as pb
|
|
19
20
|
from pydantic import Field, field_validator, FieldValidationInfo
|
|
20
21
|
from pydantic_core import PydanticUndefined
|
|
@@ -404,13 +405,20 @@ class GnetcliDeployer(DeployDriver, AdapterWithConfig, AdapterWithName):
|
|
|
404
405
|
for cmd in run_cmds:
|
|
405
406
|
if progress_bar:
|
|
406
407
|
progress_bar.set_progress(device.fqdn, done_cmds, total_cmds, suffix=cmd.cmd)
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
408
|
+
try:
|
|
409
|
+
res = await sess.cmd(
|
|
410
|
+
cmd=cmd.cmd,
|
|
411
|
+
cmd_timeout=cmd.timeout,
|
|
412
|
+
host_params=host_params,
|
|
413
|
+
qa=parse_annet_qa(cmd.questions or []),
|
|
414
|
+
trace=True,
|
|
415
|
+
)
|
|
416
|
+
except EOFError as e:
|
|
417
|
+
if cmd.suppress_eof:
|
|
418
|
+
if progress_bar:
|
|
419
|
+
progress_bar.set_progress(device.fqdn, total_cmds, total_cmds, suffix=f"suppressed EOF: {cmd.cmd}")
|
|
420
|
+
break # we can't exec subsequent cmds
|
|
421
|
+
raise e
|
|
414
422
|
if progress_bar:
|
|
415
423
|
tr = format_trace(res.trace)
|
|
416
424
|
progress_bar.set_content(device.fqdn, f"cmd={cmd.cmd} out={res.out_str} status={res.status}\n{tr}")
|
|
@@ -448,7 +456,7 @@ class GnetcliDeployer(DeployDriver, AdapterWithConfig, AdapterWithName):
|
|
|
448
456
|
break # break on command for current file
|
|
449
457
|
raise Exception("cmd %s error %s status %s", cmd, res.error, res.status)
|
|
450
458
|
result.append(res)
|
|
451
|
-
if progress_bar:
|
|
459
|
+
if reload_cmds and progress_bar:
|
|
452
460
|
progress_bar.set_progress(device.fqdn, total_cmds, total_cmds)
|
|
453
461
|
if seen_exc and progress_bar:
|
|
454
462
|
progress_bar.set_exception(device.fqdn, "seen exception", str(seen_exc), total_cmds)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|