Bug 213557 - mail/postfix: Prevent interactive message about mailer.conf
Summary: mail/postfix: Prevent interactive message about mailer.conf
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Olli Hauer
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2016-10-17 06:36 UTC by Baptiste Daroussin
Modified: 2018-01-08 03:18 UTC (History)
2 users (show)

See Also:
vlad-fbsd: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Baptiste Daroussin freebsd_committer 2016-10-17 06:36:08 UTC
When pkg install postfix it keeps asing the question:

Would you like to activate Postfix in /usr/local/etc/mail/mailer.conf [n]? 

which stop the process of pkg upgrade, it also makes it unfriendly for configuration managers such as puppet, chef etc.

Please consider removing the question
Comment 1 Olli Hauer freebsd_committer 2016-10-17 06:52:38 UTC
Hm, are you sure the question pops up during upgrade?

I've designed the script to not ask if the package is installed for example with saltstack or during upgrade or during package building.

I can redesign the script to always install the mailer.conf but then we also have to remove/install mailer.conf during upgrades, even I haven't tested if pkg issue bug #212335 has any side effects during the update.
Comment 2 Baptiste Daroussin freebsd_committer 2016-10-17 07:02:00 UTC
Yes it does, pkg does not expose any env var that would prevent pkg upgrade.

It is also the only package that is going interractive, imho it should just explain the user how to modify mailer.conf in message and maybe install a sample of it, not try to replace it.

Also note that on mailerconf on recent freebsd reads /usr/local/etc/mailer.conf (but that is a side note)
Comment 3 Olli Hauer freebsd_committer 2016-10-17 07:24:29 UTC
>Yes it does, pkg does not expose any env var that would prevent pkg upgrade.
Env var is not required, the script checks if all replacements are listed in mailer.conf, 

>It is also the only package that is going interractive, imho it should just
>explain the user how to modify mailer.conf in message and maybe install a 
>sample of it, not try to replace it.

In case no tty is detected it displays already a message with the location of a valid mailer.conf

>Also note that on mailerconf on recent freebsd reads /usr/local/etc/mailer.conf 
That's already implemented in every postfix port since 10.3-BETAx e.g.
https://svnweb.freebsd.org/ports/head/mail/postfix/files/pkg-install.in?r1=405234&r2=409551

Do you have any puppet/chef log for me? I'm having only daily saltstack logs for fresh installs / upgrades
Comment 4 VK freebsd_triage 2016-10-17 08:39:01 UTC
ssmtp will just inform the user via pkg-message about changing the mailer.conf and show which lines have to be added, and I agree with that approach. No interactive installation please. Let's not become Debian. :)

I'd propose a hybrid approach where the pkg adds commented out lines to the mailer.conf and informs the user via pkg-message about that.
Comment 5 VK freebsd_triage 2016-10-17 08:42:11 UTC
Btw, I can confirm that ansible installs it just fine, no interruption.
Comment 6 Baptiste Daroussin freebsd_committer 2016-10-17 08:44:00 UTC
Adding comment in mailer.conf would be imho a bad idea.

===> Creating users
Using existing user 'postfix'.
[52/76] Extracting postfix-3.1.3,1: 100%
You may need to manually remove /usr/local/etc/postfix/main.cf if it is no longer needed.
You may need to manually remove /usr/local/etc/postfix/master.cf if it is no longer needed.
Would you like to activate Postfix in /usr/local/etc/mail/mailer.conf [n]? 

===============================================================
Postfix was *not* activated in /usr/local/etc/mail/mailer.conf! 

To finish installation run the following commands:

  mkdir -p /usr/local/etc/mail
  install -m 0644 /usr/local/share/postfix/mailer.conf.postfix /usr/local/etc/mail/mailer.conf
===============================================================


This is the log of my pkg upgrade from this morning, it was warning on me to hint y or n.

IMHO this is a bad idea. (and yes I can see now the pkg-message is already there :)
Comment 7 Olli Hauer freebsd_committer 2016-10-17 10:56:40 UTC
@Babt
Thats really an unexpected behavior, in my previous test (pre 10.3 beta) i was running into this only in case I was connected via ssh (test -t => 0) and $x/mail/mailer.conf cmp mailer.conf.postfix was not returning 0 (e.g. after os upgrade and overwritten etc/mail/mailer.conf and not existing $localbase/etc/mail/mailer.conf.

I will do some additional tests to install the config as @sample, but then it is possible to loose some mails or inject them to the original sendmail if anything goes wrong during upgrade