Review and update Fess management API calls#22
Merged
Conversation
…3.3.2 This commit improves the robustness of Fess API calls and updates all version references to the latest stable releases. API Improvements: - Add explicit HTTP status code checking (400+ errors) - Make timeout configurable via FessAPIClient constructor (default: 5.0s) - Enhance error messages for better debugging: - Network errors clearly identified - HTTP errors include status code and API response message - JSON parse errors show the invalid response Version Updates: - Update Fess from 15.1.0 to 15.3.2 - Update OpenSearch from 3.1.0 to 3.3.2 - Update default version in settings.py from 14.19.0 to 15.3.2 - Update all documentation and test configurations The previous implementation had response.raise_for_status() commented out, which could allow HTTP errors to pass through silently if they returned valid JSON. This is now properly handled with explicit status code checks.
The previous commit incorrectly raised exceptions for all HTTP 400+ status codes. However, Fess API returns valid JSON responses even for errors (like "resource not found"), with error details in the response.status field. Changes: - Remove HTTP 400+ status code check that was raising exceptions - Allow JSON parsing for all HTTP status codes - Commands can now check response.status field and display appropriate error messages - Keep improved error messages for network errors and JSON parsing failures This fixes test failures where commands expected to handle 400 errors gracefully by checking the JSON response status field.
These commands were missing exception handling in their get operations, causing exit code 2 errors when exceptions occurred. Changes: - Add try-except blocks to get_fileauth, get_fileconfig, and get_keymatch - Properly catch and display error messages for API failures - Match the error handling pattern used in other commands (e.g., user.py) - Change exit code from hardcoded 1 to status for consistency This fixes test failures in: - test_fileauth_crud_flow - test_fileconfig_crud_flow - test_keymatch_crud_flow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…3.3.2
This commit improves the robustness of Fess API calls and updates all version references to the latest stable releases.
API Improvements:
Version Updates:
The previous implementation had response.raise_for_status() commented out, which could allow HTTP errors to pass through silently if they returned valid JSON. This is now properly handled with explicit status code checks.