annet 0.12.6__py3-none-any.whl → 0.12.8__py3-none-any.whl

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.

Potentially problematic release.


This version of annet might be problematic. Click here for more details.

annet/executor.py CHANGED
@@ -359,7 +359,7 @@ async def bulk(
359
359
  tasks = []
360
360
  res = {}
361
361
  pending = set()
362
- tasks_to_hostname = {}
362
+ tasks_to_device = {}
363
363
  time_of_start = {}
364
364
  deploy_durations = {}
365
365
  now = None
@@ -391,10 +391,15 @@ async def bulk(
391
391
  return task.result()
392
392
 
393
393
  for device in devices:
394
- conn = await executor.amake_connection(device=device)
394
+ try:
395
+ conn = await executor.amake_connection(device=device)
396
+ except Exception as exc:
397
+ _logger.error("failed to connect to %s %r", device.hostname, exc)
398
+ res[device] = exc
399
+ continue
395
400
  start_hook(device)
396
401
  task = asyncio.create_task(coro_gen(conn=conn, device=device, **kwargs))
397
- tasks_to_hostname[task] = device
402
+ tasks_to_device[task] = device
398
403
  tasks.append(task)
399
404
  try:
400
405
  ndone = 0
@@ -415,21 +420,21 @@ async def bulk(
415
420
 
416
421
  now = time.monotonic()
417
422
  for task in done:
418
- hostname = tasks_to_hostname[task]
419
- res[hostname] = end_hook(hostname, task)
423
+ device = tasks_to_device[task]
424
+ res[device] = end_hook(device, task)
420
425
  ndone += 1
421
426
  except CancelAllTasks:
422
427
  exc = asyncio.CancelledError()
423
428
 
424
429
  now = time.monotonic()
425
- for hostname, task in _get_remaining(tasks, pending, tasks_to_hostname):
426
- res[hostname] = exc
430
+ for device, task in _get_remaining(tasks, pending, tasks_to_device):
431
+ res[device] = exc
427
432
 
428
- if hostname in time_of_start:
429
- duration = now - time_of_start[hostname]
433
+ if device.hostname in time_of_start:
434
+ duration = now - time_of_start[device.hostname]
430
435
  else:
431
436
  duration = None
432
- deploy_durations[hostname] = duration
437
+ deploy_durations[device.hostname] = duration
433
438
 
434
439
  if not asyncio.iscoroutine(task):
435
440
  _logger.info("task %s", task)
@@ -471,11 +476,11 @@ class CancelAllTasks(Exception):
471
476
  pass
472
477
 
473
478
 
474
- def _get_remaining(tasks, pending, tasks_to_hostname):
479
+ def _get_remaining(tasks, pending, tasks_to_device):
475
480
  for task in pending:
476
- yield (tasks_to_hostname[task], task)
481
+ yield (tasks_to_device[task], task)
477
482
  for task in tasks:
478
- yield (tasks_to_hostname[task], task)
483
+ yield (tasks_to_device[task], task)
479
484
 
480
485
 
481
486
  _platform = platform.system()
annet/gen.py CHANGED
@@ -709,10 +709,9 @@ def _old_new_get_config_cli(ctx: OldNewDeviceContext, device: Device) -> str:
709
709
  elif ctx.config == "running":
710
710
  text = ctx.running.get(device)
711
711
  if text is None:
712
- exc = (ctx.failed_running.get(device.fqdn) or
713
- ctx.failed_running.get(device.hostname) or
712
+ exc = (ctx.failed_running.get(device) or
714
713
  Exception("I can't get device config and I don't know why"))
715
- get_logger(host=device.hostname).error("config error %s", exc)
714
+ get_logger(host=device.hostname).error("config error %r", exc)
716
715
  raise exc
717
716
  elif ctx.config == "-":
718
717
  text = ctx.stdin["config"]
@@ -120,7 +120,7 @@ def run_partial_initial(device):
120
120
  tracing_connector.get().set_device_attributes(tracing_connector.get().get_current_span(), device)
121
121
 
122
122
  run_args = GeneratorPartialRunArgs(device)
123
- return run_partial_generators([InitialConfig(storage=device.storage)], [], run_args)
123
+ return run_partial_generators([InitialConfig(storage=device.storage, do_run=True)], [], run_args)
124
124
 
125
125
 
126
126
  @tracing.function
@@ -12,9 +12,9 @@ class InitialConfig(PartialGenerator):
12
12
  Acl для данного генератора не нужен, он будет генерировать
13
13
  конфиг целиком.
14
14
  """
15
- def __init__(self, storage=None):
16
- self._do_run = not storage
15
+ def __init__(self, storage, do_run: bool = False):
17
16
  super().__init__(storage=storage)
17
+ self._do_run = do_run
18
18
 
19
19
  def run_huawei(self, device):
20
20
  if not self._do_run:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: annet
3
- Version: 0.12.6
3
+ Version: 0.12.8
4
4
  Summary: annet
5
5
  Home-page: https://github.com/annetutil/annet
6
6
  License: MIT
@@ -6,9 +6,9 @@ annet/cli_args.py,sha256=Wv2X2wk6trTsGpKpcaZacGqVbDxMzEJvN8uYIJOq4D0,16071
6
6
  annet/connectors.py,sha256=FLFJlhb73g2c8e61zYnGn8dTkIiaaWYqeUCsZd48AWg,2471
7
7
  annet/deploy.py,sha256=B8E0P_VvCrS2URjFvgmUiIkHp95g7pAWfmT34igaDeo,18893
8
8
  annet/diff.py,sha256=zLcaCnb4lZRUb7frpH1CstQ3kacRcCblZs1uLG8J5lk,3391
9
- annet/executor.py,sha256=bw7COJNtssuxIqbQehlHYJnkdUeYvvL8WO5B-c67XE0,19040
9
+ annet/executor.py,sha256=EaeQ_JeRFuUUHUoR2LXDcNvY7IVg0eA2d6zSmQVJt-M,19216
10
10
  annet/filtering.py,sha256=F4ZKUCU3Yb1RlL2zKdyHtVUaWPzjWF4vWyMcdygKNYk,852
11
- annet/gen.py,sha256=j8ldncYAGTUmuQermnAuP8lt278Mz5ubPx0JSkeGWgc,32862
11
+ annet/gen.py,sha256=J3TKaD61HzHo2etEpStpTFcC19pbVwYUNSKX5YycpHg,32795
12
12
  annet/hardware.py,sha256=HYPDfji_GdRn5S0_0fl4rvM7byOY9aHxG6VMAtsLaxE,1090
13
13
  annet/implicit.py,sha256=QigK4uoxvrFho2h9yFjOq1d9rLsC5xFlAU4bKkCuMWk,5139
14
14
  annet/lib.py,sha256=zQIfNBg7fAAk2BHbHAqy_McAiXhz0RqpBAcfdU-6pAA,3742
@@ -68,7 +68,7 @@ annet/annlib/rulebook/common.py,sha256=9kCZwZpsH5UliF2OzaN9nLs2eLlz_d__4L7_oZ3Sr
68
68
  annet/api/__init__.py,sha256=nrtPSDGLk5GO6nKSXDx9PNrCyiDBCJRXuUG1ua_y9MM,33141
69
69
  annet/configs/context.yml,sha256=nt4QnzYzrG2hqmaWOUsab2wgFl-CXmFSzbto6rqqFt4,291
70
70
  annet/configs/logging.yaml,sha256=Hu42lRK248dssp9TgkbHCaZNl0E6f4IChGb0XaQnTVo,970
71
- annet/generators/__init__.py,sha256=ZWKdxy6XbANW8vO6Tz7TMP_5rkHHKPBiBhPK2g-NOvI,15609
71
+ annet/generators/__init__.py,sha256=tk20umBuMEcd8QKET3mxJQsDj-dvjlwGnrlgTw0wbRY,15622
72
72
  annet/generators/base.py,sha256=rgQLcQBPZm4ecbKmRhVOpBR-GFJAiVfdb_y5f2-LUR8,3670
73
73
  annet/generators/entire.py,sha256=7WySkVaXNT3ZAiHcQ0JUKdlhGJAN8cNUxF6c7ilYnO8,2928
74
74
  annet/generators/exceptions.py,sha256=GPXTBgn2xZ3Ev_bdOPlfCLGRC1kQHe_dEq88S-uyi5s,151
@@ -78,7 +78,7 @@ annet/generators/perf.py,sha256=K72ivUuXbNXrsHrLeKWhGmczGYWsB7kUDdDzqOX6j3c,2370
78
78
  annet/generators/ref.py,sha256=QVdeL8po1D0kBsVLOpCjFR81D8yNTk-kaQj5WUM4hng,438
79
79
  annet/generators/result.py,sha256=boMG4mwvitBLlHdPM8rPOqlKPrrNAqdV6NAM9wwIZHc,4765
80
80
  annet/generators/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
81
- annet/generators/common/initial.py,sha256=TDkY-ZNaL3yMxGGATVD76uR-nsNTmZrXs2_56MyndxM,1232
81
+ annet/generators/common/initial.py,sha256=qYBxXFhyOPy34cxc6hsIXseod-lYCmmbuNHpM0uteY0,1244
82
82
  annet/rulebook/__init__.py,sha256=14IpOfTbeJtre7JKrfXVYiH0qAXsUSOL7AatUFmSQs0,3847
83
83
  annet/rulebook/common.py,sha256=zK1s2c5lc5HQbIlMUQ4HARQudXSgOYiZ_Sxc2I_tHqg,721
84
84
  annet/rulebook/deploying.py,sha256=XV0XQvc3YvwM8SOgOQlc-fCW4bnjQg_1CTZkTwMp14A,2972
@@ -128,10 +128,10 @@ annet/rulebook/texts/routeros.rul,sha256=ipfxjj0mjFef6IsUlupqx4BY_Je_OUb8u_U1019
128
128
  annet_generators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
129
  annet_generators/example/__init__.py,sha256=zVd8_DrXuOASrNzg2Ab94rPyvJff83L-_HppDFxnUjM,228
130
130
  annet_generators/example/lldp.py,sha256=68CLrK7vxTQQy9XIBxtywuEdBNlIlfXGYj8_wYWs5UI,1146
131
- annet-0.12.6.dist-info/AUTHORS,sha256=rh3w5P6gEgqmuC-bw-HB68vBCr-yIBFhVL0PG4hguLs,878
132
- annet-0.12.6.dist-info/LICENSE,sha256=yPxl7dno02Pw7gAcFPIFONzx_gapwDoPXsIsh6Y7lC0,1079
133
- annet-0.12.6.dist-info/METADATA,sha256=T6AvsDaqSWsBAZ0Q2MyGJzdyWnUhb-GtI7OV0pefjxg,694
134
- annet-0.12.6.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
135
- annet-0.12.6.dist-info/entry_points.txt,sha256=yHimujIzR2bwNIbb--MTs_GpXiAve89Egpu2LlgTEkg,119
136
- annet-0.12.6.dist-info/top_level.txt,sha256=QsoTZBsUtwp_FEcmRwuN8QITBmLOZFqjssRfKilGbP8,23
137
- annet-0.12.6.dist-info/RECORD,,
131
+ annet-0.12.8.dist-info/AUTHORS,sha256=rh3w5P6gEgqmuC-bw-HB68vBCr-yIBFhVL0PG4hguLs,878
132
+ annet-0.12.8.dist-info/LICENSE,sha256=yPxl7dno02Pw7gAcFPIFONzx_gapwDoPXsIsh6Y7lC0,1079
133
+ annet-0.12.8.dist-info/METADATA,sha256=QV1U3C_eS9t_pCWA0arAfZqULlZCqE9_oteoCCv68vc,694
134
+ annet-0.12.8.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
135
+ annet-0.12.8.dist-info/entry_points.txt,sha256=yHimujIzR2bwNIbb--MTs_GpXiAve89Egpu2LlgTEkg,119
136
+ annet-0.12.8.dist-info/top_level.txt,sha256=QsoTZBsUtwp_FEcmRwuN8QITBmLOZFqjssRfKilGbP8,23
137
+ annet-0.12.8.dist-info/RECORD,,
File without changes