Skip to content

CMLDEV-910 added raise for InitializationError when jwt is incorrect and usernam…#194

Merged
tmikuska merged 2 commits intodevfrom
CMLDEV-910-fixed-flow-with-invalid-jwt-on-init
Mar 2, 2026
Merged

CMLDEV-910 added raise for InitializationError when jwt is incorrect and usernam…#194
tmikuska merged 2 commits intodevfrom
CMLDEV-910-fixed-flow-with-invalid-jwt-on-init

Conversation

@vprysiaz
Copy link
Collaborator

…e/password not provided

@PatrikMosko PatrikMosko self-requested a review February 27, 2026 13:32
_LOGGER.warning("re-auth called on 401 unauthorized")
self.token = None
if not (self.client_library.username and self.client_library.password):
raise InitializationError(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that APIError is not ideal name either, but this is mostly problem on re-auth not on initialization

do we know why and if we need to use APIError when a request fails?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I choose InitializationError as when it is raised we have good error handling flow. and flag that is responsible for "raise on auth" or something like that.
for me Init errors looks good. because providing token only without password and calling re-auth is a problem in how pcl was initialized. but feel free to suggest something else

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with APIError as that's what we use in integration tests

@tmikuska tmikuska changed the title added raise for InitializationError when jwt is incorrect and usernam… CMLDEV-910 added raise for InitializationError when jwt is incorrect and usernam… Feb 27, 2026
@tmikuska tmikuska force-pushed the CMLDEV-910-fixed-flow-with-invalid-jwt-on-init branch from 136b0bc to 962323e Compare March 2, 2026 14:21
@tmikuska tmikuska changed the base branch from main to dev March 2, 2026 14:22
@tmikuska
Copy link
Collaborator

tmikuska commented Mar 2, 2026

next time be careful to create a branch from dev

@tmikuska tmikuska merged commit 660da18 into dev Mar 2, 2026
@tmikuska tmikuska deleted the CMLDEV-910-fixed-flow-with-invalid-jwt-on-init branch March 2, 2026 14:23
tmikuska pushed a commit that referenced this pull request Mar 17, 2026
* Raise APIError when jwt is incorrect and username/password not provided
tmikuska added a commit that referenced this pull request Mar 17, 2026
* Expose all operational data in sync call
* Allow passing arbitrary PyATS parameters in run command
* Configuration cleanup
* Add missing attributes to join_existing_lab method
* Fix type annotations for convergence wait time
* Remove unnecessary trailing slashes

Add support for starting index when connecting nodes (#126)

SIMPLE-7357 - Advanced group permissions

SIMPLE-7357 - Advanced group permissions update
* Fix deprecated endpoints and remove missed trailing slashes

SIMPLE-6003 - Improve node __repr__ readability
* Switch all __repr__ to f-strings and shorten to useful info
* Simplify node constructor for manual use

Add params to connection function (#134)
* Add ability to update multiple lab properties

SIMPLE-7411 - Support tar file upload for Docker

SIMPLE-7407 - Diagnostics in client (#138)

SIMPLE-7496 - Deprecate get_diagnostics with no args (#139)
* Remove unused group permissions
* Rename modules to singular
* Fix docstring indentation and content
* Raise LabNotFound only on 404 Not Found

SIMPLE-7569 - API changes for RBAC (#141)

SIMPLE-7622 - Fix GET NodeDefinition API call (#145)

SIMPLE-7461 - Consolidate exceptions (#144)

SIMPLE-7433 - Show all running nodes in compute hosts sysadmin (#146)
* Fix image definition download with YAML response
* Workaround for previous CML releases

SIMPLE-7745 - Allow .tar.gz image file extension (#147)

SIMPLE-7783 - Use test_data_dir fixture, allow Path for image upload (#148)

SIMPLE-6967 - Add pubkey for user create/update and testbed key_path setting (#151)

SIMPLE-7758 - Add client type identifier (#149)
* Fix CVE-2024-47081

SIMPLE-7993 - Deprecate original module names (#156)
* Fix CVE-2025-50181, CVE-2025-50182

SIMPLE-8002 - Exclude unneeded files (#161)

SIMPLE-8052 - Fix None fields (#162)

SIMPLE-7778 - Update Poetry to version 2 (#163)
* Update CML version to 2.10
* Rework mechanism to check incompatible versions

SIMPLE-7926 - Fix PCL operational data storage (#157)

SIMPLE-7927 - Fix system management controller property compute load
* Fix invalid external connector references

Fix PCL node configuration confusion with Main and default (#166)

SIMPLE-8078 - PCL support for lab repositories (#165)

Make client version check optional, rearrange attribute setting in init (#169)

CMLDEV-95 - Remove deprecated structures (#170)

CMLDEV-377 - Support for clearing discovered addresses (#167)

CMLDEV-587 - Extend link conditioning parameters (#174)
* Allow unsetting link conditioning properties

CMLDEV-617 - Drop support for Python 3.9 (#175)
* Add support for Python 3.14

CMLDEV-655 - Refactor opt-in to enum (#178)
* Add telemetry support

CMLDEV-12 - Add serial console switching for pyATS connections (#177)

CMLDEV-376 - Fix pyATS relogin after node stop and start (#176)

CMLDEV-23 - Clean pyATS loggers (#179)

CMLDEV-531 - Implement lab_autostart support (#172)

CMLDEV-537 - Implement node-staging feature (#173)

CMLDEV-702 - Fix pyATS console switching (#184)
* Default pyATS terminal server SSH options disable agents and identities
* Improve disconnect detection and reconnect

CMLDEV-575 - PCAP support (#186)

CMLDEV-727 - JWT authentication (#182)

CMLDEV-777 - Refactor configuration handling
* Reduce complexity of _get_configuration
* Move config methods to ClientConfig
* Resolve pyATS inconsistencies

CMLDEV-727 - Revert old authentication for previous CML releases (#189)

CMLDEV-786 - Switch to using link ID as capture key (#188)
* Remove the never-released capture key method

CMLDEV-428 - Make pyATS configurable per node image definition (#190)

CMLDEV-690 - Add pyATS enable password configurable per node

Move deprecation warning for configuration via input (#191)

CMLDEV-689 - Implement RADIUS auth (#192)

CMLDEV-489 - Add timeout property to LDAP auth and fix password setter
* Fix opt_in coercion for UserManagement payloads
* Fix documentation and deprecation warning correctness
* Update cryptography to fix vulnerabilities
* Deprecate USER_LIST diagnostics

CMLDEV-910 - Raise APIError when JWT is incorrect and credentials not provided (#194)

Fix bugs and apply improvements across client library (#197)
* Fix PyatsException inheritance and ControllerNotFound instantiation
* Fix sync_states staleness handling and _import_link parameter order
* Refactor Annotation validation, Version comparisons, and get_lab_list
* Optimize Node.next_available_interface with direct slicing

Store users locally to improve performance when querying labs/nodes (#199)
* Consolidate duplicated annotation properties
tmikuska added a commit that referenced this pull request Mar 17, 2026
* Expose all operational data in sync call
* Allow passing arbitrary PyATS parameters in run command
* Configuration cleanup
* Add missing attributes to join_existing_lab method
* Fix type annotations for convergence wait time
* Remove unnecessary trailing slashes

Add support for starting index when connecting nodes (#126)

SIMPLE-7357 - Advanced group permissions

SIMPLE-7357 - Advanced group permissions update
* Fix deprecated endpoints and remove missed trailing slashes

SIMPLE-6003 - Improve node __repr__ readability
* Switch all __repr__ to f-strings and shorten to useful info
* Simplify node constructor for manual use

Add params to connection function (#134)
* Add ability to update multiple lab properties

SIMPLE-7411 - Support tar file upload for Docker

SIMPLE-7407 - Diagnostics in client (#138)

SIMPLE-7496 - Deprecate get_diagnostics with no args (#139)
* Remove unused group permissions
* Rename modules to singular
* Fix docstring indentation and content
* Raise LabNotFound only on 404 Not Found

SIMPLE-7569 - API changes for RBAC (#141)

SIMPLE-7622 - Fix GET NodeDefinition API call (#145)

SIMPLE-7461 - Consolidate exceptions (#144)

SIMPLE-7433 - Show all running nodes in compute hosts sysadmin (#146)
* Fix image definition download with YAML response
* Workaround for previous CML releases

SIMPLE-7745 - Allow .tar.gz image file extension (#147)

SIMPLE-7783 - Use test_data_dir fixture, allow Path for image upload (#148)

SIMPLE-6967 - Add pubkey for user create/update and testbed key_path setting (#151)

SIMPLE-7758 - Add client type identifier (#149)
* Fix CVE-2024-47081

SIMPLE-7993 - Deprecate original module names (#156)
* Fix CVE-2025-50181, CVE-2025-50182

SIMPLE-8002 - Exclude unneeded files (#161)

SIMPLE-8052 - Fix None fields (#162)

SIMPLE-7778 - Update Poetry to version 2 (#163)
* Update CML version to 2.10
* Rework mechanism to check incompatible versions

SIMPLE-7926 - Fix PCL operational data storage (#157)

SIMPLE-7927 - Fix system management controller property compute load
* Fix invalid external connector references

Fix PCL node configuration confusion with Main and default (#166)

SIMPLE-8078 - PCL support for lab repositories (#165)

Make client version check optional, rearrange attribute setting in init (#169)

CMLDEV-95 - Remove deprecated structures (#170)

CMLDEV-377 - Support for clearing discovered addresses (#167)

CMLDEV-587 - Extend link conditioning parameters (#174)
* Allow unsetting link conditioning properties

CMLDEV-617 - Drop support for Python 3.9 (#175)
* Add support for Python 3.14

CMLDEV-655 - Refactor opt-in to enum (#178)
* Add telemetry support

CMLDEV-12 - Add serial console switching for pyATS connections (#177)

CMLDEV-376 - Fix pyATS relogin after node stop and start (#176)

CMLDEV-23 - Clean pyATS loggers (#179)

CMLDEV-531 - Implement lab_autostart support (#172)

CMLDEV-537 - Implement node-staging feature (#173)

CMLDEV-702 - Fix pyATS console switching (#184)
* Default pyATS terminal server SSH options disable agents and identities
* Improve disconnect detection and reconnect

CMLDEV-575 - PCAP support (#186)

CMLDEV-727 - JWT authentication (#182)

CMLDEV-777 - Refactor configuration handling
* Reduce complexity of _get_configuration
* Move config methods to ClientConfig
* Resolve pyATS inconsistencies

CMLDEV-727 - Revert old authentication for previous CML releases (#189)

CMLDEV-786 - Switch to using link ID as capture key (#188)
* Remove the never-released capture key method

CMLDEV-428 - Make pyATS configurable per node image definition (#190)

CMLDEV-690 - Add pyATS enable password configurable per node

Move deprecation warning for configuration via input (#191)

CMLDEV-689 - Implement RADIUS auth (#192)

CMLDEV-489 - Add timeout property to LDAP auth and fix password setter
* Fix opt_in coercion for UserManagement payloads
* Fix documentation and deprecation warning correctness
* Update cryptography to fix vulnerabilities
* Deprecate USER_LIST diagnostics

CMLDEV-910 - Raise APIError when JWT is incorrect and credentials not provided (#194)

Fix bugs and apply improvements across client library (#197)
* Fix PyatsException inheritance and ControllerNotFound instantiation
* Fix sync_states staleness handling and _import_link parameter order
* Refactor Annotation validation, Version comparisons, and get_lab_list
* Optimize Node.next_available_interface with direct slicing

Store users locally to improve performance when querying labs/nodes (#199)
* Consolidate duplicated annotation properties
@tmikuska tmikuska mentioned this pull request Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants