centralcli 7.2.4__tar.gz → 7.2.6__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.
Files changed (64) hide show
  1. {centralcli-7.2.4 → centralcli-7.2.6}/PKG-INFO +1 -1
  2. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/cache.py +3 -2
  3. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/central.py +3 -3
  4. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/cli.py +14 -11
  5. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clicommon.py +4 -3
  6. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/response.py +1 -1
  7. {centralcli-7.2.4 → centralcli-7.2.6}/pyproject.toml +1 -1
  8. {centralcli-7.2.4 → centralcli-7.2.6}/LICENSE +0 -0
  9. {centralcli-7.2.4 → centralcli-7.2.6}/README.md +0 -0
  10. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/__init__.py +0 -0
  11. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/boilerplate/README.md +0 -0
  12. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/boilerplate/_cnx_allcalls.py +0 -0
  13. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/boilerplate/allcalls.py +0 -0
  14. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/caas.py +0 -0
  15. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/cleaner.py +0 -0
  16. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/cliadd.py +0 -0
  17. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/cliassign.py +0 -0
  18. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clibatch.py +0 -0
  19. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clicaas.py +0 -0
  20. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clicheck.py +0 -0
  21. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/cliclone.py +0 -0
  22. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clidel.py +0 -0
  23. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clidelfirmware.py +0 -0
  24. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/cliexport.py +0 -0
  25. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clikick.py +0 -0
  26. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clioptions.py +0 -0
  27. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clirefresh.py +0 -0
  28. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clirename.py +0 -0
  29. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/cliset.py +0 -0
  30. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clisetfirmware.py +0 -0
  31. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clishow.py +0 -0
  32. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clishowaudit.py +0 -0
  33. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clishowbandwidth.py +0 -0
  34. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clishowbranch.py +0 -0
  35. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clishowcloudauth.py +0 -0
  36. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clishowfirmware.py +0 -0
  37. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clishowmpsk.py +0 -0
  38. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clishowospf.py +0 -0
  39. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clishowoverlay.py +0 -0
  40. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clishowtshoot.py +0 -0
  41. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clishowwids.py +0 -0
  42. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clitest.py +0 -0
  43. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/clitshoot.py +0 -0
  44. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/cliunassign.py +0 -0
  45. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/cliupdate.py +0 -0
  46. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/cliupgrade.py +0 -0
  47. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/config.py +0 -0
  48. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/constants.py +0 -0
  49. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/exceptions.py +0 -0
  50. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/logger.py +0 -0
  51. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/models.py +0 -0
  52. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/objects.py +0 -0
  53. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/render.py +0 -0
  54. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/setup.py +0 -0
  55. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/static/favicon.ico +0 -0
  56. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/strings.py +0 -0
  57. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/typedefs.py +0 -0
  58. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/utils.py +0 -0
  59. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/vendored/csvlexer/__init__.py +0 -0
  60. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/vendored/csvlexer/csv.py +0 -0
  61. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/vscodeargs.py +0 -0
  62. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/wh2snow.py +0 -0
  63. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/wh_proxy.py +0 -0
  64. {centralcli-7.2.4 → centralcli-7.2.6}/centralcli/wh_proxy_service.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: centralcli
3
- Version: 7.2.4
3
+ Version: 7.2.6
4
4
  Summary: A CLI for interacting with Aruba Central (Cloud Management Platform). Facilitates bulk imports, exports, reporting. A handy tool if you have devices managed by Aruba Central.
5
5
  Home-page: https://github.com/Pack3tL0ss/central-api-cli
6
6
  License: MIT
@@ -2356,9 +2356,10 @@ class Cache:
2356
2356
  """Update Device Database (local cache).
2357
2357
 
2358
2358
  If data is provided it's asumed to be a partial update. No devices will be removed from the cache unless remove=True.
2359
+
2359
2360
  Args:
2360
- data (List[Dict[str, Any]] | Dict[str, Any] | List[int] | int): Device data to update cache with. Existing devices are
2361
- retained and updated with any changes from the new data provided.
2361
+ data (List[Dict[str, Any]] | Dict[str, Any] | List[int] | int): Device data to update cache with.
2362
+ Existing devices are retained and updated with any changes from the new data provided.
2362
2363
  remove (bool, optional): Set True to remove devices from cache, data should be a list of doc_ids (int).
2363
2364
 
2364
2365
  Returns:
@@ -4524,7 +4524,7 @@ class CentralApi(Session):
4524
4524
  ) -> Response:
4525
4525
  """Delete devices using Serial number. Only applies to CoP deployments.
4526
4526
 
4527
- Device can not be archived in CoP inventoryI
4527
+ Device can not be archived in CoP inventory.
4528
4528
 
4529
4529
  Args:
4530
4530
  devices (list, optional): List of devices to be deleted from
@@ -5378,7 +5378,7 @@ class CentralApi(Session):
5378
5378
  async def get_brach_health(
5379
5379
  self,
5380
5380
  name: str = None,
5381
- column: int = None,
5381
+ column: int = None, # NEXT-MAJOR remove or make consistent with other parameters (sort)
5382
5382
  reverse: bool = False,
5383
5383
  filters: dict = {},
5384
5384
  offset: int = 0,
@@ -5499,7 +5499,7 @@ class CentralApi(Session):
5499
5499
  """Get all portals with limited data.
5500
5500
 
5501
5501
  Args:
5502
- sort (str, optional): + is for ascending and - for descending order, Valid Values: name prepended with + or - i.e. +name.
5502
+ sort (str, optional): `+` is for ascending and `-` for descending order, Valid Values: name prepended with `+` or `-` i.e. +name.
5503
5503
  Defaults to None. Which results in use of API default +name.
5504
5504
  offset (int, optional): Starting index of element for a paginated query Defaults to 0.
5505
5505
  limit (int, optional): Number of items required per query Defaults to 100.
@@ -585,21 +585,24 @@ def archive(
585
585
 
586
586
  Just use cencli deleve device ... or cencli batch delete devices
587
587
  """
588
- devices: List[CentralObject] = [cli.cache.get_dev_identifier(dev, silent=True, include_inventory=True) for dev in devices]
589
-
590
- # TODO add confirmation method builder to output class
588
+ _emsg = ""
591
589
  _msg = "[bright_green]Archive devices[/]:"
592
- if len(devices) > 1:
593
- _dev_msg = '\n '.join([dev.rich_help_text for dev in devices])
594
- _msg = f"{_msg}\n {_dev_msg}\n"
595
- else:
596
- dev = devices[0]
597
- _msg = f"{_msg} {dev.rich_help_text}"
590
+ serials = []
591
+ cache_devs: List[CentralObject] = [cli.cache.get_dev_identifier(dev, silent=True, include_inventory=True, exit_on_fail=False) for dev in devices]
592
+ for dev_in, cache_dev in zip(devices, cache_devs):
593
+ if cache_dev:
594
+ _msg = f"{_msg}\n {cache_dev.rich_help_text}"
595
+ serials += [cache_dev.serial]
596
+ elif cache_dev is None and not utils.is_serial(dev_in):
597
+ _emsg = f"{_emsg}\n [dark_orange3]\u26a0[/] [red]Skipping[/] [cyan]{dev_in}[/]. Not found in Cache and does not appear to be a serial number."
598
+ else:
599
+ _msg = f"{_msg}\n {dev_in}"
600
+ serials += [dev_in]
598
601
 
599
602
  console = Console(emoji=False)
600
- console.print(_msg)
603
+ console.print(_msg, _emsg, sep="\n")
601
604
  if cli.confirm(yes):
602
- resp = cli.central.request(cli.central.archive_devices, [d.serial for d in devices])
605
+ resp = cli.central.request(cli.central.archive_devices, serials)
603
606
  cli.display_results(resp, tablefmt="action")
604
607
 
605
608
 
@@ -1472,6 +1472,7 @@ class CLICommon:
1472
1472
  not_found_devs: List[str] = [s for s, c in zip(serials_in, cache_devs) if c is None]
1473
1473
  cache_found_devs: List[CacheDevice | CacheInvDevice] = [d for d in cache_devs if d]
1474
1474
  cache_mon_devs: List[CacheDevice] = [d for d in cache_found_devs if d.db.name == "devices"]
1475
+ cache_inv_devs: List[CacheInvDevice] = [d for d in cache_found_devs if d.db.name == "inventory"]
1475
1476
 
1476
1477
 
1477
1478
  # archive / unarchive removes any subscriptions (less calls than determining the subscriptions for each then unsubscribing)
@@ -1488,12 +1489,12 @@ class CLICommon:
1488
1489
  mon_del_reqs, delayed_mon_del_reqs = self._build_mon_del_reqs(cache_mon_devs)
1489
1490
 
1490
1491
  # cop only delete devices from GreenLake inventory
1491
- cop_del_reqs = [] if not config.is_cop or not serials_in else [
1492
- BR(self.central.cop_delete_device_from_inventory, serials_in)
1492
+ cop_del_reqs = [] if not config.is_cop or not cache_inv_devs else [
1493
+ BR(self.central.cop_delete_device_from_inventory, [dev.serial for dev in cache_inv_devs])
1493
1494
  ]
1494
1495
 
1495
1496
  # warn about devices that were not found
1496
- if (mon_del_reqs or delayed_mon_del_reqs) and not_found_devs:
1497
+ if (mon_del_reqs or delayed_mon_del_reqs or cop_del_reqs) and not_found_devs:
1497
1498
  not_in_inv_msg = utils.color(not_found_devs, color_str="cyan", pad_len=4, sep="\n")
1498
1499
  self.econsole.print(f"\n[dark_orange3]\u26a0[/] The following provided devices were not found in the inventory.\n{not_in_inv_msg}", emoji=False)
1499
1500
  self.econsole.print("[grey42 italic]They will be skipped[/]\n")
@@ -384,7 +384,7 @@ class Response:
384
384
 
385
385
  r = r.replace("failed:", "[red]failed[/]:").replace("FAILED", "[red]FAILED[/red]").replace("failed_devices", "[red]failed_devices[/]").replace("INVALID", "[red]INVALID[/]")
386
386
  r = r.replace("SUCCESS", "[bright_green]SUCCESS[/]").replace("Success", "[bright_green]Success[/]").replace("Success[/]fully", "Successfully[/]")
387
- r = r.replace("Success", "[bright_green]Success[/]").replace("success", "[bright_green]success[/]").replace("succeeded_devices", "[bright_green]succeeded_devices[/]")
387
+ r = r.replace("Success", "[bright_green]Success[/]").replace("success", "[bright_green]success[/]").replace("success[/]fully", "successfully[/]").replace("succeeded_devices", "[bright_green]succeeded_devices[/]")
388
388
  r = r.replace("invalid_device", "[red]invalid_device[/]").replace("blocked_device", "[red]blocked_device[/red]").replace("ATHENA_ERROR_DEVICE_ALREADY_EXIST", "[italic dark_orange3]Device already exists[/]")
389
389
 
390
390
  # sanitize sensitive data for demos
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "centralcli"
3
- version = "7.2.4"
3
+ version = "7.2.6"
4
4
  description = "A CLI for interacting with Aruba Central (Cloud Management Platform). Facilitates bulk imports, exports, reporting. A handy tool if you have devices managed by Aruba Central."
5
5
  license = "MIT"
6
6
  authors = ["Wade Wells (Pack3tL0ss) <wade@consolepi.org>"]
File without changes
File without changes