Include-once functionality
adam12 opened this issue · comments
Adam Daniels commented
What are your thoughts on preventing literal includes occurring more than once? Maybe store them in a map at the start of the include process?
This won't work for the backticks support but for plain literals it might be OK.
Use case:
# systemd.in
shell triggers {
name => "Reload systemctl daemon",
command => "systemctl daemon-reload"
}
# service_1.in
include "systemd.in"
file {
target => "/etc/systemd/system/service_1.service",
notify => "Reload systemctl daemon"
}
# service_2.in
include "systemd.in"
file {
target => "/etc/systemd/system/service_2.service",
notify => "Reload systemctl daemon"
}
Currently triggers an error about the Reload systemctl daemon
name not being unique.
Steve Kemp commented
That seems like a sensible enough idea, definitely.
Would you be able to test #39, I think that should work as expected. (But as you say there's the caveat that shell commands won't get duplicated which might be expected.)
Adam Daniels commented
Would you be able to test
Worked a treat. Thanks.
Steve Kemp commented
Great, thanks for confirming.