Bug 263878 - sysutils/snmp_exporter: configuration file "generator.yml" is overwritten on update
Summary: sysutils/snmp_exporter: configuration file "generator.yml" is overwritten on ...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Fernando Apesteguía
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-09 12:28 UTC by topical
Modified: 2022-05-16 11:06 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (fabian.freyer)


Attachments
Patch for sysutils/snmp_exporter (850 bytes, patch)
2022-05-12 11:35 UTC, Fernando Apesteguía
fernape: maintainer-approval? (fabian.freyer)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description topical 2022-05-09 12:28:39 UTC
The snmp_exporter daemon reads its configuration from "snmp.yml". 

Because of the size and complexity of "snmp.yml", there is a generator called "snmp_exporter_generator" that takes "generator.yml" as its input.

So, you always edit "generator.yml", call the generator and then (re)start the daemon.

Unfortunately, the file "generator.yml" is unconditionally written by the port, so you loose your configuration on every port update.
Comment 1 Fernando Apesteguía freebsd_committer freebsd_triage 2022-05-12 11:35:36 UTC
Created attachment 233872 [details]
Patch for sysutils/snmp_exporter

Thanks for reporting this.

Would you give this patch a try? It adds generator.yaml.sample and warns about manually removing generator.yaml on deinstall.
Comment 2 Fernando Apesteguía freebsd_committer freebsd_triage 2022-05-15 17:49:25 UTC
Committed,

Thanks!
Comment 3 commit-hook freebsd_committer freebsd_triage 2022-05-15 17:49:39 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1491693fd88faef9f95e9f20f80b4740e8365a57

commit 1491693fd88faef9f95e9f20f80b4740e8365a57
Author:     Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2022-05-11 11:47:04 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2022-05-15 17:46:51 +0000

    updatesysutils/snmp_exporter: do not overwrite generator.yml

    Mark it as sample file.
    generator.yml is used by snmp_exporter_generator to generate the final
    configuration (snmp.yml) which should not be edited by hand.

    PR:     263878
    Reported by:    topical@gmx.net
    Approved by:    fabian.freyer@physik.tu-berlin.de (1 week)

 sysutils/snmp_exporter/Makefile  | 2 +-
 sysutils/snmp_exporter/pkg-plist | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 4 topical 2022-05-16 11:06:51 UTC
Thank you very much for the fix!