gnetcli-adapter 2.0.1__tar.gz → 2.0.2__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.2}/PKG-INFO +1 -1
- {gnetcli_adapter-2.0.1 → gnetcli_adapter-2.0.2}/src/gnetcli_adapter/gnetcli_adapter.py +17 -8
- {gnetcli_adapter-2.0.1 → gnetcli_adapter-2.0.2}/README.md +0 -0
- {gnetcli_adapter-2.0.1 → gnetcli_adapter-2.0.2}/pyproject.toml +0 -0
- {gnetcli_adapter-2.0.1 → gnetcli_adapter-2.0.2}/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,21 @@ 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
|
+
time.sleep(1)
|
|
417
|
+
except EOFError as e:
|
|
418
|
+
if cmd.suppress_eof:
|
|
419
|
+
if progress_bar:
|
|
420
|
+
progress_bar.set_progress(device.fqdn, total_cmds, total_cmds, suffix=f"suppressed EOF: {cmd.cmd}")
|
|
421
|
+
break # we can't exec subsequent cmds
|
|
422
|
+
raise e
|
|
414
423
|
if progress_bar:
|
|
415
424
|
tr = format_trace(res.trace)
|
|
416
425
|
progress_bar.set_content(device.fqdn, f"cmd={cmd.cmd} out={res.out_str} status={res.status}\n{tr}")
|
|
@@ -448,7 +457,7 @@ class GnetcliDeployer(DeployDriver, AdapterWithConfig, AdapterWithName):
|
|
|
448
457
|
break # break on command for current file
|
|
449
458
|
raise Exception("cmd %s error %s status %s", cmd, res.error, res.status)
|
|
450
459
|
result.append(res)
|
|
451
|
-
if progress_bar:
|
|
460
|
+
if reload_cmds and progress_bar:
|
|
452
461
|
progress_bar.set_progress(device.fqdn, total_cmds, total_cmds)
|
|
453
462
|
if seen_exc and progress_bar:
|
|
454
463
|
progress_bar.set_exception(device.fqdn, "seen exception", str(seen_exc), total_cmds)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|