-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(debian): preserve vector.yaml as a conffile + move examples to docs folder #25884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
7bc4e40
2d71eb2
985902b
a1bc7cb
80f61b8
657e319
bbd27f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Fixed two Debian packaging issues: `/etc/vector/vector.yaml` is now shipped as a proper Debian conffile (a stub with no active sources/sinks) so local modifications are preserved across upgrades; example configurations have been moved from `/etc/vector/examples/` to `/usr/share/doc/vector/examples/` where they belong as documentation rather than administrator-managed configuration. | ||
|
|
||
| Since `/etc/vector/vector.yaml` was not previously a dpkg conffile, a pre-existing file at that path (created by a user, or by a Vector version prior to this fix) would otherwise make `dpkg` stop with an interactive "file created by you" conffile prompt, breaking unattended upgrades. Maintainer scripts now move any such untracked file aside before install and restore it afterwards, so upgrades complete without prompting and existing content is preserved byte-for-byte. | ||
| authors: koenserry |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,37 @@ | ||
| #!/bin/sh | ||
| set -e | ||
|
|
||
| # Complete the rm_conffile transition started in preinst; see preinst for context. | ||
| for _example_conffile in \ | ||
| docs_example.yaml \ | ||
| environment_variables.yaml \ | ||
| es_s3_hybrid.yaml \ | ||
| file_to_cloudwatch_metrics.yaml \ | ||
| file_to_prometheus.yaml \ | ||
| http_sink_custom_retry.yaml \ | ||
| prometheus_to_console.yaml \ | ||
| stdio.yaml \ | ||
| varint_framing_protobuf.yaml \ | ||
| wrapped_json.yaml \ | ||
| namespacing/sinks/es_cluster.yaml \ | ||
| namespacing/sinks/s3_archives.yaml \ | ||
| namespacing/sources/apache_logs.yaml \ | ||
| namespacing/transforms/apache_parser.yaml \ | ||
| namespacing/transforms/apache_sample.yaml \ | ||
| namespacing/vector.yaml | ||
| do | ||
| dpkg-maintscript-helper rm_conffile \ | ||
| "/etc/vector/examples/$_example_conffile" 0.57.0-1 vector -- "$@" | ||
| done | ||
|
|
||
| # Restore a pre-existing /etc/vector/vector.yaml that preinst moved aside | ||
| # (see preinst for why). This puts the user's original content back in | ||
| # place of the stub conffile dpkg just unpacked, so nothing is lost and no | ||
| # conffile prompt was ever shown. | ||
| if [ -e /etc/vector/vector.yaml.vector-preserve ]; then | ||
| mv -f /etc/vector/vector.yaml.vector-preserve /etc/vector/vector.yaml | ||
|
Comment on lines
+31
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because the only restore of Useful? React with 👍 / 👎. |
||
| fi | ||
|
|
||
| # Add Vector to adm group to read /var/logs | ||
| usermod --append --groups adm vector || true | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,30 @@ | ||
| #!/bin/sh | ||
| set -e | ||
|
|
||
| # /etc/vector/examples/*.yaml were conffiles through v0.57.0; they moved to | ||
| # /usr/share/doc/vector/examples/. Remove unmodified copies on upgrade. | ||
| for _example_conffile in \ | ||
| docs_example.yaml \ | ||
| environment_variables.yaml \ | ||
| es_s3_hybrid.yaml \ | ||
| file_to_cloudwatch_metrics.yaml \ | ||
| file_to_prometheus.yaml \ | ||
| http_sink_custom_retry.yaml \ | ||
| prometheus_to_console.yaml \ | ||
| stdio.yaml \ | ||
| varint_framing_protobuf.yaml \ | ||
| wrapped_json.yaml \ | ||
| namespacing/sinks/es_cluster.yaml \ | ||
| namespacing/sinks/s3_archives.yaml \ | ||
| namespacing/sources/apache_logs.yaml \ | ||
| namespacing/transforms/apache_parser.yaml \ | ||
| namespacing/transforms/apache_sample.yaml \ | ||
| namespacing/vector.yaml | ||
| do | ||
| dpkg-maintscript-helper rm_conffile \ | ||
| "/etc/vector/examples/$_example_conffile" 0.57.0-1 vector -- "$@" | ||
|
Comment on lines
+24
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Although this adds the Useful? React with 👍 / 👎. |
||
| done | ||
|
|
||
| # Add vector:vector user & group | ||
| id --user vector >/dev/null 2>&1 || \ | ||
| useradd --system --shell /sbin/nologin --home-dir /var/lib/vector --user-group \ | ||
|
|
@@ -12,4 +36,21 @@ mkdir -p /var/lib/vector | |
| # Make vector:vector the owner of the Vector data directory | ||
| chown -R vector:vector /var/lib/vector | ||
|
|
||
| # /etc/vector/vector.yaml was not a dpkg conffile before this version. If a | ||
| # file already exists at that path, dpkg has no record of it and will treat | ||
| # it as "created by you", prompting interactively (or failing outright on | ||
| # unattended upgrades) before it will unpack the new conffile over it. Move | ||
| # any such untracked file out of the way so dpkg can install the conffile | ||
| # cleanly; postinst restores it afterwards so the user's content is kept | ||
| # byte-for-byte, without ever prompting. | ||
| 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 -qE ' /etc/vector/vector\.yaml [0-9a-f]'; then | ||
| mv /etc/vector/vector.yaml /etc/vector/vector.yaml.vector-preserve | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If Useful? React with 👍 / 👎. |
||
| fi | ||
| fi | ||
| ;; | ||
| esac | ||
|
|
||
| #DEBHELPER# | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # __ __ __ | ||
| # \ \ / / / / | ||
| # \ V / / / | ||
| # \_/ \/ | ||
| # | ||
| # V E C T O R | ||
| # Configuration | ||
| # | ||
| # ------------------------------------------------------------------------------ | ||
| # Website: https://vector.dev | ||
| # Docs: https://vector.dev/docs | ||
| # Chat: https://chat.vector.dev | ||
| # ------------------------------------------------------------------------------ | ||
|
|
||
| # Change this to use a non-default directory for Vector data storage: | ||
| # data_dir: "/var/lib/vector" | ||
|
|
||
| # Example configurations are available at /usr/share/doc/vector/examples/ | ||
|
|
||
| # Add your sources, transforms, and sinks here. | ||
| # See https://vector.dev/docs/reference/configuration/ for full reference. | ||
|
|
||
| # sources: | ||
| # my_source: | ||
| # type: "..." | ||
|
|
||
| # transforms: | ||
| # my_transform: | ||
| # type: "..." | ||
| # inputs: ["my_source"] | ||
|
|
||
| # sinks: | ||
| # my_sink: | ||
| # type: "..." | ||
| # inputs: ["my_transform"] | ||
|
|
||
| # Vector's API (disabled by default) | ||
| # Uncomment to try it out with the `vector top` command | ||
| # api: | ||
| # enabled: true | ||
| # address: "127.0.0.1:8686" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Debian users who installed a version where
/etc/vector/vector.yamlwas not package-owned and then created that file themselves, adding the same path as a new dpkg conffile makesdpkg -istop at the “File on system created by you” conffile prompt; without explicit--force-confold/confnewoptions, 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 👍 / 👎.