diff options
| author | Martin André <m.andre@redhat.com> | 2017-07-04 15:31:35 +0200 |
|---|---|---|
| committer | Martin André <m.andre@redhat.com> | 2017-07-06 11:18:53 +0200 |
| commit | f54f3406308406a158737c468c5e61ddb1eb61a2 (patch) | |
| tree | c0d8e4aac6d5de8a1cd3b38e5a136350aeb127a8 /docker/base | |
| parent | db38eef3aeef372eb4149ca43f72df0aaed1b6d6 (diff) | |
| download | kolla-f54f3406308406a158737c468c5e61ddb1eb61a2.tar.gz kolla-f54f3406308406a158737c468c5e61ddb1eb61a2.zip | |
Make set_configs.py work with symlinks
Closes-Bug: #1702305
Change-Id: I92a404b8d301937dc1847d42576e30db43951990
Diffstat (limited to 'docker/base')
| -rw-r--r-- | docker/base/set_configs.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py index 53678a287..b6c56ca97 100644 --- a/docker/base/set_configs.py +++ b/docker/base/set_configs.py @@ -75,12 +75,16 @@ class ConfigFile(object): self._delete_path(dest) # dest endswith / means copy the <source> to <dest> folder LOG.info('Copying %s to %s', source, dest) - shutil.copy(source, dest) - self._set_properties(source, dest) + if os.path.islink(source): + link_target = os.readlink(source) + os.symlink(link_target, dest) + else: + shutil.copy(source, dest) + self._set_properties(source, dest) def _merge_directories(self, source, dest): if os.path.isdir(source): - if os.path.exists(dest) and not os.path.isdir(dest): + if os.path.lexists(dest) and not os.path.isdir(dest): self._delete_path(dest) if not os.path.isdir(dest): LOG.info('Creating directory %s', dest) @@ -95,7 +99,7 @@ class ConfigFile(object): self._copy_file(source, dest) def _delete_path(self, path): - if not os.path.exists(path): + if not os.path.lexists(path): return LOG.info('Deleting %s', path) if os.path.isdir(path): |
