service config file validation?

18 views
Skip to first unread message

Matt Zagrabelny

unread,
Jun 5, 2014, 5:59:16 PM6/5/14
to puppet...@googlegroups.com
What is the community's opinion/experience with performing some sort
of validation check before puppet drives out a config and restarts a
service?

I'm thinking of things like ISC DHCP where you can test the
correctness of a config:

dhcpd -t -q -cf /etc/dhcp/dhcpd.conf && cp
/some/staging/area/dhcpd.conf /etc/dhcp/dhcpd.conf

Thanks for any hints!

-mz

Felix Frank

unread,
Jun 6, 2014, 3:45:24 AM6/6/14
to puppet...@googlegroups.com
Hi,

since Puppet 3.5.0 there is a feature that will allow you to do just
that, courtesy of Erik Dalen.

http://docs.puppetlabs.com/references/3.5.0/type.html#file-attribute-validate_cmd

So you can

file { "/etc/dhcp/dhcpd.conf":
validate_cmd => "/path/to/dhcpd -t -q -cf %"
}

and Puppet will take care of (not) overwriting the actual config.

HTH,
Felix
Reply all
Reply to author
Forward
0 new messages