fix(server): Install rclone on servers created from an image - #7253
Open
regdocs wants to merge 2 commits into
Open
fix(server): Install rclone on servers created from an image#7253regdocs wants to merge 2 commits into
regdocs wants to merge 2 commits into
Conversation
Contributor
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (3): Last reviewed commit: "fix(server): Enqueue rclone install on t..." | Re-trigger Greptile |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #7253 +/- ##
===========================================
- Coverage 59.43% 53.91% -5.52%
===========================================
Files 1024 1024
Lines 94103 94168 +65
Branches 1216 1067 -149
===========================================
- Hits 55929 50772 -5157
- Misses 38151 43373 +5222
Partials 23 23
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Dashboard-created servers boot from a prebaked VMI, so they're inserted with is_server_setup already true and never play server.yml — where the install_rclone role lives. Give the Create Server press job its own rclone step, ahead of set_additional_config so it doesn't contend for the dpkg lock with the apt plays that step enqueues. That step also sets stream_backups, rather than the field defaulting to 1: the agent rejects a streamed backup when rclone is missing, so the flag can't be set before the play succeeds. A failed play leaves streaming off instead of failing the job, since a healthy server shouldn't be marked un-provisioned over an optional backup path. setup_rclone() has had no automatic caller since cc10819. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
regdocs
force-pushed
the
fix/install-rclone-on-new-servers
branch
from
August 18, 2026 07:52
62d1849 to
f7cd871
Compare
setup_rclone() inherited enqueue_doc's defaults, so a play that has to SSH in, fetch a deb from GitHub and run apt got 300s on the queue that also carries agent job polling. Matches the other playbook enqueues here (_install_nginx, _setup_auditd, _set_docker_mtu). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Why
Install Rclonewas never running on servers created from the dashboard.The
install_rclonerole is only wired into the full setup playbooks (press/playbooks/server.yml,unified_server.yml), which are played byServer._setup_server()/_setup_unified_server(). Dashboard-created servers never take that path:api/server.py:new()→Cluster.create_server()→VirtualMachine.create_server(), and since those VMs boot from a prebakedvirtual_machine_image, the server doc is inserted withis_server_setupalready set to true, soserver.ymlis skipped entirely.The post-boot work for those servers is done by the Create Server press job.
Server.setup_rclone()has existed since cc10819 but had no automatic caller, so it only ever ran if someone invoked it by hand.What changed
A dedicated, synchronous rclone step in the Create Server job. Rather than adding
setup_rclone()toset_additional_config(), which only enqueues its plays, the job gets its own@task:It runs ahead of
set_additional_config()for two reasons: provisioning has to actually wait for rclone before anything advertises streaming, and that step enqueues filebeat, wazuh, earlyoom, ncdu and cadvisor — several of which use apt, so running rclone inside that pool would have it contending for the dpkg lock. Theserver_type != "Server"guard also covers unified servers, since those areServerdocs.stream_backupsis set by that step, not by a field default. The flag is a consequence of a successful install:Defaulting the field to
1would have been wrong: the doc is inserted with streaming on while rclone is still absent, so an offsite backup landing in that window — or on a server where the play failed — advertises streaming and gets rejected by the agent for a missing binary._setup_rclone()now returns itsAnsible Playinstead of discarding it;Ansible.run()folds task failures into the play'sstatusrather than raising (runner.py:252-266), sostatus == "Success"is the real signal, and theplay andguard covers the exception path, which still logs as before.A failed play leaves streaming off rather than failing the job. Raising would fail the press job and block
is_provisioning_press_job_completed, marking a healthy server un-provisioned over an optional backup optimization. The failedAnsible Playrecord is the signal instead.setup_rclone()gets an explicit queue and timeout (second commit). It inheritedenqueue_doc's defaults —queue="default", timeout=300(background_jobs.py:218) — so a play that has to SSH in, fetch a deb from GitHub and run apt got 300s on the queue that also carries agent job polling. Nowqueue="long", timeout=1200, matching the other playbook enqueues in the file (_install_nginx,_setup_auditd,_set_docker_mtu) and the ceiling on the new press job task.Tests
Three in
TestServer, following the existingtest_install_marks_wazuh_agent_installed_on_successful_playpattern: streaming enabled after a successful play, and staying disabled both when the play returnsFailureand whenAnsible.runraises.Notes for review
server.ymlstill won't stream. That path plays theinstall_rclonerole but never sets the flag, so bootstrap and manual "Setup Server" servers stay opted out until someone sets it. Left alone deliberately — the reported bug is the dashboard/image path. Happy to have_setup_server()'s success branch set it too if that's wanted.stream_backups = 0and have no rclone. Enabling streaming on any of them needs_setup_rclone()run first, and there's currently no desk button for it (server.jsexposes no action forsetup_rcloneorsetup_ncdu), so today it's a console call. A button and/or a backfill patch would be worth adding separately.settings.wazuh_api_password = "pass"intest_server.pygot a# pragma: allowlist secret. It's a pre-existing false positive thatdetect-secretsonly surfaces once the file is staged, and it blocks committing any change to that file.🤖 Generated with Claude Code