annet 2.3.0__py3-none-any.whl → 2.3.1__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/api/__init__.py CHANGED
@@ -16,7 +16,7 @@ from typing import (
16
16
  Mapping,
17
17
  Set,
18
18
  Tuple,
19
- Union, cast,
19
+ Union, cast, Any,
20
20
  )
21
21
 
22
22
  import colorama
@@ -312,16 +312,18 @@ def res_diff_patch(
312
312
  def diff(
313
313
  args: cli_args.DiffOptions,
314
314
  loader: ann_gen.Loader,
315
- ) -> Mapping[Device, Union[Diff, PCDiff]]:
315
+ device_ids: List[Any]
316
+ ) -> tuple[Mapping[Device, Union[Diff, PCDiff]], Mapping[Device, Exception]]:
316
317
  """ Сгенерировать конфиг для устройств """
317
318
  stdin = args.stdin(filter_acl=args.filter_acl, config=None)
318
319
 
319
320
  filterer = filtering.filterer_connector.get()
320
321
  pool = Parallel(ann_diff.worker, args, stdin, loader, filterer).tune_args(args)
321
322
  if args.show_hosts_progress:
322
- pool.add_callback(PoolProgressLogger(loader.device_fqdns))
323
+ fqdns = {k: v for k, v in loader.device_fqdns.items() if k in device_ids}
324
+ pool.add_callback(PoolProgressLogger(fqdns))
323
325
 
324
- return pool.run(loader.device_ids, args.tolerate_fails, args.strict_exit_code)
326
+ return pool.run(device_ids, args.tolerate_fails, args.strict_exit_code)
325
327
 
326
328
 
327
329
  def collapse_texts(texts: Mapping[str, str | Generator[str, None, None]]) -> Mapping[Tuple[str, ...], str]:
@@ -500,7 +502,6 @@ class Deployer:
500
502
 
501
503
  self._collapseable_diffs = {}
502
504
  self._diff_lines: List[str] = []
503
- self._filterer = filtering.filterer_connector.get()
504
505
 
505
506
  def parse_result(self, job: DeployerJob, result: ann_gen.OldNewResult):
506
507
  logger = get_logger(job.device.hostname)
@@ -594,14 +595,28 @@ class Deployer:
594
595
  self.args,
595
596
  config="running",
596
597
  )
598
+
597
599
  if diff_args.query:
598
600
  ann_gen.live_configs = None
599
- diffs = diff(diff_args, loader, success_device_ids, self._filterer)
600
- non_pc_diffs = {dev: diff for dev, diff in diffs.items() if not isinstance(diff, PCDiff)}
601
+
602
+ diffs, failed = diff(diff_args, loader, success_device_ids)
603
+ for device_id, exc in failed.items():
604
+ self.failed_configs[loader.get_device(device_id).fqdn] = exc
605
+
606
+ non_pc_diffs = {
607
+ loader.get_device(device_id): diff
608
+ for device_id, diff in diffs.items()
609
+ if not isinstance(diff, PCDiff)
610
+ }
601
611
  devices_to_diff = ann_diff.collapse_diffs(non_pc_diffs)
602
- devices_to_diff.update({(dev,): diff for dev, diff in diffs.items() if isinstance(diff, PCDiff)})
612
+ devices_to_diff.update({
613
+ (loader.get_device(device_id),): diff
614
+ for device_id, diff in diffs.items()
615
+ if isinstance(diff, PCDiff)}
616
+ )
603
617
  else:
604
618
  devices_to_diff = {}
619
+
605
620
  for devices, diff_obj in devices_to_diff.items():
606
621
  if diff_obj:
607
622
  for dev in devices:
annet/cli.py CHANGED
@@ -204,7 +204,7 @@ def gen(args: cli_args.ShowGenOptions):
204
204
  def diff(args: cli_args.ShowDiffOptions):
205
205
  """ Generate configuration for devices and show a diff with current configuration using the rulebook """
206
206
  with get_loader(args, args) as loader:
207
- success, fail = api.diff(args, loader)
207
+ success, fail = api.diff(args, loader, loader.device_ids)
208
208
 
209
209
  out = list(gen_sort_diff({loader.get_device(k): v for k, v in success.items()}, args))
210
210
  output_driver = output_driver_connector.get()
annet/deploy.py CHANGED
@@ -49,8 +49,8 @@ class ProgressBar(abc.ABC):
49
49
 
50
50
 
51
51
  class DeployResult(_DeployResultBase): # noqa: E302
52
- def add_results(self, results: dict[str, tuple[list[str], list[Exception]]]) -> None:
53
- for hostname, (excs, result) in results.items():
52
+ def add_results(self, results: dict[str, Exception]) -> None:
53
+ for hostname, excs in results.items():
54
54
  self.hostnames.append(hostname)
55
55
  self.results[hostname] = excs
56
56
  self.durations[hostname] = 0.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: annet
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: annet
5
5
  Home-page: https://github.com/annetutil/annet
6
6
  License: MIT
@@ -2,10 +2,10 @@ annet/__init__.py,sha256=0OKkFkqog8As7B6ApdpKQkrEAcEELUREWp82D8WvGA8,1846
2
2
  annet/annet.py,sha256=8Hc-n0S6d-YhcMpMiMET_SsYKfHFJeCA_E2gKgzK-2Y,790
3
3
  annet/argparse.py,sha256=v1MfhjR0B8qahza0WinmXClpR8UiDFhmwDDWtNroJPA,12855
4
4
  annet/bgp_models.py,sha256=oibTSdipNkGL4t8Xn94bhyKHMOtwbPBqmYaAy4FmTxQ,12361
5
- annet/cli.py,sha256=II1R_HFdr4NAwVojffAy8JEJpFEnU6q8BMr16-f1T4w,12714
5
+ annet/cli.py,sha256=shq3hHzrTxFL3x1_zTOR43QHo0JYs8QSwyOvGtL86Co,12733
6
6
  annet/cli_args.py,sha256=jzMKRezWe_87k7VBNzgwPjWGMROJksbgrlX-GDd6oQs,13533
7
7
  annet/connectors.py,sha256=aoiDVLPizx8CW2p8SAwGCzyO_WW8H9xc2aujbGC4bDg,4882
8
- annet/deploy.py,sha256=Dp-l0z7gmVIGpFB4snj6P_5G4siEeGC6vBWGJayJcn0,7732
8
+ annet/deploy.py,sha256=JCcJ2hUmUsaOSrcxFuW8SlN0ubXSnHQ7H_nP_tx-PgE,7698
9
9
  annet/deploy_ui.py,sha256=KcP1g_c1HSA3n5qFxbGHd8t_arL4_xJV46PFO-7FLg8,28650
10
10
  annet/diff.py,sha256=vz51az7RrXdYXsPbNMi9Y2awbjNRPQSFl6zzvE36Kx4,9441
11
11
  annet/executor.py,sha256=lcKI-EbYqeCiBNpL729kSltduzxbAzOkQ1L_QK7tNv8,5112
@@ -68,7 +68,7 @@ annet/annlib/rbparser/platform.py,sha256=65-r9mboRA3gaz9DRkSwPCdCRQneItqxppdMB6z
68
68
  annet/annlib/rbparser/syntax.py,sha256=iZ7Y-4QQBw4L3UtjEh54qisiRDhobl7HZxFNdP8mi54,3577
69
69
  annet/annlib/rulebook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
70
  annet/annlib/rulebook/common.py,sha256=hqwmmNofm5q2f-hV2usMY-IPMeiANLth28tZcRBYJTw,16640
71
- annet/api/__init__.py,sha256=SIxUCX3u91ioFw-_AIy3aGCqdQav9Mtd2fBczy8zdeg,32616
71
+ annet/api/__init__.py,sha256=BnFu1BbGZVgiT4GKa5x8reIHV40hl8UGR4vtwD8VREI,32992
72
72
  annet/configs/context.yml,sha256=RVLrKLIHpCty7AGwOnmqf7Uu0iZQCn-AjYhophDJer8,259
73
73
  annet/configs/logging.yaml,sha256=EUagfir99QqA73Scc3k7sfQccbU3E1SvEQdyhLFtCl4,997
74
74
  annet/generators/__init__.py,sha256=rVHHDTPKHPZsml1eNEAj3o-8RweFTN8J7LX3tKMXdIY,16402
@@ -178,10 +178,10 @@ annet_generators/rpl_example/generator.py,sha256=zndIGfV4ZlTxPgAGYs7bMQvTc_tYScO
178
178
  annet_generators/rpl_example/items.py,sha256=d99HSXDHFjZq511EvGhIqRTWK3F4ZsCWfdUqFYQcyhE,772
179
179
  annet_generators/rpl_example/mesh.py,sha256=z_WgfDZZ4xnyh3cSf75igyH09hGvtexEVwy1gCD_DzA,288
180
180
  annet_generators/rpl_example/route_policy.py,sha256=z6nPb0VDeQtKD1NIg9sFvmUxBD5tVs2frfNIuKdM-5c,2318
181
- annet-2.3.0.dist-info/AUTHORS,sha256=rh3w5P6gEgqmuC-bw-HB68vBCr-yIBFhVL0PG4hguLs,878
182
- annet-2.3.0.dist-info/LICENSE,sha256=yPxl7dno02Pw7gAcFPIFONzx_gapwDoPXsIsh6Y7lC0,1079
183
- annet-2.3.0.dist-info/METADATA,sha256=5m1CMIWY8pk9goNCLOvHma1A2z7vGN5tVYJ0utQwDIM,793
184
- annet-2.3.0.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
185
- annet-2.3.0.dist-info/entry_points.txt,sha256=5lIaDGlGi3l6QQ2ry2jZaqViP5Lvt8AmsegdD0Uznck,192
186
- annet-2.3.0.dist-info/top_level.txt,sha256=QsoTZBsUtwp_FEcmRwuN8QITBmLOZFqjssRfKilGbP8,23
187
- annet-2.3.0.dist-info/RECORD,,
181
+ annet-2.3.1.dist-info/AUTHORS,sha256=rh3w5P6gEgqmuC-bw-HB68vBCr-yIBFhVL0PG4hguLs,878
182
+ annet-2.3.1.dist-info/LICENSE,sha256=yPxl7dno02Pw7gAcFPIFONzx_gapwDoPXsIsh6Y7lC0,1079
183
+ annet-2.3.1.dist-info/METADATA,sha256=U_8hFGlPprmgg8gwixbZkAinKUK9VW--rWrkVGPNiC0,793
184
+ annet-2.3.1.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
185
+ annet-2.3.1.dist-info/entry_points.txt,sha256=5lIaDGlGi3l6QQ2ry2jZaqViP5Lvt8AmsegdD0Uznck,192
186
+ annet-2.3.1.dist-info/top_level.txt,sha256=QsoTZBsUtwp_FEcmRwuN8QITBmLOZFqjssRfKilGbP8,23
187
+ annet-2.3.1.dist-info/RECORD,,
File without changes
File without changes
File without changes