Ensure consistent mirroring across config-data
Ensure consistent mirroring across config-data

...paths for the container-puppet tool.

Purge obsoleted/irrelevant files
in the destingation (puppet-generated) before rsyncing new contents
into it. This is achieved in a few steps:

After puppet run, it might remove some files in the container's under
its config management. Like conflicting Apache MPM modules. Get a list
of such files using rsync dry-run mode.

After the changed/new or deleted files rsync'ed from the container into
/var/lib/config-data/${NAME} config volume, we must make sure the
latter (marked by rsync as 'deleting') files will be also removed for
the 2nd /var/lib/config-data/puppet-generated/${NAME} location. Rsync
--delete has no such knowledge as the files we saved earlier get
deleted before rsync gets invoked, so it cannot detect such files in
the transition.

Manually delete the files removed with puppet and captured in the saved
list for the 2nd location, then continue with the final rsync command
as usual.

Additional related changes:

Remove the note about debugging usage as the puppet-generated path
became a part of the deployment framework and all service templates
rely on it.

Add conf_data_path and puppet_generated_path vars to not repeat
/var/lib/config-data/... all the time.

Use mktemp for better handling of temporary files.

Fix sorting lists of files for the debug messages

Change-Id: Ic7b8c4f5b21c5e31c6fcc17e0a365d534ba32379
Closes-Bug: #1835414

openstack/tripleo-heat-templates,openstack/tripleo-heat-templates