From 7cd5ca9cbd429b09de64217142db6cedfd92dc43 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 15 Mar 2017 14:02:46 +0000 Subject: [PATCH] Add support for symlinks Change-Id: Ic37f8e00a53642501aa9c7ae108e819d7d8cf3c0 --- snap_openstack/base.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snap_openstack/base.py b/snap_openstack/base.py index 773f457..1698c89 100644 --- a/snap_openstack/base.py +++ b/snap_openstack/base.py @@ -94,6 +94,13 @@ class OpenStackSnap(object): LOG.debug('Creating directory {}'.format(dir_name)) os.makedirs(dir_name, 0o750) + for link_target in setup['symlinks']: + link = setup['symlinks'][link_target] + target = link_target.format(**self.snap_env) + if not os.path.exists(link): + LOG.debug('Creating symlink {} to {}'.format(link, target)) + os.symlink(target, link) + for template in setup['templates']: target = setup['templates'][template] target_file = target.format(**self.snap_env)