puppetlabs/puppetdb — pull request #473 by kbarber (2013-03-28 18:15:04+00:00)
Title: WIP: (#19349) puppetdb-ssl-setup should be choosey when it changes things

This patch modifies puppetdb-ssl-setup so it is more choosey when it changes
items in jetty.ini. In the past it would simply overwrite all settings, but
now you need to supply -f if you want to do this. This means that during
package upgrade we are passive for settings that have already been set, but
we do return warnings to the console so users can make these changes
themselves if they so desire.

However, there are cases where this kind of thing is required - esp. during
first installation so the tool now looks for factory default settings and
modifies those if it finds them. These are in the form:

# setting =

Our tool looks for these especially, assuming they are package defaults and
_will_ modify them regardless of the -f setting. Once they are modified it
shouldn't do it again. This makes sure the 'initial installation' case does
the write thing.

The original jetty.ini file that is laid down now has all the SSL settings
commented out and in the format the tool requires. The fact they are commented
means that if the tool bombs out PuppetDB should still work but with no SSL
settings.

I've made the script more wordy about what it is doing which might help, and
also made sure we backup the old jetty.ini before doing anything. The backup
itself is timestamped, so subsequent runs on a faulty jetty.ini do not
override somethings settings no matter how often it runs. Generally I hate it
when tools don't do this, so I don't want to inflict it on our users.

The scriptage around change settings has been made more generalised so we can
stretch this pattern out to a number of settings if required now.

Signed-off-by: Ken Barber