Templates and PMG upgrades

f4242

Well-Known Member
Dec 19, 2016
101
4
58
Quebec, QC
Hello,

I had a need to modify the postfix configuration. I read the documentation and found the section about the template system. So, I created the directory /etc/pmg/templates and copied the file main.cf.in from /var/lib/pmg/templates.

This was easy and worked at the first time!

When I'll upgrade PMG in the future, how will I deal with my custom modification? Is there something in the upgrade process that will tell me that the base template has changed?

Can I expect no changes in the base templates in minor release updates?

Thank you!
 
Last edited:
  • Like
Reactions: larsen
When I'll upgrade PMG in the future, how will I deal with my custom modification? Is there something in the upgrade process that will tell me that the base template has changed?

no

Can I expect no changes in the base templates in minor release updates?

Changes are very unlikely, but I suggest that you simply compare the files after each update (manually).
 
cat /etc/pmg/templates/main.cf.in

Code:
[% INSERT /var/lib/pmg/templates/main.cf.in %]

mail_name = Your New Mailname

smtp_helo_name = Your.New.SMTP.Helo
 
Hi,
this works but there is the following error message in syslog:

Code:
pmgconfig[744]: file error - /var/lib/pmg/templates/main.cf.in: absolute paths are not allowed (set ABSOLUTE option)
 
  • Like
Reactions: keeka
Hi,
this works but there is the following error message in syslog:

Code:
pmgconfig[744]: file error - /var/lib/pmg/templates/main.cf.in: absolute paths are not allowed (set ABSOLUTE option)

I am not sure it does work. But constructing custom template using the INSERT directive looks like a useful feature. Is there any documentation on using the INSERT/ABSOLUTE options?
 
It seems that, in order for INSERT above to work as intended, ABSOLUTE (or REALATIVE) must be true. AFAICS these can't be set in a template file but rather require modifying template constructor in one or more perl scripts of the pmg-api package.
template-toolkit.org/docs/manual/Config.html#section_ABSOLUTE
I mean the solution above works, but the log message indicates that the config is not clean. I ended up copying the whole file to /etc/pmg/templates and modify it there.
 
I mean the solution above works, but the log message indicates that the config is not clean. I ended up copying the whole file to /etc/pmg/templates and modify it there.
IME the error is fatal. pmgconfig will not generate the relevant config file if you try to insert file contents from an absolute path.
With that template in place, temporarily remove (or change contents of) /etc/postfix/main.cf and run pmgconfig sync: The output file is not created/updated.
 
Last edited:
IME the error is fatal. pmgconfig will not generate the relevant config file if you try to insert file contents from an absolute path.
With that template in place, temporarily remove (or change contents of) /etc/postfix/main.cf and run pmgconfig sync: The output file is not created/updated.
Yes you are right. So copy and edit the whole file is going to be my final solution. I do not need to change vital things, just smtp ehlo and mailname. Compare after an update remains easy. Probably devs might consider creating options in the GUI for that.
 
So copy and edit the whole file is going to be my final solution.
I'm with you on that, especially since the package upgrade now checks for diffs between /etc/pmg/templates & vanilla templates.
I did however see this thread, which mentions another approach. Symlinking to distribution templates in /etc/pmg/templates.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!