Only copy symlinks when merge and preserve_properties are set

The kolla-kubernetes config files live in a ..data directory in the
config volume and are symlinked with relative path at the root of the
config volume. This naturally breaks with the link copy feature
introduce in I92a404b8d301937dc1847d42576e30db43951990.

This commit restores the original behavior to copy the target of the
link unless both 'merge' and 'preserve_properties' options are set, in
which case the link itself is copied.

Change-Id: I5d768687208205fb50ef5ab93675f47e98ea6351
This commit is contained in:
Martin André 2017-07-17 09:46:24 +02:00
parent 5e07cc1ab4
commit fc1caced86

View File

@ -75,7 +75,7 @@ class ConfigFile(object):
self._delete_path(dest) self._delete_path(dest)
# dest endswith / means copy the <source> to <dest> folder # dest endswith / means copy the <source> to <dest> folder
LOG.info('Copying %s to %s', source, dest) LOG.info('Copying %s to %s', source, dest)
if os.path.islink(source): if self.merge and self.preserve_properties and os.path.islink(source):
link_target = os.readlink(source) link_target = os.readlink(source)
os.symlink(link_target, dest) os.symlink(link_target, dest)
else: else: