Skip to content

πŸ”–v9.0.2

Choose a tag to compare

@Pack3tL0ss Pack3tL0ss released this 03 Dec 23:38
· 541 commits to master since this release

πŸ’₯πŸ’₯πŸ’₯Breaking ChangesπŸ’₯πŸ’₯πŸ’₯

This release of centralcli is a major refactor, and introduces a number of potentially breaking changes if you are using it as a library (importing it into another script), or if you've built scripts that use the CLI (i.e. a bash script that uses cencli).

  • 🚚 Files have been moved / reorganized / broken up
  • ✨ Significant new features:
    • Add support for doing inventory/subscription calls direct to GreenLake.
    • Cache subscription info, use GLP API to update inventory and subscription cache.
  • βœ… The bulk of this update is work to add tests and get coverage to > 90% (91% currently). This effort flushed out a number of bugs also fixed in this release.

Resolved Bugs

  • 🩹 Fix minor issue with invalid flag detection in update config
  • 🩹 Exit when duplicates found in import files. Handling duplicates had bug due to use of set and set not maintaining order
  • 🩹 Fix missing cache object in CacheGuest
  • 🩹 Fix some filtering logic in kick client
  • 🩹 Fix validation for monitor_only being updated on group w/ switches already allowed.
  • 🩹 Fix detection of ap and gw together for upgrade which is valid.
  • 🩹 Fix flaw in multiple incompatible devices detection
  • 🩹 Minor fix in template matching logic in update template
  • 🩹 Fix potential for markup error when msg passed to logger includes [/...
  • 🩹 Fix bug where cols and rows flipped in TTY object
  • 🩹 Fix group logic in show firmware compliance + other code formatting
  • 🩹 Fix corner-case in get_device_firmware_details ... offline AP could have empty list for data["aps"]
  • 🩹 Fix corner-case issue... Would only apply if cert completion was attempted after a cert had been added via cencli and show certs had not been run.
  • 🩹 Fix update webhook not honoring --yes option
  • 🩹 Fix completion in remove
  • 🩹 Handle null fields in get_site_identifier querries
  • 🩹 Fix mpsk reset option in cloudauth_update_namedmpsk.
  • 🩹 Fix rate limit output when combining multiple named_mpsk calls
  • 🩹 Fix potential for IndexError during fuzz match if dev_type is specified in get_dev_identifier, and none of that type exist
  • 🩹 Minor fix for cache update after clone group
  • πŸ› Fix potential for TyperError due to services (subscription) being a list from inventory.
  • πŸ› Fix issue with cache update after cert delete
  • πŸ› Fix bug in kick client (if client is not connected per current cache)
  • πŸ› Fix bug when using show alerts with --label flag
  • πŸ› Fix batch verify subscription validation
  • πŸ› Fix --mo-cx flag in update group
  • πŸ› Fix potential for exception if all calls to get_named_mpsk fail in refresh_mpsk_db()
  • πŸ› Fix bug in show devices/aps/gateways... <device iden> --inv where invalid paramerter name was used for dev_type causing Exception.
  • πŸ› Fix errant match in get_guest_identifier when qry_str is all text... match would then match any guests that lack a phone.
  • πŸ› Fix bug in upgrade device if not version is provided (recommended version)
  • πŸ› Fix bug where kick by --ssid was not actually honoring the SSID part (was kicking all users from the AP)
  • πŸ› Fix UnboundLocalError on multi-match with conductor_only option (now swack) in get_dev_identifier
  • πŸ› Fix bug in assign subscription when anything other than the id is used to identify the dev and the dev is not in monitoring DB yet.
  • πŸ› Fix reboot request logic in batch_update_aps / _reboot_after_changes
  • πŸ› Fix missing APNetworkRole when group ap is added as allowed device type in update_group_properties()
  • πŸ› Fix update for group that currently does not have aps in allowed_types
  • πŸ› Fix bug in update_per_ap_settings
  • πŸ› Fix bug in caas.send_cmds when site keyword is used. Was looking up group identifier not site.
  • πŸ› Fix serial number by text file validation in _get_import_file()
  • πŸ› Fix upload_certificate for pkcs12 and DER cert types
  • πŸ› Fix _verify_device_type ... make @staticmethod
  • πŸ› Fix validation of device_type in move_devices_to_site()
  • πŸ› Fix -a|--all flag in show audit logs
  • πŸ› Fix honoring of enabled/disabled and role flags when no ssid is specified.
  • πŸ› Fix bug in guest completion when incomplete is empty str
  • πŸ› Fix ability to update variables for device that has not checked into central yet
  • πŸ› Fix cencli show inventory when dev_type switch is specified
  • πŸ› Fix --up | --down flags for show swarms
  • πŸ› Fix bug in interface cleaner for stacks
  • πŸ› Fix --up | --down flags for show swarms
  • πŸ› Fix setup_batch_import_file() for tests. Was not creating yaml/csv files correctly.
  • πŸ› Fix lldp neighbors for VSF stacks, which was using wrong function/API endpoint
  • πŸ› Fix bug in TTY object
  • πŸ› Fix exception was being returned not raised
  • πŸ› Fix bug where loop evaluating process pid could never give up in stop hook-proxy
  • πŸ› Fix handling of multiple groups in update cp-cert. WorkAround bug in typer.
  • πŸ›βͺ Fix regression bug related to clients with null last_connected_time
  • πŸ› Fix bug in template_completion when COMP_WORD is an empty str
  • πŸ› Fix url query string issue in batch assign subscriptions
  • πŸ› Fix response when validation fails in update_group_properties
  • πŸ› Fix markup mismatch issue in clone group (when upgrading to aos10, which doesn't work anyway)
  • πŸ› Fix upgrade when --at is used to specify upgrade at later time
  • πŸ› Fix exception when min_width=None is passed into render.display_results
  • πŸ› Fix convert template
  • πŸ› Fix batch assign when --tags option is not provided
  • πŸ› Fix imports, move custom exception import out of if TYPE_CHECKING block.
  • πŸ› Fix CacheInvMonDevice summary_text
  • πŸ› Fix --dev-type filter output (make it work) in show subscriptions
  • πŸ› Fix retry logic for clients in cache.get_client_identifier()
  • πŸ› Fix Config.wss_key was referencing the webhook token not the wss key
  • πŸ› Fix show branch health make (restore) site argument optional
  • πŸ› Fix cache file moves for mocked tests
  • πŸ› Fix bug when sending duration parmeter to send_command_to_device
  • πŸ› Fix incorrect argument name during inventory db update
  • πŸ› Fix bug if -S|--swarm option used in show wids commands
  • πŸ› Fix incorrect base_url passed into GreenLakeAPI during instantiation
  • πŸ› Fix potential for an IndexError when attempting fuzzy match (typo check), could happen if the cache being querried was empty.
  • πŸ› Fix bug in batch_delete_sites
  • πŸ› Fix ImportSite model deal with potential for NoneType as state (geo-loc)
  • πŸ‘½οΈ Fix output adjustment when API returns 404 when compliance policy is not set. API used to return reason "Not Found" now returns "ERROR" so we just key off 404

Commands/Options Updates / New Commands/Features

  • πŸ”§ configuration schema changed. ✨ Command cencli convert config available to update legacy schema
  • ✨ Add show bssids
  • ✨ Add delete variables
  • ✨ Add export redsky-bssids
  • ✨ Add ts mesh to run mesh / bridge related troubleshooting commands on APs
  • 🚸 Filter logs by device when --swarm option is used for a non-ap (show logs --dev <not ap> --swarm). --swarm is not just ignored in this scenario.
  • 🚸 return appropriate exit code when API calls fail or there is a partial failure.
  • 🚸 --sort in show guests now supports completion and has valid values in help text.
  • ✨ Add logic to ignore group field for batch_add_devices if "retain_config" is in the import and set to True.

    retain_config is valid for batch move not batch add, batch add doesn't support retain_config

  • ✨ auto detect cert format based on extension if no cert format is provided in cencli add cert
  • ✨ show config for switch in template group uses diff API endpoint.
  • ✨ Add cencli show cloud-auth authentication and cencli show cloud-auth sessions
  • ⚰️ Remove auto as valid arg in assign license. No longer needed as cencli enable/disable was added to replace.
  • 🚩 -s flag for swarm is now -S so it does not conflict with -s for start in commands supporting time range.
  • ✨ Add unassign subscription (GLP)
  • 🚸 Add missing confirmation prompt in batch archive
  • ✨ Allow filtering of inventory output by --key (subscription key)
  • ✨ Add --location flag for show clients. To see location from floor plan API
  • 🚚 ♻️ show clients --denylisted --dev ... moved to it's own command show denylisted <DEVICE>
  • ✨ show device (ap, gateways, switches, switches, all, etc.) now support filtering by version or excluding a version.
  • ✨ upgrade device now supports multiple devices.
  • ✨ Add cencli ts clear ...
  • ✨ cencli assign subscription (GLP) ... Implement query method that returns object with fields from both inv and dev cache.

centralcli API changes (Library changes)

  • ✨ Add ability for only template to be provided in utils.generate_template. Add logic to search parent dir of template_file for var_file matching same name (with yaml/json suffix)
  • ⚑️ fix auto device type based on filters in get_clients.
  • ✨ utils.summarize_list can now flatten a list of lists
  • ✨ ♻️ get_sub_identifier now supports match by sub key (moved to it's own function)
  • ✨ add validate_wss_key (websocket)

Cache / database changes

  • πŸ—ƒοΈ Ensure inventory services (subscription) field is stored as a str not a list with 1 str
  • πŸ—ƒοΈ Improve cache update after site update.
  • πŸ—ƒοΈ normalize phone numbers stored in guest cache... always remove leading +
  • πŸ—ƒοΈ Add cache update after cert add,
  • πŸ—ƒοΈ Handle lack of id in Inventory cache
    This can happen after adding devices, as we update the cache with what we know from the import, but don't do a cache update.

Other / developer improvements

  • πŸ§‘β€πŸ’» ✨ Add cencli dev commands (hidden)

  • ✨ πŸ§‘β€πŸ’» Add dev commands to flip between v1 and v2 config (for testing)

  • ✨ Add support for displaying or tailing pytest log

  • πŸŽ‰ πŸŽ‰ remove all uses of requests.request (aiohttp form-data workaround).
    Previously used as work-around due to not being able to sort out how to format form-data for aiohttp. Still using requests to prepare the payload (prepared request).

  • ⚑️ only check inv cache if doing inv operations in batch_delete_devices

  • βœ… raise typer.Exit if handle_multi_match is called during pytest run
    handle_multi_match requires a tty, tests / fixtures should be such that it never hits, but it's possible if things are not cleaned up properly in a hung or aborted test run.

  • πŸ’₯ render.display_results exit_on_fail now defaults to True

  • 🚚 cache.Cache.get_dev_identifier rename params swack/conductor_only to
    swack_only: Only return matches that are VC or Conductor. (Used to be swack)
    swack: When multiple matches only return VC or Conductor. Still returns standalone/non-vc matches if single match. (used to be conductor_only)

  • πŸ§‘β€πŸ’» Add dev help-text to verify formatting of summary / help text for all object types in cache.

  • πŸ”Š Numerous tweaks to log output

  • 🀑 Implement mocking to run large scale automated tests with mocked responses.

  • βž• Add pytest-cov as dev dependency to track test coverage

  • 🚩 πŸ§‘β€πŸ’» Add hidden global --mock flag.

    --mock is stripped before instantiating CLI so it will not impact any commands. It's only useful for cencli show cache it sets the env var PYTEST_VERSION resulting the mock cache being used for cencli show cache commands.