appcanary / agent

The Appcanary agent
https://www.appcanary.com
GNU General Public License v3.0
47 stars 6 forks source link

Fix packaging for yaml #152

Closed j0ni closed 7 years ago

j0ni commented 7 years ago

In this PR we stop installing a broken (incomplete template) config file and instead install the template with a .sample extension. This allows the agent to successfully convert an old configuration if one exists, avoiding ignoring the old configuration and loading a broken configuration on restart.

In addition, I've tweaked the config struct so it doesn't dump empty tag lists when it converts the configuration.

Finally, there is one possible gotcha - when you purge a package, it leaves in place files it doesn't know about; this includes agent.conf.deprecated, but also the actual agent.yml, because the files now marked as config files in the package have the .sample extension, e.g., agent.yml.sample. This is fairly minor, but I'm not sure if there are other consequences of this change. Would it be appropriate to add the .yml files into the list of config files? Resulting in the following list:

being treated as config files. Note that doing this would still leave *.conf.deprecated in place, unremoved.

mveytsman commented 7 years ago

I think agent.yml and agent.conf should be added ot the list of config files. Is that something you do with fpm?

j0ni commented 7 years ago

@mveytsman yes, we can do that, it just fucks with the slick packaging logic. Oh well :)

j0ni commented 7 years ago

@mveytsman looks like listing them causes the packager to barf if they aren't present in the package. I'll see if there's another way.

j0ni commented 7 years ago

I've been fiddling with this, and I don't see a way to deal with it correctly.

What we want to do is remove the leftover files plus the legit config file when purging, but leave them all in place if just removing the appcanary package.

So, I'm inclined to leave this as is, and allow the files to remain and prevent the directory being removed. The only thing that niggles is the fact that on purge, the .sample file will be removed, but the regular .yml version will not, which is slightly broken.

mveytsman commented 7 years ago

👍