annet 2.3.0__py3-none-any.whl → 2.4.0__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.

@@ -128,6 +128,8 @@
128
128
  "PC.Whitebox.Asterfusion.CX": " CX",
129
129
  "PC.Whitebox.Asterfusion.CX.CX500": " CX5\\d\\d",
130
130
  "PC.Whitebox.Asterfusion.CX.CX500.CX532P-N": " CX532P-N",
131
+ "PC.Whitebox.Asterfusion.CX.CX800": " CX8\\d\\d",
132
+ "PC.Whitebox.Asterfusion.CX.CX800.CX864E-N": " CX864E-N",
131
133
  "PC.Whitebox.Ufispace": "[Uu]fi[Ss]pace",
132
134
  "PC.Whitebox.Ufispace.S": " S",
133
135
  "PC.Whitebox.Ufispace.S.S9100": " S91\\d\\d",
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
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: annet
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: annet
5
5
  Home-page: https://github.com/annetutil/annet
6
6
  License: MIT
@@ -24,6 +24,7 @@ Provides-Extra: netbox
24
24
  Requires-Dist: annetbox[sync]>=0.2.1; extra == "netbox"
25
25
  Dynamic: home-page
26
26
  Dynamic: license
27
+ Dynamic: license-file
27
28
  Dynamic: provides-extra
28
29
  Dynamic: requires-dist
29
30
  Dynamic: requires-python
@@ -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
@@ -56,7 +56,7 @@ annet/annlib/types.py,sha256=VHU0CBADfYmO0xzB_c5f-mcuU3dUumuJczQnqGlib9M,852
56
56
  annet/annlib/netdev/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
57
  annet/annlib/netdev/db.py,sha256=fI_u5aya4l61mbYSjj4JwlVfi3s7obt2jqERSuXGRUI,1634
58
58
  annet/annlib/netdev/devdb/__init__.py,sha256=aKYjjLbJebdKBjnGDpVLQdSqrV2JL24spGm58tmMWVU,892
59
- annet/annlib/netdev/devdb/data/devdb.json,sha256=E9dnmAbAJpg_-F82ZZIjUaKFL02vDC7W7yfMyjaah2Q,6561
59
+ annet/annlib/netdev/devdb/data/devdb.json,sha256=4RTRg9PbRiUfi-kVIalim7Rtdkdu_48MGGtrZ6XmXmg,6677
60
60
  annet/annlib/netdev/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
61
  annet/annlib/netdev/views/dump.py,sha256=rIlyvnA3uM8bB_7oq1nS2KDxTp6dQh2hz-FbNhYIpOU,4630
62
62
  annet/annlib/netdev/views/hardware.py,sha256=3JCZLH7deIHhCguwPJTUX-WDvWjG_xt6BdSEZSO6zkQ,4226
@@ -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
@@ -167,6 +167,8 @@ annet/rulebook/texts/ribbon.deploy,sha256=hCq2XeAcwaYanyQ8lTdnez6Pgq-gRqpNuR8dAl
167
167
  annet/rulebook/texts/ribbon.rul,sha256=609LyLTDCtXPVQNAzqS-VEyCpW3byHP8TCMJLFMn5cc,2108
168
168
  annet/rulebook/texts/routeros.order,sha256=M71uy_hf0KAjLNS3zZY3uih4m2xLUcu26FEoVVjC6k0,905
169
169
  annet/rulebook/texts/routeros.rul,sha256=ipfxjj0mjFef6IsUlupqx4BY_Je_OUb8u_U1019O1DE,1203
170
+ annet-2.4.0.dist-info/licenses/AUTHORS,sha256=rh3w5P6gEgqmuC-bw-HB68vBCr-yIBFhVL0PG4hguLs,878
171
+ annet-2.4.0.dist-info/licenses/LICENSE,sha256=yPxl7dno02Pw7gAcFPIFONzx_gapwDoPXsIsh6Y7lC0,1079
170
172
  annet_generators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
171
173
  annet_generators/example/__init__.py,sha256=1z030I00c9KeqW0ntkT1IRLYKD5LZAHYjiNHrOLen1Q,221
172
174
  annet_generators/example/lldp.py,sha256=24bGvShxbio-JxUdaehyPRu31LhH9YwSwFDrWVRn6yo,2100
@@ -178,10 +180,8 @@ annet_generators/rpl_example/generator.py,sha256=zndIGfV4ZlTxPgAGYs7bMQvTc_tYScO
178
180
  annet_generators/rpl_example/items.py,sha256=d99HSXDHFjZq511EvGhIqRTWK3F4ZsCWfdUqFYQcyhE,772
179
181
  annet_generators/rpl_example/mesh.py,sha256=z_WgfDZZ4xnyh3cSf75igyH09hGvtexEVwy1gCD_DzA,288
180
182
  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,,
183
+ annet-2.4.0.dist-info/METADATA,sha256=boKtnkrhg9LXUXbwV9EARQdsoZ1HTOIFIY3rvKOcark,815
184
+ annet-2.4.0.dist-info/WHEEL,sha256=tTnHoFhvKQHCh4jz3yCn0WPTYIy7wXx3CJtJ7SJGV7c,91
185
+ annet-2.4.0.dist-info/entry_points.txt,sha256=5lIaDGlGi3l6QQ2ry2jZaqViP5Lvt8AmsegdD0Uznck,192
186
+ annet-2.4.0.dist-info/top_level.txt,sha256=QsoTZBsUtwp_FEcmRwuN8QITBmLOZFqjssRfKilGbP8,23
187
+ annet-2.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.1.0)
2
+ Generator: setuptools (77.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5