Merged
Conversation
e03d4ed to
df8a3a1
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds initial support for submitting reports over a REST API in the client library, making the REST functionality optional based on an environment variable.
- Added REST URI validation using a regex pattern
- Implemented a new rest_submit() function for REST-based submissions and updated submit() and future_submit() to support REST
- Early return in init() when KCIDB_REST is set, bypassing the traditional database and MQ setup
Comments suppressed due to low confidence (1)
kcidb/init.py:156
- LOGGER is used but not defined in this file; please initialize a logger or use logging.getLogger to properly log errors.
LOGGER.error("Error submitting report: %s", e)
df8a3a1 to
b58d18e
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds optional REST support to the client library, enabling report submissions over a REST API if the environment variable KCIDB_REST is present.
- Introduces required imports for REST support (os, re, requests).
- Adds a REST URI validation regex, validate_rest_uri, and rest_submit method to handle REST submissions.
- Updates the init, submit, and future_submit methods to conditionally use REST over the traditional MQ publishing.
8796391 to
567ba6a
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR introduces initial support for REST submissions in the client library by leveraging a new environment variable (KCIDB_REST) to enable an alternative submission path. Key changes include:
- Importing and using new modules (os, re, and requests) for REST functionality.
- Adding new methods for validating REST URIs and submitting reports over a REST API.
- Modifying the submit and future_submit methods to prioritize REST submission when available.
Comments suppressed due to low confidence (1)
kcidb/init.py:134
- [nitpick] The variable name 'vre' is ambiguous; consider renaming it to something more descriptive (e.g., 'regex_match' or 'rest_regex').
vre = self.REST_REGEX
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
567ba6a to
d1e61c2
Compare
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.
As we implemented kcidb-rest interface on server side, we need to make optional (for now) support for it in client library.