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 4 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".
| ["distribution/debian/vector.yaml", "/etc/vector/vector.yaml", "644"], | ||
| ["config/vector.yaml", "/usr/share/vector/examples/vector.yaml", "644"], | ||
| ["config/examples/*", "/etc/vector/examples/", "644"], | ||
| ["config/examples/*", "/usr/share/doc/vector/examples/", "644"], |
There was a problem hiding this comment.
Remove obsolete Debian example conffiles on upgrade
When upgrading from a Debian package that installed config/examples/* under /etc/vector/examples, cargo-deb treats those /etc files as conffiles, so moving the asset here only affects fresh installs: dpkg leaves the old /etc/vector/examples/*.yaml files on disk and marks them obsolete (this matches dpkg-maintscript-helper(1), which says removed conffiles need an explicit rm_conffile transition). That means the new verify/changelog expectation that examples no longer live under /etc is false for existing users; please add a maintainer-script transition for the previous example paths so unmodified old examples are removed and modified ones are preserved as backups.
Useful? React with 👍 / 👎.
| case "$1" in | ||
| 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 |
There was a problem hiding this comment.
Preserve obsolete vector.yaml before re-adding it
For users who upgraded through the release that removed /etc/vector/vector.yaml, dpkg-query still reports the old path with an obsolete marker (the dpkg-maintscript-helper docs describe this state for removed conffiles), so this grep treats it as tracked and skips the preserve/restore path. If that old config was locally modified, dpkg prompts when this package re-adds a different conffile, which breaks unattended upgrades; treat obsolete conffile entries as needing the same no-prompt preservation path.
Useful? React with 👍 / 👎.
| 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 👍 / 👎.
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.