Allow a source to point to multiple links
This commit is contained in:
@@ -187,7 +187,7 @@ class PkgInstallComponent(component.Component):
|
||||
links = {}
|
||||
for fn in self.config_files:
|
||||
source_fn = self.target_config(fn)
|
||||
links[source_fn] = sh.joinpths(self.link_dir, fn)
|
||||
links[source_fn] = [sh.joinpths(self.link_dir, fn)]
|
||||
return links
|
||||
|
||||
def _config_param_replace(self, config_fn, contents, parameters):
|
||||
@@ -217,22 +217,24 @@ class PkgInstallComponent(component.Component):
|
||||
# order happens. Ie /etc/blah link runs before /etc/blah/blah
|
||||
link_srcs = sorted(links.keys())
|
||||
link_srcs.reverse()
|
||||
links_made = 0
|
||||
link_nice = []
|
||||
for source in link_srcs:
|
||||
link = links[source]
|
||||
link_nice.append("%s => %s" % (link, source))
|
||||
links_to_be = links[source]
|
||||
for link in links_to_be:
|
||||
link_nice.append("%s => %s" % (link, source))
|
||||
utils.log_iterable(link_nice, logger=LOG,
|
||||
header="Creating %s sym-links" % (len(link_nice)))
|
||||
links_made = 0
|
||||
for source in link_srcs:
|
||||
link = links[source]
|
||||
try:
|
||||
LOG.debug("Symlinking %s to %s.", (link), (source))
|
||||
self.tracewriter.dirs_made(*sh.symlink(source, link))
|
||||
self.tracewriter.symlink_made(link)
|
||||
links_made += 1
|
||||
except OSError as e:
|
||||
LOG.warn("Symlinking %s to %s failed: %s", colorizer.quote(link), colorizer.quote(source), e)
|
||||
links_to_be = links[source]
|
||||
for link in links_to_be:
|
||||
try:
|
||||
LOG.debug("Symlinking %s to %s.", link, source)
|
||||
self.tracewriter.dirs_made(*sh.symlink(source, link))
|
||||
self.tracewriter.symlink_made(link)
|
||||
links_made += 1
|
||||
except (IOError, OSError) as e:
|
||||
LOG.warn("Symlinking %s to %s failed: %s", colorizer.quote(link), colorizer.quote(source), e)
|
||||
return links_made
|
||||
|
||||
def configure(self):
|
||||
|
||||
@@ -75,9 +75,14 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
||||
@property
|
||||
def symlinks(self):
|
||||
links = super(HorizonInstaller, self).symlinks
|
||||
link_tgt = self.distro.get_command_config('apache', 'settings', 'conf-link-target', quiet=True)
|
||||
tgt = self.distro.get_command_config('apache', 'settings', 'conf-link-target', quiet=True)
|
||||
if not tgt:
|
||||
return links
|
||||
src = self.target_config(HORIZON_APACHE_CONF)
|
||||
links[src] = link_tgt
|
||||
if src in links:
|
||||
links[src].append(tgt)
|
||||
else:
|
||||
links[src] = [tgt]
|
||||
return links
|
||||
|
||||
def _check_ug(self):
|
||||
|
||||
Reference in New Issue
Block a user