fix(debian): preserve vector.yaml as a conffile + move examples to docs folder#25884
fix(debian): preserve vector.yaml as a conffile + move examples to docs folder#25884koen-serry wants to merge 7 commits into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
This comment has been minimized.
This comment has been minimized.
|
I have no clue what that CLA Assistant is |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7bc4e400cc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| section = "admin" | ||
| maintainer-scripts = "distribution/debian/scripts/" | ||
| conf-files = ["/etc/default/vector"] | ||
| conf-files = ["/etc/default/vector", "/etc/vector/vector.yaml"] |
There was a problem hiding this comment.
Avoid conffile prompts on upgrades
For Debian users who installed a version where /etc/vector/vector.yaml was not package-owned and then created that file themselves, adding the same path as a new dpkg conffile makes dpkg -i stop at the “File on system created by you” conffile prompt; without explicit --force-confold/confnew options, unattended apt/dpkg upgrades fail before the package is configured. The new verify path only reinstalls this same package, so it misses the transition from an unowned user config to a packaged conffile; please add a maintainer-script transition or another approach that preserves the existing file without prompting.
Useful? React with 👍 / 👎.
|
I have read the CLA Document and I hereby sign the CLA |
…file Since /etc/vector/vector.yaml was not a dpkg conffile before this change, a file already present at that path (created by a user, or by an older Vector package) is unknown to dpkg. Unpacking it as a new conffile makes dpkg treat it as "created by you" and stop at an interactive prompt, which breaks unattended upgrades without --force-confold/confnew. Add a preinst/postinst transition: preinst moves aside any untracked pre-existing file so dpkg can install the conffile without prompting, and postinst restores it afterwards so the content is preserved byte-for-byte. Once installed this way the path is a normal tracked conffile and standard dpkg conffile handling applies on later upgrades. Extend verify-install.sh to seed such an untracked file before the first install and assert it survives, since the existing verify path only reinstalled the same package and never exercised this transition.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1bc7cbd4b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| install|upgrade) | ||
| if [ -e /etc/vector/vector.yaml ] && [ ! -L /etc/vector/vector.yaml ]; then | ||
| if ! dpkg-query -W -f='${Conffiles}' vector 2>/dev/null | grep -q ' /etc/vector/vector.yaml '; then | ||
| mv /etc/vector/vector.yaml /etc/vector/vector.yaml.vector-preserve |
There was a problem hiding this comment.
Don't move files owned by another package
If /etc/vector/vector.yaml is provided by a local configuration package or any other Debian package while vector is not installed, this mv runs before dpkg's file-conflict check and hides the other package's file; I verified with dummy packages that dpkg still aborts on the ownership conflict after preinst, leaving only vector.yaml.vector-preserve and no file at the path owned by the other package. Please check package ownership (not only Vector's conffile list) before moving the file aside.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bbd27f3a80
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| dpkg-maintscript-helper rm_conffile \ | ||
| "/etc/vector/examples/$_example_conffile" 0.57.0-1 vector -- "$@" |
There was a problem hiding this comment.
Add the postrm half of rm_conffile
Although this adds the rm_conffile calls to preinst/postinst, I checked dpkg-maintscript-helper --help and it states that rm_conffile must be called in preinst, postinst, and postrm. Without a matching postrm call, an upgrade from a version that owned /etc/vector/examples/*.yaml can run preinst and move old examples to .dpkg-remove/.dpkg-backup, then if the upgrade aborts before postinst the abort path never restores them; purges also leave helper backup files behind. Please add the corresponding postrm transition for the same file list.
Useful? React with 👍 / 👎.
| if [ -e /etc/vector/vector.yaml.vector-preserve ]; then | ||
| mv -f /etc/vector/vector.yaml.vector-preserve /etc/vector/vector.yaml |
There was a problem hiding this comment.
Restore preserved config on aborted installs
Because the only restore of .vector-preserve is in postinst configure, an install/upgrade that reaches the preinst move and then aborts during unpack before postinst runs leaves the user's active /etc/vector/vector.yaml displaced as /etc/vector/vector.yaml.vector-preserve while the package is not configured. Add an abort-install/abort-upgrade cleanup path, such as a postrm handler, so failed upgrades do not leave Vector without its original config at the default path.
Useful? React with 👍 / 👎.
Summary
Vector configuration
How did you test this PR?
Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.make fmtmake check-clippy(if there are failures it's possible some of them can be fixed withmake clippy-fix)make testgit merge origin masterandgit push.Cargo.lock), pleaserun
make build-licensesto regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.