Skip to content

Commit ddca73d

Browse files
authored
feat: add Elasticsearch 9 support with comprehensive test coverage (#22)
- Add elasticsearch9_mod module and returner with full ES 9.x client support - Add new ES9 API methods: count, mget, delete_by_query, update_by_query, reindex, msearch, scroll, clear_scroll, open/close_point_in_time, document_update, search, bulk - Fix dict-mutation-during-iteration crash in returner states_order_output - Fix event_return() to index each event individually instead of only the last - Fix search() in both ES8 and ES9 modules to parse JSON string body arguments - Fix typos in returner error messages and debug log strings - Normalize ret['data'] into ret['return'] when return is None in returner - Add comprehensive returner tests (31 tests, 97% coverage) - Add pyupgrade Python 3.10+ syntax improvements - Fix Sphinx documentation formatting errors - Add missing Salt runtime deps (tornado, looseversion) to nox sessions - Add changelog entry for bug fixes
1 parent 4441561 commit ddca73d

File tree

16 files changed

+8112
-5
lines changed

16 files changed

+8112
-5
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ jobs:
158158

159159
- name: Delete Exit Status Artifacts
160160
if: always()
161+
continue-on-error: true
161162
uses: geekyeggo/delete-artifact@7ee91e82b4a7f3339cd8b14beace3d826a2aac39 # v5.1.0
162163
with:
163164
name: exitstatus-*

.github/workflows/deploy-docs-action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858

5959
- name: Delete GitHub Pages artifact
6060
if: always()
61+
continue-on-error: true
6162
uses: geekyeggo/delete-artifact@7ee91e82b4a7f3339cd8b14beace3d826a2aac39 # v5.1.0
6263
with:
6364
name: html-docs-pages

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ repos:
119119
alias: lint-src
120120
name: Lint Source Code
121121
language: python
122+
language_version: python3.10
122123
entry: nox -e lint-code-pre-commit --
123124
files: ^((setup|noxfile)|src/.*)\.py$
124125
require_serial: true
@@ -130,6 +131,7 @@ repos:
130131
alias: lint-tests
131132
name: Lint Tests
132133
language: python
134+
language_version: python3.10
133135
entry: nox -e lint-tests-pre-commit --
134136
files: ^tests/.*\.py$
135137
require_serial: true

changelog/22.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed a crash in the elasticsearch9 returner when `states_order_output` is enabled (dict modified during iteration). Fixed `event_return()` to index each event individually instead of only the last one. Fixed `search()` in both elasticsearch8 and elasticsearch9 modules to parse JSON string `body` arguments before calling `.get()`.

docs/ref/modules/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ _________________
1111

1212
elasticsearch6_mod
1313
elasticsearch8_mod
14+
elasticsearch9_mod
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``elasticsearch``
2+
=================
3+
4+
.. automodule:: saltext.elasticsearch.modules.elasticsearch9_mod
5+
:members:

docs/ref/returners/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ ________________
1111

1212
elasticsearch6_mod
1313
elasticsearch8_mod
14+
elasticsearch9_mod
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
``elasticsearch``
2+
=================
3+
4+
.. automodule:: saltext.elasticsearch.returners.elasticsearch9_mod
5+
:members:

noxfile.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,20 @@ def _install_requirements(
113113
finally:
114114
os.unlink(constraints_file.name)
115115

116+
# Salt doesn't properly declare all its runtime dependencies in package metadata
117+
# (they are in requirements/base.txt but not in its setup config), so uv doesn't
118+
# resolve them transitively. Install the known missing runtime deps explicitly.
119+
salt_missing_deps = [
120+
"jinja2",
121+
"markupsafe",
122+
"requests",
123+
"looseversion",
124+
"tornado",
125+
"aiohttp",
126+
"pyyaml",
127+
]
128+
session.install(no_progress, *salt_missing_deps, silent=PIP_INSTALL_SILENT)
129+
116130
if install_test_requirements:
117131
install_extras.append("tests")
118132

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ tests = [
8989
[tool.uv]
9090
# Salt's legacy setup.py requires old setuptools.
9191
# Since uv 0.6.0, it does not fall back to reading requirements from egg-info.
92-
build-constraint-dependencies = ["setuptools<69"]
92+
constraint-dependencies = ["setuptools<69"]
9393

9494
[tool.setuptools]
9595
zip-safe = false

0 commit comments

Comments
 (0)