Title: Load the Elasticsearch restart handler's node-start file without a nested block (#495) by shipmill-romamo[bot] · Pull Request #517 · cloudfall-dev/cloudfall · GitHub
Open Graph Title: Load the Elasticsearch restart handler's node-start file without a nested block (#495) by shipmill-romamo[bot] · Pull Request #517 · cloudfall-dev/cloudfall
X Title: Load the Elasticsearch restart handler's node-start file without a nested block (#495) by shipmill-romamo[bot] · Pull Request #517 · cloudfall-dev/cloudfall
Description: Plan Serves: quality bar Files: engine/ansible/roles/cloudfall_elasticsearch/tasks/node-start.yml, engine/tests/test_role_handlers_load.py (new), engine/tests/test_s012_elasticsearch_cluster_role.py, changelog.d/495-elasticsearch-handler-block.md Order: the failing test first (every role's handlers, and the task files they include, loaded with Ansible's handler loader), then flatten the nested block in node-start.yml, then the S-012-6 test that read the old shape, then the changelog fragment Proof: test_role_handlers_load.py fails on main with ansible-core's own Using a block as a handler is not supported. for cloudfall_elasticsearch and passes with the fix Summary The restart handler was already an include_tasks handler (handlers/main.yml includes tasks/restart.yml, which includes node-stop.yml then node-start.yml). The error at node-start.yml:16:7 comes from a different rule: ansible-core loads every file a handler includes with its handler loader, which accepts a block at a file's top level but refuses one nested inside another block (ansible/playbook/helpers.py, load_list_of_tasks with use_handlers=True). node-start.yml nested the rejoin steps ("Wait for the node to rejoin on the declared version") inside the "Start the node and let replicas move again whatever happens" block. The fix lifts the three rejoin steps (wait to rejoin, read the version, refuse another version) into the outer block, each carrying the nested block's two conditions (cloudfall_elasticsearch_rolling | default({}) | length > 0, not ansible_check_mode). The steps, their order, the always that lets replicas move again, the handler name, every notify: string, restart.yml and node-stop.yml are unchanged. With the handler loading, a first converge starts the node, and the tasks after flush_handlers record the cluster-formed marker and remove cluster.initial_master_nodes in the same run. Other roles: cloudfall_access, cloudfall_alerting, cloudfall_firewall, cloudfall_logging_backend, cloudfall_logging_collector, cloudfall_mariadb, cloudfall_nginx_site, cloudfall_postgresql and cloudfall_redis have no block handler and include no task file from a handler; the new test loads them all and they pass. Tests engine/tests/test_role_handlers_load.py (new): for each role with handlers/main.yml, follows its include_tasks/import_tasks chain and loads every file with load_list_of_blocks(..., use_handlers=True), as a notified handler loads it; a second test checks the walk reaches restart.yml, node-stop.yml and node-start.yml, so the first can't pass vacuously. Fails on main, passes here test_s012_6_a_restarted_node_rejoins_on_the_new_version_before_the_next reads the flattened steps and now checks each rejoin step's conditions uv run pytest engine/tests/test_role_handlers_load.py engine/tests/test_s012_elasticsearch_cluster_role.py engine/tests/test_s012_elasticsearch_existing_cluster_role.py: 50 passed uv run ruff check, uv run ruff format --check on the touched test files, uv run mypy, ANSIBLE_CONFIG=engine/ansible/ansible.cfg uv run ansible-lint engine/ansible: pass ruff format also reformatted three older hunks in test_s012_elasticsearch_cluster_role.py that were not formatted on main Not run: ansible-playbook --syntax-check (the headless session's hook allows no ansible-playbook; CI runs it, and it can't catch this error anyway since handler includes load at run time) and a live converge on a host Fixes #495 🤖 Generated with Claude Code
Open Graph Description: Plan Serves: quality bar Files: engine/ansible/roles/cloudfall_elasticsearch/tasks/node-start.yml, engine/tests/test_role_handlers_load.py (new), engine/tests/test_s012_elasticsearch_cluster_role....
X Description: Plan Serves: quality bar Files: engine/ansible/roles/cloudfall_elasticsearch/tasks/node-start.yml, engine/tests/test_role_handlers_load.py (new), engine/tests/test_s012_elasticsearch_cluster_role....
Opengraph URL: https://github.com/cloudfall-dev/cloudfall/pull/517
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:94e46dbf-be92-f64d-4777-7508c1d38a0f |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CD16:64B1C:5188A2:6EA04F:6B055F1A |
| html-safe-nonce | 3ddd1b33bc6ddb76580a5025aec4cf6b222e3e2c9316cbdec939cea18ea6041b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDE2OjY0QjFDOjUxODhBMjo2RUEwNEY6NkIwNTVGMUEiLCJ2aXNpdG9yX2lkIjoiMzU5MzA3NTM0NTYyMjEzMDQ1OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d0fa556b844d9cbf116aee76fca10cbce24f09d6144dc884757cea9534decfb8 |
| hovercard-subject-tag | pull_request:5359413829 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/cloudfall-dev/cloudfall/pull/517/files |
| twitter:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| og:image:alt | Plan Serves: quality bar Files: engine/ansible/roles/cloudfall_elasticsearch/tasks/node-start.yml, engine/tests/test_role_handlers_load.py (new), engine/tests/test_s012_elasticsearch_cluster_role.... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8a6760da3cce5e2d079d07e3b62df71194316c4478db1a5e38050f44fce72c72 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/cloudfall-dev/cloudfall git https://github.com/cloudfall-dev/cloudfall.git |
| octolytics-dimension-user_id | 339512759 |
| octolytics-dimension-user_login | cloudfall-dev |
| octolytics-dimension-repository_id | 1360999777 |
| octolytics-dimension-repository_nwo | cloudfall-dev/cloudfall |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1360999777 |
| octolytics-dimension-repository_network_root_nwo | cloudfall-dev/cloudfall |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8327739ac0648b9c3c722b5f401f7338553936b8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width