Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robust error handling #26

Merged
merged 21 commits into from
Oct 30, 2023
Merged

Robust error handling #26

merged 21 commits into from
Oct 30, 2023

Conversation

ElijahSwiftIBM
Copy link
Collaborator

💡 Issue Reference

Issue: #12

💻 What does this address?

Some of the functions of pyracf have a lot of functional overlap that can lead to issues, and there was very little input validation. Admin.Add functions could "alter" resource profiles that already existed and Admin.Alter functions could "add" new ones. This can lead to typos making changes to existing profiles or creating new ones that were unintentional.

📟 Implementation Details

New error objects were created:

  • AddOperationError for when an add detects the profile already exists.
  • AlterOperationError for when alter detects the profile does not yet exist.
  • InvalidSegmentNameError for when an invalid/unknown segment name is specified on an extract request
  • InvalidSegmentTraitError for when an invalid/unknown segment-trait combination is specified on an add/alter request

Additionally, I took this opportunity to pluralize Setropts Getters/Setters that were already capable of taking multiple classes as arguments and adjusting the type hints accordingly, as well as some other small name changes and bug fixes prior to beta release.

📋 Is there a test case?

Testing suite was also updated. Testing of debug logging and secrets redaction were moved to ALTER functions rather than ADD as ADD lacks the consistent structure to test successes and failures with the new input validation and error cases. Each new error case is also tested. Additional testing was added to confirm pluralized Setropts functions work as now documented and referenced.

ElijahSwiftIBM and others added 11 commits October 11, 2023 17:24
-Used "Fail on first error flag" which should stop Add requests from inadvertently altering existing users
-Added AlterOperationError and raise this when Alter cannot extract the target profile before performing its operation
Access and Connection Admin had no difference between Add and Alter commands. The operations "under the covers" were exactly the same. Now that other function groups have more differences, these are merged to alter.
Throw InvalidSegmentTraitError when there is an invalid segment trait combination.

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Unit test to confirm that Alters for Group, Resource, User and Data Set Admin all throw AlterOperationError when failing in the EXTRACT step.

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Added Invalid Segment Name Error
Pluralized SETROPTS gettrs/settrs and changed type hints
Change name of alter connection and alter access

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
-Used preliminary extract to determine if add is valid (in user)
-Updated unit testing framework to account for this
-Moved checking of redacted secrets and debug logging to alter (for User) due to Add changes

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Pull Dev Changes and Fix resulting conflicts

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Add Unit Testing for list and string forms of multiple "classes" passed to Setropts Admin Settrs

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Move Testing of debug logging to Alter in Group, DataSet and Resource Admins

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
General_command_classes -> Generic_command_classes

set/remove grpacc in connection admin to give/take away grpacc

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
@lcarcaramo lcarcaramo added the enhancement New feature or request label Oct 27, 2023
@lcarcaramo lcarcaramo added this to the Beta 1.0b1 milestone Oct 27, 2023
Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Added Alter=True to Connection, Access, and Setropts Admin's Add/Alter command to establish operation flags.

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
ElijahSwiftIBM and others added 4 commits October 27, 2023 14:44
correction for bad find/replace

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Base:ID was NOT extraneous in Access Admin, changed to AUTH_ID

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Formatting and Docstring Changes
Also added result parser test for custom secrets on userid alter.

Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
Signed-off-by: Elijah Swift <elijah.swift@ibm.com>
@lcarcaramo lcarcaramo merged commit 85336a0 into dev Oct 30, 2023
4 checks passed
@lcarcaramo lcarcaramo deleted the robust-error-handling branch October 31, 2023 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants