Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughElasticsearch client initialization in ChangesElasticsearch Client Initialization
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 9/10 reviews remaining, refill in 6 minutes. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cloud_governance/common/elasticsearch/elasticsearch_operations.py`:
- Around line 57-58: The code unconditionally writes to the private field
self.__es.transport._verified_elasticsearch which can be absent in other
elasticsearch-py versions and currently lives inside a broad except that sets
self.__es = None; instead, guard that write by checking hasattr(self, "__es")
and hasattr(self.__es, "transport") and hasattr(self.__es.transport,
"_verified_elasticsearch") (or wrap only that assignment in a try/except
AttributeError), and on failure log a warning with the exception details (do not
set self.__es = None there). Narrow the broad exception handling around client
creation/connection so only real connection/creation failures set self.__es =
None, and keep the private-attribute override isolated and safely handled in the
method where self.__es is initialized/modified.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 430bd23a-1e74-4700-b011-8495625b8eda
📒 Files selected for processing (1)
cloud_governance/common/elasticsearch/elasticsearch_operations.py
|
@pragya811, I will aproved it but we should ask @inntran to upgrade OpenSearch version to support elasticsearch 8/9 versions. |
Type of change
Note: Fill x in []
Description
The elasticsearch-py 7.14+ client introduced a product verification check that rejects connections to non-Elasticsearch servers. Since we connect to OpenSearch 1.2.4, the client throws UnsupportedProductError on the first request (ping()), preventing all data uploads.
Fix : Bypass the product verification by setting transport._verified_elasticsearch = True immediately after client initialization, before any requests are made. This skips the server product check while preserving all existing client functionality.
For security reasons, all pull requests need to be approved first before running any automated CI
Summary by CodeRabbit